aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2021-02-10 21:41:05 +0100
committerorwell96 <orwell@bleipb.de>2021-02-10 21:41:05 +0100
commitb65d99aa2c816b6dea3ecb6dd824ce02f7519fe2 (patch)
tree42e3ebd0bd7ed35896c2ebab25603b9754e8abb0 /advtrains
parent0a9cb548d79b8019762d3629a49afe3d257cda43 (diff)
downloadadvtrains-b65d99aa2c816b6dea3ecb6dd824ce02f7519fe2.tar.gz
advtrains-b65d99aa2c816b6dea3ecb6dd824ce02f7519fe2.tar.bz2
advtrains-b65d99aa2c816b6dea3ecb6dd824ce02f7519fe2.zip
Don't try to invalidate_ahead when path has been regularily invalidated before
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/path.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/advtrains/path.lua b/advtrains/path.lua
index 7226a7b..714781a 100644
--- a/advtrains/path.lua
+++ b/advtrains/path.lua
@@ -142,6 +142,10 @@ end
-- Keeps the path intact, but invalidates all path nodes from the specified index (inclusive)
-- onwards. This has the advantage that we don't need to recalculate the whole path, and we can do it synchronously.
function advtrains.path_invalidate_ahead(train, start_idx, ignore_when_passed)
+ if not train.path then
+ -- the path wasn't even initialized. Nothing to do
+ return
+ end
local idx = atfloor(start_idx)
--atdebug("Invalidate_ahead:",train.id,"start_index",start_idx,"cur_idx",train.index)