summaryrefslogtreecommitdiff
path: root/src/order_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-02-22 20:36:20 +0000
committerfrosch <frosch@openttd.org>2010-02-22 20:36:20 +0000
commit3222ace3e1f522d8095cc5e1979f98499e2f09fe (patch)
treea6b8e00360992b8fe5339029d5c418cdcf66042a /src/order_gui.cpp
parenta74b7ecd809e49c8f236edadf1baa3277a5ce080 (diff)
downloadopenttd-3222ace3e1f522d8095cc5e1979f98499e2f09fe.tar.xz
(svn r19215) -Codechange: Add Order::GetLocation() to deduplicate code.
Diffstat (limited to 'src/order_gui.cpp')
-rw-r--r--src/order_gui.cpp18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index d591bb438..9f974f8b8 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -996,23 +996,7 @@ public:
int sel = this->GetOrderFromPt(pt.y);
if (_ctrl_pressed && sel < this->vehicle->GetNumOrders()) {
- const Order *ord = this->vehicle->GetOrder(sel);
- TileIndex xy = INVALID_TILE;
-
- switch (ord->GetType()) {
- case OT_GOTO_WAYPOINT:
- case OT_GOTO_STATION:
- xy = BaseStation::Get(ord->GetDestination())->xy;
- break;
-
- case OT_GOTO_DEPOT:
- if ((ord->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) break;
- xy = (this->vehicle->type == VEH_AIRCRAFT) ? Station::Get(ord->GetDestination())->xy : Depot::Get(ord->GetDestination())->xy;
- break;
- default:
- break;
- }
-
+ TileIndex xy = this->vehicle->GetOrder(sel)->GetLocation(this->vehicle);
if (xy != INVALID_TILE) ScrollMainWindowToTile(xy);
return;
}