CvDiplomacyAI::DoTurn(PlayerTypes, DiplomacyPlayerType)
- Defined in
- CvDiplomacyAI.cpp, line 1991
- Class
- CvDiplomacyAI
- Hook name
CivHooks::CvDiplomacyAI_DoTurn
Hooks
static bool BeforeCvDiplomacyAI_DoTurn(CvDiplomacyAI* self, PlayerTypes eTargetPlayer, DiplomacyPlayerType eTargetPlayerType);static void AfterCvDiplomacyAI_DoTurn(CvDiplomacyAI* self, PlayerTypes eTargetPlayer, DiplomacyPlayerType eTargetPlayerType);static void ReplaceCvDiplomacyAI_DoTurn(void (*original)(CvDiplomacyAI*, PlayerTypes, DiplomacyPlayerType), CvDiplomacyAI* self, PlayerTypes eTargetPlayer, DiplomacyPlayerType eTargetPlayerType);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoTurn>(host, &BeforeCvDiplomacyAI_DoTurn);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoTurn>(host, &AfterCvDiplomacyAI_DoTurn);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoTurn>(host, &ReplaceCvDiplomacyAI_DoTurn);
Code
1989/// Runs every turn! The order matters for a lot of this stuff, so be VERY careful about moving anything around (!)1990#if defined(MOD_AI_MP_DIPLOMACY)1991void CvDiplomacyAI::DoTurn(PlayerTypes eTargetPlayer, DiplomacyPlayerType eTargetPlayerType)1992#else1993void CvDiplomacyAI::DoTurn(PlayerTypes eTargetPlayer)1994#endif1995{1996#if defined(MOD_AI_MP_DIPLOMACY)1997 m_eTargetPlayerType = eTargetPlayerType;1998#endif1999 m_eTargetPlayer = eTargetPlayer;2000 // Military Stuff2001 DoWarDamageDecay();2002 DoUpdateWarDamageLevel();2003 DoUpdatePlayerMilitaryStrengths();2004 DoUpdatePlayerEconomicStrengths();20052006 DoUpdateWarmongerThreats();2007 DoUpdateMilitaryThreats();2008 DoUpdatePlayerTargetValues();2009 DoUpdateWarStates();2010 DoUpdateWarProjections();2011 DoUpdateWarGoals();20122013 DoUpdatePeaceTreatyWillingness();20142015 // Issues of Dispute2016 DoUpdateLandDisputeLevels();2017 DoUpdateVictoryDisputeLevels();2018 DoUpdateWonderDisputeLevels();2019 DoUpdateMinorCivDisputeLevels();20202021 // Has any player gone back on any promises he made?2022 DoTestPromises();20232024 // What we think other Players are up to2025 DoUpdateOtherPlayerWarDamageLevel();2026 DoUpdateEstimateOtherPlayerLandDisputeLevels();2027 DoUpdateEstimateOtherPlayerVictoryDisputeLevels();2028 DoUpdateEstimateOtherPlayerMilitaryThreats();2029 DoEstimateOtherPlayerOpinions();2030 LogOtherPlayerGuessStatus();20312032 // Look at the situation2033 DoUpdateMilitaryAggressivePostures();2034 DoUpdateExpansionAggressivePostures();2035 DoUpdatePlotBuyingAggressivePosture();20362037 // Player Opinion & Approach2038 DoUpdateApproachTowardsUsGuesses();20392040 DoUpdateOpinions();2041 DoUpdateMajorCivApproaches();2042 DoUpdateMinorCivApproaches();20432044 // These functions actually DO things, and we don't want the shadow AI behind a human player doing things for him2045 if(!GetPlayer()->isHuman())2046 {2047 MakeWar();2048 DoMakePeaceWithMinors();2049 DoUpdateDemands();20502051 DoUpdatePlanningExchanges();2052 DoContactMinorCivs();2053 DoContactMajorCivs();20542055#if defined(MOD_AI_MP_DIPLOMACY)2056 // JdH => cleanup AI to AI deals (was all deals before)2057 GC.getGame().GetGameDeals()->DoCancelAllProposedDealsWithPlayer(GetPlayer()->GetID(), DIPLO_AI_PLAYERS);2058#else2059 GC.getGame().GetGameDeals()->DoCancelAllProposedDealsWithPlayer(GetPlayer()->GetID()); //Proposed deals with AI players are purely transitional.2060#endif2061 //was previously controlled by a human player who had a proposed2062 //human-to-human deal. AI can't process human-to-human deals2063 //so cancel them now to prevent zombie deals.2064 }20652066 // Update Counters2067 DoCounters();20682069 // Save our current war value estimates, so we can compare them with the updated estimates next turn2070 CacheOtherPlayerWarValuesLost();20712072 LogStatus();2073 LogWarStatus();2074 LogStatements();20752076#if defined(MOD_AI_MP_DIPLOMACY)2077 m_eTargetPlayerType = DIPLO_ALL_PLAYERS;2078#endif2079 m_eTargetPlayer = NO_PLAYER;2080}
Calls
- CvDiplomacyAI::CacheOtherPlayerWarValuesLost()
- CvDiplomacyAI::DoContactMajorCivs()
- CvDiplomacyAI::DoContactMinorCivs()
- CvDiplomacyAI::DoCounters()
- CvDiplomacyAI::DoEstimateOtherPlayerOpinions()
- CvDiplomacyAI::DoMakePeaceWithMinors()
- CvDiplomacyAI::DoTestPromises()
- CvDiplomacyAI::DoUpdateApproachTowardsUsGuesses()
- CvDiplomacyAI::DoUpdateDemands()
- CvDiplomacyAI::DoUpdateEstimateOtherPlayerLandDisputeLevels()
- CvDiplomacyAI::DoUpdateEstimateOtherPlayerMilitaryThreats()
- CvDiplomacyAI::DoUpdateEstimateOtherPlayerVictoryDisputeLevels()
- CvDiplomacyAI::DoUpdateExpansionAggressivePostures()
- CvDiplomacyAI::DoUpdateLandDisputeLevels()
- CvDiplomacyAI::DoUpdateMajorCivApproaches()
- CvDiplomacyAI::DoUpdateMilitaryAggressivePostures()
- CvDiplomacyAI::DoUpdateMilitaryThreats()
- CvDiplomacyAI::DoUpdateMinorCivApproaches()
- CvDiplomacyAI::DoUpdateMinorCivDisputeLevels()
- CvDiplomacyAI::DoUpdateOpinions()
- CvDiplomacyAI::DoUpdateOtherPlayerWarDamageLevel()
- CvDiplomacyAI::DoUpdatePeaceTreatyWillingness()
- CvDiplomacyAI::DoUpdatePlanningExchanges()
- CvDiplomacyAI::DoUpdatePlayerEconomicStrengths()
- CvDiplomacyAI::DoUpdatePlayerMilitaryStrengths()
- CvDiplomacyAI::DoUpdatePlayerTargetValues()
- CvDiplomacyAI::DoUpdatePlotBuyingAggressivePosture()
- CvDiplomacyAI::DoUpdateVictoryDisputeLevels()
- CvDiplomacyAI::DoUpdateWarDamageLevel()
- CvDiplomacyAI::DoUpdateWarGoals()
- CvDiplomacyAI::DoUpdateWarmongerThreats()
- CvDiplomacyAI::DoUpdateWarProjections()
- CvDiplomacyAI::DoUpdateWarStates()
- CvDiplomacyAI::DoUpdateWonderDisputeLevels()
- CvDiplomacyAI::DoWarDamageDecay()
- CvDiplomacyAI::GetPlayer()
- CvDiplomacyAI::LogOtherPlayerGuessStatus()
- CvDiplomacyAI::LogStatements()
- CvDiplomacyAI::LogStatus()
- CvDiplomacyAI::LogWarStatus()
- CvDiplomacyAI::MakeWar()
- CvGame::GetGameDeals()
- CvGameDeals::DoCancelAllProposedDealsWithPlayer(PlayerTypes, DiplomacyPlayerType)
- CvGlobals::getGame()
- CvPlayer::GetID() const
- CvPlayer::isHuman() const