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