X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Flibr2c2%2Fblockallocator.cpp;h=79274b77ded54cd6df67fb7e38329e36a2a4b03a;hb=1c1f8e0c2ce41bc6f943b450a510cc6bac7ef2e4;hp=7e992e00f41b65f6aecdc6afd6e89ec03e899bd0;hpb=771e1724b44afb85cf673e85ef0f2e02ebb30344;p=r2c2.git diff --git a/source/libr2c2/blockallocator.cpp b/source/libr2c2/blockallocator.cpp index 7e992e0..79274b7 100644 --- a/source/libr2c2/blockallocator.cpp +++ b/source/libr2c2/blockallocator.cpp @@ -39,6 +39,7 @@ BlockAllocator::BlockAllocator(Train &t): Layout &layout = train.get_layout(); layout.signal_block_reserved.connect(sigc::mem_fun(this, &BlockAllocator::block_reserved)); layout.signal_sensor_state_changed.connect(sigc::mem_fun(this, &BlockAllocator::sensor_state_changed)); + layout.get_driver().signal_halt.connect(sigc::mem_fun(this, &BlockAllocator::halt_event)); const set &tracks = layout.get_all(); for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) @@ -190,6 +191,9 @@ void BlockAllocator::reserve_more() if(blocks.empty()) throw logic_error("no blocks"); + if(train.get_layout().get_driver().is_halted()) + return; + BlockIter start = blocks.back(); if(&*start==stop_at_block) return; @@ -561,6 +565,12 @@ void BlockAllocator::update_next_sensor(Sensor *after) next_sensor = 0; } +void BlockAllocator::halt_event(bool halted) +{ + if(active && !halted) + reserve_more(); +} + void BlockAllocator::save(list &st) const { if(!blocks.empty() && cur_blocks_end!=blocks.begin())