Bazaar developer reference

CvDllGameContext::GetRandomNumberGenerator(unsigned int)

Defined in
CvDllContext.cpp, line 1143
Class
CvDllGameContext
Hook name
CivHooks::CvDllGameContext_GetRandomNumberGenerator

Hooks

static bool BeforeCvDllGameContext_GetRandomNumberGenerator(CvDllGameContext* self, unsigned int index, ICvRandom1*& result);static void AfterCvDllGameContext_GetRandomNumberGenerator(CvDllGameContext* self, unsigned int index, ICvRandom1*& result);static ICvRandom1* ReplaceCvDllGameContext_GetRandomNumberGenerator(ICvRandom1* (*original)(CvDllGameContext*, unsigned int), CvDllGameContext* self, unsigned int index);// CivHooks.h gives this hook point no types, so nothing checks these hooks' parameters.host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_GetRandomNumberGenerator::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllGameContext_GetRandomNumberGenerator);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_GetRandomNumberGenerator::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllGameContext_GetRandomNumberGenerator);host->RegisterHook(host->pluginIndex, CivHooks::CvDllGameContext_GetRandomNumberGenerator::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllGameContext_GetRandomNumberGenerator);

Code

1143ICvRandom1* CvDllGameContext::GetRandomNumberGenerator(unsigned int index)1144{1145	for(std::vector<std::pair<uint, CvRandom*> >::iterator it = m_RandomNumberGenerators.begin();1146	        it != m_RandomNumberGenerators.end(); ++it)1147	{1148		if((*it).first == index)1149			return new CvDllRandom((*it).second);1150	}11511152	return NULL;1153}

Calls