Bazaar developer reference

CvTacticalTarget::IsTargetStillAlive(PlayerTypes)

Defined in
CvTacticalAI.cpp, line 115
Class
CvTacticalTarget
Hook name
CivHooks::CvTacticalTarget_IsTargetStillAlive

Hooks

static bool BeforeCvTacticalTarget_IsTargetStillAlive(CvTacticalTarget* self, PlayerTypes m_eAttackingPlayer, bool& result);static void AfterCvTacticalTarget_IsTargetStillAlive(CvTacticalTarget* self, PlayerTypes m_eAttackingPlayer, bool& result);static bool ReplaceCvTacticalTarget_IsTargetStillAlive(bool (*original)(CvTacticalTarget*, PlayerTypes), CvTacticalTarget* self, PlayerTypes m_eAttackingPlayer);CivRegisterBefore<CivHooks::CvTacticalTarget_IsTargetStillAlive>(host, &BeforeCvTacticalTarget_IsTargetStillAlive);CivRegisterAfter<CivHooks::CvTacticalTarget_IsTargetStillAlive>(host, &AfterCvTacticalTarget_IsTargetStillAlive);CivRegisterReplace<CivHooks::CvTacticalTarget_IsTargetStillAlive>(host, &ReplaceCvTacticalTarget_IsTargetStillAlive);

Code

114/// Still a living target?115bool CvTacticalTarget::IsTargetStillAlive(PlayerTypes m_eAttackingPlayer)116{117	bool bRtnValue = false;118119	AITacticalTargetType eType = GetTargetType();120	if(eType == AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT ||121	        eType == AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT ||122	        eType == AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT)123	{124		CvUnit* pUnit;125		CvPlot* pPlot;126		pPlot = GC.getMap().plot(m_iTargetX, m_iTargetY);127		pUnit = pPlot->getVisibleEnemyDefender(m_eAttackingPlayer);128		if(pUnit != NULL && !pUnit->isDelayedDeath())129		{130			bRtnValue = true;131		}132	}133	else if(eType == AI_TACTICAL_TARGET_CITY)134	{135		CvCity* pCity;136		CvPlot* pPlot;137		pPlot = GC.getMap().plot(m_iTargetX, m_iTargetY);138		pCity = pPlot->getPlotCity();139		if(pCity != NULL && pCity->getOwner() == GetTargetPlayer())140		{141			bRtnValue = true;142		}143	}144	return bRtnValue;145}

Calls

Called by