aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-06-05 13:39:34 +0200
committerorwell96 <orwell@bleipb.de>2020-06-05 13:48:12 +0200
commit657446e16346f9b9f21344b3591e7103bbf7c2c8 (patch)
tree95ce5e72b26bc512176168dd6025eb8c29e2f960
parentfb837a449af3bc3f5d70b10d807fc53982520e9f (diff)
downloadadvtrains-657446e16346f9b9f21344b3591e7103bbf7c2c8.tar.gz
advtrains-657446e16346f9b9f21344b3591e7103bbf7c2c8.tar.bz2
advtrains-657446e16346f9b9f21344b3591e7103bbf7c2c8.zip
Fix minetest.after() loop between ARS->update_route->update_signal_aspect->invalidate_path
-rw-r--r--advtrains_interlocking/routesetting.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 7c4d14c..1c9ee5a 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -282,6 +282,7 @@ end
-- cancel: true in combination with newrte=nil causes cancellation of the current route.
function ilrs.update_route(sigd, tcbs, newrte, cancel)
--atdebug("Update_Route for",sigd,tcbs.signal_name)
+ local has_changed_aspect = false
if tcbs.route_origin and not sigd_equal(tcbs.route_origin, sigd) then
--atdebug("Signal not in control, held by",tcbs.signal_name)
return
@@ -293,6 +294,7 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel)
end
tcbs.route_committed = nil
tcbs.aspect = nil
+ has_changed_aspect = true
tcbs.routeset = nil
tcbs.route_auto = nil
tcbs.route_rsn = nil
@@ -320,9 +322,13 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel)
end
else
--atdebug("Committed Route:",tcbs.routeset)
+ has_changed_aspect = true
end
end
- advtrains.interlocking.update_signal_aspect(tcbs)
+ if has_changed_aspect then
+ -- FIX: prevent an minetest.after() loop caused by update_signal_aspect dispatching path invalidation, which in turn calls ARS again
+ advtrains.interlocking.update_signal_aspect(tcbs)
+ end
advtrains.interlocking.update_player_forms(sigd)
end