aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/routesetting.lua
diff options
context:
space:
mode:
authororwell <orwell@bleipb.de>2025-01-09 00:57:32 +0100
committerorwell <orwell@bleipb.de>2025-01-09 08:38:09 +0100
commit8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c (patch)
treec5915919c6efe856207d136404846f6ed86670ae /advtrains_interlocking/routesetting.lua
parent9bd34f738663cdc268db6399ecb6aaba2d4c9a28 (diff)
downloadadvtrains-8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c.tar.gz
advtrains-8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c.tar.bz2
advtrains-8c91ce1ec178d6d49f3ddefc57d99eecd0caef3c.zip
Various bugfixes found in lunixforks debug
Diffstat (limited to 'advtrains_interlocking/routesetting.lua')
-rw-r--r--advtrains_interlocking/routesetting.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 28c8c3c..0668e62 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -104,7 +104,7 @@ function ilrs.set_route(signal, route, try)
end
for lp, state in pairs(c_locks) do
- local confl = ilrs.has_route_lock(pts, state)
+ local confl = ilrs.has_route_lock(lp, state)
local pos = advtrains.decode_pos(lp)
if advtrains.is_passive(pos) then
@@ -131,7 +131,8 @@ function ilrs.set_route(signal, route, try)
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 re_tcbs or not re_tcbs.ts_id or re_tcbs.ts_id~=c_ts_id)
+ and route[i+1] then --FIX 2025-01-08: in old worlds the final TCB may be wrong (it didn't matter back then), don't error out here (route still shown invalid in UI)
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
@@ -413,7 +414,9 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel)
-- set_route now sets the signal aspects
--has_changed_aspect = true
-- route success. apply default_autoworking flag if requested
- tcbs.route_auto = route.default_autoworking
+ if route.default_autoworking then
+ tcbs.route_auto = true --FIX 2025-01-08: never set it to false if it was true!
+ end
end
end
if has_changed_aspect then