Bazaar developer reference

CvTacticalAI::PlotHedgehogMoves()

Defined in
CvTacticalAI.cpp, line 3803
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotHedgehogMoves

Hooks

static bool BeforeCvTacticalAI_PlotHedgehogMoves(CvTacticalAI* self);static void AfterCvTacticalAI_PlotHedgehogMoves(CvTacticalAI* self);static void ReplaceCvTacticalAI_PlotHedgehogMoves(void (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_PlotHedgehogMoves>(host, &BeforeCvTacticalAI_PlotHedgehogMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotHedgehogMoves>(host, &AfterCvTacticalAI_PlotHedgehogMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotHedgehogMoves>(host, &ReplaceCvTacticalAI_PlotHedgehogMoves);

Code

3802/// Build a defensive shell around this city3803void CvTacticalAI::PlotHedgehogMoves()3804{3805	// Attack priority unit targets3806	for(unsigned int iI = 0; iI < m_ZoneTargets.size(); iI++)3807	{3808		if(m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT ||3809		        m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT)3810		{3811			if(m_ZoneTargets[iI].IsTargetStillAlive(m_pPlayer->GetID()))3812			{3813				ExecutePriorityAttacksOnUnitTarget(m_ZoneTargets[iI]);3814			}3815		}3816	}38173818	PlotDestroyUnitMoves(AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT, true);3819	PlotDestroyUnitMoves(AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT, true);38203821	// But after best attacks are exhausted, go right to playing defense3822	CvTacticalDominanceZone* pZone = m_pMap->GetZone(m_iCurrentZoneIndex);3823	if(pZone->GetClosestCity() != NULL)3824	{3825		CvTacticalTarget target;3826		target.SetTargetType(AI_TACTICAL_TARGET_CITY);3827		target.SetTargetPlayer(pZone->GetClosestCity()->getOwner());3828		target.SetTargetX(pZone->GetClosestCity()->plot()->getX());3829		target.SetTargetY(pZone->GetClosestCity()->plot()->getY());3830		target.SetDominanceZone(pZone->GetDominanceZoneID());3831		ExecuteHedgehogDefense(target, pZone);3832	}3833}

Calls

Called by