feat: kør videre til næste mark og parkeringsrådgiver (1.62.202)

This commit is contained in:
2026-10-10 18:04:18 +02:00
parent 78651d8b2f
commit fefdf2a85e
11 changed files with 169 additions and 10 deletions
+16
View File
@@ -91,6 +91,15 @@ function ADFieldStorage.save(state)
xmlFile:setString(string.format("%s.manual.vehicle(%d)#id", ADFieldStorage.ROOT, manualIndex), vehicleId)
manualIndex = manualIndex + 1
end
-- spillerkørsler pr. maskine (parkeringsrådgiver, ADPlayerTransport)
local tripIndex = 0
for vehicleId, trip in pairs(state.playerTrips or {}) do
local key = string.format("%s.playerTrips.vehicle(%d)", ADFieldStorage.ROOT, tripIndex)
xmlFile:setString(key .. "#id", vehicleId)
xmlFile:setInt(key .. "#count", trip.count or 0)
xmlFile:setString(key .. "#label", tostring(trip.label or ""))
tripIndex = tripIndex + 1
end
local courseIndex = 0
for _, record in pairs(state.courseRecords or {}) do
ADFieldStorage.writeCourseRecord(xmlFile, string.format("%s.courses.course(%d)", ADFieldStorage.ROOT, courseIndex), record)
@@ -130,6 +139,13 @@ function ADFieldStorage.load()
local id = xmlFile:getString(key .. "#id")
if id ~= nil and id ~= "" then result.manual[id] = true end
end)
result.playerTrips = {}
xmlFile:iterate(ADFieldStorage.ROOT .. ".playerTrips.vehicle", function(_, key)
local id = xmlFile:getString(key .. "#id")
if id ~= nil and id ~= "" then
result.playerTrips[id] = {count = xmlFile:getInt(key .. "#count") or 0, label = xmlFile:getString(key .. "#label")}
end
end)
xmlFile:iterate(ADFieldStorage.ROOT .. ".courses.course", function(_, key)
local record = ADCourseCache ~= nil and ADCourseCache.newRecord(ADFieldStorage.readCourseRecord(xmlFile, key)) or nil
if record ~= nil then result.courseRecords[record.vehicle] = record end