aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r--advtrains/trainlogic.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 7e9a613..c0c3888 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -434,7 +434,7 @@ function advtrains.train_step_b(id, train, dtime)
else s = (v1*v1 - v0*v0)/2/a
end
train.ctrl.lzb = nil
- if lzblimit.velocity and lzblimit.velocity < train.velocity then
+ if lzblimit.velocity and lzblimit.lever < train.lever then
tmp_lever = lzblimit.lever
while (lzbmap[tmp_lever].t > dtime) do
tmp_lever = tmp_lever - 1
@@ -457,7 +457,7 @@ function advtrains.train_step_b(id, train, dtime)
a = (v1 - train.velocity)/dtime
--- 4b. Move train and update train properties ---
local pdist = train.path_dist[math.floor(train.index)] or 1
- local distance = s / pdist
+ local distance = pdist == 0 and s or s / pdist
train.lever = tmp_lever
train.velocity = v1
train.acceleration = a