fix: salgsvalg-linjen skrives kun ved ny rangorden, ikke ved prisudsving — 1.62.325

This commit is contained in:
2026-10-17 17:55:10 +02:00
parent b777c852a8
commit eb7f729a5b
3 changed files with 14 additions and 5 deletions
+12 -4
View File
@@ -190,16 +190,24 @@ function ADOutbound.describeSellChoice(name, rows)
return string.format("salg %s: %s", tostring(name), #parts > 0 and table.concat(parts, "; ") or "ingen salgssteder med markør")
end
-- Rangordenen uden priser: navne og grunde i rækkefølge. Priserne rykker hver spilletime (10,63 -> 10,62), og det må
-- ikke give en ny linje (in-game 17/10 17:53: tre linjer på et minut).
function ADOutbound.sellChoiceSignature(rows)
local parts = {}
for _, row in ipairs(rows or {}) do table.insert(parts, tostring(row.name) .. "=" .. tostring(row.status)) end
return table.concat(parts, ";")
end
-- Kun når valget/rangordenen ændrer sig (pr. vogn og vare): mælkeruten valgte Family Fare frem for mejerierne
-- (brugerspørgsmål 17/10 17:32), og loggen kunne ikke sige hvorfor.
local loggedSellChoice = {}
local function logSellChoice(vehicle, product, rows)
pcall(function()
local key = tostring(ADRuns.vehicleLabel(vehicle)) .. "|" .. tostring(product.name)
local text = ADOutbound.describeSellChoice(product.name, rows)
if loggedSellChoice[key] ~= text then
loggedSellChoice[key] = text
Logging.info(ADOutbound.LOG_PREFIX .. "'%s' %s", tostring(ADRuns.vehicleLabel(vehicle)), text)
local signature = ADOutbound.sellChoiceSignature(rows)
if loggedSellChoice[key] ~= signature then
loggedSellChoice[key] = signature
Logging.info(ADOutbound.LOG_PREFIX .. "'%s' %s", tostring(ADRuns.vehicleLabel(vehicle)), ADOutbound.describeSellChoice(product.name, rows))
end
end)
end
+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.62.324.0</version>
<version>1.62.325.0</version>
<title>
<en>AD Smart Pickup</en>
</title>