diff options
author | rubidium <rubidium@openttd.org> | 2011-02-08 22:36:16 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2011-02-08 22:36:16 +0000 |
commit | 7c254110c06975deb0738f0e2c620460465a2a07 (patch) | |
tree | 576089c5d26ad96ecb90e4b9b472bd5c4b073113 | |
parent | 5ccf5cc55174cea36354cd8c67eac88d4839d2d1 (diff) | |
download | openttd-7c254110c06975deb0738f0e2c620460465a2a07.tar.xz |
(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
-rw-r--r-- | src/vehicle_gui.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index c84bd522c..048af0e4c 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -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; |