Code
4719void CvPlayer::doTurnPostDiplomacy()4720{4721 CvGame& kGame = GC.getGame();47224723 if(isAlive())4724 {4725 kGame.GetTacticalAnalysisMap()->RefreshDataForNextPlayer(this);47264727 {4728 AI_PERF_FORMAT("AI-perf.csv", ("Plots/Danger, Turn %03d, %s", kGame.getElapsedGameTurns(), getCivilizationShortDescription()) );47294730 UpdatePlots();4731 m_pDangerPlots->UpdateDanger();4732 }47334734 if(!isBarbarian())4735 {4736 GetEconomicAI()->DoTurn();4737 GetMilitaryAI()->DoTurn();4738 GetReligionAI()->DoTurn();4739 GetTradeAI()->DoTurn();4740 GetCitySpecializationAI()->DoTurn();4741 GetLeagueAI()->DoTurn();4742 }47434744 if(isMinorCiv())4745 {4746 GetMinorCivAI()->DoTurn();4747 }4748 }47494750 // Temporary boosts4751 if(GetAttackBonusTurns() > 0)4752 {4753 ChangeAttackBonusTurns(-1);4754 }4755 if(GetCultureBonusTurns() > 0)4756 {4757 ChangeCultureBonusTurns(-1);4758 }4759 if(GetTourismBonusTurns() > 0)4760 {4761 ChangeTourismBonusTurns(-1);4762 }47634764 // Golden Age4765 DoProcessGoldenAge();47664767 // Great People gifts from Allied City States (if we have that policy)4768 DoGreatPeopleSpawnTurn();47694770 // Do turn for all Cities4771 {4772 AI_PERF_FORMAT("AI-perf.csv", ("Do City Turns, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) );4773 if(getNumCities() > 0)4774 {4775 int iLoop = 0;4776 for(CvCity* pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))4777 {4778 pLoopCity->doTurn();4779 }4780 }4781 }47824783 // Gold4784 GetTreasury()->DoGold();47854786 // Culture47874788 // Prevent exploits in turn timed MP games - no accumulation of culture if player hasn't picked yet4789 GetCulture()->SetLastTurnLifetimeCulture(GetJONSCultureEverGenerated());4790 if(kGame.isOption(GAMEOPTION_END_TURN_TIMER_ENABLED))4791 {4792 if(getJONSCulture() < getNextPolicyCost())4793 changeJONSCulture(GetTotalJONSCulturePerTurn());4794 }4795 else4796 {4797 changeJONSCulture(GetTotalJONSCulturePerTurn());4798 }47994800 // Compute the cost of policies for this turn4801 DoUpdateNextPolicyCost();48024803 // if this is the human player, have the popup come up so that he can choose a new policy4804 if(isAlive() && isHuman() && getNumCities() > 0)4805 {4806 if(!GC.GetEngineUserInterface()->IsPolicyNotificationSeen())4807 {4808 if(getNextPolicyCost() <= getJONSCulture() && GetPlayerPolicies()->GetNumPoliciesCanBeAdopted() > 0)4809 {4810 CvNotifications* pNotifications = GetNotifications();4811 if(pNotifications)4812 {4813 CvString strBuffer;48144815 if(kGame.isOption(GAMEOPTION_POLICY_SAVING))4816 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_ENOUGH_CULTURE_FOR_POLICY_DISMISS");4817 else4818 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_ENOUGH_CULTURE_FOR_POLICY");48194820 CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_ENOUGH_CULTURE_FOR_POLICY");4821 pNotifications->Add(NOTIFICATION_POLICY, strBuffer, strSummary, -1, -1, -1);4822 }4823 }4824 }48254826 if (GetPlayerPolicies()->IsTimeToChooseIdeology() && GetPlayerPolicies()->GetLateGamePolicyTree() == NO_POLICY_BRANCH_TYPE)4827 {4828 CvNotifications* pNotifications = GetNotifications();4829 if(pNotifications)4830 {4831 CvString strBuffer;4832#if defined(MOD_CONFIG_GAME_IN_XML)4833 if (GetCurrentEra() > GD_INT_GET(IDEOLOGY_START_ERA))4834#else4835 if (GetCurrentEra() > GC.getInfoTypeForString("ERA_INDUSTRIAL"))4836#endif4837 {4838 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_CHOOSE_IDEOLOGY_ERA");4839 }4840 else4841 {4842 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_CHOOSE_IDEOLOGY_FACTORIES");4843 }4844 CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_CHOOSE_IDEOLOGY");4845 pNotifications->Add(NOTIFICATION_CHOOSE_IDEOLOGY, strBuffer, strSummary, -1, -1, GetID());4846 }4847 }4848 }48494850 if (isAlive() && getNumCities() > 0 && !isHuman() && !isMinorCiv())4851 {4852 if (GetPlayerPolicies()->IsTimeToChooseIdeology() && GetPlayerPolicies()->GetLateGamePolicyTree() == NO_POLICY_BRANCH_TYPE)4853 {4854 AI_PERF_FORMAT("AI-perf.csv", ("DoChooseIdeology, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) );4855 GetPlayerPolicies()->DoChooseIdeology();4856 }4857 }48584859 if(!isBarbarian() && !isHuman())4860 {4861 AI_PERF_FORMAT("AI-perf.csv", ("DoPolicyAI, Turn %03d, %s", GC.getGame().getElapsedGameTurns(), getCivilizationShortDescription()) );4862 GetPlayerPolicies()->DoPolicyAI();4863 }48644865 // Science4866 doResearch();48674868 GetEspionage()->DoTurn();48694870 // Faith4871 CvGameReligions* pGameReligions = kGame.GetGameReligions();4872 pGameReligions->DoPlayerTurn(*this);48734874 // Leagues4875 CvGameLeagues* pGameLeagues = kGame.GetGameLeagues();4876 pGameLeagues->DoPlayerTurn(*this);48774878 // Anarchy counter4879 if(GetAnarchyNumTurns() > 0)4880 ChangeAnarchyNumTurns(-1);48814882 DoIncomingUnits();48834884 const int iGameTurn = kGame.getGameTurn();48854886 GatherPerTurnReplayStats(iGameTurn);48874888 GC.GetEngineUserInterface()->setDirty(CityInfo_DIRTY_BIT, true);48894890 AI_doTurnPost();4891}