From 76e277499fec494a96a1120692a1c6b4dc85ba60 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Thu, 29 Jan 2015 18:50:52 +0200 Subject: [PATCH] Ensure that Timetable has necessary helper AIs Since AIControl and TrainRouter don't emit statements to the state file, they are not created automatically when loading the state. If they are missing, the timetable won't be able to operate. --- source/libr2c2/timetable.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/libr2c2/timetable.cpp b/source/libr2c2/timetable.cpp index 9608182..42414f6 100644 --- a/source/libr2c2/timetable.cpp +++ b/source/libr2c2/timetable.cpp @@ -1,8 +1,10 @@ #include +#include "aicontrol.h" #include "clock.h" #include "layout.h" #include "timetable.h" #include "train.h" +#include "trainrouter.h" #include "zone.h" using namespace std; @@ -15,6 +17,11 @@ Timetable::Timetable(Train &t): current_row(rows.end()), update_pending(false) { + if(!train.get_ai_of_type()) + new AIControl(train); + if(!train.get_ai_of_type()) + new TrainRouter(train); + train.signal_ai_event.connect(sigc::mem_fun(this, &Timetable::event)); } -- 2.45.2