Index: src/smallmap_gui.cpp =================================================================== --- src/smallmap_gui.cpp (revision 19760) +++ src/smallmap_gui.cpp (working copy) @@ -81,7 +81,11 @@ MC(STR_TINY_BLACK_HEIGHT), MC(STR_TINY_BLACK_HEIGHT), MC(STR_TINY_BLACK_HEIGHT), + + MS(_legend_land_contours[4].colour, STR_TINY_BLACK_HEIGHT), MC(STR_TINY_BLACK_HEIGHT), + MC(STR_TINY_BLACK_HEIGHT), + MC(STR_TINY_BLACK_HEIGHT), MS(0xD7, STR_SMALLMAP_LEGENDA_ROADS), MK(0x0A, STR_SMALLMAP_LEGENDA_RAILROADS), @@ -269,13 +273,22 @@ {_violet_map_heights, MKCOLOUR(0x82828282)}, ///< Violet colour scheme. }; +/** Used for building up the legend txt entries*/ +//TODO: to be reused for autocalculating the array below. +enum { +HEIGHT_LEGEND_STEP = 2, ///< How many heightlevels are covered by 1 heightlegend entry. +}; + void BuildLandLegend() { - _legend_land_contours[0].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[0]; - _legend_land_contours[1].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[4]; - _legend_land_contours[2].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[8]; - _legend_land_contours[3].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[12]; - _legend_land_contours[4].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[14]; + _legend_land_contours[0].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[0]; + _legend_land_contours[1].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[2]; + _legend_land_contours[2].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[4]; + _legend_land_contours[3].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[6]; + _legend_land_contours[4].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[8]; + _legend_land_contours[5].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[10]; + _legend_land_contours[6].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[12]; + _legend_land_contours[7].colour = _heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[14]; } struct AndOr { @@ -1104,7 +1117,8 @@ } } else { if (this->map_type == SMT_CONTOUR) { - SetDParam(0, (tbl - _legend_table[this->map_type] + 1) * 100); + /* After having calculated the entry subtract 1 step to make the height legend start at zero.*/ + SetDParam(0, ((tbl - _legend_table[this->map_type] + 1) * MINIMAP_HEIGHT_STEP * HEIGHT_LEGEND_STEP) - (MINIMAP_HEIGHT_STEP * HEIGHT_LEGEND_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); Index: src/landscape.h =================================================================== --- src/landscape.h (revision 19760) +++ src/landscape.h (working copy) @@ -95,4 +95,12 @@ void InitializeLandscape(); void GenerateLandscape(byte mode); +/** + * Used for building up the smallmap height legend entries + * and for displaying the height difference in the tooltips in the viewports. + */ +enum { +MINIMAP_HEIGHT_STEP = 50, ///< 1 minimap legend heightstep is two heightlevelslevels +}; + #endif /* LANDSCAPE_H */ Index: src/viewport.cpp =================================================================== --- src/viewport.cpp (revision 19760) +++ src/viewport.cpp (working copy) @@ -2251,8 +2251,9 @@ } if (swap) Swap(h0, h1); - /* Minimap shows height in intervals of 50 meters, let's do the same */ - return (int)(h1 - h0) * 50; + /* Minimap shows height in intervals of MINIMAP_HEIGHT_STEP meters for each step, let's do the same. + * @note devide the result by 2 because the minimap height step is 2 tileheights and result would be incorrect values in the toolptips. */ + return (int)(h1 - h0) * MINIMAP_HEIGHT_STEP; } static const StringID measure_strings_length[] = {STR_NULL, STR_MEASURE_LENGTH, STR_MEASURE_LENGTH_HEIGHTDIFF};