X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Flayout.h;h=e06d4fb04f50d8ccb1e581a363e2dce18d13d91a;hb=065d35f5f86a5b9cda95736f59e63845e0bb6fa6;hp=41de73d7dc11f9b46e3e209c318ff801a6c69851;hpb=9cb5f9ef3c0eaac499ef5d045c513116d6809e56;p=r2c2.git diff --git a/source/libr2c2/layout.h b/source/libr2c2/layout.h index 41de73d..e06d4fb 100644 --- a/source/libr2c2/layout.h +++ b/source/libr2c2/layout.h @@ -1,9 +1,11 @@ #ifndef LIBR2C2_LAYOUT_H_ #define LIBR2C2_LAYOUT_H_ +#include #include #include #include +#include #include #include "geometry.h" #include "sensor.h" @@ -36,11 +38,12 @@ public: void beamgate(); void clock(); void route(); - void signal(ArticleNumber); - void terrain(ArticleNumber); - void track(ArticleNumber); - void train(ArticleNumber, unsigned, const std::string &); - void turnout(unsigned, unsigned); + void signal(const std::string &); + void terrain(const std::string &); + void track(const std::string &); + void train(const std::string &, unsigned, const std::string &); + void turnout(unsigned); + void turnout2(unsigned, unsigned); void zone(); }; @@ -67,6 +70,14 @@ private: void del(); }; + struct BlockReservation + { + Block *block; + Train *train; + + BlockReservation(Block &, Train *); + }; + public: typedef std::vector ZoneArray; @@ -91,6 +102,8 @@ private: std::map trains; Msp::Time::TimeStamp last_tick; unsigned next_turnout_addr; + bool emitting_block_reserved; + std::deque block_reserve_queue; public: Layout(Catalogue &, Driver * = 0); @@ -138,13 +151,17 @@ public: const std::map &get_trains() const { return trains; } void remove_train(Train &); - void tick(); + void tick(float = 1.0f); +private: + void step(const Msp::Time::TimeDelta &); +public: void emergency(Block *, const std::string &); void save(const std::string &) const; void save_dynamic(const std::string &) const; private: void sensor_state_changed(Sensor &, Sensor::State); + void block_reserved(Block &, Train *); }; } // namespace R2C2