Bazaar developer reference

CvPlayer::DoSeedGreatPeopleSpawnCounter()

Defined in
CvPlayer.cpp, line 14708
Class
CvPlayer
Hook name
CivHooks::CvPlayer_DoSeedGreatPeopleSpawnCounter

Hooks

static bool BeforeCvPlayer_DoSeedGreatPeopleSpawnCounter(CvPlayer* self);static void AfterCvPlayer_DoSeedGreatPeopleSpawnCounter(CvPlayer* self);static void ReplaceCvPlayer_DoSeedGreatPeopleSpawnCounter(void (*original)(CvPlayer*), CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_DoSeedGreatPeopleSpawnCounter>(host, &BeforeCvPlayer_DoSeedGreatPeopleSpawnCounter);CivRegisterAfter<CivHooks::CvPlayer_DoSeedGreatPeopleSpawnCounter>(host, &AfterCvPlayer_DoSeedGreatPeopleSpawnCounter);CivRegisterReplace<CivHooks::CvPlayer_DoSeedGreatPeopleSpawnCounter>(host, &ReplaceCvPlayer_DoSeedGreatPeopleSpawnCounter);

Code

14707// Figures out how long before we spawn a free Great Person for ePlayer14708void CvPlayer::DoSeedGreatPeopleSpawnCounter()14709{14710	int iNumTurns = /*37*/ GC.getMINOR_TURNS_GREAT_PEOPLE_SPAWN_BASE();1471114712	// Start at -1 since if we only have one ally we don't want to add any more14713	int iExtraAllies = -1;1471414715	PlayerTypes eMinor;14716	for(int iMinorLoop = MAX_MAJOR_CIVS; iMinorLoop < MAX_CIV_PLAYERS; iMinorLoop++)14717	{14718		eMinor = (PlayerTypes) iMinorLoop;1471914720		// Not alive14721		if(!GET_PLAYER(eMinor).isAlive())14722			continue;1472314724		if(GET_PLAYER(eMinor).GetMinorCivAI()->GetAlly() == GetID())14725			iExtraAllies++;14726	}1472714728	if(iExtraAllies > 0)14729	{14730		int iExtraAlliesChange = iExtraAllies* /*-1*/ GC.getMINOR_ADDITIONAL_ALLIES_GP_CHANGE();1473114732		iExtraAlliesChange = max(/*-10*/ GC.getMAX_MINOR_ADDITIONAL_ALLIES_GP_CHANGE(), iExtraAlliesChange);1473314734		iNumTurns += iExtraAlliesChange;14735	}1473614737	int iRand = /*7*/ GC.getMINOR_TURNS_GREAT_PEOPLE_SPAWN_RAND();14738	iNumTurns += GC.getGame().getJonRandNum(iRand, "Rand turns for Friendly Minor GreatPeople spawn");1473914740	// If we're biasing the result then decrease the number of turns14741	if(!IsAlliesGreatPersonBiasApplied())14742	{14743		iNumTurns *= /*50*/ GC.getMINOR_TURNS_GREAT_PEOPLE_SPAWN_BIAS_MULTIPLY();14744		iNumTurns /= 100;1474514746		SetAlliesGreatPersonBiasApplied(true);14747	}1474814749	// Modify for Game Speed14750	iNumTurns *= GC.getGame().getGameSpeedInfo().getGreatPeoplePercent();14751	iNumTurns /= 100;1475214753	if(iNumTurns < 1)14754		iNumTurns = 1;1475514756	SetGreatPeopleSpawnCounter(iNumTurns);14757}

Calls

Called by