Bazaar developer reference

CvMinorCivAI::GetCurrentSpawnEstimate(PlayerTypes)

Defined in
CvMinorCivAI.cpp, line 8704
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_GetCurrentSpawnEstimate

Hooks

static bool BeforeCvMinorCivAI_GetCurrentSpawnEstimate(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static void AfterCvMinorCivAI_GetCurrentSpawnEstimate(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvMinorCivAI_GetCurrentSpawnEstimate(int (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_GetCurrentSpawnEstimate>(host, &BeforeCvMinorCivAI_GetCurrentSpawnEstimate);CivRegisterAfter<CivHooks::CvMinorCivAI_GetCurrentSpawnEstimate>(host, &AfterCvMinorCivAI_GetCurrentSpawnEstimate);CivRegisterReplace<CivHooks::CvMinorCivAI_GetCurrentSpawnEstimate>(host, &ReplaceCvMinorCivAI_GetCurrentSpawnEstimate);

Code

8703/// What is the average number of turns between unit spawns?8704int CvMinorCivAI::GetCurrentSpawnEstimate(PlayerTypes ePlayer)8705{8706	// Not friends8707	if(!IsFriends(ePlayer))8708		return 0;87098710	// This guy isn't militaristic8711	if(GetTrait() != MINOR_CIV_TRAIT_MILITARISTIC)8712		return 0;87138714	int iNumTurns = GetSpawnBaseTurns(ePlayer) * 100;87158716	int iRand = /*3*/ GC.getFRIENDS_RAND_TURNS_UNIT_SPAWN() * 100;8717	iNumTurns += (iRand / 2);87188719	return iNumTurns / 100;8720}

Calls

Called by