summaryrefslogtreecommitdiff
path: root/window.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-11-19 12:37:28 +0000
committertron <tron@openttd.org>2005-11-19 12:37:28 +0000
commitf2b344084accd953a8e26db9a4196688f07a30a5 (patch)
tree75c59fd3b0544ce3e6d7c714bba70d5da37824e2 /window.c
parentc7683a63ceefa29e1727304d780d0f8225ed2ded (diff)
downloadopenttd-f2b344084accd953a8e26db9a4196688f07a30a5.tar.xz
(svn r3222) -Feature: Right-Click-Scrolling optionally moves in the opposite direction (Requested by manx)
Diffstat (limited to 'window.c')
-rw-r--r--window.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/window.c b/window.c
index 79540e860..be2f8d408 100644
--- a/window.c
+++ b/window.c
@@ -1182,13 +1182,22 @@ stop_capt:;
w = FindWindowFromPt(_cursor.pos.x, _cursor.pos.y);
if (w == NULL) goto stop_capt;
+ if (_patches.reverse_scroll) {
+ dx = -_cursor.delta.x;
+ dy = -_cursor.delta.y;
+ } else {
+ dx = _cursor.delta.x;
+ dy = _cursor.delta.y;
+ }
+
if (w->window_class != WC_SMALLMAP) {
vp = IsPtInWindowViewport(w, _cursor.pos.x, _cursor.pos.y);
if (vp == NULL)
goto stop_capt;
- WP(w,vp_d).scrollpos_x += _cursor.delta.x << vp->zoom;
- WP(w,vp_d).scrollpos_y += _cursor.delta.y << vp->zoom;
+ WP(w,vp_d).scrollpos_x += dx << vp->zoom;
+ WP(w,vp_d).scrollpos_y += dy << vp->zoom;
+
_cursor.delta.x = _cursor.delta.y = 0;
return false;
} else {
@@ -1200,9 +1209,6 @@ stop_capt:;
_cursor.fix_at = true;
- dx = _cursor.delta.x;
- dy = _cursor.delta.y;
-
x = WP(w,smallmap_d).scroll_x;
y = WP(w,smallmap_d).scroll_y;