Bazaar developer reference

CvPlayerEspionage::IsMyDiplomatVisitingThem(PlayerTypes, bool)

Defined in
CvEspionageClasses.cpp, line 2716
Class
CvPlayerEspionage
Hook name
CivHooks::CvPlayerEspionage_IsMyDiplomatVisitingThem

Hooks

static bool BeforeCvPlayerEspionage_IsMyDiplomatVisitingThem(CvPlayerEspionage* self, PlayerTypes ePlayer, bool bIncludeTravelling, bool& result);static void AfterCvPlayerEspionage_IsMyDiplomatVisitingThem(CvPlayerEspionage* self, PlayerTypes ePlayer, bool bIncludeTravelling, bool& result);static bool ReplaceCvPlayerEspionage_IsMyDiplomatVisitingThem(bool (*original)(CvPlayerEspionage*, PlayerTypes, bool), CvPlayerEspionage* self, PlayerTypes ePlayer, bool bIncludeTravelling);CivRegisterBefore<CivHooks::CvPlayerEspionage_IsMyDiplomatVisitingThem>(host, &BeforeCvPlayerEspionage_IsMyDiplomatVisitingThem);CivRegisterAfter<CivHooks::CvPlayerEspionage_IsMyDiplomatVisitingThem>(host, &AfterCvPlayerEspionage_IsMyDiplomatVisitingThem);CivRegisterReplace<CivHooks::CvPlayerEspionage_IsMyDiplomatVisitingThem>(host, &ReplaceCvPlayerEspionage_IsMyDiplomatVisitingThem);

Code

2716bool CvPlayerEspionage::IsMyDiplomatVisitingThem(PlayerTypes ePlayer, bool bIncludeTravelling)2717{2718	CvCity* pTheirCapital = GET_PLAYER(ePlayer).getCapitalCity();2719	if (!pTheirCapital)2720	{2721		return false;2722	}27232724	int iSpyIndex = GetSpyIndexInCity(pTheirCapital);27252726	if (iSpyIndex < 0)2727	{2728		return false;2729	}27302731	if (!m_aSpyList[iSpyIndex].m_bIsDiplomat)2732	{2733		return false;2734	}27352736	if (!bIncludeTravelling)2737	{2738		// If the spy is not schmoozing yet, then it doesn't count as a diplomat yet2739		if (!IsSchmoozing(iSpyIndex))2740		{2741			return false;2742		}2743	}27442745	return true;2746}

Calls

Called by