aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--advtrains_interlocking/routesetting.lua6
-rw-r--r--advtrains_interlocking/train_sections.lua7
2 files changed, 12 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)
diff --git a/advtrains_interlocking/train_sections.lua b/advtrains_interlocking/train_sections.lua
index 757f36a..ec7f95f 100644
--- a/advtrains_interlocking/train_sections.lua
+++ b/advtrains_interlocking/train_sections.lua
@@ -91,6 +91,13 @@ local function setsection(tid, train, ts_id, ts, sigd)
tcbs.route_comitted = nil -- TODO compatibility cleanup
tcbs.aspect = nil
tcbs.route_origin = nil
+ if tcbs.signal then
+ local spos = tcbs.signal
+ local _, setter = advtrains.distant.get_main(spos)
+ if setter == "routesetting" then
+ advtrains.distant.unassign_dst(spos, true)
+ end
+ end
advtrains.interlocking.update_signal_aspect(tcbs)
if tcbs.signal and sigd_equal(ts.route.entry, ts.route.origin) then
if tcbs.route_auto and tcbs.routeset then