aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authororwell96 <orwell@bleipb.de>2019-01-22 00:11:31 +0100
committerorwell96 <orwell@bleipb.de>2019-01-22 00:13:11 +0100
commit5f290819cdb78303396f9f89907ebbc66a9d74b3 (patch)
tree409e64c9c9b80262af72526129758d3cc11d153a
parent1965e846b6c61958063ea13e2ac88ae18b701d09 (diff)
downloadadvtrains-5f290819cdb78303396f9f89907ebbc66a9d74b3.tar.gz
advtrains-5f290819cdb78303396f9f89907ebbc66a9d74b3.tar.bz2
advtrains-5f290819cdb78303396f9f89907ebbc66a9d74b3.zip
Correct last commit
-rw-r--r--advtrains/path.lua1
-rw-r--r--advtrains/trainlogic.lua13
2 files changed, 14 insertions, 0 deletions
diff --git a/advtrains/path.lua b/advtrains/path.lua
index 92ad8c1..4ead244 100644
--- a/advtrains/path.lua
+++ b/advtrains/path.lua
@@ -124,6 +124,7 @@ end
-- This function should be 'atprint', 'atlog', 'atwarn' or 'atdebug', because it needs to use print_concat_table
function advtrains.path_print(train, printf)
if not train.path then
+ printf("path_print: tid =",train.train_id," index =",train.index," end_index =",train.end_index," vel =",train.velocity)
printf("path_print: Path is invalidated/inexistant.")
return
end
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index a3785df..393e1a7 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -629,11 +629,24 @@ advtrains.te_register_on_update(function(id, train)
old_index = old_index + 1
local pos = advtrains.round_vector_floor_y(advtrains.path_get(train,old_index))
tnc_call_enter_callback(pos, id, train, old_index)
+
+ if not train.path then
+ atwarn(id,"@register_on_update missing path")
+ atwarn(advtrains.dbg_last_pathclear)
+ return
+ end
end
while old_end_index < new_end_index do
local pos = advtrains.round_vector_floor_y(advtrains.path_get(train,old_end_index))
tnc_call_leave_callback(pos, id, train, old_end_index)
old_end_index = old_end_index + 1
+
+ if not train.path then
+ atwarn(id,"@register_on_update missing path")
+ atwarn(advtrains.dbg_last_pathclear)
+ return
+ end
+
end
train.tnc.old_index = new_index
train.tnc.old_end_index = new_end_index