summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-05-07 20:39:00 +0000
committeralberth <alberth@openttd.org>2010-05-07 20:39:00 +0000
commit8d1d4267afccf29d298485fca1251bd1c341158c (patch)
tree4894e11c3b1d2a93443f3364e3ccc8d9098ed1ed /src
parentd822b2969bad3bfe2519e6ff673557ee8d58c36c (diff)
downloadopenttd-8d1d4267afccf29d298485fca1251bd1c341158c.tar.xz
(svn r19767) -Fix [FS#3808]: Height in smallmap was different from measured heights (ChillCore).
Diffstat (limited to 'src')
-rw-r--r--src/smallmap_gui.cpp2
-rw-r--r--src/viewport.cpp6
-rw-r--r--src/viewport_func.h2
3 files changed, 6 insertions, 4 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 78e779b2d..9bea2a542 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -1107,7 +1107,7 @@ public:
GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, 0); // Outer border of the legend colour
}
} else {
- if (this->map_type == SMT_CONTOUR) SetDParam(0, tbl->u.height * 100);
+ if (this->map_type == SMT_CONTOUR) SetDParam(0, tbl->u.height * TILE_HEIGHT_STEP);
/* Anything that is not an industry is using normal process */
GfxFillRect(x + blob_left, y + 1, x + blob_right, y + row_height - 1, 0);
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 3e5f1de9b..00ef9f6cc 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -2170,7 +2170,8 @@ static bool SwapDirection(HighLightStyle style, TileIndex start_tile, TileIndex
}
/** Calculates height difference between one tile and another.
- * Multiplies the result to suit the standard given by minimap - 50 meters high
+ * Multiplies the result to suit the standard given by #TILE_HEIGHT_STEP.
+ *
* To correctly get the height difference we need the direction we are dragging
* in, as well as with what kind of tool we are dragging. For example a horizontal
* autorail tool that starts in bottom and ends at the top of a tile will need the
@@ -2249,8 +2250,7 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
}
if (swap) Swap(h0, h1);
- /* Minimap shows height in intervals of 50 meters, let's do the same */
- return (int)(h1 - h0) * 50;
+ return (int)(h1 - h0) * TILE_HEIGHT_STEP;
}
static const StringID measure_strings_length[] = {STR_NULL, STR_MEASURE_LENGTH, STR_MEASURE_LENGTH_HEIGHTDIFF};
diff --git a/src/viewport_func.h b/src/viewport_func.h
index 027f9c165..dbe965d4f 100644
--- a/src/viewport_func.h
+++ b/src/viewport_func.h
@@ -18,6 +18,8 @@
#include "window_type.h"
#include "tile_type.h"
+static const int TILE_HEIGHT_STEP = 50; ///< One Z unit tile height difference is displayed as 50m.
+
void SetSelectionRed(bool);
void DeleteWindowViewport(Window *w);