void CvPlayerAI::AI_doTurnPost() { AI_PERF_FORMAT("AI-perf.csv", ("CvPlayerAI::AI_doTurnPost, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) ); if(isHuman()) { return; } if(isBarbarian()) { return; } if(isMinorCiv()) { return; } for(int i = 0; i < GC.getNumVictoryInfos(); ++i) { AI_launch((VictoryTypes)i); } ProcessGreatPeople(); GetEspionageAI()->DoTurn(); GetTradeAI()->DoTurn(); }
void CvCityAI::AI_doTurn() { AI_PERF_FORMAT("City-AI-perf.csv", ("CvCityAI::AI_doTurn, Turn %03d, %s, %s", GC.getGame().getElapsedGameTurns(), GetPlayer()->getCivilizationShortDescription(), getName().c_str()) ); VALIDATE_OBJECT if(!isHuman()) { AI_stealPlots(); } }
/// Fill the map with data for this AI player's turn void CvTacticalAnalysisMap::RefreshDataForNextPlayer(CvPlayer* pPlayer) { if(m_pPlots) { if(pPlayer != m_pPlayer || m_iTurnBuilt < GC.getGame().getGameTurn()) { m_pPlayer = pPlayer; m_iTurnBuilt = GC.getGame().getGameTurn(); m_iTacticalRange = ((GC.getAI_TACTICAL_RECRUIT_RANGE() + GC.getGame().getCurrentEra()) * 2) / 3; // Have this increase as game goes on m_iUnitStrengthMultiplier = GC.getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER() * m_iTacticalRange; AI_PERF_FORMAT("AI-perf.csv", ("Tactical Analysis Map, Turn %d, %s", GC.getGame().getGameTurn(), m_pPlayer->getCivilizationShortDescription()) ); m_bIsBuilt = false; // AI civs build this map every turn //if (!m_pPlayer->isHuman() && !m_pPlayer->isBarbarian()) if(!m_pPlayer->isBarbarian()) { m_DominanceZones.clear(); AddTemporaryZones(); for(int iI = 0; iI < GC.getMap().numPlots(); iI++) { CvAssertMsg((iI < m_iNumPlots), "Plot to be accessed exceeds allocation!"); CvPlot* pPlot = GC.getMap().plotByIndexUnchecked(iI); if(pPlot == NULL) { // Erase this cell m_pPlots[iI].Clear(); } else { if(PopulateCell(iI, pPlot)) { AddToDominanceZones(iI, &m_pPlots[iI]); } } } CalculateMilitaryStrengths(); PrioritizeZones(); LogZones(); BuildEnemyUnitList(); MarkCellsNearEnemy(); m_bIsBuilt = true; } } } }
/// Fill the map with data for this AI player's turn void CvTacticalAnalysisMap::Refresh() { if(!IsUpToDate()) { //can happen in the first turn ... if (m_pCells.size()!=GC.getMap().numPlots()) Init(m_ePlayer); m_iTurnBuilt = GC.getGame().getGameTurn(); m_iTacticalRange = ((GC.getAI_TACTICAL_RECRUIT_RANGE() + GC.getGame().getCurrentEra()) * 3) / 5; // Have this increase as game goes on m_iUnitStrengthMultiplier = GC.getAI_TACTICAL_MAP_UNIT_STRENGTH_MULTIPLIER() * m_iTacticalRange; AI_PERF_FORMAT("AI-perf.csv", ("Tactical Analysis Map, Turn %d, %s", GC.getGame().getGameTurn(), m_pPlayer->getCivilizationShortDescription()) ); m_DominanceZones.clear(); AddTemporaryZones(); for(int iI = 0; iI < GC.getMap().numPlots(); iI++) { CvAssertMsg((iI < m_iNumPlots), "Plot to be accessed exceeds allocation!"); CvPlot* pPlot = GC.getMap().plotByIndexUnchecked(iI); if(pPlot == NULL) { // Erase this cell m_pCells[iI].Clear(); } else { if(PopulateCell(iI, pPlot)) { AddToDominanceZones(iI, &m_pCells[iI]); } } } //barbarians don't care about tactical dominance if(m_ePlayer!=BARBARIAN_PLAYER) { EstablishZoneNeighborhood(); CalculateMilitaryStrengths(); PrioritizeZones(); LogZones(); } BuildEnemyUnitList(); MarkCellsNearEnemy(); } }
void CvPlayerAI::AI_doTurnPre() { AI_PERF_FORMAT("AI-perf.csv", ("CvPlayerAI::AI_doTurnPre, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) ); CvAssertMsg(getPersonalityType() != NO_LEADER, "getPersonalityType() is not expected to be equal with NO_LEADER"); CvAssertMsg(getLeaderType() != NO_LEADER, "getLeaderType() is not expected to be equal with NO_LEADER"); CvAssertMsg(getCivilizationType() != NO_CIVILIZATION, "getCivilizationType() is not expected to be equal with NO_CIVILIZATION"); if(isHuman()) { return; } AI_updateFoundValues(); AI_doResearch(); AI_considerAnnex(); }
void CvPlayerAI::AI_doTurnPost() { AI_PERF_FORMAT("AI-perf.csv", ("CvPlayerAI::AI_doTurnPost, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) ); if(isHuman()) { return; } // EventEngine - v0.1, Snarko // DO NOT pass pEvent to AI_chooseEventOption. The event is deleted when an option has been chosen. int iLoop = 0; for(CvEvent* pEvent = firstEvent(&iLoop, false); pEvent != NULL; pEvent = nextEvent(&iLoop, false)) { AI_chooseEventOption(pEvent->GetID()); } // END EventEngine if(isBarbarian()) { return; } if(isMinorCiv()) { return; } for(int i = 0; i < GC.getNumVictoryInfos(); ++i) { AI_launch((VictoryTypes)i); } ProcessGreatPeople(); GetEspionageAI()->DoTurn(); GetTradeAI()->DoTurn(); }