diff --git a/FS25_ADSmartPickup/adFlowGuide.lua b/FS25_ADSmartPickup/adFlowGuide.lua index 6c6e354..47656ca 100644 --- a/FS25_ADSmartPickup/adFlowGuide.lua +++ b/FS25_ADSmartPickup/adFlowGuide.lua @@ -307,6 +307,7 @@ local function rowsTractors(guide) local inRun = chosenSet(draft.vehicleIds) local entries = {} local other, blocked = 0, 0 + local blockedTexts = {} for _, vehicle in ipairs(guide.context.vehicles or {}) do local state = "free" if inRun[vehicle.id] then @@ -317,6 +318,7 @@ local function rowsTractors(guide) elseif vehicle.blocked then state = "blocked" blocked = blocked + 1 + table.insert(blockedTexts, tostring(vehicle.text)) end table.insert(entries, {id = vehicle.id, label = tostring(vehicle.text), state = state}) end @@ -325,7 +327,12 @@ local function rowsTractors(guide) end if #rows == 0 then table.insert(rows, text("spu_guide_flow_noTractors")) end if other > 0 then table.insert(rows, text("spu_guide_flow_otherFlows", {other})) end - if blocked > 0 then table.insert(rows, text("spu_guide_flow_blocked", {blocked})) end + if blocked > 0 then + table.insert(rows, text("spu_guide_flow_blocked", {blocked})) + -- navn + grund (fx "X ingen vogn"), så man kan se hvorfor en traktor ikke kan vælges + table.sort(blockedTexts) + for _, line in ipairs(blockedTexts) do table.insert(rows, {type = "text", label = T(" " .. line)}) end + end return rows end diff --git a/FS25_ADSmartPickup/gui/SmartPickupFlowGuide.lua b/FS25_ADSmartPickup/gui/SmartPickupFlowGuide.lua index 7083237..684b074 100644 --- a/FS25_ADSmartPickup/gui/SmartPickupFlowGuide.lua +++ b/FS25_ADSmartPickup/gui/SmartPickupFlowGuide.lua @@ -117,7 +117,12 @@ function SmartPickupFrame:flowVehicleContext(adEnv, preview) return {id = ADRunsController.getVehicleId(vehicle), text = text, label = ADRunsController.getVehicleLabel(adEnv, vehicle), otherRunId = other ~= nil and other.id or nil, otherRunName = other ~= nil and other.name or nil, blocked = SmartPickupFrame.VEHICLE_BLOCKING_REASONS[validation.reason] == true} end) - if ok and entry.id ~= nil then table.insert(result, entry) end + if ok and entry.id ~= nil then + table.insert(result, entry) + elseif not ok then + Logging.warning(SmartPickupFrame.LOG_PREFIX .. "traktor '%s' kunne ikke vises i flowets traktorliste: %s", + tostring(vehicle.getName ~= nil and vehicle:getName() or "?"), tostring(entry)) + end end return result end diff --git a/FS25_ADSmartPickup/modDesc.xml b/FS25_ADSmartPickup/modDesc.xml index 45e2f95..1d04a9b 100644 --- a/FS25_ADSmartPickup/modDesc.xml +++ b/FS25_ADSmartPickup/modDesc.xml @@ -1,7 +1,7 @@ masterdraco - 1.36.1.0 + 1.36.2.0 <en>AD Smart Pickup</en> diff --git a/tests/test_adFlowGuide.lua b/tests/test_adFlowGuide.lua index 59b85f5..921ccd9 100644 --- a/tests/test_adFlowGuide.lua +++ b/tests/test_adFlowGuide.lua @@ -162,6 +162,10 @@ check("FL9 egne først", (function() for _, r in ipairs(tractorRows) do if r.typ check("FL9 skjult andre flows", findRow(tractorRows, "vehicleIds", "t2"), nil) check("FL9 skjult blokeret", findRow(tractorRows, "vehicleIds", "t3"), nil) check("FL9 linjer", textKeys(tractorRows), "spu_guide_flow_otherFlows,spu_guide_flow_blocked") +-- in-game 27/9: en parkeret Lintrac dukkede ikke op og ingen kunne se hvorfor — blokerede står med navn + grund +local blockedLine = nil +for _, r in ipairs(tractorRows) do if r.type == "text" and r.label.text ~= nil and r.label.text:find("Traktor 3", 1, true) then blockedLine = r end end +check("FL9 blokeret traktor vises med sin tekst", blockedLine ~= nil, true) local inThisRun = FG.open(newRun("supply"), ctx({vehicles = {{id = "t2", text = "T2", otherRunId = 1, otherRunName = "Mælk ud"}}})) check("FL9 traktor i dette flow er ikke 'andet flow'", countType(FG.rows(at(inThisRun, "tractors")), "check"), 1)