]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/simplecontroller.h
Don't crash if a train has no router
[r2c2.git] / source / libr2c2 / simplecontroller.h
1 #ifndef LIBR2C2_SIMPLECONTROLLER_H_
2 #define LIBR2C2_SIMPLECONTROLLER_H_
3
4 #include <string>
5 #include "controller.h"
6
7 namespace R2C2 {
8
9 class SimpleController: public Controller
10 {
11 private:
12         Control target_speed;
13         Control reverse;
14         float accel;
15         float speed;
16
17 public:
18         SimpleController();
19
20         virtual const char *enumerate_controls(unsigned) const;
21         virtual void set_control(const std::string &, float);
22         virtual const Control &get_control(const std::string &) const;
23
24         virtual float get_speed() const { return speed; }
25         virtual bool get_reverse() const { return reverse.value; }
26         virtual float get_braking_distance() const;
27
28         virtual void tick(const Msp::Time::TimeDelta &);
29 };
30
31 } // namespace R2C2
32
33 #endif