Bazaar developer reference

CvGame::SetBestWondersPlayer(PlayerTypes, int)

Defined in
CvGame.cpp, line 10742
Class
CvGame
Hook name
CivHooks::CvGame_SetBestWondersPlayer

Hooks

static bool BeforeCvGame_SetBestWondersPlayer(CvGame* self, PlayerTypes ePlayer, int iWonderCount);static void AfterCvGame_SetBestWondersPlayer(CvGame* self, PlayerTypes ePlayer, int iWonderCount);static void ReplaceCvGame_SetBestWondersPlayer(void (*original)(CvGame*, PlayerTypes, int), CvGame* self, PlayerTypes ePlayer, int iWonderCount);CivRegisterBefore<CivHooks::CvGame_SetBestWondersPlayer>(host, &BeforeCvGame_SetBestWondersPlayer);CivRegisterAfter<CivHooks::CvGame_SetBestWondersPlayer>(host, &AfterCvGame_SetBestWondersPlayer);CivRegisterReplace<CivHooks::CvGame_SetBestWondersPlayer>(host, &ReplaceCvGame_SetBestWondersPlayer);

Code

10741/// Set Player leading with Wonders10742void CvGame::SetBestWondersPlayer(PlayerTypes ePlayer, int iWonderCount)10743{10744	int iVictoryPointChange = /*5*/ GC.getZERO_SUM_COMPETITION_WONDERS_VICTORY_POINTS();1074510746	// Remove VPs from old player's team10747	if(GetBestWondersPlayer() != NO_PLAYER)10748	{10749		GET_TEAM(GET_PLAYER(GetBestWondersPlayer()).getTeam()).changeVictoryPoints(-iVictoryPointChange);10750	}1075110752	m_eBestWondersPlayer = ePlayer;1075310754	if(ePlayer != NO_PLAYER)10755	{10756		GET_TEAM(GET_PLAYER(ePlayer).getTeam()).changeVictoryPoints(iVictoryPointChange);1075710758		// Notify everyone of this change.10759		for(int iNotifyLoop = 0; iNotifyLoop < MAX_MAJOR_CIVS; ++iNotifyLoop){10760			PlayerTypes eNotifyPlayer = (PlayerTypes) iNotifyLoop;10761			CvPlayerAI& kCurNotifyPlayer = GET_PLAYER(eNotifyPlayer);10762			TeamTypes eCurNotifyTeam = kCurNotifyPlayer.getTeam();1076310764			CvNotifications* pNotifications = kCurNotifyPlayer.GetNotifications();10765			if(pNotifications)10766			{10767				CvString strBuffer;10768				CvString strSummary;1076910770				// current player now has the most Wonders10771				if(kCurNotifyPlayer.GetID() == ePlayer)10772				{10773					strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_BEST_IN_WONDERS_YOU", iVictoryPointChange, iWonderCount+1);10774					strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_BEST_IN_WONDERS_YOU", iVictoryPointChange, iWonderCount+1);10775				}10776				// Unmet player10777				else if(!GET_TEAM(eCurNotifyTeam).isHasMet(GET_PLAYER(ePlayer).getTeam()))10778				{10779					strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_BEST_IN_WONDERS_UNMET", iVictoryPointChange, iWonderCount+1);10780					strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_BEST_IN_WONDERS_UNMET", iVictoryPointChange, iWonderCount+1);10781				}10782				// Player we've met10783				else10784				{10785					strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_BEST_IN_WONDERS_ANOTHER", GET_PLAYER(ePlayer).getCivilizationShortDescriptionKey(), iVictoryPointChange, iWonderCount+1);10786					strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_BEST_IN_WONDERS_ANOTHER", GET_PLAYER(ePlayer).getCivilizationShortDescriptionKey());10787				}1078810789				pNotifications->Add(NOTIFICATION_VICTORY, strBuffer, strSummary, -1, -1, -1);10790			}10791		}10792	}10793}

Calls