summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-12-12 02:28:08 +0000
committerbelugas <belugas@openttd.org>2007-12-12 02:28:08 +0000
commite0646af976337e6ed210b0ea920710613f078fca (patch)
tree30791ce97cb65e0e97199d61e7caefd787052e2e /src
parented54703db8dbd9a0b09c2e804fda1eb544a22324 (diff)
downloadopenttd-e0646af976337e6ed210b0ea920710613f078fca.tar.xz
(svn r11624) -Fix[FS#1530]: An error in the translation of bitset to scroll directions made it so that up-down-right arrow keys did scrolled up, while it should have scrolled right instead. It was initially interpreted as left-right-up.
Diffstat (limited to 'src')
-rw-r--r--src/openttd.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 4e3d244a8..a84030903 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1055,24 +1055,32 @@ static void ScrollMainViewport(int x, int y)
WP(w,vp_d).dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
}
}
-
+/**
+ * Describes all the different arrow key combinations the game allows
+ * when it is in scrolling mode.
+ * The real arrow keys are bitwise numbered as
+ * 1 = left
+ * 2 = up
+ * 4 = right
+ * 8 = down
+ */
static const int8 scrollamt[16][2] = {
- { 0, 0},
+ { 0, 0}, ///< no key specified
{-2, 0}, ///< 1 : left
{ 0, -2}, ///< 2 : up
- {-2, -1}, ///< 3 : left + up
+ {-2, -1}, ///< 3 : left + up
{ 2, 0}, ///< 4 : right
- { 0, 0}, ///< 5 : left + right
+ { 0, 0}, ///< 5 : left + right = nothing
{ 2, -1}, ///< 6 : right + up
- { 0, -2}, ///< 7 : left + right + up = up
+ { 0, -2}, ///< 7 : right + left + up = up
{ 0 ,2}, ///< 8 : down
- {-2 ,1}, ///< 9 : down+left
- { 0, 0}, ///< 10 : impossible
- {-2, 0}, ///< 11 : left + up + down = left
- { 2, 1}, ///< 12 : down+right
- { 0, 2}, ///< 13 : left + right + down = down
- { 0, -2}, ///< 14 : left + right + up = up
- { 0, 0}, ///< 15 : impossible
+ {-2 ,1}, ///< 9 : down + left
+ { 0, 0}, ///< 10 : down + up = nothing
+ {-2, 0}, ///< 11 : left + up + down = left
+ { 2, 1}, ///< 12 : down + right
+ { 0, 2}, ///< 13 : left + right + down = down
+ { 2, 0}, ///< 14 : right + up + down = right
+ { 0, 0}, ///< 15 : left + up + right + down = nothing
};
static void HandleKeyScrolling()