From: Mikko Rasa Date: Tue, 15 Apr 2014 15:41:36 +0000 (+0300) Subject: Add a signal for advancing the rear end of the train X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6eba064c477836843a2647d777e95823a96dda43;p=r2c2.git Add a signal for advancing the rear end of the train --- diff --git a/source/libr2c2/blockallocator.cpp b/source/libr2c2/blockallocator.cpp index 8e87269..5870a6d 100644 --- a/source/libr2c2/blockallocator.cpp +++ b/source/libr2c2/blockallocator.cpp @@ -397,6 +397,7 @@ void BlockAllocator::advance_back() if(i!=end) ++end; release_blocks_begin(end); + signal_rear_advanced.emit(*last()); } return; } diff --git a/source/libr2c2/blockallocator.h b/source/libr2c2/blockallocator.h index 33e9d55..cd6dfd5 100644 --- a/source/libr2c2/blockallocator.h +++ b/source/libr2c2/blockallocator.h @@ -28,6 +28,7 @@ public: }; sigc::signal signal_advanced; + sigc::signal signal_rear_advanced; private: struct BlockMatch; diff --git a/source/libr2c2/train.cpp b/source/libr2c2/train.cpp index 98553e3..b670d41 100644 --- a/source/libr2c2/train.cpp +++ b/source/libr2c2/train.cpp @@ -68,6 +68,7 @@ Train::Train(Layout &l, const VehicleType &t, unsigned a, const string &p): controller->signal_control_changed.connect(sigc::mem_fun(this, &Train::control_changed)); allocator.signal_advanced.connect(sigc::mem_fun(this, &Train::advanced)); + allocator.signal_rear_advanced.connect(signal_rear_advanced); } Train::~Train() diff --git a/source/libr2c2/train.h b/source/libr2c2/train.h index 3c4176d..6d9a20f 100644 --- a/source/libr2c2/train.h +++ b/source/libr2c2/train.h @@ -44,6 +44,7 @@ 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;