summaryrefslogtreecommitdiff
path: root/il_timetable/init_code.lua
diff options
context:
space:
mode:
Diffstat (limited to 'il_timetable/init_code.lua')
-rw-r--r--il_timetable/init_code.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/il_timetable/init_code.lua b/il_timetable/init_code.lua
index 42b3509..59cf8a2 100644
--- a/il_timetable/init_code.lua
+++ b/il_timetable/init_code.lua
@@ -261,10 +261,12 @@ function F.ttp_begin(p)
last_delay = 0,
}
-- if no travel times are available yet, set this train as recording
- if not tti.travel_times or p.force_tt_reset then
+ if not tti.travel_times or p.force_tt_reset or tti.force_tt_reset then
tti.travel_times = {}
tti.station_order = {p.stn}
tti.recording_train = atc_id
+ tti.force_tt_reset = false
+ print(atc_id,"starting TT recording for",p.tt)
elseif tti.recording_train == atc_id then
tti.recording_train = nil
end
@@ -365,6 +367,7 @@ F.ttp_stop({
if tti.recording_train == atc_id then
-- we are recording. save travel time
tti.travel_times[p.stn] = rwt.diff(trn.initial_dep or 0, time_now)
+ print(atc_id," for ",p.tt,"at",p.stn,"-> travel time",rwt.to_string(tti.travel_times[p.stn]))
tti.station_order[#tti.station_order+1] = p.stn
atc_set_text_inside(p.stn.."\nRec TT "
..rwt.to_string(tti.travel_times[p.stn], true).." Da"
@@ -420,14 +423,14 @@ function F.ttp_info_trains(tt, starttime)
if trn.actual_dep then
p[#p+1] = ("Trn "..tid..
" after "..trn.location..
- " Dd "..rwt.to_string(trn.desired_dep, true)..
+ " Dd "..rwt.to_string(trn.desired_dep or 0, true)..
" Da "..rwt.to_string(trn.actual_dep, true)..
- " Delay "..rwt.to_string(trn.last_delay))
+ " Delay "..rwt.to_string(trn.last_delay or "59;59"))
else
p[#p+1] = ("Trn "..tid..
" at "..trn.location..
- " Dd "..rwt.to_string(trn.desired_dep, true)..
- " Delay "..rwt.to_string(trn.last_delay))
+ " Dd "..rwt.to_string(trn.desired_dep or 0, true)..
+ " Delay "..rwt.to_string(trn.last_delay or "59;59"))
end
end
end