]> git.tdb.fi Git - r2c2.git/blobdiff - source/libr2c2/train.h
Redesign the train activation system
[r2c2.git] / source / libr2c2 / train.h
index ece5b4bb6340351119fe162532a0fbb725198a45..f3783893d3297628f5af69df539e3500e7b7cf66 100644 (file)
@@ -4,7 +4,7 @@
 #include <sigc++/signal.h>
 #include <sigc++/trackable.h>
 #include <msp/datafile/objectloader.h>
-#include <msp/time/timestamp.h>
+#include <msp/time/timedelta.h>
 #include "blockallocator.h"
 #include "controller.h"
 #include "sensor.h"
@@ -35,7 +35,6 @@ public:
                void name(const std::string &);
                void quantized_speed();
                void router();
-               void timetable();
                void vehicle(ArticleNumber);
        };
 
@@ -57,15 +56,14 @@ private:
        bool advancing;
        Controller *controller;
        std::list<TrainAI *> ais;
-       bool active;
        unsigned current_speed_step;
        bool speed_changing;
        bool reverse;
-       Msp::Time::TimeStamp stop_timeout;
+       Msp::Time::TimeDelta stop_timeout;
        unsigned functions;
 
        BlockIter last_entry_block;
-       Msp::Time::TimeStamp last_entry_time;
+       Msp::Time::TimeDelta travel_time;
        bool pure_speed;
        SpeedQuantizer *speed_quantizer;
        bool accurate_position;
@@ -91,13 +89,11 @@ 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; }
        bool get_function(unsigned) const;
        unsigned get_functions() const { return functions; }
 
@@ -118,13 +114,13 @@ public:
        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_first_noncritical_block() const;
+       void refresh_blocks_from(Block &);
        const BlockAllocator &get_block_allocator() const { return allocator; }
        float get_reserved_distance() const;
 
-       void tick(const Msp::Time::TimeStamp &, const Msp::Time::TimeDelta &);
+       void tick(const Msp::Time::TimeDelta &);
 
        void save(std::list<Msp::DataFile::Statement> &) const;
 private: