X-Git-Url: http://git.tdb.fi/?p=r2c2.git;a=blobdiff_plain;f=source%2Flibr2c2%2Flayout.cpp;h=dc07c191991b7cebe4de15f44d9aa85d91cd00b2;hp=bc149dff1f904a014a0518052dacb36818a62fe6;hb=d0881a98a6240758ac1aeceaa9443d718ab1ad5c;hpb=dfe3dd563981883f3b7c826102fed33c7ff0d12d diff --git a/source/libr2c2/layout.cpp b/source/libr2c2/layout.cpp index bc149df..dc07c19 100644 --- a/source/libr2c2/layout.cpp +++ b/source/libr2c2/layout.cpp @@ -41,8 +41,7 @@ namespace R2C2 { Layout::Layout(Catalogue &c, Driver *d): catalogue(c), driver(d), - next_turnout_addr(0x800), - emitting_block_reserved(false) + next_turnout_addr(0x800) { clock.set_rate(60); } @@ -123,7 +122,7 @@ void Layout::add(Block &b) { if(track_chains.insert(b)) { - sigc::connection conn = b.signal_reserved.connect(sigc::bind<0>(sigc::mem_fun(this, &Layout::block_reserved), sigc::ref(b))); + sigc::connection conn = b.signal_reserved.connect(sigc::bind<0>(signal_block_reserved, sigc::ref(b))); try { signal_track_chain_added.emit(b); @@ -562,35 +561,6 @@ void Layout::sensor_state_changed(Sensor &sensor, Sensor::State state) } } -void Layout::block_reserved(Block &block, Train *train) -{ - if(emitting_block_reserved) - { - if(!train) - { - for(deque::iterator i=block_reserve_queue.end(); i!=block_reserve_queue.begin(); ) - if((--i)->block==&block) - { - block_reserve_queue.erase(i); - return; - } - } - - block_reserve_queue.push_back(BlockReservation(block, train)); - } - else - { - SetFlag setf(emitting_block_reserved); - signal_block_reserved.emit(block, train); - while(!block_reserve_queue.empty()) - { - BlockReservation br = block_reserve_queue.front(); - block_reserve_queue.pop_front(); - signal_block_reserved.emit(*br.block, br.train); - } - } -} - template Layout::Storage::~Storage() @@ -645,12 +615,6 @@ void Layout::Storage::del() } -Layout::BlockReservation::BlockReservation(Block &b, Train *t): - block(&b), - train(t) -{ } - - Layout::Loader::Loader(Layout &l): DataFile::ObjectLoader(l) {