X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Faicontrol.h;h=01429cdd01581481918eefe10e1d22abd6d90c0e;hb=2d44923e135a119fde31a7a50e5fcd3e400e4f41;hp=9e0808e1b821803179e627c9f1d7536c226b3c49;hpb=90f9efba8d88f41c7a180734b7bcbdd1501d995e;p=r2c2.git diff --git a/source/libr2c2/aicontrol.h b/source/libr2c2/aicontrol.h index 9e0808e..01429cd 100644 --- a/source/libr2c2/aicontrol.h +++ b/source/libr2c2/aicontrol.h @@ -1,7 +1,7 @@ /* $Id$ This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa +Copyright © 2010-2011 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -9,13 +9,13 @@ Distributed under the GPL #define LIBR2C2_AICONTROL_H_ #include -#include "controller.h" +#include "trainai.h" namespace R2C2 { class Train; -class AIControl: public Controller, public sigc::trackable +class AIControl: public TrainAI, public sigc::trackable { private: enum State @@ -26,26 +26,24 @@ private: FOLLOW }; - Train &train; - Controller *next_ctrl; - Control target_speed; + float target_speed; + bool reverse; + bool pending_reverse; State state; + bool need_update; public: - AIControl(Train &, Controller *); - virtual ~AIControl(); + AIControl(Train &); - virtual void set_control(const std::string &, float); - virtual const Control &get_control(const std::string &) const; + void set_target_speed(float); + float get_target_speed() const { return target_speed; } + void set_reverse(bool); + bool get_reverse() const { return reverse; } - virtual float get_speed() const; - virtual bool get_reverse() const; - virtual float get_braking_distance() const; - - virtual void tick(const Msp::Time::TimeDelta &); + virtual void message(const Message &); + virtual void tick(const Msp::Time::TimeStamp &, const Msp::Time::TimeDelta &); private: - void control_changed(const Control &); void arrived(); };