aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/routesetting.lua
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-07-03 15:54:14 +0200
committerY. Wang <yw05@forksworld.de>2023-03-23 20:06:02 +0100
commit6ae0615309bd5862a7480686ccba01a24b69356b (patch)
tree311482d116e78df0549da6b3afa950ea627f3da6 /advtrains_interlocking/routesetting.lua
parent4a3d442601a800e28a274026392461bd1a7cb127 (diff)
downloadadvtrains-6ae0615309bd5862a7480686ccba01a24b69356b.tar.gz
advtrains-6ae0615309bd5862a7480686ccba01a24b69356b.tar.bz2
advtrains-6ae0615309bd5862a7480686ccba01a24b69356b.zip
Automatic dst unassignment; respect tcbs.nodst
Diffstat (limited to 'advtrains_interlocking/routesetting.lua')
-rw-r--r--advtrains_interlocking/routesetting.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 857a681..e792d28 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -46,12 +46,16 @@ function ilrs.set_route(signal, route, try)
local signalname = ildb.get_tcbs(signal).signal_name
local c_tcbs, c_ts_id, c_ts, c_rseg, c_lckp
local signals = {}
+ local nodst
while c_sigd and i<=#route do
c_tcbs = ildb.get_tcbs(c_sigd)
if not c_tcbs then
if not try then atwarn("Did not find TCBS",c_sigd,"while setting route",rtename,"of",signal) end
return false, "No TCB found at "..sigd_to_string(c_sigd)..". Please reconfigure route!"
end
+ if i == 1 then
+ nodst = c_tcbs.nodst
+ end
c_ts_id = c_tcbs.ts_id
if not c_ts_id then
if not try then atwarn("Encountered End-Of-Interlocking while setting route",rtename,"of",signal) end
@@ -138,7 +142,7 @@ function ilrs.set_route(signal, route, try)
local tcbs = signals[i]
local pos = tcbs.signal
local _, assigned_by = advtrains.distant.get_main(pos)
- if not assigned_by or assigned_by == "routesetting" then
+ if (not nodst) and (not assigned_by or assigned_by == "routesetting") then
advtrains.distant.assign(lastsig, pos, "routesetting", true)
end
advtrains.interlocking.update_signal_aspect(tcbs, i ~= 1)