X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Flibr2c2%2Ftimetable.h;h=75572490665ae80d66a670cc6f42131cdb68dcf6;hb=b85fa11e45805cd71383577642030d8d01f43447;hp=07250ca94a941376601ad0dafd4b7419c4daaba2;hpb=1ac853ffc606b29ffd88b923ed3551ee6282afb2;p=r2c2.git diff --git a/source/libr2c2/timetable.h b/source/libr2c2/timetable.h index 07250ca..7557249 100644 --- a/source/libr2c2/timetable.h +++ b/source/libr2c2/timetable.h @@ -2,12 +2,12 @@ #define LIBR2C2_TIMETABLE_H_ #include +#include "trackchain.h" #include "trainai.h" namespace R2C2 { class Layout; -class TrackChain; class Timetable: public TrainAI { @@ -27,7 +27,8 @@ public: enum RowType { ARRIVE = 1, - DEPART + DEPART, + THROUGH }; struct Row @@ -43,11 +44,13 @@ public: private: void block(unsigned); void time(Msp::Time::RawTime); - void zone(const std::string &, unsigned); + void zone(const std::string &); + void zone_numbered(const std::string &, unsigned); }; RowType type; TrackChain *target; + TrackChain::Direction direction; Msp::Time::TimeDelta time; Row(); @@ -55,6 +58,15 @@ public: void save(std::list &) const; }; + struct RowTypeMatch + { + RowType type; + + RowTypeMatch(RowType t): type(t) { } + + bool operator()(const Row &r) const { return r.type==type; } + }; + sigc::signal signal_row_added; sigc::signal signal_row_modified; sigc::signal signal_row_removed; @@ -63,6 +75,7 @@ private: std::list rows; std::list::iterator current_row; bool update_pending; + bool sync_to_clock; public: Timetable(Train &); @@ -80,9 +93,12 @@ public: void save(std::list &) const; private: - void check_update(std::list::const_iterator); + void check_update(const std::list::const_iterator &); + std::list::iterator find_trip(const std::list::iterator &, std::list::iterator *); void update_route(); void event(TrainAI &, const Message &); + void record_time(); + void clock_discontinuity(); }; } // namespace R2C2