Bazaar developer reference

CvUnit::canAirSweepAt(int, int) const

Defined in
CvUnit.cpp, line 22022
Class
CvUnit
Hook name
CivHooks::CvUnit_canAirSweepAt

Hooks

static bool BeforeCvUnit_canAirSweepAt(const CvUnit* self, int iX, int iY, bool& result);static void AfterCvUnit_canAirSweepAt(const CvUnit* self, int iX, int iY, bool& result);static bool ReplaceCvUnit_canAirSweepAt(bool (*original)(const CvUnit*, int, int), const CvUnit* self, int iX, int iY);CivRegisterBefore<CivHooks::CvUnit_canAirSweepAt>(host, &BeforeCvUnit_canAirSweepAt);CivRegisterAfter<CivHooks::CvUnit_canAirSweepAt>(host, &AfterCvUnit_canAirSweepAt);CivRegisterReplace<CivHooks::CvUnit_canAirSweepAt>(host, &ReplaceCvUnit_canAirSweepAt);

Code

22021/// Sweep the skies and clear out interceptors22022bool CvUnit::canAirSweepAt(int iX, int iY) const22023{22024	VALIDATE_OBJECT22025	if(!canAirSweep())22026	{22027		return false;22028	}2202922030	CvPlot* pSourcePlot = plot();2203122032	CvPlot* pTargetPlot = GC.getMap().plot(iX, iY);2203322034	if(NULL == pTargetPlot)22035	{22036		return false;22037	}2203822039	// Have to be able to see the target plot22040	if(!pTargetPlot->isVisible(getTeam()))22041	{22042		return false;22043	}2204422045	// Target plot must be within this unit's air range22046	if(plotDistance(pSourcePlot->getX(), pSourcePlot->getY(), pTargetPlot->getX(), pTargetPlot->getY()) > GetRange())22047	{22048		return false;22049	}2205022051	return true;22052}

Calls

Called by