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

Function ParseGameInfo

source/core/initfs.cpp:66–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64//==========================================================================
65
66static std::vector<std::string> ParseGameInfo(std::vector<std::string>& pwads, const char* fn, const char* data, int size)
67{
68 FScanner sc;
69 std::vector<std::string> bases;
70 int pos = 0;
71
72 const char* lastSlash = strrchr(fn, '/');
73
74 sc.OpenMem("GAMEINFO", data, size);
75 sc.SetCMode(true);
76 while (sc.GetToken())
77 {
78 sc.TokenMustBe(TK_Identifier);
79 FString nextKey = sc.String;
80 sc.MustGetToken('=');
81 if (!nextKey.CompareNoCase("GAME"))
82 {
83 sc.MustGetString();
84 bases.push_back(sc.String);
85 }
86 else if (!nextKey.CompareNoCase("LOAD"))
87 {
88 do
89 {
90 sc.MustGetString();
91
92 // Try looking for the wad in the same directory as the .wad
93 // before looking for it in the current directory.
94
95 FString checkpath;
96 if (lastSlash != NULL)
97 {
98 checkpath = FString(fn, (lastSlash - fn) + 1);
99 checkpath += sc.String;
100 }
101 else
102 {
103 checkpath = sc.String;
104 }
105 if (!FileExists(checkpath))
106 {
107 pos += D_AddFile(pwads, sc.String, true, pos, GameConfig);
108 }
109 else
110 {
111 pos += D_AddFile(pwads, checkpath.GetChars(), true, pos, GameConfig);
112 }
113 } while (sc.CheckToken(','));
114 }
115 else if (!nextKey.CompareNoCase("STARTUPTITLE"))
116 {
117 sc.MustGetString();
118 GameStartupInfo.Name = sc.String;
119 }
120 else if (!nextKey.CompareNoCase("STARTUPCOLORS"))
121 {
122 sc.MustGetString();
123 GameStartupInfo.FgColor = V_GetColor(sc);

Callers 2

ParseMapInfoMethod · 0.85
CheckGameInfoFunction · 0.85

Calls 15

D_AddFileFunction · 0.85
V_GetColorFunction · 0.85
SetCModeMethod · 0.80
GetTokenMethod · 0.80
TokenMustBeMethod · 0.80
MustGetTokenMethod · 0.80
CompareNoCaseMethod · 0.80
MustGetStringMethod · 0.80
CheckTokenMethod · 0.80
MustGetStringNameMethod · 0.80
MustGetAnyTokenMethod · 0.80
FStringClass · 0.50

Tested by

no test coverage detected