aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2017-01-24 20:41:37 +0100
committerorwell96 <mono96.mml@gmail.com>2017-01-24 20:41:37 +0100
commit29886d56571f465b448173cfc0ab0dded60d1727 (patch)
treea54016e8ecadeeb73d1a0d0822c39c205e40cf5a
parenta2d0b1b8f2f6ba2864e1dbbfc2457583114152ea (diff)
downloadadvtrains-29886d56571f465b448173cfc0ab0dded60d1727.tar.gz
advtrains-29886d56571f465b448173cfc0ab0dded60d1727.tar.bz2
advtrains-29886d56571f465b448173cfc0ab0dded60d1727.zip
Fix crash when train went off track
-rw-r--r--advtrains/advtrains/trainlogic.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/advtrains/advtrains/trainlogic.lua b/advtrains/advtrains/trainlogic.lua
index d2c86a4..df7df14 100644
--- a/advtrains/advtrains/trainlogic.lua
+++ b/advtrains/advtrains/trainlogic.lua
@@ -406,7 +406,7 @@ function advtrains.pathpredict(id, train)
maxn=advtrains.maxN(train.path)
end
- local minn=train.min_index_on_track or 0
+ local minn=train.min_index_on_track or -1
while (train.index-minn) < (train.trainlen or 0) + pregen_back do --post_generate. has to be at least trainlen. (we let go of the exact calculation here since this would be unuseful here)
--atprint("minn conway for ",minn,minetest.pos_to_string(path[minn]),minn+1,minetest.pos_to_string(path[minn+1]))
local conway=advtrains.conway(train.path[minn], train.path[minn+1], train.drives_on)