diff --git a/CvGameCoreDLL_Expansion2/CvCity.cpp b/CvGameCoreDLL_Expansion2/CvCity.cpp index 2e85e2bfe0..c059839afa 100644 --- a/CvGameCoreDLL_Expansion2/CvCity.cpp +++ b/CvGameCoreDLL_Expansion2/CvCity.cpp @@ -5398,7 +5398,7 @@ CvString CvCity::GetScaledHelpText(CityEventChoiceTypes eEventChoice, bool bYiel if (iPreValue != 0) { iPreValue *= -1; - if (yieldCostTip != "") + if (!yieldCostTip.empty()) { yieldCostTip += ", "; } @@ -5433,7 +5433,7 @@ CvString CvCity::GetScaledHelpText(CityEventChoiceTypes eEventChoice, bool bYiel iYieldValue /= 100; if (iYieldValue != 0) { - if (yieldInstantTip != "") + if (!yieldInstantTip.empty()) { yieldInstantTip += ", "; } @@ -5461,7 +5461,7 @@ CvString CvCity::GetScaledHelpText(CityEventChoiceTypes eEventChoice, bool bYiel int iCityValue = pkEventChoiceInfo->getCityYield(eIndex); if (iCityValue != 0) { - if (yieldCityTip != "") + if (!yieldCityTip.empty()) { yieldCityTip += ", "; } @@ -5502,7 +5502,7 @@ CvString CvCity::GetScaledHelpText(CityEventChoiceTypes eEventChoice, bool bYiel } if (iValue != 0) { - if (yieldSpecialistTip != "") + if (!yieldSpecialistTip.empty()) { yieldSpecialistTip += ", "; } @@ -5643,7 +5643,7 @@ CvString CvCity::GetDisabledTooltip(CityEventChoiceTypes eChosenEventChoice, int if (GAMEEVENTINVOKE_TESTALL(GAMEEVENT_CityEventChoiceCanTake, getOwner(), GetID(), eChosenEventChoice) == GAMEEVENTRETURN_FALSE) { CvString strOverrideText = GetLocalizedText(pkEventInfo->getDisabledTooltip()); - if (strOverrideText != "") + if (!strOverrideText.empty()) { DisabledTT += strOverrideText; } @@ -7537,7 +7537,7 @@ void CvCity::DoEventChoice(CityEventChoiceTypes eEventChoice, CityEventTypes eCi continue; CvString strNotificationString = pkEventChoiceInfo->GetNotificationInfo(iI)->GetNotificationString(); - if (strNotificationString != NULL && strNotificationString != "") + if (strNotificationString != NULL && !strNotificationString.empty()) { NotificationTypes eNotificationType = (NotificationTypes)FString::Hash(strNotificationString); @@ -9861,7 +9861,7 @@ void CvCity::ChangeNumResourceLocal(ResourceTypes eResource, int iChange, bool b } // Combine the list we just made with the header text - if (strList != "") + if (!strList.empty()) { Localization::String strText = Localization::Lookup("TXT_KEY_NOTIFICATION_CITY_RESOURCE_PROD_COST_MOD"); strText << getNameKey() << pkResource->GetTextKey() << strList; @@ -22852,7 +22852,7 @@ CvString CvCity::GetCityUnhappinessBreakdown(bool bIncludeMedian, bool bCityBann { strIcon = GC.getReligionInfo(eMajority)->GetIconString(); } - if (strIcon != "") + if (!strIcon.empty()) { strTooltip += "[NEWLINE]" + GetLocalizedText("TXT_KEY_EO_CITY_RELIGION", iUnhappyCitizens, strIcon); } @@ -23029,7 +23029,7 @@ CvString CvCity::GetCityUnhappinessBreakdown(bool bIncludeMedian, bool bCityBann { strIcon = GC.getReligionInfo(eMajority)->GetIconString(); } - if (iReligiousUnrest != 0 && strIcon != "") + if (iReligiousUnrest != 0 && !strIcon.empty()) { int iReduction = GetReligiousUnrestFlatReduction() + kPlayer.GetReligiousUnrestFlatReductionGlobal(); strTooltip += "[NEWLINE]" + GetLocalizedText("TXT_KEY_RELIGIOUS_UNREST_UNHAPPINESS", iReligiousUnrest, strIcon, iReduction); @@ -23108,7 +23108,7 @@ CvString CvCity::GetCityUnhappinessBreakdown(bool bIncludeMedian, bool bCityBann // Religious Unrest (only shows % modifier, and only shows up if city has a majority religion) int iTotalReligiousUnrestModifier = bReligionOff ? 0 : GetTotalNeedModifierForYield(YIELD_FAITH, false); - if (strIcon != "") + if (!strIcon.empty()) { float fUnhappyPerMinorityPop = 0.00f; fUnhappyPerMinorityPop += /*0.5f*/ GD_FLOAT_GET(UNHAPPINESS_PER_RELIGIOUS_MINORITY_POP); @@ -23245,7 +23245,7 @@ CvString CvCity::GetCityUnhappinessBreakdown(bool bIncludeMedian, bool bCityBann if (iArtsModifier != 0) strTooltip += "[NEWLINE]" + GetLocalizedText("TXT_KEY_ARTS_UNHAPPINESS_MOD", iArtsModifier); - if (iPrayerModifier != 0 && strIcon != "") + if (iPrayerModifier != 0 && !strIcon.empty()) strTooltip += "[NEWLINE]" + GetLocalizedText("TXT_KEY_PRAYER_UNHAPPINESS_MOD", strIcon, iPrayerModifier); // OTHER MODIFIERS @@ -23289,7 +23289,7 @@ CvString CvCity::GetCityUnhappinessBreakdown(bool bIncludeMedian, bool bCityBann else strTooltip += "[NEWLINE]" + GetLocalizedText("TXT_KEY_MISC_BOREDOM_UNHAPPINESS_MOD", iExtraBoredomMod); } - if (iExtraReligiousUnrestMod != 0 && strIcon != "") + if (iExtraReligiousUnrestMod != 0 && !strIcon.empty()) { if (iExtraReligiousUnrestMod > 0) strTooltip += "[NEWLINE]" + GetLocalizedText("TXT_KEY_MISC_RELIGIOUS_UNREST_UNHAPPINESS_MOD_POS", strIcon, iExtraReligiousUnrestMod); diff --git a/CvGameCoreDLL_Expansion2/CvCorporationClasses.cpp b/CvGameCoreDLL_Expansion2/CvCorporationClasses.cpp index 45385f9689..334de670e0 100644 --- a/CvGameCoreDLL_Expansion2/CvCorporationClasses.cpp +++ b/CvGameCoreDLL_Expansion2/CvCorporationClasses.cpp @@ -1751,7 +1751,7 @@ bool CvPlayerCorporations::CanCreateFranchiseInCity(CvCity* pOriginCity, CvCity* return false; CvLeague* pLeague = GC.getGame().GetGameLeagues()->GetActiveLeague(); - return !(pLeague != NULL && pLeague->IsTradeEmbargoed(m_pPlayer->GetID(), pTargetCity->getOwner())); + return pLeague == NULL || !pLeague->IsTradeEmbargoed(m_pPlayer->GetID(), pTargetCity->getOwner()); } int CvPlayerCorporations::GetAdditionalNumFranchises() const diff --git a/CvGameCoreDLL_Expansion2/CvDealAI.cpp b/CvGameCoreDLL_Expansion2/CvDealAI.cpp index e5b2839d10..924e6a837d 100644 --- a/CvGameCoreDLL_Expansion2/CvDealAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvDealAI.cpp @@ -1778,7 +1778,7 @@ vector CvDealAI::GetStrategicResourceItemList(ResourceTypes eResource, int // don't have prereq tech? // if we're selling, consider also buildings we'll soon be able to build TechTypes ePrereqTech = (TechTypes)pkBuildingInfo->GetPrereqAndTech(); - if (ePrereqTech != NO_TECH && !(GetPlayer()->HasTech(ePrereqTech) || (bFromMe && GetPlayer()->findPathLength(ePrereqTech, false) < 3))) + if (ePrereqTech != NO_TECH && !GetPlayer()->HasTech(ePrereqTech) && (!bFromMe || GetPlayer()->findPathLength(ePrereqTech, false) >= 3)) continue; // is the building obsolete? @@ -1945,7 +1945,7 @@ vector CvDealAI::GetStrategicResourceItemList(ResourceTypes eResource, int // don't have prereq tech? // if we're selling, consider also units we'll soon be able to build TechTypes ePrereqTech = (TechTypes)pkUnitInfo->GetPrereqAndTech(); - if (ePrereqTech != NO_TECH && !(ePlayer->HasTech(ePrereqTech) || (bFromMe && ePlayer->findPathLength(ePrereqTech, false) < 3))) + if (ePrereqTech != NO_TECH && !ePlayer->HasTech(ePrereqTech) && (!bFromMe || ePlayer->findPathLength(ePrereqTech, false) >= 3)) continue; // is the unit obsolete? diff --git a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp index d20ad5abbd..8f3d17933c 100644 --- a/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvDiplomacyAI.cpp @@ -28689,10 +28689,7 @@ bool CvDiplomacyAI::IsWillingToGiveOpenBordersToPlayer(PlayerTypes ePlayer) /// Are we willing to swap Open Borders with ePlayer? bool CvDiplomacyAI::IsOpenBordersExchangeAcceptable(PlayerTypes ePlayer) { - if (IsWillingToGiveOpenBordersToPlayer(ePlayer) && IsWantsOpenBordersWithPlayer(ePlayer)) - return true; - - return false; + return IsWillingToGiveOpenBordersToPlayer(ePlayer) && IsWantsOpenBordersWithPlayer(ePlayer); } diff --git a/CvGameCoreDLL_Expansion2/CvEspionageClasses.cpp b/CvGameCoreDLL_Expansion2/CvEspionageClasses.cpp index fdd2bd636d..97ee80bf44 100644 --- a/CvGameCoreDLL_Expansion2/CvEspionageClasses.cpp +++ b/CvGameCoreDLL_Expansion2/CvEspionageClasses.cpp @@ -1598,7 +1598,7 @@ CvString CvPlayerEspionage::GetSpyMissionTooltip(CvCity* pCity, uint uiSpyIndex) if (!pSpy) return ""; - if (MOD_BALANCE_VP && !(pSpy->GetSpyState() == SPY_STATE_TERMINATED || pSpy->GetSpyState() == SPY_STATE_DEAD) && pSpy->m_eRank < (NUM_SPY_RANKS - 1)) + if (MOD_BALANCE_VP && pSpy->GetSpyState() != SPY_STATE_TERMINATED && pSpy->GetSpyState() != SPY_STATE_DEAD && pSpy->m_eRank < (NUM_SPY_RANKS - 1)) { int iExperienceDenominator = /*100*/ GD_INT_GET(ESPIONAGE_SPY_EXPERIENCE_DENOMINATOR); iExperienceDenominator *= GC.getGame().getGameSpeedInfo().getTrainPercent(); @@ -1612,7 +1612,7 @@ CvString CvPlayerEspionage::GetSpyMissionTooltip(CvCity* pCity, uint uiSpyIndex) { if (eSpyState == SPY_STATE_UNASSIGNED) { - if (strSpyAtCity != "") + if (!strSpyAtCity.empty()) strSpyAtCity += "[NEWLINE][NEWLINE]"; strSpyAtCity += GetLocalizedText("TXT_KEY_EO_SPY_UNASSIGNED_TT", GetSpyRankName(pSpy->m_eRank), pSpy->GetSpyName(m_pPlayer)); @@ -1623,7 +1623,7 @@ CvString CvPlayerEspionage::GetSpyMissionTooltip(CvCity* pCity, uint uiSpyIndex) } else if (eSpyState == SPY_STATE_TERMINATED || pSpy->GetSpyState() == SPY_STATE_DEAD) { - if (strSpyAtCity != "") + if (!strSpyAtCity.empty()) strSpyAtCity += "[NEWLINE][NEWLINE]"; strSpyAtCity += GetLocalizedText("TXT_KEY_EO_SPY_BUTTON_DISABLED_SPY_DEAD_TT", GetSpyRankName(pSpy->m_eRank), pSpy->GetSpyName(m_pPlayer)); @@ -3060,7 +3060,7 @@ int CvPlayerEspionage::CalcNetworkPointsPerTurn(CvSpyState eSpyState, CvCity* pC if (!pCity) return 0; - if (!(eSpyState == SPY_STATE_GATHERING_INTEL || eSpyState == SPY_STATE_SCHMOOZE)) + if (eSpyState != SPY_STATE_GATHERING_INTEL && eSpyState != SPY_STATE_SCHMOOZE) return 0; int iNP = 0; @@ -6065,7 +6065,7 @@ void CvCityEspionage::ResetPassiveBonuses(PlayerTypes ePlayer) { SetSciencePassivePerTurn(ePlayer, 0); SetDiplomatTradeBonus(ePlayer, 0); - SetRevealCityScreen(ePlayer, 0); + SetRevealCityScreen(ePlayer, false); SetVisionBonus(ePlayer, 0); } @@ -6334,11 +6334,7 @@ bool CvCityEspionage::HasCounterSpy() const return false; CvEspionageSpy* pSpy = GET_PLAYER(m_pCity->getOwner()).GetEspionage()->GetSpyByID(iSpyID); - if (pSpy && pSpy->GetSpyState() == SPY_STATE_COUNTER_INTEL) - { - return true; - } - return false; + return pSpy && pSpy->GetSpyState() == SPY_STATE_COUNTER_INTEL; } int CvCityEspionage::GetCounterSpyID() const { diff --git a/CvGameCoreDLL_Expansion2/CvPlayerAI.cpp b/CvGameCoreDLL_Expansion2/CvPlayerAI.cpp index 8d080cd491..6b23567341 100644 --- a/CvGameCoreDLL_Expansion2/CvPlayerAI.cpp +++ b/CvGameCoreDLL_Expansion2/CvPlayerAI.cpp @@ -1946,14 +1946,7 @@ bool CvPlayerAI::GreatMerchantWantsCash() { //what would be a sane limit? //FIXME: look at the politics of potential targets ... - if (GetNumPuppetCities() > max(2,GC.getGame().GetNumMinorCivsEver()-3)) - { - return true; - } - else - { - return false; - } + return static_cast(GetNumPuppetCities() > max(2,GC.getGame().GetNumMinorCivsEver()-3)); } return true; diff --git a/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp b/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp index de1f80c594..73e67a2896 100644 --- a/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp +++ b/CvGameCoreDLL_Expansion2/CvReligionClasses.cpp @@ -7540,7 +7540,7 @@ bool CvReligionAI::BuyAnyAvailableNonFaithUnit() } } } - return bPurchased == true; + return bPurchased; } #endif /// Any building that we can build with Faith (not Faith-generating ones) diff --git a/CvGameCoreDLL_Expansion2/CvUnit.cpp b/CvGameCoreDLL_Expansion2/CvUnit.cpp index 701a5c9609..3de85cfebb 100644 --- a/CvGameCoreDLL_Expansion2/CvUnit.cpp +++ b/CvGameCoreDLL_Expansion2/CvUnit.cpp @@ -7353,10 +7353,7 @@ bool CvUnit::canUseForAIOperation() const } //don't pull units out of important citadels - if (TacticalAIHelpers::IsPlayerCitadel(plot(), getOwner()) && TacticalAIHelpers::IsCloseToContestedBorder(&kPlayer, plot())) - return false; - - return true; + return !(TacticalAIHelpers::IsPlayerCitadel(plot(), getOwner()) && TacticalAIHelpers::IsCloseToContestedBorder(&kPlayer, plot())); } // --------------------------------------------------------------------------------