(svn r22034) -Fix [FS#4488]: crash when watching the vehicle view of a vehicle that has multiple sequential nearest depot orders (or consists of a single nearest depot order) when there is no depot with index 0

This commit is contained in:
rubidium 2011-02-08 22:36:16 +00:00
parent 5ccf5cc551
commit 7c254110c0

View File

@ -2432,7 +2432,15 @@ public:
SetDParam(0, v->type);
SetDParam(1, v->current_order.GetDestination());
SetDParam(2, v->GetDisplaySpeed());
if (v->current_order.GetDepotActionType() & ODATFB_HALT) {
if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
/* This case *only* happens when multiple nearest depot orders
* follow eachother (including an order list only one order: a
* nearest depot order) and there are no reachable depots.
* It is primarily to guard for the case that there is no
* depot with index 0, which would be used as fallback for
* evaluating the string in the status bar. */
str = STR_EMPTY;
} else if (v->current_order.GetDepotActionType() & ODATFB_HALT) {
str = STR_VEHICLE_STATUS_HEADING_FOR_DEPOT_VEL;
} else {
str = STR_VEHICLE_STATUS_HEADING_FOR_DEPOT_SERVICE_VEL;