aboutsummaryrefslogtreecommitdiff
path: root/advtrains/lzb.lua
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2020-06-12 12:32:46 +0200
committerorwell96 <orwell@bleipb.de>2021-02-10 16:36:24 +0100
commit61329c11a28ca0d68f95f189d3a66c373d7dddc3 (patch)
tree8e57504f17c86efdadf2b8494e3427e4f947a001 /advtrains/lzb.lua
parentd3b2f614be059e65869a615fe319118c0a354995 (diff)
downloadadvtrains-61329c11a28ca0d68f95f189d3a66c373d7dddc3.tar.gz
advtrains-61329c11a28ca0d68f95f189d3a66c373d7dddc3.tar.bz2
advtrains-61329c11a28ca0d68f95f189d3a66c373d7dddc3.zip
Start using path_invalidate_ahead()
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)