summaryrefslogtreecommitdiff
path: root/il_timetable
diff options
context:
space:
mode:
authorautocommitter <autocommitter@linux-forks.de>2024-04-22 14:54:33 +0200
committerautocommitter <autocommitter@linux-forks.de>2024-04-22 14:54:33 +0200
commit3326b2b23ac441c49910074b57a528cb04571047 (patch)
tree9f312e2a919f3ee1e53e73bedd94d5d50987e808 /il_timetable
parenta938d2557ef4c948c53bf9a8dd59233ab662db41 (diff)
downloadluaatc_envs-3326b2b23ac441c49910074b57a528cb04571047.tar.gz
luaatc_envs-3326b2b23ac441c49910074b57a528cb04571047.tar.bz2
luaatc_envs-3326b2b23ac441c49910074b57a528cb04571047.zip
State at 2021-10-01
Diffstat (limited to 'il_timetable')
-rw-r--r--il_timetable/init_code.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua
index 9c86dec..191dfc0 100644
--- a/il_timetable/init_code.lua
+++ b/il_timetable/init_code.lua
@@ -260,11 +260,13 @@ function F.ttp_begin(p)
end
if event.schedule then
-- departure. save actual departure time in tt
- S.ttt[atc_id].actual_dep = rwt.now()
- local delay = rwt.diff(S.ttt[atc_id].desired_dep, S.ttt[atc_id].actual_dep)
- atc_set_text_inside(F.ttp[p.tt].inside_line_desc
- .."\nDelay:"..rwt.to_string(delay, true))
- S.ttt[atc_id].last_delay = delay
+ if S.ttt[atc_id] then -- failsafe: if entry is deleted externally somehow, train just departs and is not tracked by tt (makes resetting S.ttt possible)
+ S.ttt[atc_id].actual_dep = rwt.now()
+ local delay = rwt.diff(S.ttt[atc_id].desired_dep, S.ttt[atc_id].actual_dep)
+ atc_set_text_inside(F.ttp[p.tt].inside_line_desc
+ .."\nDelay:"..rwt.to_string(delay, true))
+ S.ttt[atc_id].last_delay = delay
+ end
if p.reverse then
atc_send(RDEPCMD)
else