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

Method EnterFile

tools/gdc/GameConfigs.cpp:726–762  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

724}
725
726bool CGameConfig::EnterFile(const char *file, char *error, size_t maxlength)
727{
728 SMCError err;
729 SMCStates state = {0, 0};
730
731 /* Initialize parse states */
732 m_IgnoreLevel = 0;
733 bShouldBeReadingDefault = true;
734 m_ParseState = PSTATE_NONE;
735
736 if ((err=textparsers->ParseSMCFile(file, this, &state, error, maxlength))
737 != SMCError_Okay)
738 {
739 const char *msg;
740
741 msg = textparsers->GetSMCErrorString(err);
742
743 printf("[SM] Error parsing gameconfig file \"%s\":\n", file);
744 printf("[SM] Error %d on line %d, col %d: %s\n",
745 err,
746 state.line,
747 state.col,
748 msg ? msg : "Unknown error");
749
750 if (m_ParseState == PSTATE_GAMEDEFS_CUSTOM)
751 {
752 //error occurred while parsing a custom section
753 m_CustomHandler->ReadSMC_ParseEnd(true, true);
754 m_CustomHandler = NULL;
755 m_CustomLevel = 0;
756 }
757
758 exit(PARSE_ERROR);
759 }
760
761 return true;
762}
763
764#if 0
765bool CGameConfig::GetOffset(const char *key, int *value)

Callers 1

mainFunction · 0.45

Calls 3

ParseSMCFileMethod · 0.45
GetSMCErrorStringMethod · 0.45
ReadSMC_ParseEndMethod · 0.45

Tested by

no test coverage detected