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

Function SM_ConfigCheckRegeneration

core/CoreConfig.cpp:425–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425bool SM_ConfigCheckRegeneration(
426 const char *file,
427 ke::HashMap<std::string, std::string, StringPolicy> &existing_cvars,
428 List<const ConVar *> &convars)
429{
430 FILE *fp = fopen(file, "rt");
431 if (!fp)
432 {
433 logger->LogError("Failed to read config for checking regeneration, make sure the directory has read permission.");
434 return true;
435 }
436
437 SM_ParseConfig(fp, existing_cvars);
438 fclose(fp);
439
440 /* #1. Check if the plugin's cvar list has a cvar that doesn't exist in the config file. */
441 for (List<const ConVar *>::iterator iter = convars.begin(); iter != convars.end(); iter++)
442 {
443 const ConVar *cvar = (*iter);
444#if SOURCE_ENGINE >= SE_ORANGEBOX
445 if (cvar->IsFlagSet(FCVAR_DONTRECORD))
446#else
447 if (cvar->IsBitSet(FCVAR_DONTRECORD))
448#endif
449 {
450 continue;
451 }
452
453 if (!SM_CvarExistsInConfig(existing_cvars, cvar->GetName()))
454 {
455 return true;
456 }
457 }
458
459 /* #2. Check if the config file has a cvar that doesn't exist in the plugin's cvar list. */
460 for (auto it = existing_cvars.iter(); !it.empty(); it.next())
461 {
462 if (!SM_CvarExistsInPlugin(convars, it->key.c_str()))
463 {
464 return true;
465 }
466 }
467
468 return false;
469}
470
471inline void SM_ExecuteConfigFile(const char *file)
472{

Callers 1

SM_ExecuteConfigFunction · 0.85

Calls 11

SM_ParseConfigFunction · 0.85
SM_CvarExistsInConfigFunction · 0.85
SM_CvarExistsInPluginFunction · 0.85
emptyMethod · 0.80
nextMethod · 0.80
LogErrorMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
GetNameMethod · 0.45
iterMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected