X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrainrouter.h;h=cbaa520cd20d945c5e1249ba5679fddb07c9b9b9;hb=3de7ae761b9a1fd1c1cd40457cc7067f4cf57c36;hp=6f697f997b6349ba686b409022ce9e1d6fd79e86;hpb=df72b71642bbc5b9a4e5010ebca8643fbeea3ca8;p=r2c2.git diff --git a/source/libr2c2/trainrouter.h b/source/libr2c2/trainrouter.h index 6f697f9..cbaa520 100644 --- a/source/libr2c2/trainrouter.h +++ b/source/libr2c2/trainrouter.h @@ -12,6 +12,7 @@ class Layout; class Track; class TrackChain; class TrainRouteMetric; +class TrainRoutePlanner; class TrainRouter: public TrainAI { @@ -28,7 +29,6 @@ public: sigc::signal signal_arrived; sigc::signal signal_waypoint_reached; -private: struct SequencePoint { Block *block; @@ -39,6 +39,7 @@ private: SequencePoint(Block &, unsigned); }; +private: typedef std::list RouteList; int priority; @@ -46,13 +47,14 @@ private: unsigned arriving; const TrackChain *destination; std::vector waypoints; + bool destination_changed; std::vector metrics; + bool metrics_stale; std::list sequence_points; std::list pending_sequence_checks; unsigned current_sequence; Msp::Time::TimeDelta delay; - - bool update_pending; + Msp::RefPtr planner; public: TrainRouter(Train &); @@ -62,12 +64,12 @@ public: int get_priority() const { return priority; } bool set_route(const Route *); - bool add_route(const Route &); const Route *get_route() const; - void add_sequence_point(Block &, unsigned); - void add_sequence_point(Block &, Train &, unsigned, unsigned); unsigned get_current_sequence() const { return current_sequence; } +private: + void route_changed(); +public: void set_destination(const TrackChain &); const TrackChain *get_destination() const { return destination; } bool is_destination(Track &) const; @@ -93,7 +95,7 @@ private: bool advance_route(RouteList::iterator &, const Block &); bool is_on_route(const Block &); - static void create_plans(Layout &); + static void start_planning(Layout &); }; } // namespace R2C2