X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibmarklin%2Ftrain.h;h=9b6344c2fa104066bbb782f0dc6e87bfa3fcd832;hb=010d8321e982d1684fcbff5bf6fc2bdec7cb7bae;hp=0b88d8ac6af6fef6f5fee5af9da7cd51be8d52b7;hpb=25b79ab38c2be2e5c89b8240504f641fd9c4899c;p=r2c2.git diff --git a/source/libmarklin/train.h b/source/libmarklin/train.h index 0b88d8a..9b6344c 100644 --- a/source/libmarklin/train.h +++ b/source/libmarklin/train.h @@ -1,3 +1,10 @@ +/* $Id$ + +This file is part of the MSP Märklin suite +Copyright © 2006-2009 Mikkosoft Productions, Mikko Rasa +Distributed under the GPL +*/ + #ifndef LIBMARKLIN_TRAIN_H_ #define LIBMARKLIN_TRAIN_H_ @@ -14,6 +21,17 @@ class TrafficManager; class Train: public sigc::trackable { +public: + class Loader: public Msp::DataFile::BasicLoader + { + public: + Loader(Train &); + }; + + sigc::signal signal_name_changed; + sigc::signal signal_target_speed_changed; + sigc::signal signal_status_changed; + private: struct BlockRef { @@ -31,28 +49,43 @@ private: unsigned target_speed; Msp::Time::TimeStamp try_reserve; std::string status; + Msp::Time::TimeStamp last_entry_time; float travel_dist; - unsigned real_speed; + unsigned travel_speed; + bool pure_speed; + float speed_scale; + float speed_scale_weight; -public: - sigc::signal signal_name_changed; - sigc::signal signal_status_changed; + Track *cur_track; + unsigned cur_track_ep; + float offset; + Point pos; +public: Train(TrafficManager &, Locomotive &); void set_name(const std::string &); void set_speed(unsigned); + void set_reverse(bool); const std::string &get_name() const { return name; } Locomotive &get_locomotive() const { return loco; } + unsigned get_target_speed() const { return target_speed; } const std::string &get_status() const { return status; } + const Point &get_position() const { return pos; } void place(Block *, unsigned); bool free_block(Block *); - void tick(const Msp::Time::TimeStamp &); + void tick(const Msp::Time::TimeStamp &, const Msp::Time::TimeDelta &); + void save(std::list &) const; private: + void locomotive_reverse_changed(bool); void sensor_event(bool, Sensor *); - bool reserve_more(); + void turnout_route_changing(unsigned, Turnout *); + void turnout_route_changed(unsigned, Turnout *); + unsigned reserve_more(); + void update_speed(); void set_status(const std::string &); + void set_position(const Block::Endpoint &); }; } // namespace Marklin