MCPcopy Create free account
hub / github.com/ZDoom/Raze / GetGames

Function GetGames

source/core/gamecontrol.cpp:917–964  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

915
916
917void GetGames()
918{
919 auto getgames = Args->CheckValue("-getgames");
920 if (getgames)
921 {
922 try
923 {
924 auto groups = GrpScan();
925 FSerializer arc;
926 if (arc.OpenWriter())
927 {
928 if (arc.BeginArray("games"))
929 {
930 for (auto& entry : groups)
931 {
932 if (arc.BeginObject(nullptr))
933 {
934 arc("filename", entry.FileName)
935 ("description", entry.FileInfo.name)
936 ("defname", entry.FileInfo.defname)
937 ("scriptname", entry.FileInfo.scriptname)
938 ("gamefilter", entry.FileInfo.gamefilter)
939 ("gameid", entry.FileInfo.gameid)
940 ("fgcolor", entry.FileInfo.FgColor)
941 ("bkcolor", entry.FileInfo.BgColor)
942 ("addon", entry.FileInfo.isAddon)
943 .EndObject();
944 }
945 }
946 arc.EndArray();
947 }
948 unsigned int len;
949 auto p = arc.GetOutput(&len);
950 FILE* f = fopen(getgames, "wb");
951 if (f)
952 {
953 fwrite(p, 1, len, f);
954 fclose(f);
955 }
956 }
957 }
958 catch (...)
959 {
960 // Ignore all errors
961 }
962 throw CExitEvent(0);
963 }
964}
965
966//==========================================================================
967//

Callers 1

RunGameFunction · 0.85

Calls 9

GrpScanFunction · 0.85
CExitEventClass · 0.85
OpenWriterMethod · 0.80
CheckValueMethod · 0.45
BeginArrayMethod · 0.45
BeginObjectMethod · 0.45
EndObjectMethod · 0.45
EndArrayMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected