Bazaar developer reference

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

Defined in
CvDllPreGame.cpp, line 237
Class
CvDllPreGame
Hook name
CivHooks::CvDllPreGame_GetMapOption

Hooks

static bool BeforeCvDllPreGame_GetMapOption(CvDllPreGame* self, uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue, bool& result);static void AfterCvDllPreGame_GetMapOption(CvDllPreGame* self, uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue, bool& result);static bool ReplaceCvDllPreGame_GetMapOption(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_GetMapOption::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllPreGame_GetMapOption);host->RegisterHook(host->pluginIndex, CivHooks::CvDllPreGame_GetMapOption::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllPreGame_GetMapOption);host->RegisterHook(host->pluginIndex, CivHooks::CvDllPreGame_GetMapOption::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllPreGame_GetMapOption);

Code

237bool CvDllPreGame::GetMapOption(uint uiIndex, char* szOptionNameBuffer, uint nOptionNameBufferSize, int& iValue)238{239	const std::vector<CvPreGame::CustomOption>& kOptions = CvPreGame::GetMapOptions();240	if(uiIndex < kOptions.size())241	{242		size_t nSourceBufferSize;243		const char* pszSourceBuffer = kOptions[uiIndex].GetName(nSourceBufferSize);244		if(nOptionNameBufferSize+1 > nSourceBufferSize)245		{246			strcpy(szOptionNameBuffer, pszSourceBuffer);247			iValue = kOptions[uiIndex].GetValue();248			return true;249		}250	}251	return false;252}

Calls