Skip to content

Commit

Permalink
(6-63) Show Global Mutual Exclusiveness in the UI
Browse files Browse the repository at this point in the history
https://forums.civfanatics.com/threads/6-63-show-global-mutual-exclusiveness-in-the-ui.686187/

Separated requirements and exclusiveness. Added info about global dependencies from:
- Buidling_ClassNeededAnywhere,
- Building_ClassNeededNowhere.

Added new text tag to separate requirements from exclusiveness.

Deleted local MutualExclusiveGroup from American Wonders (double info).
  • Loading branch information
adaneslavo authored and RecursiveVision committed Nov 6, 2023
1 parent 42d2736 commit 91064b7
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,15 +386,6 @@ WHERE Type IN (
'BUILDING_TRAINSTATION'
);

-- Likely unnecessary with Building_ClassNeededNowhere, just for clarity on tooltip
UPDATE Buildings
SET MutuallyExclusiveGroup = 15
WHERE Type IN (
'BUILDING_AMERICA_SMITHSONIAN',
'BUILDING_AMERICA_WESTPOINT',
'BUILDING_AMERICA_SLATERMILL'
);

UPDATE Buildings
SET MutuallyExclusiveGroup = 50
WHERE Type IN (
Expand Down
5 changes: 5 additions & 0 deletions (2) Vox Populi/Database Changes/Text/en_US/UI/NewUIText.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3108,5 +3108,10 @@
<Row Tag="TXT_KEY_ANTIQUITY_LEGEND_HIDDEN_SITE">
<Text>Hidden Antiquity Site</Text>
</Row>

<!-- EUI_tooltip_library -->
<Row Tag="TXT_KEY_PEDIA_EXC_BLDG_LABEL">
<Text>Exclusive Buildings:</Text>
</Row>
</Language_en_US>
</GameData>
23 changes: 22 additions & 1 deletion (3a) EUI Compatibility Files/LUA/EUI_tooltip_library.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1481,6 +1481,7 @@ local function GetHelpTextForBuilding( buildingID, bExcludeName, bExcludeHeader,

-- Required Buildings:
local buildings = table()
-- local
for row in GameInfo.Building_PrereqBuildingClasses( thisBuildingType ) do
local item = GetCivBuilding( activeCivilizationType, row.BuildingClassType )
if item then
Expand All @@ -1492,17 +1493,37 @@ local function GetHelpTextForBuilding( buildingID, bExcludeName, bExcludeHeader,
local item = GetCivBuilding( activeCivilizationType, row.BuildingClassType )
buildings:insertIf( item and not buildings[ item ] and BuildingColor( L(item.Description) ) )
end
-- global
items = {}
for classNeededAnywhere in DB.Query("SELECT Building_ClassNeededAnywhere.BuildingClassType FROM Building_ClassNeededAnywhere WHERE BuildingType = ?", building.Type) do
SetKey( items, classNeededAnywhere.BuildingClassType )
end
for buildingClassType in pairs( items ) do
local item = GetCivBuilding( activeCivilizationType, buildingClassType )
buildings:insertIf( item and TextColor( "[COLOR_YIELD_FOOD]", L(item.Description) ) )
end
-- printing...
tips:insertIf( #buildings > 0 and L"TXT_KEY_PEDIA_REQ_BLDG_LABEL" .. " " .. buildings:concat(", ") )

-- Exclusive Buildings:
local buildings = table()
-- local
items = {}
if (building.MutuallyExclusiveGroup or -1) >= 0 then
for row in GameInfo.Buildings{ MutuallyExclusiveGroup = building.MutuallyExclusiveGroup } do
SetKey( items, row.BuildingClass ~= buildingClassType and row.BuildingClass )
end
end
-- global
for classNeededNowhere in DB.Query("SELECT Building_ClassNeededNowhere.BuildingClassType FROM Building_ClassNeededNowhere WHERE BuildingType = ?", building.Type) do
SetKey( items, classNeededNowhere.BuildingClassType )
end
for buildingClassType in pairs( items ) do
local item = GetCivBuilding( activeCivilizationType, buildingClassType )
buildings:insertIf( item and TextColor( "[COLOR_RED]", L(item.Description) ) )
end
tips:insertIf( #buildings > 0 and L"TXT_KEY_PEDIA_REQ_BLDG_LABEL" .. " " .. buildings:concat(", ") )
-- printing...
tips:insertIf( #buildings > 0 and L"TXT_KEY_PEDIA_EXC_BLDG_LABEL" .. " " .. buildings:concat(", ") )

-- Local Resources Required:
local resources = table()
Expand Down

0 comments on commit 91064b7

Please sign in to comment.