Bazaar developer reference

CvDllPreGame::GetGameOption(uint, char *, uint, int &)

Defined in
CvDllPreGame.cpp, line 215
Class
CvDllPreGame
Hook name
CivHooks::CvDllPreGame_GetGameOption_with_uint_char_uint_int

Hooks

static bool BeforeCvDllPreGame_GetGameOption_with_uint_char_uint_int(CvDllPreGame* self, uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue, bool& result);static void AfterCvDllPreGame_GetGameOption_with_uint_char_uint_int(CvDllPreGame* self, uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue, bool& result);static bool ReplaceCvDllPreGame_GetGameOption_with_uint_char_uint_int(bool (*original)(CvDllPreGame*, uint, char*, uint, int&), CvDllPreGame* self, uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue);// CivHooks.h gives this hook point no types, so nothing checks these hooks' parameters.host->RegisterHook(host->pluginIndex, CivHooks::CvDllPreGame_GetGameOption_with_uint_char_uint_int::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllPreGame_GetGameOption_with_uint_char_uint_int);host->RegisterHook(host->pluginIndex, CivHooks::CvDllPreGame_GetGameOption_with_uint_char_uint_int::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllPreGame_GetGameOption_with_uint_char_uint_int);host->RegisterHook(host->pluginIndex, CivHooks::CvDllPreGame_GetGameOption_with_uint_char_uint_int::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllPreGame_GetGameOption_with_uint_char_uint_int);

Code

215bool CvDllPreGame::GetGameOption(uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue)216{217	const std::vector<CvPreGame::CustomOption>& kOptions = CvPreGame::GetGameOptions();218	if(uiIndex < kOptions.size())219	{220		size_t nSourceBufferSize;221		const char* pszSourceBuffer = kOptions[uiIndex].GetName(nSourceBufferSize);222		if(nOptionNameBufferSize+1 > nSourceBufferSize)223		{224			strcpy(szOptionNameBuffer, pszSourceBuffer);225			iValue = kOptions[uiIndex].GetValue();226			return true;227		}228	}229	return false;230}

Calls