X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Faicontrol.h;h=a9f9de14c92c0bff35ab3dfb1357486eb524d075;hb=f0aa8913aa1f4df37b87dcedbc257febb0e101a1;hp=8d9ff11591eba395c414b6197d99652454eb06d6;hpb=bd174b180d22a68bfa2caa35fb31d8b50fa3a750;p=r2c2.git diff --git a/source/libr2c2/aicontrol.h b/source/libr2c2/aicontrol.h index 8d9ff11..a9f9de1 100644 --- a/source/libr2c2/aicontrol.h +++ b/source/libr2c2/aicontrol.h @@ -1,21 +1,14 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #ifndef LIBR2C2_AICONTROL_H_ #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,28 +19,26 @@ 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(); - - virtual const char *enumerate_controls(unsigned) const; - virtual void set_control(const std::string &, float); - virtual const Control &get_control(const std::string &) const; + AIControl(Train &); - virtual float get_speed() const; - virtual bool get_reverse() const; - virtual float get_braking_distance() 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 void message(const Message &); virtual void tick(const Msp::Time::TimeDelta &); + virtual bool has_intent_to_move() const; private: - void control_changed(const Control &); - void arrived(); + void event(TrainAI &, const Message &); }; } // namespace R2C2