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

Method ReadSMC_KeyValue

core/logic/GameConfigs.cpp:386–485  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value)
387{
388 if (m_IgnoreLevel)
389 {
390 return SMCResult_Continue;
391 }
392
393 if (m_ParseState == PSTATE_GAMEDEFS_OFFSETS_OFFSET)
394 {
395 if (strcmp(key, "class") == 0)
396 {
397 m_Class = value;
398 } else if (strcmp(key, "prop") == 0) {
399 m_Prop = value;
400 } else if (IsPlatformCompatible(key, &matched_platform)) {
401 m_Offsets.replace(m_offset.c_str(), static_cast<int>(strtol(value, NULL, 0)));
402 }
403 } else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
404 std::string vstr(value);
405 m_Keys.replace(key, std::move(vstr));
406 }
407 else if (m_ParseState == PSTATE_GAMEDEFS_KEYS_PLATFORM) {
408 if (IsPlatformCompatible(key, &matched_platform))
409 {
410 std::string vstr(value);
411 m_Keys.replace(m_Key.c_str(), std::move(vstr));
412 }
413 } else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
414 if (strcmp(key, "game") == 0)
415 {
416 had_game = true;
417 if (DoesGameMatch(value))
418 {
419 matched_game = true;
420 }
421 if ((!had_engine && matched_game) || (matched_engine && matched_game))
422 {
423 bShouldBeReadingDefault = true;
424 }
425 }
426 else if (strcmp(key, "engine") == 0)
427 {
428 had_engine = true;
429 if (DoesEngineMatch(value))
430 {
431 matched_engine = true;
432 }
433 if ((!had_game && matched_engine) || (matched_game && matched_engine))
434 {
435 bShouldBeReadingDefault = true;
436 }
437 }
438 } else if (m_ParseState == PSTATE_GAMEDEFS_SIGNATURES_SIG) {
439 if (IsPlatformCompatible(key, &matched_platform))
440 {
441 strncopy(s_TempSig.sig, value, sizeof(s_TempSig.sig));
442 } else if (strcmp(key, "library") == 0) {
443 strncopy(s_TempSig.library, value, sizeof(s_TempSig.library));

Callers

nothing calls this directly

Calls 8

IsPlatformCompatibleFunction · 0.85
DoesPlatformMatchFunction · 0.85
DoesEngineMatchFunction · 0.70
strncopyFunction · 0.70
DoesGameMatchFunction · 0.50
replaceMethod · 0.45
c_strMethod · 0.45
LogErrorMethod · 0.45

Tested by

no test coverage detected