From aee7f0d4198c441c3dd4cb5d33f488607a1a81a5 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Thu, 30 Jan 2020 13:59:46 +0100 Subject: Fix things, rework signal aspect select dialog, transform old aspects on-the-fly --- advtrains_interlocking/database.lua | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'advtrains_interlocking/database.lua') diff --git a/advtrains_interlocking/database.lua b/advtrains_interlocking/database.lua index 82c7e25..68d4138 100644 --- a/advtrains_interlocking/database.lua +++ b/advtrains_interlocking/database.lua @@ -131,6 +131,37 @@ function ildb.load(data) if data.npr_rails then advtrains.interlocking.npr_rails = data.npr_rails end + + --COMPATIBILITY to Signal aspect format + -- TODO remove in time... + for pts,tcb in pairs(track_circuit_breaks) do + for connid, tcbs in ipairs(tcb) do + if tcbs.routes then + for _,route in ipairs(tcbs.routes) do + if route.aspect then + -- transform the signal aspect format + local asp = route.aspect + if type(asp.main) == "table" then + atwarn("Transforming route aspect of signal",pts,"/",connid,"") + if asp.main.free then + asp.main = asp.main.speed + else + asp.main = 0 + end + if asp.dst.free then + asp.dst = asp.dst.speed + else + asp.dst = 0 + end + asp.proceed_as_main = asp.shunt.proceed_as_main + asp.shunt = asp.shunt.free + -- Note: info table not transferred, it's not used right now + end + end + end + end + end + end end function ildb.save() @@ -149,6 +180,7 @@ end --[[ TCB data structure { +-- This is the "A" side of the TCB [1] = { -- Variant: with adjacent TCs. ts_id = -- ID of the assigned track section signal = -- optional: when set, routes can be set from this tcb/direction and signal @@ -164,6 +196,7 @@ TCB data structure routes = { } -- a collection of routes from this signal route_auto = -- When set, we will automatically re-set the route (designated by routeset) }, +-- This is the "B" side of the TCB [2] = { -- Variant: end of track-circuited area (initial state of TC) ts_id = nil, -- this is the indication for end_of_interlocking section_free = , --this can be set by an exit node via mesecons or atlatc, -- cgit v1.2.3