Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BulkUI/IGE_CityBanner.lua
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ local function UpdateCityBanner(city)
-- Production time
local buildGrowth = "-";
if city:IsProduction() and not city:IsProductionProcess() then
if city:GetCurrentProductionDifferenceTimes100(false, false) > 0 then
if city:GetYieldRateTimes100(YieldTypes.YIELD_PRODUCTION) > 0 then
buildGrowth = city:GetProductionTurnsLeft();
end
end
Expand Down
10 changes: 4 additions & 6 deletions BulkUI/IGE_ProductionPopup.lua
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ function UpdateWindow( city )
Controls.PopulationSuffix:LocalizeAndSetText("TXT_KEY_CITYVIEW_CITIZENS_TEXT", cityPopulation);

local productionYield = city:GetYieldRate(YieldTypes.YIELD_PRODUCTION);
local productionPerTurn = math.floor(productionYield + (productionYield * (city:GetProductionModifier() / 100)));

local scienceYield = city:GetYieldRate(YieldTypes.YIELD_SCIENCE);
if (Game.IsOption(GameOptionTypes.GAMEOPTION_NO_SCIENCE)) then
Expand All @@ -222,7 +221,7 @@ function UpdateWindow( city )

Controls.GrowthBar:SetPercent( city:GetFood() / city:GrowthThreshold() );
Controls.Food:SetText( "[ICON_FOOD]" .. city:FoodDifference() );
Controls.Production:SetText( "[ICON_PRODUCTION]" .. productionPerTurn );
Controls.Production:SetText( "[ICON_PRODUCTION]" .. productionYield );
Controls.Science:SetText( "[ICON_RESEARCH]" .. scienceYield);
Controls.Gold:SetText( "[ICON_GOLD]" .. city:GetYieldRate( YieldTypes.YIELD_GOLD ) );
Controls.Culture:SetText( "[ICON_CULTURE]" .. city:GetJONSCulturePerTurn() );
Expand Down Expand Up @@ -261,7 +260,7 @@ function UpdateWindow( city )
local strTurnsLeft = g_strInfiniteTurns;

local bGeneratingProduction = false;
if (city:GetCurrentProductionDifferenceTimes100(false, false) > 0) then
if (city:GetYieldRateTimes100(YieldTypes.YIELD_PRODUCTION) > 0) then
bGeneratingProduction = true;
end

Expand Down Expand Up @@ -607,8 +606,7 @@ function UpdateWindow( city )
end

-- Base Production per turn
local iProductionPerTurn = city:GetCurrentProductionDifferenceTimes100(false, false) / 100;
local iProductionModifier = city:GetProductionModifier() + 100;
local iProductionPerTurn = city:GetYieldRateTimes100(YieldTypes.YIELD_PRODUCTION) / 100;

local strProductionPerTurn = L("TXT_KEY_CITY_SCREEN_PROD_PER_TURN", iProductionPerTurn);
Controls.ProductionOutput:SetText(strProductionPerTurn);
Expand All @@ -634,7 +632,7 @@ function UpdateWindow( city )
strNumTurns = L("TXT_KEY_PRODUCTION_HELP_NUM_TURNS", productionTurnsLeft);
end

local bGeneratingProduction = city:IsProductionProcess() or city:GetCurrentProductionDifferenceTimes100(false, false) == 0;
local bGeneratingProduction = city:IsProductionProcess() or city:GetYieldRateTimes100(YieldTypes.YIELD_PRODUCTION) == 0;

if (bGeneratingProduction) then
strNumTurns = "";
Expand Down
23 changes: 6 additions & 17 deletions IGE_API_Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1135,14 +1135,7 @@ function SetImprovementsData(data, options)
end

-- Yield changes from adjacent to other Improvements
for row in GameInfo.Improvement_AdjacentImprovementYieldChanges(item.condition) do
local improvement = GameInfo.Improvements[row.OtherImprovementType];
if improvement then
table.insert(item.yieldChanges, { yieldType = row.YieldType, yield = row.Yield, name = L(improvement.Description), type = "IMPROVEMENT", cause = adjacentToCause });
else
ReportBadRef("Improvement_AdjacentImprovementYieldChanges", row.OtherImprovementType, item.type);
end
end

end

-- Yield changes from Routes
Expand Down Expand Up @@ -1614,11 +1607,9 @@ function SetUnitsData(data)
(item.class == "UNITCLASS_INQUISITOR")
);]]

-- Help text
item.help = GetIGEHelpTextForUnit(row, activePlayer).."[NEWLINE]"
AppendIDAndTypeToHelp(item)
AppendClassToHelp(item)
AppendDomainToHelp(item)
-- Store unit data for lazy tooltip generation
item.unitRow = row;
item.unitActivePlayer = activePlayer;

-- Prereq and era
if row.PrereqTech then
Expand Down Expand Up @@ -1721,10 +1712,8 @@ function SetBuildingsData(data)
item.corpfranchises = ((row.IsCorporation == 1) and (row.Cost == -1) and (not row.WonderSplashImage));
end

-- Help
item.help = GetHelpTextForBuilding(item.ID, true, false, false).."[NEWLINE]";
AppendIDAndTypeToHelp(item)
AppendClassToHelp(item)
-- Store building ID for lazy tooltip generation
item.buildingID = item.ID;

if item.isNationalWonder then
item.priority = 1;
Expand Down
2 changes: 1 addition & 1 deletion IGE_API_Terrain.lua
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ end
-------------------------------------------------------------------------------------------------
function SetImprovement(improvement, plot)
if plot and (plot:GetImprovementType() ~= improvement.ID or plot:IsImprovementPillaged() ~= IGE.pillaged) then
plot:SetImprovementType(improvement.ID);
plot:SetImprovementType(improvement.ID, IGE.currentPlayerID);
plot:SetImprovementPillaged(IGE.pillaged);
return true, true;
end
Expand Down
26 changes: 23 additions & 3 deletions IGE_API_UI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ToolTipHandler(item)
-- Name and subtitle
local label = "[COLOR_POSITIVE_TEXT]"..item.name.."[ENDCOLOR]";
local subtitle = item.subtitle;
if subtitle and subtitle ~= "" then
if subtitle and subtitle ~= "" then
label = label.."[NEWLINE]"..subtitle;
end
local lines = { string.find(label, "[NEWLINE]") };
Expand All @@ -40,8 +40,28 @@ function ToolTipHandler(item)
tipControlTable.SmallLabel:SetHide(true);
end

-- Help
-- Help - generate lazily on first access
local hasHelp = false;
if not item.help or item.help == "" then
-- Generate help text on-demand based on item type
if item.buildingID then
-- Building tooltip
item.help = GetHelpTextForBuilding(item.buildingID, true, false, false).."[NEWLINE]";
AppendIDAndTypeToHelp(item)
AppendClassToHelp(item)
elseif item.unitRow and item.unitActivePlayer then
-- Unit tooltip
item.help = GetIGEHelpTextForUnit(item.unitRow, item.unitActivePlayer).."[NEWLINE]"
AppendIDAndTypeToHelp(item)
AppendClassToHelp(item)
AppendDomainToHelp(item)
elseif item.techData then
-- Tech tooltip
item.help = GetIGEHelpTextForTech(item)
AppendIDAndTypeToHelp(item)
end
end

if item.help and item.help ~= "" then
tipControlTable.Help:SetText(item.help);
tipControlTable.Help:SetHide(false);
Expand All @@ -64,7 +84,7 @@ function ToolTipHandler(item)
tipControlTable.Frame:SetHide(false);
else
tipControlTable.Frame:SetHide(true);
end
end
end
TTManager:GetTypeControlTable("IGE_ToolTip", tipControlTable);

Expand Down
2 changes: 1 addition & 1 deletion IGE_InfoToolTipInclude.lua
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ end
GetProductionTooltip = GetProductionTooltip or function(pCity)

local iBaseProductionPT = pCity:GetBaseYieldRate(YieldTypes.YIELD_PRODUCTION);
local iProductionPerTurn = pCity:GetCurrentProductionDifferenceTimes100(false, false) / 100;--pCity:GetYieldRate(YieldTypes.YIELD_PRODUCTION);
local iProductionPerTurn = pCity:GetYieldRateTimes100(YieldTypes.YIELD_PRODUCTION) / 100;--pCity:GetYieldRate(YieldTypes.YIELD_PRODUCTION);
local strCodeToolTip = pCity:GetYieldModifierTooltip(YieldTypes.YIELD_PRODUCTION);

local strProductionBreakdown = GetYieldTooltip(pCity, YieldTypes.YIELD_PRODUCTION, iBaseProductionPT, iProductionPerTurn, "[ICON_PRODUCTION]", strCodeToolTip);
Expand Down
2 changes: 1 addition & 1 deletion IGE_Window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ end

-------------------------------------------------------------------------------------------------
local function Open()
if not IsVisible() and not busy then
if not Players[Game.GetActivePlayer()]:IsObserver() and not IsVisible() and not busy then
SetBusy(true);

-- More than one version installed?
Expand Down
2 changes: 1 addition & 1 deletion InGame Editor+.civ5proj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ProjectGuid>{66eadccc-2daf-466b-b97f-59a8942741ce}</ProjectGuid>
<Name>InGame Editor+</Name>
<Guid>170c8ed1-b516-4fe2-b571-befeac39d220</Guid>
<ModVersion>46</ModVersion>
<ModVersion>47</ModVersion>
<Stability>Stable</Stability>
<Teaser>[COLOR_GREEN]Change terrain, units, cities, ...[ENDCOLOR]</Teaser>
<Description>[ICON_CAPITAL] IGE [ICON_CAPITAL]
Expand Down
13 changes: 3 additions & 10 deletions Panels/IGE_CitiesPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function OnInitialize()
Resize(Controls.OuterContainer);

-- Hide "Add +1 Move" button if Community Patch is detected, since it does not work thanks to a bugfix
--Controls.AddMoveUnitButton:SetHide(IGE_HasCommunityPatch);
Controls.AddMoveUnitButton:SetHide(IGE_HasCommunityPatch);

-- Create eras instances
for i, v in ipairs(data.eras) do
Expand Down Expand Up @@ -677,15 +677,8 @@ Controls.HealUnitButton:RegisterCallback(Mouse.eLClick, OnHealUnitClick);

-------------------------------------------------------------------------------------------------
function OnAddMoveUnitClick()
local iMaxMoves = currentUnit:MaxMoves();
local iMovesLeft = currentUnit:MovesLeft();
-- If Community Patch is detected, limit "Add +1 Move" button to only add +1 more move than the maximum move limit
-- Since it does not work thanks to a bugfix
if IGE_HasCommunityPatch and iMovesLeft <= iMaxMoves + 60 then
currentUnit:SetMoves(iMovesLeft + 60);
else
currentUnit:SetMoves(iMovesLeft + 60);
end
currentUnit:SetMoves(iMovesLeft + 60);
Events.SerialEventGameDataDirty();
OnUpdate();
end
Expand Down Expand Up @@ -804,7 +797,7 @@ function SetWeLoveTheKing(turns)
goldRow.ID);
end

currentCity:SetWeLoveTheKingDayCounter(turns);
currentCity:ChangeWeLoveTheKingDayCounter(turns);
currentCity:SetResourceDemanded(-1);
print("wltkd turns: "..currentCity:GetWeLoveTheKingDayCounter());
Events.SerialEventCityInfoDirty();
Expand Down
4 changes: 2 additions & 2 deletions Panels/IGE_TechsPanel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ table.insert(profiles, { name = L("TXT_KEY_IGE_TECHS_COMPATIBILITY_NIGHTS"), fil
function InitializeHelp()
print("IGE_TechsPanel.InitializeHelp");
for _, v in pairs(data.techsByTypes) do
v.help = GetIGEHelpTextForTech(v)
AppendIDAndTypeToHelp(v)
-- Store tech data flag for lazy tooltip generation
v.techData = true;
end
end

Expand Down