Hooks
static bool BeforeCvTacticalAnalysisMap_SetTargetBombardCells(CvTacticalAnalysisMap* self, CvPlot* pTarget, int iRange, bool bIgnoreLOS);static void AfterCvTacticalAnalysisMap_SetTargetBombardCells(CvTacticalAnalysisMap* self, CvPlot* pTarget, int iRange, bool bIgnoreLOS);static void ReplaceCvTacticalAnalysisMap_SetTargetBombardCells(void (*original)(CvTacticalAnalysisMap*, CvPlot*, int, bool), CvTacticalAnalysisMap* self, CvPlot* pTarget, int iRange, bool bIgnoreLOS);CivRegisterBefore<CivHooks::CvTacticalAnalysisMap_SetTargetBombardCells>(host, &BeforeCvTacticalAnalysisMap_SetTargetBombardCells);CivRegisterAfter<CivHooks::CvTacticalAnalysisMap_SetTargetBombardCells>(host, &AfterCvTacticalAnalysisMap_SetTargetBombardCells);CivRegisterReplace<CivHooks::CvTacticalAnalysisMap_SetTargetBombardCells>(host, &ReplaceCvTacticalAnalysisMap_SetTargetBombardCells);
Code
396// Mark cells we can use to bomb a specific target397void CvTacticalAnalysisMap::SetTargetBombardCells(CvPlot* pTarget, int iRange, bool bIgnoreLOS)398{399 int iDX, iDY;400 CvPlot* pLoopPlot;401 int iPlotIndex;402 int iPlotDistance;403404 for(iDX = -(iRange); iDX <= iRange; iDX++)405 {406 for(iDY = -(iRange); iDY <= iRange; iDY++)407 {408 pLoopPlot = plotXY(pTarget->getX(), pTarget->getY(), iDX, iDY);409 if(pLoopPlot != NULL)410 {411 iPlotDistance = plotDistance(pLoopPlot->getX(), pLoopPlot->getY(), pTarget->getX(), pTarget->getY());412 if(iPlotDistance > 0 && iPlotDistance <= iRange)413 {414 iPlotIndex = GC.getMap().plotNum(pLoopPlot->getX(), pLoopPlot->getY());415 if(m_pPlots[iPlotIndex].IsRevealed() && !m_pPlots[iPlotIndex].IsImpassableTerrain() && !m_pPlots[iPlotIndex].IsImpassableTerritory())416 {417 if(!m_pPlots[iPlotIndex].IsEnemyCity() && !m_pPlots[iPlotIndex].IsNeutralCity())418 {419 if(bIgnoreLOS || pLoopPlot->canSeePlot(pTarget, m_pPlayer->getTeam(), iRange, NO_DIRECTION))420 {421 m_pPlots[iPlotIndex].SetWithinRangeOfTarget(true);422 }423 }424 }425 }426 }427 }428 }429}