CvTacticalAnalysisMap::FindExistingZone(CvPlot *)
- Defined in
- CvTacticalAnalysisMap.cpp, line 1140
- Class
- CvTacticalAnalysisMap
- Hook name
CivHooks::CvTacticalAnalysisMap_FindExistingZone
Hooks
static bool BeforeCvTacticalAnalysisMap_FindExistingZone(CvTacticalAnalysisMap* self, CvPlot* pPlot, CvTacticalDominanceZone*& result);static void AfterCvTacticalAnalysisMap_FindExistingZone(CvTacticalAnalysisMap* self, CvPlot* pPlot, CvTacticalDominanceZone*& result);static CvTacticalDominanceZone* ReplaceCvTacticalAnalysisMap_FindExistingZone(CvTacticalDominanceZone* (*original)(CvTacticalAnalysisMap*, CvPlot*), CvTacticalAnalysisMap* self, CvPlot* pPlot);CivRegisterBefore<CivHooks::CvTacticalAnalysisMap_FindExistingZone>(host, &BeforeCvTacticalAnalysisMap_FindExistingZone);CivRegisterAfter<CivHooks::CvTacticalAnalysisMap_FindExistingZone>(host, &AfterCvTacticalAnalysisMap_FindExistingZone);CivRegisterReplace<CivHooks::CvTacticalAnalysisMap_FindExistingZone>(host, &ReplaceCvTacticalAnalysisMap_FindExistingZone);
Code
1139/// Can this cell go in an existing dominance zone?1140CvTacticalDominanceZone* CvTacticalAnalysisMap::FindExistingZone(CvPlot* pPlot)1141{1142 CvTacticalDominanceZone* pZone;11431144 for(unsigned int iI = 0; iI < m_DominanceZones.size(); iI++)1145 {1146 pZone = &m_DominanceZones[iI];11471148 // If this is a temporary zone, matches if unowned and close enough1149 if((pZone->GetTerritoryType() == TACTICAL_TERRITORY_TEMP_ZONE) &&1150 (m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_NO_OWNER || m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_NEUTRAL) &&1151 (plotDistance(pPlot->getX(), pPlot->getY(), pZone->GetTempZoneCenter()->getX(), pZone->GetTempZoneCenter()->getY()) <= m_iTacticalRange))1152 {1153 return pZone;1154 }11551156 // If not friendly or enemy, just 1 zone per area1157 if((pZone->GetTerritoryType() == TACTICAL_TERRITORY_NO_OWNER || pZone->GetTerritoryType() == TACTICAL_TERRITORY_NEUTRAL) &&1158 (m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_NO_OWNER || m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_NEUTRAL))1159 {1160 if(pZone->GetAreaID() == m_TempZone.GetAreaID())1161 {1162 return pZone;1163 }1164 }11651166 // Otherwise everything needs to match1167 if(pZone->GetTerritoryType() == m_TempZone.GetTerritoryType() &&1168 pZone->GetOwner() == m_TempZone.GetOwner() &&1169 pZone->GetAreaID() == m_TempZone.GetAreaID() &&1170 pZone->GetClosestCity() == m_TempZone.GetClosestCity())1171 {1172 return pZone;1173 }1174 }11751176 return NULL;1177}
Calls
BaseVector::operator[]BaseVector::size- CvPlot::getX() const
- CvPlot::getY() const
- CvTacticalDominanceZone::GetAreaID() const
- CvTacticalDominanceZone::GetClosestCity() const
- CvTacticalDominanceZone::GetOwner() const
- CvTacticalDominanceZone::GetTempZoneCenter() const
- CvTacticalDominanceZone::GetTerritoryType() const
- plotDistance(int, int, int, int)