]> git.tdb.fi Git - r2c2.git/blob - source/libr2c2/trainstatus.h
Remove status from Train and turn it into a TrainAI
[r2c2.git] / source / libr2c2 / trainstatus.h
1 /* $Id$
2
3 This file is part of R²C²
4 Copyright © 2011  Mikkosoft Productions, Mikko Rasa
5 Distributed under the GPL
6 */
7
8 #ifndef LIBR2C2_TRAINSTATUS_H_
9 #define LIBR2C2_TRAINSTATUS_H_
10
11 #include <string>
12 #include <sigc++/signal.h>
13 #include "trainai.h"
14
15 namespace R2C2 {
16
17 class Train;
18
19 /**
20 Provides textual description of the status of a train.
21 */
22 class TrainStatus: public TrainAI
23 {
24 public:
25         sigc::signal<void, const std::string &> signal_changed;
26
27 private:
28         int speed;
29         std::string status;
30
31 public:
32         TrainStatus(Train &);
33
34         const std::string &get_status() const { return status; }
35         void tick(const Msp::Time::TimeStamp &, const Msp::Time::TimeDelta &);
36 private:
37         void check();
38 };
39
40 } // namespace R2C2
41
42 #endif