feat: run-model v2 — retning, kilder, varepolitik, tærskler, runde (XML v2 + v1-migration)
This commit is contained in:
@@ -36,6 +36,13 @@ function ADRunsStorage.writeRecords(xmlFile, records)
|
||||
xmlFile:setString(key .. "#waitPool", record.waitPool)
|
||||
xmlFile:setInt(key .. "#loops", record.loops)
|
||||
xmlFile:setInt(key .. "#returnBelow", record.returnBelow or ADRuns.DEFAULT_RETURN_BELOW_PERCENT)
|
||||
-- v2: udkørsel
|
||||
xmlFile:setString(key .. "#kind", record.kind or "supply")
|
||||
xmlFile:setString(key .. "#sources", record.sources or "")
|
||||
xmlFile:setString(key .. "#products", record.products or "")
|
||||
xmlFile:setInt(key .. "#sellAt", record.sellAt or ADRuns.DEFAULT_SELL_AT_PERCENT)
|
||||
xmlFile:setInt(key .. "#storeAbove", record.storeAbove or ADRuns.DEFAULT_STORE_ABOVE_PERCENT)
|
||||
xmlFile:setInt(key .. "#collectRound", record.collectRound or 0)
|
||||
for vehicleIndex, vehicleId in ipairs(record.vehicleIds) do
|
||||
xmlFile:setString(string.format("%s.vehicle(%d)#id", key, vehicleIndex - 1), vehicleId)
|
||||
end
|
||||
@@ -55,6 +62,12 @@ function ADRunsStorage.readRecords(xmlFile)
|
||||
waitPool = xmlFile:getString(key .. "#waitPool"),
|
||||
loops = xmlFile:getInt(key .. "#loops"),
|
||||
returnBelow = xmlFile:getInt(key .. "#returnBelow"),
|
||||
kind = xmlFile:getString(key .. "#kind"),
|
||||
sources = xmlFile:getString(key .. "#sources"),
|
||||
products = xmlFile:getString(key .. "#products"),
|
||||
sellAt = xmlFile:getInt(key .. "#sellAt"),
|
||||
storeAbove = xmlFile:getInt(key .. "#storeAbove"),
|
||||
collectRound = xmlFile:getInt(key .. "#collectRound"),
|
||||
vehicleIds = {},
|
||||
}
|
||||
xmlFile:iterate(key .. ".vehicle", function(_, vehicleKey)
|
||||
|
||||
Reference in New Issue
Block a user