summaryrefslogtreecommitdiff
path: root/order_gui.c
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-08-13 20:30:45 +0000
committerdarkvater <darkvater@openttd.org>2004-08-13 20:30:45 +0000
commita58f9bd6216a46f569c49624e775df0a7db4ad95 (patch)
treefb6fb2adb8195a9674c53e103eccd31f2ae311be /order_gui.c
parent7af3360c5aa6c5b9cfdad97351bcc7644b4ab5c1 (diff)
downloadopenttd-a58f9bd6216a46f569c49624e775df0a7db4ad95.tar.xz
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
Diffstat (limited to 'order_gui.c')
-rw-r--r--order_gui.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/order_gui.c b/order_gui.c
index f45724b60..c6254b25b 100644
--- a/order_gui.c
+++ b/order_gui.c
@@ -276,6 +276,26 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
sel += w->vscroll.pos;
+ if (_ctrl_pressed && sel < v->num_orders) { // watch out for schedule_ptr overflow
+ int ord = v->schedule_ptr[sel];
+ int xy = 0;
+ switch (ord & OT_MASK) {
+ case OT_GOTO_STATION: /* station order */
+ xy = _stations[ord >> 8].xy ;
+ break;
+ case OT_GOTO_DEPOT: /* goto depot order */
+ xy = _depots[ord >> 8].xy;
+ break;
+ case OT_GOTO_CHECKPOINT: /* goto checkpoint order */
+ xy = _checkpoints[ord >> 8].xy;
+ }
+
+ if (xy)
+ ScrollMainWindowToTile(xy);
+
+ return;
+ }
+
if (sel == WP(w,order_d).sel) sel = -1;
WP(w,order_d).sel = sel;
SetWindowDirty(w);