diff --git a/src/lang/extra/english.txt b/src/lang/extra/english.txt index 70f58cd540..2e4254f369 100644 --- a/src/lang/extra/english.txt +++ b/src/lang/extra/english.txt @@ -407,6 +407,9 @@ STR_CONFIG_SETTING_ENABLE_SINGLE_VEH_SHARED_ORDER_GUI_HELPTEXT :Allow using the STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_SLOPES :Show slopes: {STRING2} STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_SLOPES_HELPTEXT :Whether to shade slopes, when zoomed out into map mode. +STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_HEIGHT :Show height: {STRING2} +STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_HEIGHT_HELPTEXT :Whether to shade height levels, when zoomed out into map mode and not in vegetation mode. + STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_BRIDGES :Show bridges: {STRING2} STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_BRIDGES_HELPTEXT :Whether to show a dotted line for bridges, when zoomed out into map mode. diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 9f355ee6e7..2a55ba2f7c 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -235,6 +235,7 @@ enum { GHK_CHANGE_MAP_MODE_NEXT, GHK_SWITCH_VIEWPORT_ROUTE_OVERLAY_MODE, GHK_SWITCH_VIEWPORT_MAP_SLOPE_MODE, + GHK_SWITCH_VIEWPORT_MAP_HEIGHT_MODE, }; struct MainWindow : Window @@ -473,6 +474,12 @@ struct MainWindow : Window MarkAllViewportMapLandscapesDirty(); break; } + case GHK_SWITCH_VIEWPORT_MAP_HEIGHT_MODE: { + _settings_client.gui.show_height_on_viewport_map = !_settings_client.gui.show_height_on_viewport_map; + extern void MarkAllViewportMapLandscapesDirty(); + MarkAllViewportMapLandscapesDirty(); + break; + } default: return ES_NOT_HANDLED; } @@ -593,6 +600,7 @@ static Hotkey global_hotkeys[] = { Hotkey(WKC_PAGEDOWN, "next_map_mode", GHK_CHANGE_MAP_MODE_NEXT), Hotkey((uint16)0, "switch_viewport_route_overlay_mode", GHK_SWITCH_VIEWPORT_ROUTE_OVERLAY_MODE), Hotkey((uint16)0, "switch_viewport_map_slope_mode", GHK_SWITCH_VIEWPORT_MAP_SLOPE_MODE), + Hotkey((uint16)0, "switch_viewport_map_height_mode", GHK_SWITCH_VIEWPORT_MAP_HEIGHT_MODE), HOTKEY_LIST_END }; HotkeyList MainWindow::hotkeys("global", global_hotkeys); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 0428885f2e..8b290d4275 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1992,6 +1992,7 @@ static SettingsContainer &GetSettingsTree() viewport_map->Add(new SettingEntry("gui.action_when_viewport_map_is_dblclicked")); viewport_map->Add(new SettingEntry("gui.show_scrolling_viewport_on_map")); viewport_map->Add(new SettingEntry("gui.show_slopes_on_viewport_map")); + viewport_map->Add(new SettingEntry("gui.show_height_on_viewport_map")); viewport_map->Add(new SettingEntry("gui.show_bridges_on_map")); viewport_map->Add(new SettingEntry("gui.show_tunnels_on_map")); viewport_map->Add(new SettingEntry("gui.use_owner_colour_for_tunnelbridge")); diff --git a/src/settings_type.h b/src/settings_type.h index 17948b0aed..3e52040561 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -173,6 +173,7 @@ struct GUISettings : public TimeSettings { uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel? uint8 scrollwheel_multiplier; ///< how much 'wheel' per incoming event from the OS? bool show_slopes_on_viewport_map; ///< use slope orientation to render the ground + bool show_height_on_viewport_map; ///< use height for shading when rendering the ground uint32 default_viewport_map_mode; ///< the mode to use by default when a viewport is in map mode, 0=owner, 1=industry, 2=vegetation uint32 action_when_viewport_map_is_dblclicked; ///< what to do when a doubleclick occurs on the viewport map uint32 show_scrolling_viewport_on_map; ///< when a no map viewport is scrolled, its location is marked on the other map viewports diff --git a/src/table/settings/settings.ini b/src/table/settings/settings.ini index d9eb81ebd0..0750a05429 100644 --- a/src/table/settings/settings.ini +++ b/src/table/settings/settings.ini @@ -4755,6 +4755,14 @@ str = STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_SLOPES strhelp = STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_SLOPES_HELPTEXT post_cb = ViewportMapLandscapeModeChanged +[SDTC_BOOL] +var = gui.show_height_on_viewport_map +flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC +def = true +str = STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_HEIGHT +strhelp = STR_CONFIG_SETTING_VIEWPORT_MAP_SHOW_HEIGHT_HELPTEXT +post_cb = ViewportMapLandscapeModeChanged + [SDTC_BOOL] var = gui.show_bridges_on_map flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC diff --git a/src/viewport.cpp b/src/viewport.cpp index c5da6ba2a4..f90f7a7d28 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -2993,7 +2993,6 @@ static inline uint32 ViewportMapGetColourIndustries(const TileIndex tile, const { extern LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES + 1]; extern uint _industry_to_list_pos[NUM_INDUSTRYTYPES]; - extern bool _smallmap_show_heightmap; TileType t2 = t; if (t == MP_INDUSTRY) { @@ -3044,7 +3043,7 @@ static inline uint32 ViewportMapGetColourIndustries(const TileIndex tile, const const int h = TileHeight(tile); const SmallMapColourScheme * const cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; - const uint32 colours = ApplyMask(_smallmap_show_heightmap ? cs->height_colours[h] : cs->default_colour, &_smallmap_vehicles_andor[t2]); + const uint32 colours = ApplyMask(_settings_client.gui.show_height_on_viewport_map ? cs->height_colours[h] : cs->default_colour, &_smallmap_vehicles_andor[t2]); uint32 colour = COLOUR_FROM_INDEX(colours); if (show_slope) ASSIGN_SLOPIFIED_COLOUR(tile, nullptr, colour, _lighten_colour[colour], _darken_colour[colour], colour); @@ -3078,8 +3077,8 @@ static inline uint32 ViewportMapGetColourOwner(const TileIndex tile, TileType t, } } - const int h = TileHeight(tile); - uint32 colour = COLOUR_FROM_INDEX(_heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[h]); + const SmallMapColourScheme * const cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; + uint32 colour = COLOUR_FROM_INDEX(_settings_client.gui.show_height_on_viewport_map ? cs->height_colours[TileHeight(tile)] : cs->default_colour); if (show_slope) ASSIGN_SLOPIFIED_COLOUR(tile, nullptr, colour, _lighten_colour[colour], _darken_colour[colour], colour); return IS32(colour); @@ -3143,9 +3142,11 @@ static inline uint32 ViewportMapGetColourRoutes(const TileIndex tile, TileType t return PC_WATER; } - default: - colour = COLOUR_FROM_INDEX(_heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[TileHeight(tile)]); + default: { + const SmallMapColourScheme * const cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; + colour = COLOUR_FROM_INDEX(_settings_client.gui.show_height_on_viewport_map ? cs->height_colours[TileHeight(tile)] : cs->default_colour); break; + } } break; } @@ -3179,9 +3180,11 @@ static inline uint32 ViewportMapGetColourRoutes(const TileIndex tile, TileType t FALLTHROUGH; } - default: - colour = COLOUR_FROM_INDEX(_heightmap_schemes[_settings_client.gui.smallmap_land_colour].height_colours[TileHeight(tile)]); + default: { + const SmallMapColourScheme * const cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour]; + colour = COLOUR_FROM_INDEX(_settings_client.gui.show_height_on_viewport_map ? cs->height_colours[TileHeight(tile)] : cs->default_colour); break; + } } if (show_slope) ASSIGN_SLOPIFIED_COLOUR(tile, nullptr, colour, _lighten_colour[colour], _darken_colour[colour], colour);