fix(ui): tabelceller skæres af ved egen bredde (textMaxWidth); ens bygningsnavne slås sammen ('Chicken Coop x5') i Oversigt (v1.19.3.0)

This commit is contained in:
2026-09-24 19:44:21 +02:00
parent 2ed79cf461
commit b86f420a41
7 changed files with 47 additions and 21 deletions
+21
View File
@@ -117,3 +117,24 @@ function ADFlowView.buildingRows(buildings, chosen, showAll)
end
return rows
end
-- "Chicken Coop x3 + Cow Barn": ens navne slås sammen med antal, i rækkefølge efter første forekomst.
function ADFlowView.joinCounted(names, separator, empty)
local order, counts = {}, {}
for _, name in ipairs(names or {}) do
local key = tostring(name)
if counts[key] == nil then
counts[key] = 0
table.insert(order, key)
end
counts[key] = counts[key] + 1
end
if #order == 0 then
return empty
end
local parts = {}
for _, key in ipairs(order) do
table.insert(parts, counts[key] > 1 and string.format("%s x%d", key, counts[key]) or key)
end
return table.concat(parts, separator)
end
@@ -37,7 +37,7 @@ function SmartPickupFrame:flowCells(adEnv, run)
end
local from, to
if row.kind == "outbound" then
from = joinOr(mark(row.fromNames), i18n:getText("spu_flow_noSource"))
from = ADFlowView.joinCounted(mark(row.fromNames), " + ", i18n:getText("spu_flow_noSource"))
local seen, policies = {}, {}
for _, policy in ipairs(row.policies) do
if not seen[policy] then seen[policy] = true; table.insert(policies, i18n:getText("spu_policy_" .. policy)) end
@@ -45,7 +45,7 @@ function SmartPickupFrame:flowCells(adEnv, run)
to = joinOr(policies, i18n:getText("spu_flow_noProducts"))
else
from = i18n:getText("spu_from_allSilos")
to = joinOr(mark(row.toNames), i18n:getText("spu_flow_noTarget"))
to = ADFlowView.joinCounted(mark(row.toNames), " + ", i18n:getText("spu_flow_noTarget"))
end
local rule
if row.kind == "outbound" then
+16 -16
View File
@@ -74,28 +74,28 @@
</Bitmap>
<!-- Oversigt: én række pr. flow (flow · varer · fra · til · traktorer · status). Rækken er ~815 px bred. -->
<Bitmap profile="fs25_multiTextOptionContainer" id="flowPrefab">
<Text profile="spuCellBold" name="c1" position="20px 0px" size="150px 40px"/>
<Text profile="spuCell" name="c2" position="170px 0px" size="110px 40px"/>
<Text profile="spuCell" name="c3" position="280px 0px" size="170px 40px"/>
<Text profile="spuCell" name="c4" position="450px 0px" size="170px 40px"/>
<Text profile="spuCell" name="c5" position="620px 0px" size="50px 40px"/>
<Text profile="spuCell" name="c6" position="670px 0px" size="140px 40px"/>
<Text profile="spuCellBold" name="c1" position="20px 0px" size="150px 40px" textMaxWidth="142px"/>
<Text profile="spuCell" name="c2" position="170px 0px" size="110px 40px" textMaxWidth="102px"/>
<Text profile="spuCell" name="c3" position="280px 0px" size="170px 40px" textMaxWidth="162px"/>
<Text profile="spuCell" name="c4" position="450px 0px" size="170px 40px" textMaxWidth="162px"/>
<Text profile="spuCell" name="c5" position="620px 0px" size="50px 40px" textMaxWidth="42px"/>
<Text profile="spuCell" name="c6" position="670px 0px" size="140px 40px" textMaxWidth="132px"/>
</Bitmap>
<!-- Lagre: statistik-tabel (vare · i bygningen · værdi nu · ved toppris · gården · rækker til · forbrug/prod.) -->
<Bitmap profile="fs25_multiTextOptionContainer" id="statPrefab">
<Text profile="spuCellBold" name="c1" position="20px 0px" size="140px 40px"/>
<Text profile="spuCell" name="c2" position="160px 0px" size="145px 40px"/>
<Text profile="spuCell" name="c3" position="305px 0px" size="200px 40px"/>
<Text profile="spuCell" name="c4" position="405px 0px" size="100px 40px"/>
<Text profile="spuCell" name="c5" position="505px 0px" size="65px 40px"/>
<Text profile="spuCell" name="c6" position="570px 0px" size="80px 40px"/>
<Text profile="spuCell" name="c7" position="650px 0px" size="160px 40px"/>
<Text profile="spuCellBold" name="c1" position="20px 0px" size="140px 40px" textMaxWidth="132px"/>
<Text profile="spuCell" name="c2" position="160px 0px" size="145px 40px" textMaxWidth="137px"/>
<Text profile="spuCell" name="c3" position="305px 0px" size="200px 40px" textMaxWidth="192px"/>
<Text profile="spuCell" name="c4" position="405px 0px" size="100px 40px" textMaxWidth="92px"/>
<Text profile="spuCell" name="c5" position="505px 0px" size="65px 40px" textMaxWidth="57px"/>
<Text profile="spuCell" name="c6" position="570px 0px" size="80px 40px" textMaxWidth="72px"/>
<Text profile="spuCell" name="c7" position="650px 0px" size="160px 40px" textMaxWidth="152px"/>
</Bitmap>
<!-- Lagre: gårdens beholdning som gitter (bygning · 2 varer pr. række). Rækken er ~815 px bred. -->
<Bitmap profile="fs25_multiTextOptionContainer" id="gridPrefab">
<Text profile="spuCellBold" name="c1" position="20px 0px" size="270px 40px"/>
<Text profile="spuCell" name="c2" position="290px 0px" size="260px 40px"/>
<Text profile="spuCell" name="c3" position="550px 0px" size="260px 40px"/>
<Text profile="spuCellBold" name="c1" position="20px 0px" size="270px 40px" textMaxWidth="262px"/>
<Text profile="spuCell" name="c2" position="290px 0px" size="260px 40px" textMaxWidth="252px"/>
<Text profile="spuCell" name="c3" position="550px 0px" size="260px 40px" textMaxWidth="252px"/>
</Bitmap>
<!-- udkørsel: én række pr. vare med politik Fra/Lager/Salg/Salg, ellers lager -->
<Bitmap profile="fs25_multiTextOptionContainer" id="productPrefab">
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<modDesc descVersion="107">
<author>masterdraco</author>
<version>1.19.2.0</version>
<version>1.19.3.0</version>
<title>
<en>AD Smart Pickup</en>
</title>