MCPcopy Create free account
hub / github.com/alliedmodders/sourcemod / LoadGameConfigFile

Method LoadGameConfigFile

core/logic/GameConfigs.cpp:1165–1207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1163}
1164
1165bool GameConfigManager::LoadGameConfigFile(const char *file, IGameConfig **_pConfig, char *error, size_t maxlength)
1166{
1167#if 0
1168 /* A crash was detected during last load - We block the gamedata loading so it hopefully won't happen again */
1169 if (g_blockGameDataLoad)
1170 {
1171 UTIL_Format(error, maxlength, "GameData loaded blocked due to detected crash");
1172 return false;
1173 }
1174#endif
1175
1176 CGameConfig *pConfig;
1177
1178 if (m_Lookup.retrieve(file, &pConfig))
1179 {
1180 bool ret = true;
1181 time_t modtime = GetFileModTime(file);
1182 if (pConfig->m_ModTime != modtime || pConfig->m_ModTime == 0)
1183 {
1184 pConfig->m_ModTime = modtime;
1185 ret = pConfig->Reparse(error, maxlength);
1186 }
1187
1188 pConfig->AddRef();
1189 *_pConfig = pConfig;
1190 return ret;
1191 }
1192
1193 pConfig = new CGameConfig(file);
1194 pConfig->AddRef();
1195
1196 /* :HACKHACK: Don't parse the main config file */
1197 bool retval = true;
1198 if (_pConfig != &g_pGameConf)
1199 {
1200 retval = pConfig->Reparse(error, maxlength);
1201 }
1202
1203 m_Lookup.insert(file, pConfig);
1204
1205 *_pConfig = pConfig;
1206 return retval;
1207}
1208
1209void GameConfigManager::CloseGameConfigFile(IGameConfig *cfg)
1210{

Callers 6

smn_LoadGameConfigFileFunction · 0.80
SDK_OnLoadMethod · 0.80
SDK_OnLoadMethod · 0.80
SDK_OnLoadMethod · 0.80
SDK_OnLoadMethod · 0.80
SDK_OnAllLoadedMethod · 0.80

Calls 6

GetFileModTimeFunction · 0.85
UTIL_FormatFunction · 0.50
retrieveMethod · 0.45
ReparseMethod · 0.45
AddRefMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected