]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/aicontrol.cpp
Arrange widgets in Designer with GLtk::Layout
[r2c2.git] / source / libr2c2 / aicontrol.cpp
index e5bed9ce3ba3ee71a61676f196ef673693ec667a..97b7209cf47539f892ddfa5872b21d053eed949f 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of R²C²
-Copyright © 2010-2011  Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
-
 #include "aicontrol.h"
 #include "catalogue.h"
 #include "layout.h"
@@ -23,7 +16,7 @@ AIControl::AIControl(Train &t):
        state(NORMAL),
        need_update(false)
 {
-       train.signal_arrived.connect(sigc::mem_fun(this, &AIControl::arrived));
+       train.signal_ai_event.connect(sigc::mem_fun(this, &AIControl::event));
 }
 
 void AIControl::set_target_speed(float s)
@@ -59,7 +52,7 @@ void AIControl::message(const Message &msg)
                set_reverse(!reverse);
 }
 
-void AIControl::tick(const Time::TimeStamp &, const Time::TimeDelta &)
+void AIControl::tick(const Time::TimeDelta &)
 {
        float scale = train.get_layout().get_catalogue().get_scale();
        float rsv_dist = train.get_reserved_distance();
@@ -111,9 +104,10 @@ void AIControl::tick(const Time::TimeStamp &, const Time::TimeDelta &)
                train.set_active(false);
 }
 
-void AIControl::arrived()
+void AIControl::event(TrainAI &, const Message &ev)
 {
-       set_target_speed(0);
+       if(ev.type=="arrived")
+               set_target_speed(0);
 }
 
 } // namespace R2C2