Bazaar developer reference

CvTacticalAI::PlotCloseOnTarget(bool)

Defined in
CvTacticalAI.cpp, line 3977
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotCloseOnTarget

Hooks

static bool BeforeCvTacticalAI_PlotCloseOnTarget(CvTacticalAI* self, bool bCheckDominance);static void AfterCvTacticalAI_PlotCloseOnTarget(CvTacticalAI* self, bool bCheckDominance);static void ReplaceCvTacticalAI_PlotCloseOnTarget(void (*original)(CvTacticalAI*, bool), CvTacticalAI* self, bool bCheckDominance);CivRegisterBefore<CivHooks::CvTacticalAI_PlotCloseOnTarget>(host, &BeforeCvTacticalAI_PlotCloseOnTarget);CivRegisterAfter<CivHooks::CvTacticalAI_PlotCloseOnTarget>(host, &AfterCvTacticalAI_PlotCloseOnTarget);CivRegisterReplace<CivHooks::CvTacticalAI_PlotCloseOnTarget>(host, &ReplaceCvTacticalAI_PlotCloseOnTarget);

Code

3976/// Close units in on primary target of this dominance zone3977void CvTacticalAI::PlotCloseOnTarget(bool bCheckDominance)3978{3979	CvTacticalDominanceZone* pZone = GC.getGame().GetTacticalAnalysisMap()->GetZone(m_iCurrentZoneIndex);3980	if (bCheckDominance && pZone->GetDominanceFlag() == TACTICAL_DOMINANCE_ENEMY)3981	{3982		return;3983	}39843985	// Flank attacks done; if in an enemy zone, close in on target3986	CvTacticalTarget target;3987	if(pZone->GetTerritoryType() == TACTICAL_TERRITORY_TEMP_ZONE)3988	{3989		target.SetTargetType(AI_TACTICAL_TARGET_BARBARIAN_CAMP);3990		target.SetTargetPlayer(BARBARIAN_PLAYER);3991		target.SetTargetX(pZone->GetTempZoneCenter()->getX());3992		target.SetTargetY(pZone->GetTempZoneCenter()->getY());3993		target.SetDominanceZone(pZone->GetDominanceZoneID());39943995		ExecuteCloseOnTarget(target, pZone);3996	}3997	else if(pZone->GetTerritoryType() == TACTICAL_TERRITORY_ENEMY && pZone->GetClosestCity() != NULL)3998	{3999		bool bCanSeeCity = pZone->GetClosestCity()->plot()->isVisible(m_pPlayer->getTeam());40004001		// If we can't see the city, be careful advancing on it.  We want to be sure we're not heavily outnumbered4002		if(!bCanSeeCity || pZone->GetFriendlyStrength() > (pZone->GetEnemyStrength() / 2))4003		{4004			target.SetTargetType(AI_TACTICAL_TARGET_CITY);4005			target.SetTargetPlayer(pZone->GetClosestCity()->getOwner());4006			target.SetTargetX(pZone->GetClosestCity()->plot()->getX());4007			target.SetTargetY(pZone->GetClosestCity()->plot()->getY());4008			target.SetDominanceZone(pZone->GetDominanceZoneID());40094010			ExecuteCloseOnTarget(target, pZone);4011		}4012	}4013}

Calls

Called by