summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2018-10-17 20:51:47 +0100
committerfrosch <github@elsenhans.name>2018-10-31 12:41:49 +0100
commitca5f73b196fc81185c2d08ad69fe9cd478fc0669 (patch)
treeec9e789bf5b78708fdd1366b66b0ab1f09da8c43
parentb5028efc1fa862073c908c435f84098ccd246fdc (diff)
downloadopenttd-ca5f73b196fc81185c2d08ad69fe9cd478fc0669.tar.xz
Codechange: Turn a define into a constant
-rw-r--r--src/window.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/window.cpp b/src/window.cpp
index cd8769e27..5b9dad677 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -2751,18 +2751,17 @@ static void HandleAutoscroll()
y -= vp->top;
/* here allows scrolling in both x and y axis */
-#define scrollspeed 3
+ static const int SCROLLSPEED = 3;
if (x - 15 < 0) {
- w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * scrollspeed, vp->zoom);
+ w->viewport->dest_scrollpos_x += ScaleByZoom((x - 15) * SCROLLSPEED, vp->zoom);
} else if (15 - (vp->width - x) > 0) {
- w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * scrollspeed, vp->zoom);
+ w->viewport->dest_scrollpos_x += ScaleByZoom((15 - (vp->width - x)) * SCROLLSPEED, vp->zoom);
}
if (y - 15 < 0) {
- w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * scrollspeed, vp->zoom);
+ w->viewport->dest_scrollpos_y += ScaleByZoom((y - 15) * SCROLLSPEED, vp->zoom);
} else if (15 - (vp->height - y) > 0) {
- w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * scrollspeed, vp->zoom);
+ w->viewport->dest_scrollpos_y += ScaleByZoom((15 - (vp->height - y)) * SCROLLSPEED, vp->zoom);
}
-#undef scrollspeed
}
enum MouseClick {