Scheduled dispatch: Add hints about dispatch order to timetable window

Adjust condition for dispatch order
This commit is contained in:
Jonathan G Rennison
2020-01-29 00:25:09 +00:00
parent 4c15e3dacc
commit 9917a1daef
6 changed files with 35 additions and 17 deletions

View File

@@ -2387,6 +2387,21 @@ void Vehicle::MarkAllViewportsDirty() const
::MarkAllViewportsDirty(this->coord.left, this->coord.top, this->coord.right, this->coord.bottom);
}
VehicleOrderID Vehicle::GetFirstWaitingLocation(bool require_wait_timetabled) const
{
for (int i = 0; i < this->GetNumOrders(); ++i) {
const Order* order = this->GetOrder(i);
if (order->IsWaitTimetabled() && !order->IsType(OT_IMPLICIT) && !order->IsType(OT_CONDITIONAL)) {
return i;
}
if (order->IsType(OT_GOTO_STATION)) {
return (order->IsWaitTimetabled() || !require_wait_timetabled) ? i : INVALID_VEH_ORDER_ID;
}
}
return INVALID_VEH_ORDER_ID;
}
/**
* Get position information of a vehicle when moving one pixel in the direction it is facing
* @param v Vehicle to move