aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--advtrains/lzb.lua3
-rw-r--r--advtrains/occupation.lua1
-rw-r--r--advtrains_interlocking/tcb_ts_ui.lua9
3 files changed, 9 insertions, 4 deletions
diff --git a/advtrains/lzb.lua b/advtrains/lzb.lua
index ca92170..a5e361c 100644
--- a/advtrains/lzb.lua
+++ b/advtrains/lzb.lua
@@ -69,6 +69,7 @@ local function resolve_latest_lzbdata(ckp, index)
if ckpi.index <= index and ckpi.lzbdata then
return ckpi.lzbdata
end
+ i=i-1
end
return {}
end
@@ -197,6 +198,8 @@ function advtrains.lzb_invalidate_ahead(train, start_idx)
end
end
train.lzb.trav_index = idx
+ -- FIX reset trav_lzbdata (look_ahead fetches these when required)
+ train.lzb.trav_lzbdata = nil
-- re-apply all checkpoints to path_speed
train.path_speed = {}
for _,ckp in ipairs(train.lzb.checkpoints) do
diff --git a/advtrains/occupation.lua b/advtrains/occupation.lua
index da60278..db39991 100644
--- a/advtrains/occupation.lua
+++ b/advtrains/occupation.lua
@@ -196,7 +196,6 @@ function o.get_trains_over(ppos)
local r = {}
local i = 1
while t[i] do
- local train = advtrains.trains[t[i]]
local idx = t[i+1]
r[t[i]] = idx
i = i + 2
diff --git a/advtrains_interlocking/tcb_ts_ui.lua b/advtrains_interlocking/tcb_ts_ui.lua
index da318a7..3952f91 100644
--- a/advtrains_interlocking/tcb_ts_ui.lua
+++ b/advtrains_interlocking/tcb_ts_ui.lua
@@ -558,7 +558,7 @@ local sig_pselidx = {}
-- Players having a signalling form open
local p_open_sig_form = {}
-function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
+function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, called_from_form_update)
if not minetest.check_player_privs(pname, "train_operator") then
minetest.chat_send_player(pname, "Insufficient privileges to use this!")
return
@@ -651,7 +651,10 @@ function advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
p_open_sig_form[pname] = sigd
-- always a good idea to update the signal aspect
- advtrains.interlocking.update_signal_aspect(tcbs)
+ if not called_from_form_update then
+ -- FIX prevent a callback loop
+ advtrains.interlocking.update_signal_aspect(tcbs)
+ end
end
function advtrains.interlocking.update_player_forms(sigd)
@@ -763,7 +766,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
tcbs.route_auto = false
end
- advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte)
+ advtrains.interlocking.show_signalling_form(sigd, pname, sel_rte, true)
return
end