diff options
author | orwell <orwell@bleipb.de> | 2024-12-13 00:23:18 +0100 |
---|---|---|
committer | orwell <orwell@bleipb.de> | 2024-12-13 00:23:18 +0100 |
commit | 7d5f840579b74374698704f256479520bde25091 (patch) | |
tree | b39e32d1b2f518656bb12f2b6641ad31967bac99 /advtrains_interlocking/routesetting.lua | |
parent | fe620eccb283a9d6e15c8fdbf564e8e2142da749 (diff) | |
download | advtrains-7d5f840579b74374698704f256479520bde25091.tar.gz advtrains-7d5f840579b74374698704f256479520bde25091.tar.bz2 advtrains-7d5f840579b74374698704f256479520bde25091.zip |
Repair sections on smartroute, detect start!=end TS in routesetting, create section with IL tool aux1route_prog_rework
Diffstat (limited to 'advtrains_interlocking/routesetting.lua')
-rw-r--r-- | advtrains_interlocking/routesetting.lua | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua index 95ca63c..15c42aa 100644 --- a/advtrains_interlocking/routesetting.lua +++ b/advtrains_interlocking/routesetting.lua @@ -124,9 +124,17 @@ function ilrs.set_route(signal, route, try) return false, "No passive component at "..minetest.pos_to_string(pos)..". Please update track section or reconfigure route!" end end + -- sanity check, is section at next the same as the current? + local nvar = c_rseg.next + if nvar then + local re_tcbs = ildb.get_tcbs({p = nvar.p, s = (nvar.s==1) and 2 or 1}) + if not re_tcbs or not re_tcbs.ts_id or re_tcbs.ts_id~=c_ts_id then + if not try then atwarn("Encountered inconsistent ts (front~=back) while a real run of routesetting routine, at position",pts,"while setting route",rtename,"of",signal) end + return false, "TCB at "..minetest.pos_to_string(nvar.p).." has different section than previous TCB. Please update track section or reconfigure route!" + end + end -- reserve ts and write locks if not try then - local nvar = c_rseg.next if not route[i+1] then -- We shouldn't use the "next" value of the final route segment, because this can lead to accidental route-cancelling of already set routes from another signal. nvar = nil |