Bazaar developer reference

CvTeam::EvacuateDiplomatsAtTeam(TeamTypes)

Defined in
CvTeam.cpp, line 4210
Class
CvTeam
Hook name
CivHooks::CvTeam_EvacuateDiplomatsAtTeam

Hooks

static bool BeforeCvTeam_EvacuateDiplomatsAtTeam(CvTeam* self, TeamTypes eIndex);static void AfterCvTeam_EvacuateDiplomatsAtTeam(CvTeam* self, TeamTypes eIndex);static void ReplaceCvTeam_EvacuateDiplomatsAtTeam(void (*original)(CvTeam*, TeamTypes), CvTeam* self, TeamTypes eIndex);CivRegisterBefore<CivHooks::CvTeam_EvacuateDiplomatsAtTeam>(host, &BeforeCvTeam_EvacuateDiplomatsAtTeam);CivRegisterAfter<CivHooks::CvTeam_EvacuateDiplomatsAtTeam>(host, &AfterCvTeam_EvacuateDiplomatsAtTeam);CivRegisterReplace<CivHooks::CvTeam_EvacuateDiplomatsAtTeam>(host, &ReplaceCvTeam_EvacuateDiplomatsAtTeam);

Code

4210void CvTeam::EvacuateDiplomatsAtTeam(TeamTypes eIndex)4211{4212	for (int iPlayer = 0; iPlayer < MAX_MAJOR_CIVS; iPlayer++)4213	{4214		PlayerTypes ePlayer1 = (PlayerTypes)iPlayer;4215		if (GET_PLAYER(ePlayer1).getTeam() == m_eID)4216		{4217			for (int iPlayer2 = 0; iPlayer2 < MAX_MAJOR_CIVS; iPlayer2++)4218			{4219				PlayerTypes ePlayer2 = (PlayerTypes)iPlayer2;4220				if (GET_PLAYER(ePlayer2).getTeam() != eIndex)4221				{4222					continue;4223				}42244225				if (GET_PLAYER(ePlayer1).GetEspionage()->IsMyDiplomatVisitingThem(ePlayer2, true))4226				{4227					CvCity* pCapitalCity = GET_PLAYER(ePlayer2).getCapitalCity();4228					int iSpyIndex = GET_PLAYER(ePlayer1).GetEspionage()->GetSpyIndexInCity(pCapitalCity);4229					if (iSpyIndex != -1)4230					{4231						CvNotifications* pNotifications = GET_PLAYER(ePlayer1).GetNotifications();4232						if(pNotifications)4233						{4234							CvPlayerEspionage* pEspionage = GET_PLAYER(ePlayer1).GetEspionage();4235#if !defined(MOD_BUGFIX_SPY_NAMES)4236							int iSpyName = pEspionage->m_aSpyList[iSpyIndex].m_iName;4237#endif4238							CvSpyRank eSpyRank = pEspionage->m_aSpyList[iSpyIndex].m_eRank;4239							Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_DIPLOMAT_EJECTED");4240							Localization::String strNotification = Localization::Lookup("TXT_KEY_NOTIFICATION_DIPLOMAT_EJECTED_TT");4241							strNotification << pEspionage->GetSpyRankName(eSpyRank);4242#if defined(MOD_BUGFIX_SPY_NAMES)4243							strNotification << pEspionage->m_aSpyList[iSpyIndex].GetSpyName(&GET_PLAYER(ePlayer1));4244#else4245							strNotification << GET_PLAYER(ePlayer1).getCivilizationInfo().getSpyNames(iSpyName);4246#endif4247							strNotification << pCapitalCity->getNameKey();4248							pNotifications->Add(NOTIFICATION_SPY_CANT_STEAL_TECH, strNotification.toUTF8(), strSummary.toUTF8(), -1, -1, -1);4249						}4250						GET_PLAYER(ePlayer1).GetEspionage()->MoveSpyTo(NULL, iSpyIndex, false);4251					}4252				}4253			}4254		}4255	}4256}

Calls

Called by