summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-05-28 17:07:19 +0000
committerpeter1138 <peter1138@openttd.org>2007-05-28 17:07:19 +0000
commit63f79659208c76ce51b370669f6cb0178c415b09 (patch)
tree70f664fc26ca4bb0a04c26860587fbc13450cf26 /src/viewport.cpp
parent344e9007feac6dd1e90154b45e80907c5e49821a (diff)
downloadopenttd-63f79659208c76ce51b370669f6cb0178c415b09.tar.xz
(svn r9963) -Fix (r9962): 'smooth_scroll' patch setting was ignored (always on) in some places.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index a06547051..1fc915ec5 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1397,10 +1397,15 @@ void UpdateViewportPosition(Window *w)
int delta_y = dest_y - y;
if (delta_x != 0 || delta_y != 0) {
- int max_scroll = ScaleByMapSize1D(512);
- /* Not at our desired positon yet... */
- x += clamp(delta_x / 8, -max_scroll, max_scroll);
- y += clamp(delta_y / 8, -max_scroll, max_scroll);
+ if (_patches.smooth_scroll) {
+ int max_scroll = ScaleByMapSize1D(512);
+ /* Not at our desired positon yet... */
+ x += clamp(delta_x / 8, -max_scroll, max_scroll);
+ y += clamp(delta_y / 8, -max_scroll, max_scroll);
+ } else {
+ x = dest_x;
+ y = dest_y;
+ }
}
/* Convert viewport coordinates to map coordinates
@@ -1868,7 +1873,7 @@ bool ScrollWindowTo(int x , int y, Window *w, bool instant)
if (WP(w, vp_d).dest_scrollpos_x == pt.x && WP(w, vp_d).dest_scrollpos_y == pt.y)
return false;
- if (!_patches.smooth_scroll || instant) {
+ if (instant) {
WP(w, vp_d).scrollpos_x = pt.x;
WP(w, vp_d).scrollpos_y = pt.y;
}