]> git.tdb.fi Git - r2c2.git/blobdiff - source/libmarklin/train.h
Display the total length of selected tracks in status bar
[r2c2.git] / source / libmarklin / train.h
index 02d1d52de1b8751d411bc5aa063300f46d2fb110..7039c9ea87d9ec8484ee6b9de6c7d981b0044203 100644 (file)
@@ -60,6 +60,14 @@ private:
                BlockRef next() const;
        };
 
+       struct RouteRef
+       {
+               const Route *route;
+               unsigned diversion;
+
+               RouteRef(const Route *, unsigned = 0);
+       };
+
        struct RealSpeed
        {
                float speed;
@@ -89,8 +97,7 @@ private:
        bool reverse;
        Msp::Time::TimeStamp stop_timeout;
        unsigned functions;
-       const Route *route;
-       const Route *next_route;
+       std::list<RouteRef> routes;
        bool end_of_route;
        std::string status;
 
@@ -134,12 +141,14 @@ public:
        Timetable *get_timetable() { return timetable; }
 
        void set_route(const Route *);
-       void go_to(const Track &);
-       const Route *get_route() const { return route; }
+       void go_to(Track &);
+       bool divert(Track &);
+       const Route *get_route() const;
        void place(Block &, unsigned);
        void unplace();
        bool is_placed() const { return !cur_blocks.empty(); }
        bool free_block(Block &);
+       void free_noncritical_blocks();
        int get_entry_to_block(Block &) const;
        float get_reserved_distance() const;
 
@@ -165,6 +174,9 @@ private:
        void release_blocks(std::list<BlockRef> &);
        void release_blocks(std::list<BlockRef> &, std::list<BlockRef>::iterator, std::list<BlockRef>::iterator);
        void reverse_blocks(std::list<BlockRef> &) const;
+       bool advance_route(std::list<RouteRef>::iterator &, Track &);
+       Route *create_lead_route(Route *, const Route *);
+       bool is_valid_diversion(const Route &, Track &, unsigned);
 };
 
 } // namespace Marklin