refactor: adFieldWork delt i adFieldStore/adFieldRefill, follow/dispatch/beginWork i faser, fælles adUtil — 1.62.285
Ingen ændret opførsel. adFieldWork.lua 3087 -> 2598 linjer; lager/salg og ballemål i adFieldStore.lua, påfyldningssteder i adFieldRefill.lua (begge på ADFieldWork-tabellen, indlæses efter adFieldWork). follow (296), dispatch (232) og beginWork (164 linjer) delt i én funktion pr. fase/trin. Ny adUtil.lua erstatter 28 enslydende lokale hjælpere i 22 filer. Alle 93 testfiler grønne; code-review uden fund over LOW.
This commit is contained in:
@@ -83,12 +83,7 @@ function ADOutbound.resetEmptySources()
|
||||
emptyUntil = {}
|
||||
end
|
||||
|
||||
local function now()
|
||||
if g_currentMission ~= nil and type(g_currentMission.time) == "number" then
|
||||
return g_currentMission.time
|
||||
end
|
||||
return os.clock() * 1000
|
||||
end
|
||||
local now = ADUtil.now
|
||||
|
||||
local function getRun(vehicle)
|
||||
return ADRunsController ~= nil and ADRunsController.getRunForVehicle ~= nil and activeRunOf(vehicle) or nil
|
||||
@@ -99,9 +94,7 @@ function ADOutbound.isOutboundVehicle(vehicle)
|
||||
return run ~= nil and run.kind == "outbound"
|
||||
end
|
||||
|
||||
local function fillTypeName(fillType)
|
||||
return g_fillTypeManager ~= nil and g_fillTypeManager:getFillTypeNameByIndex(fillType) or tostring(fillType)
|
||||
end
|
||||
local fillTypeName = ADUtil.fillTypeName
|
||||
|
||||
-- Lagrene en kildes læssestation trækker fra (FS25: sourceStorages = {[storage] = storage}); nil = ukendt.
|
||||
local function sourceStorages(source)
|
||||
@@ -456,11 +449,7 @@ end
|
||||
|
||||
-- ---- tur ----
|
||||
|
||||
local function copyList(list)
|
||||
local copy = {}
|
||||
for index, value in ipairs(list or {}) do copy[index] = value end
|
||||
return copy
|
||||
end
|
||||
local copyList = ADUtil.copyList
|
||||
|
||||
local function choiceFor(marker, source, trip)
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user