CvPreGame::GetMapOption(const char *, int &)
- Defined in
- CvPreGame.cpp, line 1495
- Hook name
CivHooks::CvPreGame_GetMapOption
Hooks
static bool BeforeCvPreGame_GetMapOption(const char* szOptionName, int& iValue, bool& result);static void AfterCvPreGame_GetMapOption(const char* szOptionName, int& iValue, bool& result);static bool ReplaceCvPreGame_GetMapOption(bool (*original)(const char*, int&), const char* szOptionName, int& iValue);CivRegisterBefore<CivHooks::CvPreGame_GetMapOption>(host, &BeforeCvPreGame_GetMapOption);CivRegisterAfter<CivHooks::CvPreGame_GetMapOption>(host, &AfterCvPreGame_GetMapOption);CivRegisterReplace<CivHooks::CvPreGame_GetMapOption>(host, &ReplaceCvPreGame_GetMapOption);
Code
1495bool GetMapOption(const char* szOptionName, int& iValue)1496{1497 for(std::vector<CustomOption>::const_iterator it = s_MapOptions.begin();1498 it != s_MapOptions.end(); ++it)1499 {1500 size_t bytes = 0;1501 const char* szCurrentOptionName = (*it).GetName(bytes);1502 if(strncmp(szCurrentOptionName, szOptionName, bytes) == 0)1503 {1504 iValue = (*it).GetValue();1505 return true;1506 }1507 }15081509 //Try and lookup the default value.1510 //Not a huge fan of this being here as it adds an additional dependency, but there was really no "clean" place to put it.1511 Database::Results kLookup;1512 if(GC.GetGameDatabase()->Execute(kLookup, "Select DefaultValue from MapScriptOptions where FileName = ? and OptionID = ? LIMIT 1"))1513 {1514 kLookup.Bind(1, CvPreGame::mapScriptName().c_str());1515 kLookup.Bind(2, szOptionName);1516 if(kLookup.Step())1517 {1518 iValue = kLookup.GetInt(0);1519 return true;1520 }1521 }15221523 return false;1524}
Calls
- CvGlobals::GetGameDatabase()
- CvPreGame::CustomOption::GetName(size_t &) const
- CvPreGame::CustomOption::GetValue() const
- CvPreGame::mapScriptName()
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++std::basic_string::c_strstrncmp