aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r--advtrains/trainlogic.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index bc24feb..3c0d02e 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -474,7 +474,8 @@ function advtrains.train_step_b(id, train, dtime)
--- 4. move train ---
- local pdist = train.path_dist[math.floor(train.index)] or 1
+ local idx_floor = math.floor(train.index)
+ local pdist = (train.path_dist[idx_floor+1] - train.path_dist[idx_floor])
local distance = (train.velocity*dtime) / pdist
--debugging code