if(check_allocated_blocks)
{
unsigned n_blocks = 0;
- BlockIter iter = block.next();
- while(iter && iter->get_train()==train)
+ const Block *last = train->get_block_allocator().last().block();
+ if(block.block()!=last)
{
- if(iter->get_sensor_address())
- ++n_blocks;
- iter = iter.next();
+ BlockIter iter = block.next();
+ while(iter && iter->get_train()==train && iter.block()!=last)
+ {
+ if(iter->get_sensor_address())
+ ++n_blocks;
+ iter = iter.next();
+ }
}
check_allocated_blocks = false;