aboutsummaryrefslogtreecommitdiff
path: root/advtrains/atc.lua
diff options
context:
space:
mode:
authorywang <yw05@forksworld.de>2019-12-18 16:04:51 +0100
committerywang <yw05@forksworld.de>2020-04-12 16:07:56 +0200
commitba91ba810943fffc20b841ee9a751ec159f18cd8 (patch)
treed40b2c8ca9f4ea8e16b2b44311237a2769da9f76 /advtrains/atc.lua
parent314ed9aa0b4367ed1fc0df5f4b334745b2469df5 (diff)
downloadadvtrains-ba91ba810943fffc20b841ee9a751ec159f18cd8.tar.gz
advtrains-ba91ba810943fffc20b841ee9a751ec159f18cd8.tar.bz2
advtrains-ba91ba810943fffc20b841ee9a751ec159f18cd8.zip
Fix failure to recognize braking
Diffstat (limited to 'advtrains/atc.lua')
-rw-r--r--advtrains/atc.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/advtrains/atc.lua b/advtrains/atc.lua
index fa9f097..c08acb3 100644
--- a/advtrains/atc.lua
+++ b/advtrains/atc.lua
@@ -186,18 +186,18 @@ end
local matchptn={
["SM"]=function(id, train)
train.tarvelocity=train.max_speed
+ train.atc_brake_target=nil
return 2
end,
["S([0-9]+)"]=function(id, train, match)
train.tarvelocity=tonumber(match)
+ train.atc_brake_target=nil
return #match+1
end,
["B([0-9]+)"]=function(id, train, match)
- if train.velocity>tonumber(match) then
- train.atc_brake_target=tonumber(match)
- if not train.tarvelocity or train.tarvelocity>train.atc_brake_target then
- train.tarvelocity=train.atc_brake_target
- end
+ train.atc_brake_target=tonumber(match)
+ if not train.tarvelocity or train.tarvelocity>train.atc_brake_target then
+ train.tarvelocity=train.atc_brake_target
end
return #match+1
end,