~gpcf/advtrains-devel

Fix update_route receiving invalid route ID in after() v1 PROPOSED

1F616EMO: 1
 Fix update_route receiving invalid route ID in after()

 1 files changed, 7 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~gpcf/advtrains-devel/patches/55239/mbox | git am -3
Learn more about email & git

[PATCH] Fix update_route receiving invalid route ID in after() Export this patch

From: 1F616EMO <root@1f616emo.xyz>

---
Sometimes route data changes in between ars_check() and update_route().

 advtrains_interlocking/routesetting.lua | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/advtrains_interlocking/routesetting.lua b/advtrains_interlocking/routesetting.lua
index 381fa26..fd6d595 100644
--- a/advtrains_interlocking/routesetting.lua
+++ b/advtrains_interlocking/routesetting.lua
@@ -292,7 +292,13 @@ function ilrs.update_route(sigd, tcbs, newrte, cancel)
		end
		if newrte then tcbs.routeset = newrte end
		--atdebug("Setting:",tcbs.routeset)
		local succ, rsn, cbts, cblk = ilrs.set_route(sigd, tcbs.routes[tcbs.routeset])
		local succ, rsn, cbts, cblk
		if tcbs.routes[tcbs.routeset] then
			succ, rsn, cbts, cblk = ilrs.set_route(sigd, tcbs.routes[tcbs.routeset])
		else
			succ = false
			rsn = attrans("Route state changed.")
		end
		if not succ then
			tcbs.route_rsn = rsn
			--atdebug("Routesetting failed:",rsn)
-- 
2.46.0