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

Method EnterFile

tools/gdc-psyfork/GameConfigs.cpp:527–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
528{
529 SMCError err;
530 SMCStates state = {0, 0};
531
532 /* Initialize parse states */
533 m_IgnoreLevel = 0;
534 bShouldBeReadingDefault = true;
535 m_ParseState = PSTATE_NONE;
536
537 if ((err=textparsers->ParseSMCFile(file, this, &state, error, maxlength))
538 != SMCError_Okay)
539 {
540 const char *msg;
541
542 msg = textparsers->GetSMCErrorString(err);
543
544 printf("[SM] Error parsing gameconfig file \"%s\":\n", file);
545 printf("[SM] Error %d on line %d, col %d: %s\n",
546 err,
547 state.line,
548 state.col,
549 msg ? msg : "Unknown error");
550
551 if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
552 {
553 //error occurred while parsing a custom section
554 m_CustomHandler->ReadSMC_ParseEnd(true, true);
555 m_CustomHandler = NULL;
556 m_CustomLevel = 0;
557 }
558
559 exit(PARSE_ERROR);
560 }
561
562 return true;
563}
564
565const char *CGameConfig::GetKeyValue(const char *key)
566{

Callers 1

mainFunction · 0.45

Calls 3

ParseSMCFileMethod · 0.45
GetSMCErrorStringMethod · 0.45
ReadSMC_ParseEndMethod · 0.45

Tested by

no test coverage detected