Scheduled dispatch: Do not show required vehicles if conditional order present

This commit is contained in:
Jonathan G Rennison
2020-01-27 20:03:50 +00:00
parent 4ee8215987
commit bffd52b74a

View File

@@ -349,10 +349,19 @@ struct SchdispatchWindow : Window {
this->last_departure_future ? STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE : STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST); this->last_departure_future ? STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_FUTURE : STR_SCHDISPATCH_SUMMARY_LAST_DEPARTURE_PAST);
y += FONT_HEIGHT_NORMAL; y += FONT_HEIGHT_NORMAL;
const int required_vehicle = CalculateMaxRequiredVehicle(v->orders.list->GetTimetableTotalDuration(), v->orders.list->GetScheduledDispatchDuration(), v->orders.list->GetScheduledDispatch()); bool have_conditional = false;
if (required_vehicle > 0) { for (int n = 0; n < v->GetNumOrders(); n++) {
SetDParam(0, required_vehicle); const Order *order = v->GetOrder(n);
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_SCHDISPATCH_SUMMARY_L1); if (order->IsType(OT_CONDITIONAL)) {
have_conditional = true;
}
}
if (!have_conditional) {
const int required_vehicle = CalculateMaxRequiredVehicle(v->orders.list->GetTimetableTotalDuration(), v->orders.list->GetScheduledDispatchDuration(), v->orders.list->GetScheduledDispatch());
if (required_vehicle > 0) {
SetDParam(0, required_vehicle);
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_SCHDISPATCH_SUMMARY_L1);
}
} }
y += FONT_HEIGHT_NORMAL; y += FONT_HEIGHT_NORMAL;