Bazaar developer reference

CvGame::getAsyncRandNum(int, const char *)

Defined in
CvGame.cpp, line 9305
Class
CvGame
Hook name
CivHooks::CvGame_getAsyncRandNum

Hooks

static bool BeforeCvGame_getAsyncRandNum(CvGame* self, int iNum, const char* pszLog, int& result);static void AfterCvGame_getAsyncRandNum(CvGame* self, int iNum, const char* pszLog, int& result);static int ReplaceCvGame_getAsyncRandNum(int (*original)(CvGame*, int, const char*), CvGame* self, int iNum, const char* pszLog);CivRegisterBefore<CivHooks::CvGame_getAsyncRandNum>(host, &BeforeCvGame_getAsyncRandNum);CivRegisterAfter<CivHooks::CvGame_getAsyncRandNum>(host, &AfterCvGame_getAsyncRandNum);CivRegisterReplace<CivHooks::CvGame_getAsyncRandNum>(host, &ReplaceCvGame_getAsyncRandNum);

Code

9303/// Get an asynchronous random number in the range of 0...iNum-19304/// This should only be called by operations that will not effect gameplay!9305int CvGame::getAsyncRandNum(int iNum, const char* pszLog)9306{9307#if defined(MOD_BUGFIX_RANDOM)9308	if (iNum > 0)9309		return GC.getASyncRand().get(iNum, pszLog);93109311	return -(int)GC.getASyncRand().get(-iNum, pszLog);9312#else9313	return GC.getASyncRand().get(iNum, pszLog);9314#endif9315}

Calls

Called by