aboutsummaryrefslogtreecommitdiff
path: root/advtrains
diff options
context:
space:
mode:
authorGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-06-14 12:02:48 +0200
committerGabriel Pérez-Cerezo <gabriel@gpcf.eu>2020-06-14 12:02:48 +0200
commitae79af604cf2209f0630a9613ce10cd198afa569 (patch)
tree08bdd43f080ec90df8f92bfc837017ef1acd08f4 /advtrains
parentd61c2145a0f28438b0f85345bc7808ce0b6161c6 (diff)
downloadadvtrains-ae79af604cf2209f0630a9613ce10cd198afa569.tar.gz
advtrains-ae79af604cf2209f0630a9613ce10cd198afa569.tar.bz2
advtrains-ae79af604cf2209f0630a9613ce10cd198afa569.zip
display oncoming lzb speed restrictions in HUD
Diffstat (limited to 'advtrains')
-rw-r--r--advtrains/trainhud.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/advtrains/trainhud.lua b/advtrains/trainhud.lua
index d8b25ee..c90a406 100644
--- a/advtrains/trainhud.lua
+++ b/advtrains/trainhud.lua
@@ -208,6 +208,19 @@ function advtrains.hud_train_format(train, flip)
if train.speed_restriction == 0 then
firstLine = "OVERRUN RED SIGNAL! Examine situation and reverse train to move again."
end
+
+ local lzb = train.lzb
+
+ local i = 1
+ while i<=#lzb.oncoming do
+ local k = lzb.oncoming[i]
+ secondLine = secondLine .. "\n".."LZB: speed limit ["..(k.spd or "E")..("] in %.1f m"):format(k.idx-train.index)
+ if k.spd == 0 then
+ break
+ end
+ i=i+1
+ end
+
return (train.debug or "").."\n"..topLine.."\n"..firstLine.."\n"..secondLine
end