]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/trainstatus.h
Don't crash if a train has no router
[r2c2.git] / source / libr2c2 / trainstatus.h
1 #ifndef LIBR2C2_TRAINSTATUS_H_
2 #define LIBR2C2_TRAINSTATUS_H_
3
4 #include <string>
5 #include <sigc++/signal.h>
6 #include "trainai.h"
7
8 namespace R2C2 {
9
10 class Train;
11
12 /**
13 Provides textual description of the status of a train.
14 */
15 class TrainStatus: public TrainAI
16 {
17 public:
18         sigc::signal<void, const std::string &> signal_changed;
19
20 private:
21         int speed;
22         std::string status;
23
24 public:
25         TrainStatus(Train &);
26
27         const std::string &get_status() const { return status; }
28         void tick(const Msp::Time::TimeDelta &);
29 private:
30         void check();
31 };
32
33 } // namespace R2C2
34
35 #endif