X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrain.h;h=3e7a56b7e423da7e9d4157d88138fc7e4e4ede85;hb=3d38bcbe8add00b558012fa0cd4e0be26464dbeb;hp=18ad6a1e1407d807330aedd359e686eb30d2e70a;hpb=c5b6976004967e9e0a3c43ad025ebfa096894f3f;p=r2c2.git diff --git a/source/libmarklin/train.h b/source/libmarklin/train.h index 18ad6a1..3e7a56b 100644 --- a/source/libmarklin/train.h +++ b/source/libmarklin/train.h @@ -12,14 +12,14 @@ Distributed under the GPL #include #include #include "block.h" +#include "controller.h" namespace Marklin { -class ControlModel; -class LocoType; class Route; class Timetable; class Vehicle; +class VehicleType; class Train: public sigc::trackable { @@ -28,10 +28,12 @@ public: { private: Block *prev_block; + bool blocks_valid; public: Loader(Train &); private: + virtual void finish(); void block(unsigned); void block_hint(unsigned); void name(const std::string &); @@ -68,14 +70,17 @@ private: }; Layout &layout; - const LocoType &loco_type; + const VehicleType &loco_type; unsigned address; std::string name; + int priority; std::vector vehicles; std::list cur_blocks; std::list rsv_blocks; Block *pending_block; - ControlModel *control; + bool reserving; + bool advancing; + Controller *controller; Timetable *timetable; bool active; unsigned current_speed; @@ -96,16 +101,21 @@ private: float overshoot_dist; public: - Train(Layout &, const LocoType &, unsigned); + Train(Layout &, const VehicleType &, unsigned); ~Train(); Layout &get_layout() const { return layout; } - const LocoType &get_locomotive_type() const { return loco_type; } + const VehicleType &get_locomotive_type() const { return loco_type; } unsigned get_address() const { return address; } void set_name(const std::string &); const std::string &get_name() const { return name; } - ControlModel &get_control() const { return *control; } + void set_priority(int); + int get_priority() const { return priority; } + Controller &get_controller() const { return *controller; } + void add_vehicle(const VehicleType &); + void remove_vehicle(unsigned); + unsigned get_n_vehicles() const; Vehicle &get_vehicle(unsigned); const Vehicle &get_vehicle(unsigned) const; @@ -113,10 +123,14 @@ public: void set_active(bool); void set_function(unsigned, bool); float get_control(const std::string &) const; + float get_speed() const; bool is_active() const { return active; } bool get_function(unsigned) const; unsigned get_functions() const { return functions; } + void set_timetable(Timetable *); + Timetable *get_timetable() { return timetable; } + void set_route(const Route *); void go_to(const Track &); const Route *get_route() const { return route; } @@ -132,6 +146,7 @@ public: void save(std::list &) const; private: + void control_changed(const Controller::Control &); void loco_speed_event(unsigned, unsigned, bool); void loco_func_event(unsigned, unsigned, bool); void sensor_event(unsigned, bool);