diff options
author | orwell96 <orwell@bleipb.de> | 2019-01-22 12:07:53 +0100 |
---|---|---|
committer | orwell96 <orwell@bleipb.de> | 2019-01-22 12:07:53 +0100 |
commit | 64e59b54f880fde044332e23b80aff3e8ce14b15 (patch) | |
tree | 96d570a86aa516a9e24ea9470bab4894be88fc18 /advtrains_interlocking/routesetting.lua | |
parent | adc8db22fb35e7d18dd20b73478c241b6fed7de0 (diff) | |
download | advtrains-64e59b54f880fde044332e23b80aff3e8ce14b15.tar.gz advtrains-64e59b54f880fde044332e23b80aff3e8ce14b15.tar.bz2 advtrains-64e59b54f880fde044332e23b80aff3e8ce14b15.zip |
Prohibit removing/changing of TCBs and sections while routes or signals are set
Diffstat (limited to 'advtrains_interlocking/routesetting.lua')
-rw-r--r-- | advtrains_interlocking/routesetting.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua index 7b08c4e..44f4592 100644 --- a/advtrains_interlocking/routesetting.lua +++ b/advtrains_interlocking/routesetting.lua @@ -226,14 +226,22 @@ function ilrs.cancel_route_from(sigd) while c_sigd do --atdebug("cancel_route_from: at sigd",c_sigd) c_tcbs = ildb.get_tcbs(c_sigd) + if not c_tcbs then + atwarn("Failed to cancel route, no TCBS at",c_sigd) + return false + end c_ts_id = c_tcbs.ts_id + if not c_tcbs then + atwarn("Failed to cancel route, end of interlocking at",c_sigd) + return false + end c_ts = ildb.get_ts(c_ts_id) if not c_ts or not c_ts.route or not sigd_equal(c_ts.route.entry, c_sigd) then --atdebug("cancel_route_from: abort (eoi/no route):") - return + return false end --atdebug("cancelling",c_ts.route.rsn) @@ -258,6 +266,7 @@ function ilrs.cancel_route_from(sigd) minetest.after(0, advtrains.interlocking.route.update_waiting, "ts", c_ts_id) end --atdebug("cancel_route_from: done (no final sigd)") + return true end -- TCBS Routesetting helper: generic update function for |