Skip to content

Commit

Permalink
Revert "Investment Bugfixes (#10399)"
Browse files Browse the repository at this point in the history
This reverts commit a89aa5b.
  • Loading branch information
RecursiveVision committed Oct 30, 2023
1 parent c8959ee commit 4568635
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 204 deletions.
19 changes: 4 additions & 15 deletions (2) Vox Populi/LUA/InfoTooltipInclude.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ print("This is the modded InfoTooltipInclude from CBP- CSD")


-- UNIT
function GetHelpTextForUnit(iUnitID, bIncludeRequirementsInfo, pCity)
function GetHelpTextForUnit(iUnitID, bIncludeRequirementsInfo)
local pUnitInfo = GameInfo.Units[iUnitID];

local pActivePlayer = Players[Game.GetActivePlayer()];
Expand All @@ -15,25 +15,14 @@ function GetHelpTextForUnit(iUnitID, bIncludeRequirementsInfo, pCity)

-- Name
strHelpText = strHelpText .. Locale.ToUpper(Locale.ConvertTextKey( pUnitInfo.Description ));
if (pCity ~= nil) then
if(pCity:GetUnitInvestment(iUnitID) > 0) then
strHelpText = strHelpText .. Locale.ConvertTextKey("TXT_KEY_INVESTED");
end
end


-- Cost
strHelpText = strHelpText .. "[NEWLINE]----------------[NEWLINE]";

-- Skip cost if it's 0
if(pUnitInfo.Cost > 0) then
local iCost = pActivePlayer:GetUnitProductionNeeded(iUnitID);
if (pCity ~= nil) then
if(pCity:GetUnitInvestment(iUnitID) > 0) then
iCost = pCity:GetUnitInvestment(iUnitID);
end
end
strHelpText = strHelpText .. Locale.ConvertTextKey("TXT_KEY_PRODUCTION_COST", iCost);
end
strHelpText = strHelpText .. Locale.ConvertTextKey("TXT_KEY_PRODUCTION_COST", pActivePlayer:GetUnitProductionNeeded(iUnitID));
end

-- Moves
if pUnitInfo.Domain ~= "DOMAIN_AIR" then
Expand Down
6 changes: 3 additions & 3 deletions (2) Vox Populi/LUA/ProductionPopup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ function ProductionSelected( ePurchaseEnum, iData)
elseif (eOrder == OrderTypes.ORDER_CONSTRUCT) then
if (city:IsCanPurchase(true, true, -1, iData, -1, eYield)) then
Game.CityPurchaseBuilding(city, iData, eYield);
Network.SendUpdateCityCitizens(cityID);
end
elseif (eOrder == OrderTypes.ORDER_CREATE) then
if (city:IsCanPurchase(true, true, -1, -1, iData, eYield)) then
Game.CityPurchaseProject(city, iData, eYield);
end
end
Network.SendUpdateCityCitizens(cityID);

if (eOrder == OrderTypes.ORDER_TRAIN or eOrder == OrderTypes.ORDER_CONSTRUCT or eOrder == OrderTypes.ORDER_CREATE) then
if (eYield == YieldTypes.YIELD_GOLD) then
Expand Down Expand Up @@ -824,7 +824,7 @@ function UpdateWindow( city )
Controls.ProductionPortrait:SetHide( false );

-- Info for this thing
strToolTip = Locale.ConvertTextKey(GetHelpTextForUnit(unitProduction, true, city)) .. "[NEWLINE][NEWLINE]" .. strToolTip;
strToolTip = Locale.ConvertTextKey(GetHelpTextForUnit(unitProduction, true)) .. "[NEWLINE][NEWLINE]" .. strToolTip;

else
Controls.ProductionPortrait:SetHide( true );
Expand Down Expand Up @@ -1237,7 +1237,7 @@ function AddProductionButton( id, description, orderType, turnsLeft, column, isD

-- Tooltip
local bIncludeRequirementsInfo = false;
local strToolTip = Locale.ConvertTextKey(GetHelpTextForUnit(id, bIncludeRequirementsInfo, pCity));
local strToolTip = Locale.ConvertTextKey(GetHelpTextForUnit(id, bIncludeRequirementsInfo));

-- Disabled help text
if (isDisabled) then
Expand Down
2 changes: 1 addition & 1 deletion (2) Vox Populi/LUA/TechButtonInclude.lua
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ function AdjustArtOnGrantedUnitButton( thisButton, thisUnitInfo, textureSize )

-- Tooltip
local bIncludeRequirementsInfo = true;
thisButton:SetToolTipString( GetHelpTextForUnit(thisUnitInfo.ID, bIncludeRequirementsInfo, nil) );
thisButton:SetToolTipString( GetHelpTextForUnit(thisUnitInfo.ID, bIncludeRequirementsInfo) );
local portraitOffset, portraitAtlas = UI.GetUnitPortraitIcon(thisUnitInfo.ID);
local textureOffset, textureSheet = IconLookup( portraitOffset, textureSize, portraitAtlas );
if textureOffset == nil then
Expand Down
2 changes: 0 additions & 2 deletions (3a) EUI Compatibility Files/LUA/CityView.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,6 @@ local function SelectionPurchase( orderID, itemID, yieldID, soundKey )
if orderID == OrderTypes.ORDER_TRAIN then
if cityIsCanPurchase( city, true, true, itemID, -1, -1, yieldID ) then
Game.CityPurchaseUnit( city, itemID, yieldID )
Network.SendUpdateCityCitizens( cityID )
isPurchase = true
end
elseif orderID == OrderTypes.ORDER_CONSTRUCT then
Expand All @@ -1125,7 +1124,6 @@ local function SelectionPurchase( orderID, itemID, yieldID, soundKey )
elseif orderID == OrderTypes.ORDER_CREATE then
if cityIsCanPurchase( city, true, true, -1, -1, itemID, yieldID ) then
Game.CityPurchaseProject( city, itemID, yieldID )
Network.SendUpdateCityCitizens( cityID )
isPurchase = true
end
end
Expand Down
3 changes: 2 additions & 1 deletion CvGameCoreDLL_Expansion2/CvBuildingProductionAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ int CvBuildingProductionAI::CheckBuildingBuildSanity(BuildingTypes eBuilding, in
}


#if defined(MOD_BALANCE_CORE_BUILDING_INVESTMENTS)
if (MOD_BALANCE_CORE_BUILDING_INVESTMENTS && !bIgnoreSituational)
{
//Virtually force this.
Expand All @@ -695,7 +696,7 @@ int CvBuildingProductionAI::CheckBuildingBuildSanity(BuildingTypes eBuilding, in
iBonus += 1000;
}
}

#endif
//Courthouse? Let's get it ASAP.
bool bCourthouse = false;
if(pkBuildingInfo->IsNoOccupiedUnhappiness())
Expand Down
Loading

0 comments on commit 4568635

Please sign in to comment.