(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
authorsmatz
Wed, 24 Sep 2008 16:51:36 +0000
changeset 10185 1303c1c01a5a
parent 10184 bf4e3ff4cf16
child 10186 6e6d49ff4e8c
(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
src/order_gui.cpp
--- a/src/order_gui.cpp	Wed Sep 24 16:40:06 2008 +0000
+++ b/src/order_gui.cpp	Wed Sep 24 16:51:36 2008 +0000
@@ -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);