Bazaar developer reference

CvTacticalAI::PlotSafeBombardMoves()

Defined in
CvTacticalAI.cpp, line 2992
Class
CvTacticalAI
Hook name
CivHooks::CvTacticalAI_PlotSafeBombardMoves

Hooks

static bool BeforeCvTacticalAI_PlotSafeBombardMoves(CvTacticalAI* self);static void AfterCvTacticalAI_PlotSafeBombardMoves(CvTacticalAI* self);static void ReplaceCvTacticalAI_PlotSafeBombardMoves(void (*original)(CvTacticalAI*), CvTacticalAI* self);CivRegisterBefore<CivHooks::CvTacticalAI_PlotSafeBombardMoves>(host, &BeforeCvTacticalAI_PlotSafeBombardMoves);CivRegisterAfter<CivHooks::CvTacticalAI_PlotSafeBombardMoves>(host, &AfterCvTacticalAI_PlotSafeBombardMoves);CivRegisterReplace<CivHooks::CvTacticalAI_PlotSafeBombardMoves>(host, &ReplaceCvTacticalAI_PlotSafeBombardMoves);

Code

2991/// Find all targets that we can bombard easily2992void CvTacticalAI::PlotSafeBombardMoves()2993{2994	CvTacticalTarget* pTarget;29952996	pTarget = GetFirstZoneTarget(AI_TACTICAL_TARGET_HIGH_PRIORITY_UNIT);2997	while(pTarget != NULL && pTarget->IsTargetStillAlive(m_pPlayer->GetID()))2998	{2999		m_pMap->ClearDynamicFlags();3000		CvPlot* pTargetPlot = GC.getMap().plot(pTarget->GetTargetX(), pTarget->GetTargetY());3001		m_pMap->SetTargetBombardCells(pTargetPlot, m_pMap->GetBestFriendlyRange(), m_pMap->CanIgnoreLOS());30023003		ExecuteSafeBombards(*pTarget);3004		pTarget = GetNextZoneTarget();3005	}30063007	pTarget = GetFirstZoneTarget(AI_TACTICAL_TARGET_MEDIUM_PRIORITY_UNIT);3008	while(pTarget != NULL && pTarget->IsTargetStillAlive(m_pPlayer->GetID()))3009	{3010		m_pMap->ClearDynamicFlags();3011		CvPlot* pTargetPlot = GC.getMap().plot(pTarget->GetTargetX(), pTarget->GetTargetY());3012		m_pMap->SetTargetBombardCells(pTargetPlot, m_pMap->GetBestFriendlyRange(), m_pMap->CanIgnoreLOS());30133014		ExecuteSafeBombards(*pTarget);3015		pTarget = GetNextZoneTarget();3016	}30173018	pTarget = GetFirstZoneTarget(AI_TACTICAL_TARGET_LOW_PRIORITY_UNIT);3019	while(pTarget != NULL && pTarget->IsTargetStillAlive(m_pPlayer->GetID()))3020	{3021		m_pMap->ClearDynamicFlags();3022		CvPlot* pTargetPlot = GC.getMap().plot(pTarget->GetTargetX(), pTarget->GetTargetY());3023		m_pMap->SetTargetBombardCells(pTargetPlot, m_pMap->GetBestFriendlyRange(), m_pMap->CanIgnoreLOS());30243025		ExecuteSafeBombards(*pTarget);3026		pTarget = GetNextZoneTarget();3027	}30283029	pTarget = GetFirstZoneTarget(AI_TACTICAL_TARGET_EMBARKED_MILITARY_UNIT);3030	while(pTarget != NULL && pTarget->IsTargetStillAlive(m_pPlayer->GetID()))3031	{3032		m_pMap->ClearDynamicFlags();3033		CvPlot* pTargetPlot = GC.getMap().plot(pTarget->GetTargetX(), pTarget->GetTargetY());3034		m_pMap->SetTargetBombardCells(pTargetPlot, m_pMap->GetBestFriendlyRange(), m_pMap->CanIgnoreLOS());30353036		ExecuteSafeBombards(*pTarget);3037		pTarget = GetNextZoneTarget();3038	}3039}

Calls

Called by