/// Retrieve a dominance zone by closest city CvTacticalDominanceZone* CvTacticalAnalysisMap::GetZoneByCity(CvCity* pCity, bool bWater) { CvTacticalDominanceZone* pZone; for(int iI = 0; iI < GetNumZones(); iI++) { pZone = GetZoneByIndex(iI); if(pZone->GetZoneCity() == pCity && pZone->IsWater() == bWater) { return pZone; } } return NULL; }
/// Retrieve a dominance zone by ID CvTacticalDominanceZone* CvTacticalAnalysisMap::GetZoneByID(int iID) { CvTacticalDominanceZone* pZone; for(int iI = 0; iI < GetNumZones(); iI++) { pZone = GetZoneByIndex(iI); if(pZone->GetDominanceZoneID()==iID) { return pZone; } } return NULL; }
// Is this plot in dangerous territory? bool CvTacticalAnalysisMap::IsInEnemyDominatedZone(CvPlot* pPlot) { CvTacticalAnalysisCell* pCell; int iPlotIndex; CvTacticalDominanceZone* pZone; iPlotIndex = GC.getMap().plotNum(pPlot->getX(), pPlot->getY()); pCell = GetCell(iPlotIndex); for(int iI = 0; iI < GetNumZones(); iI++) { pZone = GetZone(iI); if(pZone->GetDominanceZoneID() == pCell->GetDominanceZone()) { return (pZone->GetDominanceFlag() == TACTICAL_DOMINANCE_ENEMY); } } return false; }