aboutsummaryrefslogtreecommitdiff
path: root/advtrains/lzb.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/lzb.lua')
-rw-r--r--advtrains/lzb.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/advtrains/lzb.lua b/advtrains/lzb.lua
index c4b3a27..ca92170 100644
--- a/advtrains/lzb.lua
+++ b/advtrains/lzb.lua
@@ -190,15 +190,16 @@ function advtrains.lzb_invalidate_ahead(train, start_idx)
local idx = atfloor(start_idx)
local i = 1
while train.lzb.checkpoints[i] do
- if train.lzb.checkpoints[i].idx >= idx then
+ if train.lzb.checkpoints[i].index >= idx then
table.remove(train.lzb.checkpoints, i)
else
i=i+1
end
end
+ train.lzb.trav_index = idx
-- re-apply all checkpoints to path_speed
train.path_speed = {}
- for _,ckp in train.lzb.checkpoints do
+ for _,ckp in ipairs(train.lzb.checkpoints) do
apply_checkpoint_to_path(train, ckp)
end
end
@@ -236,8 +237,9 @@ advtrains.te_register_on_new_path(function(id, train)
look_ahead(id, train)
end)
-advtrains.te_register_on_invalidate_ahead(function(id, train)
+advtrains.te_register_on_invalidate_ahead(function(id, train, start_idx)
advtrains.lzb_invalidate_ahead(train, start_idx)
+ look_ahead(id, train)
end)
advtrains.te_register_on_update(function(id, train)