CvTacticalAnalysisMap::RefreshDataForNextPlayer(CvPlayer *)
- Defined in
- CvTacticalAnalysisMap.cpp, line 219
- Class
- CvTacticalAnalysisMap
- Hook name
CivHooks::CvTacticalAnalysisMap_RefreshDataForNextPlayer
Hooks
static bool BeforeCvTacticalAnalysisMap_RefreshDataForNextPlayer(CvTacticalAnalysisMap* self, CvPlayer* pPlayer);static void AfterCvTacticalAnalysisMap_RefreshDataForNextPlayer(CvTacticalAnalysisMap* self, CvPlayer* pPlayer);static void ReplaceCvTacticalAnalysisMap_RefreshDataForNextPlayer(void (*original)(CvTacticalAnalysisMap*, CvPlayer*), CvTacticalAnalysisMap* self, CvPlayer* pPlayer);CivRegisterBefore<CivHooks::CvTacticalAnalysisMap_RefreshDataForNextPlayer>(host, &BeforeCvTacticalAnalysisMap_RefreshDataForNextPlayer);CivRegisterAfter<CivHooks::CvTacticalAnalysisMap_RefreshDataForNextPlayer>(host, &AfterCvTacticalAnalysisMap_RefreshDataForNextPlayer);CivRegisterReplace<CivHooks::CvTacticalAnalysisMap_RefreshDataForNextPlayer>(host, &ReplaceCvTacticalAnalysisMap_RefreshDataForNextPlayer);
Code
218/// Fill the map with data for this AI player's turn219void CvTacticalAnalysisMap::RefreshDataForNextPlayer(CvPlayer* pPlayer)220{221 if(m_pPlots)222 {223 if(pPlayer != m_pPlayer || m_iTurnBuilt < GC.getGame().getGameTurn())224 {225 m_pPlayer = pPlayer;226 m_iTurnBuilt = GC.getGame().getGameTurn();227 m_iTacticalRange = ((GC.getAI_TACTICAL_RECRUIT_RANGE() + GC.getGame().getCurrentEra()) * 2) / 3; // Have this increase as game goes on228 m_iUnitStrengthMultiplier = GC.getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER() * m_iTacticalRange;229230 AI_PERF_FORMAT("AI-perf.csv", ("Tactical Analysis Map, Turn %d, %s", GC.getGame().getGameTurn(), m_pPlayer->getCivilizationShortDescription()) );231232 m_bIsBuilt = false;233234 // AI civs build this map every turn235 //if (!m_pPlayer->isHuman() && !m_pPlayer->isBarbarian())236 if(!m_pPlayer->isBarbarian())237 {238 m_DominanceZones.clear();239240 AddTemporaryZones();241242 for(int iI = 0; iI < GC.getMap().numPlots(); iI++)243 {244 CvAssertMsg((iI < m_iNumPlots), "Plot to be accessed exceeds allocation!");245246 CvPlot* pPlot = GC.getMap().plotByIndexUnchecked(iI);247 if(pPlot == NULL)248 {249 // Erase this cell250 m_pPlots[iI].Clear();251 }252 else253 {254 if(PopulateCell(iI, pPlot))255 {256 AddToDominanceZones(iI, &m_pPlots[iI]);257 }258 }259 }260261 CalculateMilitaryStrengths();262 PrioritizeZones();263 LogZones();264 BuildEnemyUnitList();265 MarkCellsNearEnemy();266267 m_bIsBuilt = true;268 }269 }270 }271}
Calls
BaseVector::clear- CvGame::getCurrentEra() const
- CvGame::getGameTurn()
- CvGlobals::getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER()
- CvGlobals::getAI_TACTICAL_RECRUIT_RANGE()
- CvGlobals::getGame()
- CvGlobals::getMap()
- CvMap::numPlots() const
- CvMap::plotByIndexUnchecked(int) const
- CvPlayer::isBarbarian() const
- CvTacticalAnalysisCell::Clear()
- CvTacticalAnalysisMap::AddTemporaryZones()
- CvTacticalAnalysisMap::AddToDominanceZones(int, CvTacticalAnalysisCell *)
- CvTacticalAnalysisMap::BuildEnemyUnitList()
- CvTacticalAnalysisMap::CalculateMilitaryStrengths()
- CvTacticalAnalysisMap::LogZones()
- CvTacticalAnalysisMap::MarkCellsNearEnemy()
- CvTacticalAnalysisMap::PopulateCell(int, CvPlot *)
- CvTacticalAnalysisMap::PrioritizeZones()