Bazaar developer reference

CvGame::DoResearchAgreementNotification(TeamTypes, TeamTypes)

Defined in
CvGame.cpp, line 10595
Class
CvGame
Hook name
CivHooks::CvGame_DoResearchAgreementNotification

Hooks

static bool BeforeCvGame_DoResearchAgreementNotification(CvGame* self, TeamTypes eTeam1, TeamTypes eTeam2);static void AfterCvGame_DoResearchAgreementNotification(CvGame* self, TeamTypes eTeam1, TeamTypes eTeam2);static void ReplaceCvGame_DoResearchAgreementNotification(void (*original)(CvGame*, TeamTypes, TeamTypes), CvGame* self, TeamTypes eTeam1, TeamTypes eTeam2);CivRegisterBefore<CivHooks::CvGame_DoResearchAgreementNotification>(host, &BeforeCvGame_DoResearchAgreementNotification);CivRegisterAfter<CivHooks::CvGame_DoResearchAgreementNotification>(host, &AfterCvGame_DoResearchAgreementNotification);CivRegisterReplace<CivHooks::CvGame_DoResearchAgreementNotification>(host, &ReplaceCvGame_DoResearchAgreementNotification);

Code

10594/// Notification letting all non-party players know that two teams made a Research Agreement.  This is in CvGame because we only want it called once, and if it were in CvDealClasses it would be called twice, or have to be special-cased, so we'll special-case it here instead10595void CvGame::DoResearchAgreementNotification(TeamTypes eTeam1, TeamTypes eTeam2)10596{10597	// Notify all non-parties that these civs made a research agreement.10598	for(int iNotifyLoop = 0; iNotifyLoop < MAX_MAJOR_CIVS; ++iNotifyLoop){10599		PlayerTypes eNotifyPlayer = (PlayerTypes) iNotifyLoop;10600		CvPlayerAI& kCurNotifyPlayer = GET_PLAYER(eNotifyPlayer);10601		TeamTypes eCurNotifyTeam = kCurNotifyPlayer.getTeam();1060210603		// Don't show notification if WE'RE the ones in the deal10604		if(eCurNotifyTeam != eTeam1 && eCurNotifyTeam != eTeam2)10605		{10606			CvTeam* pCurTeam = &GET_TEAM(eCurNotifyTeam);1060710608			if(pCurTeam->isHasMet(eTeam1) && pCurTeam->isHasMet(eTeam2))10609			{10610				CvNotifications* pNotifications = kCurNotifyPlayer.GetNotifications();10611				if(pNotifications)10612				{10613					const char* strLeaderName = GET_PLAYER(GET_TEAM(eTeam1).getLeaderID()).getCivilizationShortDescriptionKey();10614					const char* strOtherLeaderName = GET_PLAYER(GET_TEAM(eTeam2).getLeaderID()).getCivilizationShortDescriptionKey();1061510616					Localization::String strText;10617					strText = Localization::Lookup("TXT_KEY_NOTIFICATION_RESEARCH_AGREEMENT");10618					strText << strLeaderName << strOtherLeaderName;1061910620					Localization::String strSummary;10621					strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_RESEARCH_AGREEMENT");1062210623					pNotifications->Add(NOTIFICATION_DIPLOMACY_DECLARATION, strText.toUTF8(), strSummary.toUTF8(), -1, -1, -1);10624				}10625			}10626		}10627	}10628}

Calls

Called by