Bazaar developer reference

CvPlayer::GetScore(bool, bool) const

Defined in
CvPlayer.cpp, line 5497
Class
CvPlayer
Hook name
CivHooks::CvPlayer_GetScore

Hooks

static bool BeforeCvPlayer_GetScore(const CvPlayer* self, bool bFinal, bool bWinner, int& result);static void AfterCvPlayer_GetScore(const CvPlayer* self, bool bFinal, bool bWinner, int& result);static int ReplaceCvPlayer_GetScore(int (*original)(const CvPlayer*, bool, bool), const CvPlayer* self, bool bFinal, bool bWinner);CivRegisterBefore<CivHooks::CvPlayer_GetScore>(host, &BeforeCvPlayer_GetScore);CivRegisterAfter<CivHooks::CvPlayer_GetScore>(host, &AfterCvPlayer_GetScore);CivRegisterReplace<CivHooks::CvPlayer_GetScore>(host, &ReplaceCvPlayer_GetScore);

Code

5496/// What is this player's score?5497int CvPlayer::GetScore(bool bFinal, bool bWinner) const5498{5499	if(!isAlive())5500		return 0;55015502	if(GET_TEAM(getTeam()).getNumMembers() == 0)5503		return 0;55045505	int iScore = 0;55065507	iScore += GetScoreFromCities();5508	iScore += GetScoreFromPopulation();5509	iScore += GetScoreFromLand();5510	iScore += GetScoreFromWonders();5511	iScore += GetScoreFromPolicies();5512	iScore += GetScoreFromGreatWorks();5513	iScore += GetScoreFromReligion();5514	iScore += GetScoreFromTechs();5515	iScore += GetScoreFromFutureTech();5516	iScore += GetScoreFromScenario1();5517	iScore += GetScoreFromScenario2();5518	iScore += GetScoreFromScenario3();5519	iScore += GetScoreFromScenario4();55205521	// If the game is over, we apply a mod to the value, rewarding players who finish early5522	if(bFinal && bWinner)5523	{5524		int iGameProgressPercent = 100 * GC.getGame().getGameTurn() / GC.getGame().getEstimateEndTurn();5525		iGameProgressPercent = iGameProgressPercent < 1 ? 1 : iGameProgressPercent;5526		iScore *= 100;5527		iScore /= iGameProgressPercent;5528	}55295530	return iScore;5531}

Calls

Called by