Bazaar developer reference

CvMinorCivAI::GetSpawnBaseTurns(PlayerTypes)

Defined in
CvMinorCivAI.cpp, line 8668
Class
CvMinorCivAI
Hook name
CivHooks::CvMinorCivAI_GetSpawnBaseTurns

Hooks

static bool BeforeCvMinorCivAI_GetSpawnBaseTurns(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static void AfterCvMinorCivAI_GetSpawnBaseTurns(CvMinorCivAI* self, PlayerTypes ePlayer, int& result);static int ReplaceCvMinorCivAI_GetSpawnBaseTurns(int (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_GetSpawnBaseTurns>(host, &BeforeCvMinorCivAI_GetSpawnBaseTurns);CivRegisterAfter<CivHooks::CvMinorCivAI_GetSpawnBaseTurns>(host, &AfterCvMinorCivAI_GetSpawnBaseTurns);CivRegisterReplace<CivHooks::CvMinorCivAI_GetSpawnBaseTurns>(host, &ReplaceCvMinorCivAI_GetSpawnBaseTurns);

Code

8667/// What is the base number of turns between unit spawns, before randomness is applied?8668int CvMinorCivAI::GetSpawnBaseTurns(PlayerTypes ePlayer)8669{8670	// Not friends8671	if(!IsFriends(ePlayer))8672		return 0;86738674	// This guy isn't militaristic8675	if(GetTrait() != MINOR_CIV_TRAIT_MILITARISTIC)8676		return 0;86778678	int iNumTurns = /*19*/ GC.getFRIENDS_BASE_TURNS_UNIT_SPAWN() * 100;86798680	// If relations are at allied level then reduce spawn counter8681	if(IsAllies(ePlayer))8682		iNumTurns += /*-3*/ (GC.getALLIES_EXTRA_TURNS_UNIT_SPAWN() * 100);86838684	// Modify for Game Speed8685	iNumTurns *= GC.getGame().getGameSpeedInfo().getGreatPeoplePercent();8686	iNumTurns /= 100;86878688	// Modify for policies8689	CvPlayer& kPlayer = GET_PLAYER(ePlayer);8690	int iPolicyMod = kPlayer.GetPlayerPolicies()->GetNumericModifier(POLICYMOD_UNIT_FREQUENCY_MODIFIER);8691	if(iPolicyMod > 0)8692	{8693		if(GET_TEAM(kPlayer.getTeam()).HasCommonEnemy(m_pPlayer->getTeam()))8694		{8695			iNumTurns *= 100;8696			iNumTurns /= (100 + iPolicyMod);8697		}8698	}86998700	return iNumTurns / 100;8701}

Calls

Called by