Add news/advice setting to warn if no depot order in vehicle schedule

This commit is contained in:
Jonathan G Rennison
2019-05-11 19:58:16 +01:00
parent c9ec55a54a
commit af64b5dc18
5 changed files with 19 additions and 0 deletions

View File

@@ -827,6 +827,7 @@ static void DeleteOrderWarnings(const Vehicle *v)
DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_VOID_ORDER);
DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY);
DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_HAS_INVALID_ENTRY);
DeleteVehicleNews(v->index, STR_NEWS_VEHICLE_NO_DEPOT_ORDER);
DeleteVehicleNews(v->index, STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY);
}
@@ -2205,6 +2206,7 @@ void CheckOrders(const Vehicle *v)
/* Check the order list */
int n_st = 0;
bool has_depot_order = false;
FOR_VEHICLE_ORDERS(v, order) {
/* Dummy order? */
@@ -2227,6 +2229,9 @@ void CheckOrders(const Vehicle *v)
message = STR_NEWS_PLANE_USES_TOO_SHORT_RUNWAY;
}
}
if (order->IsType(OT_GOTO_DEPOT)) {
has_depot_order = true;
}
}
/* Check if the last and the first order are the same */
@@ -2245,6 +2250,8 @@ void CheckOrders(const Vehicle *v)
if (v->orders.list != nullptr) v->orders.list->DebugCheckSanity();
#endif
if (message == INVALID_STRING_ID && !has_depot_order && v->type != VEH_AIRCRAFT && _settings_client.gui.no_depot_order_warn) message = STR_NEWS_VEHICLE_NO_DEPOT_ORDER;
/* We don't have a problem */
if (message == INVALID_STRING_ID) return;