diff --git a/(1) Community Patch/LUA/TradeLogic.lua b/(1) Community Patch/LUA/TradeLogic.lua index 4c9af796a7..89008d3de4 100644 --- a/(1) Community Patch/LUA/TradeLogic.lua +++ b/(1) Community Patch/LUA/TradeLogic.lua @@ -17,6 +17,7 @@ local g_ThemPocketVoteIM = InstanceManager:new( "PocketVote", "Button", Controls local g_bAlwaysWar = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_WAR ); local g_bAlwaysPeace = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_PEACE ); local g_bNoChangeWar = Game.IsOption( GameOptionTypes.GAMEOPTION_NO_CHANGING_WAR_PEACE ); +local g_PeaceDealDuration = GameInfo.GameSpeeds[PreGame.GetGameSpeed()].PeaceDealDuration; local g_bDisableScience = Game.IsOption("GAMEOPTION_NO_SCIENCE"); local g_bDisableLeague = Game.IsOption("GAMEOPTION_NO_LEAGUES"); @@ -424,8 +425,8 @@ function OnOpenPlayerDealScreen( iOtherPlayer ) g_Deal:SetToPlayer( g_iThem ); if( g_pUsTeam:IsAtWar( g_iThemTeam ) ) then - g_Deal:AddPeaceTreaty( g_iUs, GameDefines.PEACE_TREATY_LENGTH ); - g_Deal:AddPeaceTreaty( g_iThem, GameDefines.PEACE_TREATY_LENGTH ); + g_Deal:AddPeaceTreaty( g_iUs, g_PeaceDealDuration ); + g_Deal:AddPeaceTreaty( g_iThem, g_PeaceDealDuration ); end DoUpdateButtons(); @@ -3580,7 +3581,7 @@ function LeaderSelected( iOtherPlayer, isUs ) if( mode == WAR ) then g_Deal:AddThirdPartyWar( iWho, iOtherTeam ); else - g_Deal:AddThirdPartyPeace( iWho, iOtherTeam, GameDefines.PEACE_TREATY_LENGTH ); + g_Deal:AddThirdPartyPeace( iWho, iOtherTeam, g_PeaceDealDuration ); end DisplayDeal(); @@ -3753,10 +3754,10 @@ end ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -Controls.UsMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.UsDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.ThemMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.ThemDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); +Controls.UsMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.UsDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.ThemMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.ThemDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); ResetDisplay(); DisplayDeal(); \ No newline at end of file diff --git a/(2) Vox Populi/LUA/TradeLogic.lua b/(2) Vox Populi/LUA/TradeLogic.lua index e671017bd2..aa1baaeb28 100644 --- a/(2) Vox Populi/LUA/TradeLogic.lua +++ b/(2) Vox Populi/LUA/TradeLogic.lua @@ -19,6 +19,7 @@ local g_bAlwaysWar = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_WAR ); local g_bAlwaysPeace = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_PEACE ); local g_bNoChangeWar = Game.IsOption( GameOptionTypes.GAMEOPTION_NO_CHANGING_WAR_PEACE ); +local g_PeaceDealDuration = GameInfo.GameSpeeds[PreGame.GetGameSpeed()].PeaceDealDuration; local g_bAllowResearchAgreements = Game.IsOption("GAMEOPTION_RESEARCH_AGREEMENTS"); local g_bDisableScience = Game.IsOption("GAMEOPTION_NO_SCIENCE"); local g_bDisableTechTrading = Game.IsOption("GAMEOPTION_NO_TECH_TRADING"); @@ -439,8 +440,8 @@ function OnOpenPlayerDealScreen( iOtherPlayer ) g_Deal:SetToPlayer( g_iThem ); if( g_pUsTeam:IsAtWar( g_iThemTeam ) ) then - g_Deal:AddPeaceTreaty( g_iUs, GameDefines.PEACE_TREATY_LENGTH ); - g_Deal:AddPeaceTreaty( g_iThem, GameDefines.PEACE_TREATY_LENGTH ); + g_Deal:AddPeaceTreaty( g_iUs, g_PeaceDealDuration ); + g_Deal:AddPeaceTreaty( g_iThem, g_PeaceDealDuration ); end DoUpdateButtons(); @@ -4288,7 +4289,7 @@ function LeaderSelected( iOtherPlayer, isUs ) if( mode == WAR ) then g_Deal:AddThirdPartyWar( iWho, iOtherTeam ); else - g_Deal:AddThirdPartyPeace( iWho, iOtherTeam, GameDefines.PEACE_TREATY_LENGTH ); + g_Deal:AddThirdPartyPeace( iWho, iOtherTeam, g_PeaceDealDuration ); end DisplayDeal(); @@ -4461,10 +4462,10 @@ end ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -Controls.UsMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.UsDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.ThemMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.ThemDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); +Controls.UsMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.UsDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.ThemMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.ThemDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); ResetDisplay(); DisplayDeal(); diff --git a/(3a) EUI Compatibility Files/LUA/TradeLogic.lua b/(3a) EUI Compatibility Files/LUA/TradeLogic.lua index c182c6e1d9..4b033dd205 100644 --- a/(3a) EUI Compatibility Files/LUA/TradeLogic.lua +++ b/(3a) EUI Compatibility Files/LUA/TradeLogic.lua @@ -34,6 +34,7 @@ local g_bAlwaysWar = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_WAR ); local g_bAlwaysPeace = Game.IsOption( GameOptionTypes.GAMEOPTION_ALWAYS_PEACE ); local g_bNoChangeWar = Game.IsOption( GameOptionTypes.GAMEOPTION_NO_CHANGING_WAR_PEACE ); +local g_PeaceDealDuration = GameInfo.GameSpeeds[PreGame.GetGameSpeed()].PeaceDealDuration; local g_bAllowResearchAgreements = Game.IsOption("GAMEOPTION_RESEARCH_AGREEMENTS"); local g_bDisableScience = Game.IsOption("GAMEOPTION_NO_SCIENCE"); local g_bDisableTechTrading = Game.IsOption("GAMEOPTION_NO_TECH_TRADING"); @@ -440,8 +441,8 @@ function OnOpenPlayerDealScreen( iOtherPlayer ) g_Deal:SetToPlayer( g_iThem ); if( g_pUsTeam:IsAtWar( g_iThemTeam ) ) then - g_Deal:AddPeaceTreaty( g_iUs, GameDefines.PEACE_TREATY_LENGTH ); - g_Deal:AddPeaceTreaty( g_iThem, GameDefines.PEACE_TREATY_LENGTH ); + g_Deal:AddPeaceTreaty( g_iUs, g_PeaceDealDuration ); + g_Deal:AddPeaceTreaty( g_iThem, g_PeaceDealDuration ); end DoUpdateButtons(); @@ -4291,7 +4292,7 @@ function LeaderSelected( iOtherPlayer, isUs ) if( mode == WAR ) then g_Deal:AddThirdPartyWar( iWho, iOtherTeam ); else - g_Deal:AddThirdPartyPeace( iWho, iOtherTeam, GameDefines.PEACE_TREATY_LENGTH ); + g_Deal:AddThirdPartyPeace( iWho, iOtherTeam, g_PeaceDealDuration ); end DisplayDeal(); @@ -4464,10 +4465,10 @@ end ----------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------------- -Controls.UsMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.UsDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.ThemMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); -Controls.ThemDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", 15 ); +Controls.UsMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.UsDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.ThemMakePeaceDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); +Controls.ThemDeclareWarDuration:LocalizeAndSetText( "TXT_KEY_DIPLO_TURNS", g_PeaceDealDuration); ResetDisplay(); DisplayDeal(); diff --git a/CvGameCoreDLL_Expansion2/CvDealClasses.cpp b/CvGameCoreDLL_Expansion2/CvDealClasses.cpp index b441219239..915a9820bc 100644 --- a/CvGameCoreDLL_Expansion2/CvDealClasses.cpp +++ b/CvGameCoreDLL_Expansion2/CvDealClasses.cpp @@ -3808,10 +3808,10 @@ bool CvDeal::IsPotentiallyRenewable() TradedItemList::iterator it; for(it = m_TradedItems.begin(); it != m_TradedItems.end(); ++it) { - if (GetItemTradeableState(it->m_eItemType) == DEAL_RENEWABLE) - return true; + if (GetItemTradeableState(it->m_eItemType) == DEAL_NONRENEWABLE) + return false; } - return false; + return true; } bool CvDeal::IsCheckedForRenewal() @@ -5119,7 +5119,7 @@ void CvGameDeals::DoTurn() int iGameTurn = GC.getGame().getGameTurn(); - // Check to see if any of our RENEWABLE TradeItems in any of our Deals expire this turn + // Find the deals which don't have any non-renewable items and for which one of the trade items expires this turn for (it = m_CurrentDeals.begin(); it != m_CurrentDeals.end(); ++it) { it->m_bConsideringForRenewal = false; @@ -5129,7 +5129,7 @@ void CvGameDeals::DoTurn() if (GET_PLAYER(it->GetFromPlayer()).isHuman() && GET_PLAYER(it->GetToPlayer()).isHuman()) bHumanToHuman = true; - //if we can renew this deal, we're going to send it to the Diplo AI first. + // if there are non-renewable items in the deal, move on if (!bHumanToHuman && !it->IsPotentiallyRenewable()) continue; diff --git a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp index 6d13ddf97d..fe3ab9769e 100644 --- a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp @@ -34845,45 +34845,6 @@ CvDeal* CvDiplomacyAI::DoRenewExpiredDeal(PlayerTypes ePlayer, DiploStatementTyp continue; } - // if the deal can be fully renewed - TradedItemList tradedItems = pCurrentDeal->m_TradedItems; - TradedItemList::iterator it; - - for(it = tradedItems.begin(); it != tradedItems.end(); ++it) - { - PlayerTypes eOtherPlayer; - if (it->m_eFromPlayer == pCurrentDeal->m_eFromPlayer) - { - eOtherPlayer = pCurrentDeal->m_eToPlayer; - } - else - { - eOtherPlayer = pCurrentDeal->m_eFromPlayer; - } - - //exclude items that can't be renewed: - if (it->m_eItemType == TRADE_ITEM_GOLD || - it->m_eItemType == TRADE_ITEM_GOLD_PER_TURN || - it->m_eItemType == TRADE_ITEM_RESOURCES || - it->m_eItemType == TRADE_ITEM_OPEN_BORDERS || - it->m_eItemType == TRADE_ITEM_ALLOW_EMBASSY || - it->m_eItemType == TRADE_ITEM_DEFENSIVE_PACT) - { - continue; - } - - //otherwise remove it. - pCurrentDeal->RemoveByType(it->m_eItemType, it->m_eFromPlayer); - - } - - //we emptied the deal? whoops. - if (pCurrentDeal->GetNumItems() <= 0) - { - badDeals.push_back(pCurrentDeal); - continue; - } - //Set as considered for renewal. pCurrentDeal->m_iFinalTurn = -1;