void Layout::block_reserved(Block &block, Train *train)
{
if(emitting_block_reserved)
+ {
+ if(!train)
+ {
+ for(deque<BlockReservation>::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);
{
BlockReservation br = block_reserve_queue.front();
block_reserve_queue.pop_front();
- signal_block_reserved.emit(br.block, br.train);
+ signal_block_reserved.emit(*br.block, br.train);
}
}
}
Layout::BlockReservation::BlockReservation(Block &b, Train *t):
- block(b),
+ block(&b),
train(t)
{ }