aboutsummaryrefslogtreecommitdiff
path: root/advtrains/trainlogic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'advtrains/trainlogic.lua')
-rw-r--r--advtrains/trainlogic.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/advtrains/trainlogic.lua b/advtrains/trainlogic.lua
index 8e1ac93..886abe8 100644
--- a/advtrains/trainlogic.lua
+++ b/advtrains/trainlogic.lua
@@ -457,6 +457,7 @@ function advtrains.train_step_b(id, train, dtime)
if a == 0 then s = v1*dtime
else
s = (v1*v1 - v0*v0)/2/a
+ s = math.max(s, 0)
local acctime = (v1-v0)/a
if acctime < dtime then s = s + v1*(dtime - acctime) end
end