Bazaar developer reference

CvGame::DoPlaceTeamInVictoryCompetition(VictoryTypes, TeamTypes)

Defined in
CvGame.cpp, line 6704
Class
CvGame
Hook name
CivHooks::CvGame_DoPlaceTeamInVictoryCompetition

Hooks

static bool BeforeCvGame_DoPlaceTeamInVictoryCompetition(CvGame* self, VictoryTypes eNewVictory, TeamTypes eTeam);static void AfterCvGame_DoPlaceTeamInVictoryCompetition(CvGame* self, VictoryTypes eNewVictory, TeamTypes eTeam);static void ReplaceCvGame_DoPlaceTeamInVictoryCompetition(void (*original)(CvGame*, VictoryTypes, TeamTypes), CvGame* self, VictoryTypes eNewVictory, TeamTypes eTeam);CivRegisterBefore<CivHooks::CvGame_DoPlaceTeamInVictoryCompetition>(host, &BeforeCvGame_DoPlaceTeamInVictoryCompetition);CivRegisterAfter<CivHooks::CvGame_DoPlaceTeamInVictoryCompetition>(host, &AfterCvGame_DoPlaceTeamInVictoryCompetition);CivRegisterReplace<CivHooks::CvGame_DoPlaceTeamInVictoryCompetition>(host, &ReplaceCvGame_DoPlaceTeamInVictoryCompetition);

Code

6704void CvGame::DoPlaceTeamInVictoryCompetition(VictoryTypes eNewVictory, TeamTypes eTeam)6705{6706	CvVictoryInfo* pkVictoryInfo = GC.getVictoryInfo(eNewVictory);6707	if(pkVictoryInfo == NULL)6708		return;67096710	// Is there a slot open for this new Team?6711	if(isVictoryAvailable(eNewVictory))6712	{6713		CvTeam& kTeam = GET_TEAM(eTeam);67146715		// Loop through and find first available slot6716		for(int iSlotLoop = 0; iSlotLoop < GC.getNUM_VICTORY_POINT_AWARDS(); iSlotLoop++)6717		{6718			if(getTeamVictoryRank(eNewVictory, iSlotLoop) == NO_TEAM)6719			{6720				setTeamVictoryRank(eNewVictory, iSlotLoop, eTeam);6721				int iNumPoints = pkVictoryInfo->GetVictoryPointAward(iSlotLoop);6722				kTeam.changeVictoryPoints(iNumPoints);6723				kTeam.setVictoryAchieved(eNewVictory, true);67246725				Localization::String youWonInfo = Localization::Lookup("TXT_KEY_NOTIFICATION_VICTORY_RACE_WON_YOU");6726				Localization::String youWonSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_VICTORY_RACE_WON_YOU");6727				Localization::String someoneWonInfo = Localization::Lookup("TXT_KEY_NOTIFICATION_VICTORY_RACE_WON_SOMEBODY");6728				Localization::String someoneWonSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_VICTORY_RACE_WON_SOMEBODY");6729				Localization::String unmetWonInfo = Localization::Lookup("TXT_KEY_NOTIFICATION_VICTORY_RACE_WON_UNMET");6730				Localization::String unmetWonSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_VICTORY_RACE_WON_UNMET");67316732				for(int iNotifyLoop = 0; iNotifyLoop < MAX_MAJOR_CIVS; ++iNotifyLoop){6733					PlayerTypes eNotifyPlayer = (PlayerTypes) iNotifyLoop;6734					CvPlayerAI& kCurNotifyPlayer = GET_PLAYER(eNotifyPlayer);6735					CvNotifications* pNotification = kCurNotifyPlayer.GetNotifications();6736					if(pNotification)6737					{6738						Localization::String localizedText;6739						Localization::String localizedSummary;67406741						const char* szVictoryTextKey = pkVictoryInfo->GetTextKey();6742						// Active Team6743						if(eTeam == kCurNotifyPlayer.getTeam())6744						{6745							localizedText = youWonInfo;6746							localizedText << iSlotLoop+1 << szVictoryTextKey << iNumPoints;6747							localizedSummary = youWonSummary;6748							localizedSummary << iSlotLoop+1 << szVictoryTextKey;6749						}6750						// Met Team6751						else if(GET_TEAM(kCurNotifyPlayer.getTeam()).isHasMet(eTeam))6752						{6753							const char* szTeamLeaderNameKey = GET_PLAYER(kTeam.getLeaderID()).getNameKey();67546755							localizedText = someoneWonInfo;6756							localizedText << szTeamLeaderNameKey << iSlotLoop+1 << szVictoryTextKey << iNumPoints;6757							localizedSummary = someoneWonSummary;6758							localizedSummary << szTeamLeaderNameKey << iSlotLoop+1 << szVictoryTextKey;6759						}6760						// Unmet Team6761						else6762						{6763							localizedText = unmetWonInfo;6764							localizedText << iSlotLoop+1 << szVictoryTextKey << iNumPoints;6765							localizedSummary = unmetWonSummary;6766							localizedSummary << iSlotLoop+1 << szVictoryTextKey;6767						}6768						pNotification->Add(NOTIFICATION_VICTORY, localizedText.toUTF8(), localizedSummary.toUTF8(), -1, -1, -1);6769					}6770				}67716772				break;6773			}6774		}6775	}6776}

Calls

Called by