X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Ftrain.h;h=9b228c026a791374f26de248f1a04fab3f8e95a4;hb=e8b19bb2711913226580b93ba127b0628839c10d;hp=c0eb52e850006cd4ca48f41f1ad35dd77da227f3;hpb=9f4f169affcedcf249e935f93e0a15ed60232f6a;p=r2c2.git diff --git a/source/libr2c2/train.h b/source/libr2c2/train.h index c0eb52e..9b228c0 100644 --- a/source/libr2c2/train.h +++ b/source/libr2c2/train.h @@ -32,10 +32,12 @@ public: private: virtual void finish(); void blocks(); + void function(unsigned, bool); void name(const std::string &); void quantized_speed(); void router(); - void vehicle(ArticleNumber); + void timetable(); + void vehicle(const std::string &); }; sigc::signal signal_name_changed; @@ -43,12 +45,16 @@ public: sigc::signal signal_function_changed; sigc::signal signal_ai_event; sigc::signal signal_advanced; + sigc::signal signal_rear_advanced; + sigc::signal signal_vehicle_added; + sigc::signal signal_vehicle_removed; private: Layout &layout; const VehicleType &loco_type; unsigned address; std::string protocol; + unsigned loco_id; std::string name; const Train *preceding_train; std::vector vehicles; @@ -56,7 +62,6 @@ private: bool advancing; Controller *controller; std::list ais; - bool active; unsigned current_speed_step; bool speed_changing; bool reverse; @@ -90,13 +95,12 @@ public: const Vehicle &get_vehicle(unsigned) const; void set_control(const std::string &, float); - void set_active(bool); void set_function(unsigned, bool); float get_control(const std::string &) const; float get_speed() const; float get_quantized_speed() const; unsigned get_speed_step() const { return current_speed_step; } - bool is_active() const { return active; } + float get_maximum_speed() const; bool get_function(unsigned) const; unsigned get_functions() const { return functions; } @@ -113,13 +117,16 @@ public: return 0; } - void place(const BlockIter &); + bool place(const BlockIter &); void unplace(); bool is_placed() const { return !allocator.empty(); } void stop_at(Block *); - bool free_block(Block &); - void free_noncritical_blocks(); - void reserve_more(); + bool is_block_critical(const Block &) const; + BlockIter get_last_critical_block() const; +private: + BlockIter check_critical_blocks(const Block *) const; +public: + void refresh_blocks_from(Block &); const BlockAllocator &get_block_allocator() const { return allocator; } float get_reserved_distance() const; @@ -130,7 +137,7 @@ private: void control_changed(const Controller::Control &); void loco_speed_event(unsigned, unsigned, bool); void loco_func_event(unsigned, unsigned, bool); - void sensor_state_changed(Sensor &, Sensor::State); + void advanced(Block &, Sensor *); void halt_event(bool); void block_reserved(const Block &, const Train *); float get_reserved_distance_until(const Block *) const;