changeset 10185:c1ef0b49a1cd draft

(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
author smatz <smatz@openttd.org>
date Wed, 24 Sep 2008 16:51:36 +0000 (2008-09-24)
parents fbd1b77a2509
children d5dea47b6172
files src/order_gui.cpp
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -805,13 +805,17 @@
 
 				if (_ctrl_pressed && sel < this->vehicle->num_orders) {
 					const Order *ord = GetVehicleOrder(this->vehicle, sel);
-					TileIndex xy;
+					TileIndex xy = 0;
 
 					switch (ord->GetType()) {
 						case OT_GOTO_STATION:  xy = GetStation(ord->GetDestination())->xy ; break;
-						case OT_GOTO_DEPOT:    xy = (this->vehicle->type == VEH_AIRCRAFT) ?  GetStation(ord->GetDestination())->xy : GetDepot(ord->GetDestination())->xy;    break;
 						case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->GetDestination())->xy; break;
-						default:               xy = 0; break;
+						case OT_GOTO_DEPOT:
+							if ((ord->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) break;
+							xy = (this->vehicle->type == VEH_AIRCRAFT) ?  GetStation(ord->GetDestination())->xy : GetDepot(ord->GetDestination())->xy;
+							break;
+						default:
+							break;
 					}
 
 					if (xy != 0) ScrollMainWindowToTile(xy);