diff --git a/BulkUI/IGE_CityBanner.lua b/BulkUI/IGE_CityBanner.lua
index 059ab37..4ddab6a 100644
--- a/BulkUI/IGE_CityBanner.lua
+++ b/BulkUI/IGE_CityBanner.lua
@@ -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
diff --git a/BulkUI/IGE_ProductionPopup.lua b/BulkUI/IGE_ProductionPopup.lua
index 21919cc..a43af43 100644
--- a/BulkUI/IGE_ProductionPopup.lua
+++ b/BulkUI/IGE_ProductionPopup.lua
@@ -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
@@ -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() );
@@ -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
@@ -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);
@@ -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 = "";
diff --git a/IGE_API_Data.lua b/IGE_API_Data.lua
index 6509f4a..a869d70 100644
--- a/IGE_API_Data.lua
+++ b/IGE_API_Data.lua
@@ -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
@@ -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
@@ -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;
diff --git a/IGE_API_Terrain.lua b/IGE_API_Terrain.lua
index 095a3c7..c00939b 100644
--- a/IGE_API_Terrain.lua
+++ b/IGE_API_Terrain.lua
@@ -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
diff --git a/IGE_API_UI.lua b/IGE_API_UI.lua
index 1d51039..91e7594 100644
--- a/IGE_API_UI.lua
+++ b/IGE_API_UI.lua
@@ -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]") };
@@ -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);
@@ -64,7 +84,7 @@ function ToolTipHandler(item)
tipControlTable.Frame:SetHide(false);
else
tipControlTable.Frame:SetHide(true);
- end
+ end
end
TTManager:GetTypeControlTable("IGE_ToolTip", tipControlTable);
diff --git a/IGE_InfoToolTipInclude.lua b/IGE_InfoToolTipInclude.lua
index b3584c6..c92be6a 100644
--- a/IGE_InfoToolTipInclude.lua
+++ b/IGE_InfoToolTipInclude.lua
@@ -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);
diff --git a/IGE_Window.lua b/IGE_Window.lua
index e642d07..f06aa59 100644
--- a/IGE_Window.lua
+++ b/IGE_Window.lua
@@ -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?
diff --git a/InGame Editor+.civ5proj b/InGame Editor+.civ5proj
index bcd90ff..753df31 100644
--- a/InGame Editor+.civ5proj
+++ b/InGame Editor+.civ5proj
@@ -5,7 +5,7 @@
{66eadccc-2daf-466b-b97f-59a8942741ce}
InGame Editor+
170c8ed1-b516-4fe2-b571-befeac39d220
- 46
+ 47
Stable
[COLOR_GREEN]Change terrain, units, cities, ...[ENDCOLOR]
[ICON_CAPITAL] IGE [ICON_CAPITAL]
diff --git a/Panels/IGE_CitiesPanel.lua b/Panels/IGE_CitiesPanel.lua
index bff94c0..36e666f 100644
--- a/Panels/IGE_CitiesPanel.lua
+++ b/Panels/IGE_CitiesPanel.lua
@@ -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
@@ -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
@@ -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();
diff --git a/Panels/IGE_TechsPanel.lua b/Panels/IGE_TechsPanel.lua
index 0f9dd14..5fb7291 100644
--- a/Panels/IGE_TechsPanel.lua
+++ b/Panels/IGE_TechsPanel.lua
@@ -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