From c90411b880eac30d208508af6960f3415a8b09c6 Mon Sep 17 00:00:00 2001 From: orwell96 Date: Fri, 15 Mar 2019 16:40:23 +0100 Subject: Fix cancelling "Unknown Route" when section is deleted. --- advtrains_interlocking/routesetting.lua | 21 +++++++++++---------- advtrains_interlocking/tcb_ts_ui.lua | 3 +-- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'advtrains_interlocking') diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua index 0b2d6dd..8cde423 100644 --- a/advtrains_interlocking/routesetting.lua +++ b/advtrains_interlocking/routesetting.lua @@ -234,6 +234,17 @@ function ilrs.cancel_route_from(sigd) atwarn("Failed to cancel route, no TCBS at",c_sigd) return false end + + --atdebug("cancelling",c_ts.route.rsn) + -- clear signal aspect and routesetting state + c_tcbs.route_committed = nil + c_tcbs.aspect = nil + c_tcbs.routeset = nil + c_tcbs.route_auto = nil + c_tcbs.route_origin = nil + + advtrains.interlocking.update_signal_aspect(c_tcbs) + c_ts_id = c_tcbs.ts_id if not c_tcbs then atwarn("Failed to cancel route, end of interlocking at",c_sigd) @@ -248,16 +259,6 @@ function ilrs.cancel_route_from(sigd) return false end - --atdebug("cancelling",c_ts.route.rsn) - -- clear signal aspect and routesetting state - c_tcbs.route_committed = nil - c_tcbs.aspect = nil - c_tcbs.routeset = nil - c_tcbs.route_auto = nil - c_tcbs.route_origin = nil - - advtrains.interlocking.update_signal_aspect(c_tcbs) - c_ts.route = nil if c_ts.route_post then diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua index 14e184e..4427a49 100644 --- a/advtrains_interlocking/tcb_ts_ui.lua +++ b/advtrains_interlocking/tcb_ts_ui.lua @@ -613,9 +613,8 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte) end elseif sigd_equal(tcbs.route_origin, sigd) then -- something has gone wrong: tcbs.routeset should have been set... - atwarn("Signal",tcbs.signal_name,"- Unknown route set. Route is being cancelled.") + form = form.."label[0.5,2.5;Inconsistent state: route_origin is same TCBS but no route set. Try again.]" ilrs.cancel_route_from(sigd) - return else form = form.."label[0.5,2.5;Route is set over this signal by:\n"..sigd_to_string(tcbs.route_origin).."]" form = form.."label[0.5,4;Wait for this route to be cancelled in order to do anything here.]" -- cgit v1.2.3