Bazaar developer reference

CvPlayerEspionage::IsAnySurveillanceEstablished(PlayerTypes)

Defined in
CvEspionageClasses.cpp, line 1954
Class
CvPlayerEspionage
Hook name
CivHooks::CvPlayerEspionage_IsAnySurveillanceEstablished

Hooks

static bool BeforeCvPlayerEspionage_IsAnySurveillanceEstablished(CvPlayerEspionage* self, PlayerTypes eTargetPlayer, bool& result);static void AfterCvPlayerEspionage_IsAnySurveillanceEstablished(CvPlayerEspionage* self, PlayerTypes eTargetPlayer, bool& result);static bool ReplaceCvPlayerEspionage_IsAnySurveillanceEstablished(bool (*original)(CvPlayerEspionage*, PlayerTypes), CvPlayerEspionage* self, PlayerTypes eTargetPlayer);CivRegisterBefore<CivHooks::CvPlayerEspionage_IsAnySurveillanceEstablished>(host, &BeforeCvPlayerEspionage_IsAnySurveillanceEstablished);CivRegisterAfter<CivHooks::CvPlayerEspionage_IsAnySurveillanceEstablished>(host, &AfterCvPlayerEspionage_IsAnySurveillanceEstablished);CivRegisterReplace<CivHooks::CvPlayerEspionage_IsAnySurveillanceEstablished>(host, &ReplaceCvPlayerEspionage_IsAnySurveillanceEstablished);

Code

1953/// IsAnySurveillanceEstablished - Has any spy established surveillance in this civilization?1954bool CvPlayerEspionage::IsAnySurveillanceEstablished(PlayerTypes eTargetPlayer)1955{1956	for(uint uiSpy = 0; uiSpy < m_aSpyList.size(); uiSpy++)1957	{1958		// can't have established surveillance when not in a city1959		if(!IsSpyInCity(uiSpy))1960		{1961			continue;1962		}19631964		CvPlot* pPlot = GC.getMap().plot(m_aSpyList[uiSpy].m_iCityX, m_aSpyList[uiSpy].m_iCityY);1965		CvAssertMsg(pPlot, "Spy coordinates did not point to plot");1966		if(!pPlot)1967		{1968			return false;1969		}1970		CvCity* pCity = pPlot->getPlotCity();1971		CvAssertMsg(pCity, "There is not a city at the specified plot");1972		if(!pCity)1973		{1974			return false;1975		}1976		if(HasEstablishedSurveillance(uiSpy) && pCity->getOwner() == eTargetPlayer)1977		{1978			return true;1979		}1980	}19811982	return false;1983}

Calls

Called by