Bazaar developer reference

CvTacticalAI::PlotAttritFromRangeMoves()

Defined in
CvTacticalAI.cpp, line 3651
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotAttritFromRangeMoves

Hooks

static bool BeforeCvTacticalAI_PlotAttritFromRangeMoves(CvTacticalAI* self);static void AfterCvTacticalAI_PlotAttritFromRangeMoves(CvTacticalAI* self);static void ReplaceCvTacticalAI_PlotAttritFromRangeMoves(void (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_PlotAttritFromRangeMoves>(host, &BeforeCvTacticalAI_PlotAttritFromRangeMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotAttritFromRangeMoves>(host, &AfterCvTacticalAI_PlotAttritFromRangeMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotAttritFromRangeMoves>(host, &ReplaceCvTacticalAI_PlotAttritFromRangeMoves);

Code

3650/// Win an attrition campaign with bombardments3651void CvTacticalAI::PlotAttritFromRangeMoves()3652{3653	CvPlot* pTarget;3654	bool bAttackUnderway;36553656	// Find unit targets3657	for(unsigned int iI = 0; iI < m_ZoneTargets.size(); iI++)3658	{3659		// Is the target of an appropriate type?3660		if(m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT ||3661		        m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT ||3662		        m_ZoneTargets[iI].GetTargetType() == AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT)3663		{3664			if(m_ZoneTargets[iI].IsTargetStillAlive(m_pPlayer->GetID()))3665			{3666				m_pMap->ClearDynamicFlags();3667				pTarget = GC.getMap().plot(m_ZoneTargets[iI].GetTargetX(), m_ZoneTargets[iI].GetTargetY());3668				m_pMap->SetTargetBombardCells(pTarget, m_pMap->GetBestFriendlyRange(), m_pMap->CanIgnoreLOS());36693670				bAttackUnderway = ExecuteSafeBombards(m_ZoneTargets[iI]);3671				if(m_ZoneTargets[iI].IsTargetStillAlive(m_pPlayer->GetID()))3672				{3673					ExecuteProtectedBombards(m_ZoneTargets[iI], bAttackUnderway);3674				}3675			}3676		}3677	}3678}

Calls

Called by