diff options
author | alberth <alberth@openttd.org> | 2009-12-30 17:44:38 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-12-30 17:44:38 +0000 |
commit | 0a7fc9e4ea157fa429f67839d1aa2567d5ecd4ce (patch) | |
tree | 46aefeb2bee21a1621ccb973452cf9e5e6778c77 | |
parent | ba3ef1a2d5fb1f0eda4ea76ad8a1d46ef380f372 (diff) | |
download | openttd-0a7fc9e4ea157fa429f67839d1aa2567d5ecd4ce.tar.xz |
(svn r18665) -Feature [FS#567]: Allow contour-map to be shown with coloured industries in smallmap.
-rw-r--r-- | src/lang/english.txt | 2 | ||||
-rw-r--r-- | src/smallmap_gui.cpp | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 2c094e3b8..6761e24db 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -693,6 +693,8 @@ STR_SMALLMAP_INDUSTRY :{TINYFONT}{STRI STR_SMALLMAP_TOWN :{TINYFONT}{WHITE}{TOWN} STR_SMALLMAP_DISABLE_ALL :{BLACK}Disable all STR_SMALLMAP_ENABLE_ALL :{BLACK}Enable all +STR_SMALLMAP_SHOW_HEIGHT :{BLACK}Show height +STR_SMALLMAP_TOOLTIP_SHOW_HEIGHT :{BLACK}Toggle display of heightmap # Status bar messages STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS :{BLACK}Show last message or news report diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 0e24ba57f..e51ad853a 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -47,6 +47,7 @@ enum SmallMapWindowWidgets { SM_WIDGET_SELECTINDUSTRIES, SM_WIDGET_ENABLEINDUSTRIES, SM_WIDGET_DISABLEINDUSTRIES, + SM_WIDGET_SHOW_HEIGHT, }; static int _smallmap_industry_count; ///< Number of used industries @@ -141,6 +142,8 @@ static const LegendAndColour _legend_land_owners[] = { static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES + 1]; /* For connecting industry type to position in industries list(small map legend) */ static uint _industry_to_list_pos[NUM_INDUSTRYTYPES]; +/** Show heightmap in industry mode of smallmap window. */ +static bool _smallmap_industry_show_heightmap; /** * Fills an array for the industries legends. @@ -307,11 +310,11 @@ static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile) return GetIndustrySpec(Industry::GetByTile(tile)->type)->map_colour * 0x01010101; } else { /* Otherwise, return the colour of the clear tiles, which will make it disappear */ - return ApplyMask(MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[MP_CLEAR]); + t = MP_CLEAR; } } - return ApplyMask(MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[t]); + return ApplyMask(_smallmap_industry_show_heightmap ? _map_height_bits[TileHeight(tile)] : MKCOLOUR(0x54545454), &_smallmap_vehicles_andor[t]); } /** @@ -775,6 +778,9 @@ public: this->InitNested(desc, window_number); this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR); + _smallmap_industry_show_heightmap = false; + this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_industry_show_heightmap); + this->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, this->show_towns); this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECTINDUSTRIES)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY); @@ -1024,6 +1030,12 @@ public: this->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES); this->SetDirty(); break; + + case SM_WIDGET_SHOW_HEIGHT: // Enable/disable showing of heightmap. + _smallmap_industry_show_heightmap = !_smallmap_industry_show_heightmap; + this->SetWidgetLoweredState(SM_WIDGET_SHOW_HEIGHT, _smallmap_industry_show_heightmap); + this->SetDirty(); + break; } } @@ -1245,8 +1257,9 @@ static const NWidgetPart _nested_smallmap_widgets[] = { NWidget(NWID_HORIZONTAL), NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECTINDUSTRIES), NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), - NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_ENABLEINDUSTRIES), SetMinimalSize(100, 12), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_NULL), - NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_DISABLEINDUSTRIES), SetMinimalSize(100, 12), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_NULL), + NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_ENABLEINDUSTRIES), SetDataTip(STR_SMALLMAP_ENABLE_ALL, STR_NULL), + NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_DISABLEINDUSTRIES), SetDataTip(STR_SMALLMAP_DISABLE_ALL, STR_NULL), + NWidget(WWT_TEXTBTN, COLOUR_BROWN, SM_WIDGET_SHOW_HEIGHT), SetDataTip(STR_SMALLMAP_SHOW_HEIGHT, STR_SMALLMAP_TOOLTIP_SHOW_HEIGHT), EndContainer(), NWidget(NWID_SPACER), SetFill(1, 1), EndContainer(), |