]> git.tdb.fi Git - r2c2.git/commitdiff
Add a signal for advancing the rear end of the train
authorMikko Rasa <tdb@tdb.fi>
Tue, 15 Apr 2014 15:41:36 +0000 (18:41 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 15 Apr 2014 16:02:10 +0000 (19:02 +0300)
source/libr2c2/blockallocator.cpp
source/libr2c2/blockallocator.h
source/libr2c2/train.cpp
source/libr2c2/train.h

index 8e8726955c42cfddee688a7a0a1c775355857748..5870a6d00474ccdcffa2478da7bb38ffc425e958 100644 (file)
@@ -397,6 +397,7 @@ void BlockAllocator::advance_back()
                                if(i!=end)
                                        ++end;
                                release_blocks_begin(end);
+                               signal_rear_advanced.emit(*last());
                        }
                        return;
                }
index 33e9d5511654e41928527a5cc872d2735c7b4a29..cd6dfd5949d58aa49ec346079fcf8624241f1fd0 100644 (file)
@@ -28,6 +28,7 @@ public:
        };
 
        sigc::signal<void, Block &, Sensor *> signal_advanced;
+       sigc::signal<void, Block &> signal_rear_advanced;
 
 private:
        struct BlockMatch;
index 98553e3c611540aef90dc34477315ec3c8f6ea48..b670d4137fc303df68b2e84ade2cc710d5a9c11a 100644 (file)
@@ -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()
index 3c4176d3e3cf6de5fe816e484b51205546a359bb..6d9a20f7c2ee5b5ea5af15bf0e5b0629a070d7dc 100644 (file)
@@ -44,6 +44,7 @@ public:
        sigc::signal<void, unsigned, bool> signal_function_changed;
        sigc::signal<void, TrainAI &, const TrainAI::Message &> signal_ai_event;
        sigc::signal<void, Block &> signal_advanced;
+       sigc::signal<void, Block &> signal_rear_advanced;
        sigc::signal<void, unsigned, Vehicle &> signal_vehicle_added;
        sigc::signal<void, unsigned, Vehicle &> signal_vehicle_removed;