Setting route causes stop_at information to be cleared. If the allocator
is still active when this happens, it will allocate more blocks.
TrainRouter::TrainRouter(Train &t):
TrainAI(t),
priority(0),
- arriving(false),
+ arriving(0),
dest_zone(0),
dest_block(0),
update_pending(false)
if(r)
routes.push_back(r);
train.stop_at(0);
- arriving = false;
+ arriving = 0;
train.refresh_blocks_from(*fncb);
if(update_pending)
create_plans(train.get_layout());
- if(arriving && !train.get_speed())
+ if(arriving==1 && !train.get_speed())
{
signal_arrived.emit();
signal_event.emit(Message("arrived"));
- set_route(0);
+ arriving = 2;
}
+ else if(arriving==2 && !train.get_block_allocator().is_active())
+ set_route(0);
}
void TrainRouter::save(list<DataFile::Statement> &st) const
{
b_iter = b_iter.next();
if(b_iter && !is_on_route(*b_iter))
- arriving = true;
+ arriving = 1;
}
}
int priority;
RouteList routes;
- bool arriving;
+ unsigned arriving;
const Zone *dest_zone;
const Block *dest_block;
std::list<Wait> waits;