CvPreGame::GetGameOption(const char *, int &)
- Defined in
- CvPreGame.cpp, line 927
- Hook name
CivHooks::CvPreGame_GetGameOption
Hooks
static bool BeforeCvPreGame_GetGameOption(const char* szOptionName, int& iValue, bool& result);static void AfterCvPreGame_GetGameOption(const char* szOptionName, int& iValue, bool& result);static bool ReplaceCvPreGame_GetGameOption(bool (*original)(const char*, int&), const char* szOptionName, int& iValue);CivRegisterBefore<CivHooks::CvPreGame_GetGameOption>(host, &BeforeCvPreGame_GetGameOption);CivRegisterAfter<CivHooks::CvPreGame_GetGameOption>(host, &AfterCvPreGame_GetGameOption);CivRegisterReplace<CivHooks::CvPreGame_GetGameOption>(host, &ReplaceCvPreGame_GetGameOption);
Code
927bool GetGameOption(const char* szOptionName, int& iValue)928{929 if (szOptionName == NULL || *szOptionName == 0)930 return false;931932 for(std::vector<CustomOption>::const_iterator it = s_GameOptions.begin();933 it != s_GameOptions.end(); ++it)934 {935 size_t bytes = 0;936 const char* szCurrentOptionName = (*it).GetName(bytes);937 if(strncmp(szCurrentOptionName, szOptionName, bytes) == 0)938 {939 iValue = (*it).GetValue();940 return true;941 }942 }943944 //Try and lookup the default value.945 Database::Results kLookup;946 if(GC.GetGameDatabase()->Execute(kLookup, "Select \"Default\" from GameOptions where Type = ? LIMIT 1"))947 {948 kLookup.Bind(1, szOptionName);949 if(kLookup.Step())950 {951 iValue = kLookup.GetInt(0);952 return true;953 }954 }955956 return false;957}
Calls
- CvGlobals::GetGameDatabase()
- CvPreGame::CustomOption::GetName(size_t &) const
- CvPreGame::CustomOption::GetValue() const
Database::Connection::ExecuteDatabase::Results::BindDatabase::Results::GetIntDatabase::Results::ResultsDatabase::Results::StepFAutoVariable::beginFAutoVariable::endstd::_Vector_const_iterator::operator!=std::_Vector_const_iterator::operator*std::_Vector_const_iterator::operator++strncmp