aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/database.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-01-30 13:59:46 +0100
committerorwell96 <orwell@bleipb.de>2021-02-10 16:36:24 +0100
commitaee7f0d4198c441c3dd4cb5d33f488607a1a81a5 (patch)
tree4a0d1eecb99885e88f3f00c606fffc7d07cd5c00 /advtrains_interlocking/database.lua
parent119a09b784ad3f3c6bfd327f32164cb099f47f10 (diff)
downloadadvtrains-aee7f0d4198c441c3dd4cb5d33f488607a1a81a5.tar.gz
advtrains-aee7f0d4198c441c3dd4cb5d33f488607a1a81a5.tar.bz2
advtrains-aee7f0d4198c441c3dd4cb5d33f488607a1a81a5.zip
Fix things, rework signal aspect select dialog, transform old aspects on-the-fly
Diffstat (limited to 'advtrains_interlocking/database.lua')
-rw-r--r--advtrains_interlocking/database.lua33
1 files changed, 33 insertions, 0 deletions
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> -- ID of the assigned track section
signal = <pos> -- optional: when set, routes can be set from this tcb/direction and signal
@@ -164,6 +196,7 @@ TCB data structure
routes = { <route definition> } -- a collection of routes from this signal
route_auto = <boolean> -- 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 = <boolean>, --this can be set by an exit node via mesecons or atlatc,