1
0
Fork 0

(svn r18665) -Feature [FS#567]: Allow contour-map to be shown with coloured industries in smallmap.

release/1.0
alberth 2009-12-30 17:44:38 +00:00
parent ba3ef1a2d5
commit 0a7fc9e4ea
2 changed files with 19 additions and 4 deletions

View File

@ -693,6 +693,8 @@ STR_SMALLMAP_INDUSTRY :{TINYFONT}{STRI
STR_SMALLMAP_TOWN :{TINYFONT}{WHITE}{TOWN} STR_SMALLMAP_TOWN :{TINYFONT}{WHITE}{TOWN}
STR_SMALLMAP_DISABLE_ALL :{BLACK}Disable all STR_SMALLMAP_DISABLE_ALL :{BLACK}Disable all
STR_SMALLMAP_ENABLE_ALL :{BLACK}Enable 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 # Status bar messages
STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS :{BLACK}Show last message or news report STR_STATUSBAR_TOOLTIP_SHOW_LAST_NEWS :{BLACK}Show last message or news report

View File

@ -47,6 +47,7 @@ enum SmallMapWindowWidgets {
SM_WIDGET_SELECTINDUSTRIES, SM_WIDGET_SELECTINDUSTRIES,
SM_WIDGET_ENABLEINDUSTRIES, SM_WIDGET_ENABLEINDUSTRIES,
SM_WIDGET_DISABLEINDUSTRIES, SM_WIDGET_DISABLEINDUSTRIES,
SM_WIDGET_SHOW_HEIGHT,
}; };
static int _smallmap_industry_count; ///< Number of used industries 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]; static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES + 1];
/* For connecting industry type to position in industries list(small map legend) */ /* For connecting industry type to position in industries list(small map legend) */
static uint _industry_to_list_pos[NUM_INDUSTRYTYPES]; 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. * 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; return GetIndustrySpec(Industry::GetByTile(tile)->type)->map_colour * 0x01010101;
} else { } else {
/* Otherwise, return the colour of the clear tiles, which will make it disappear */ /* 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->InitNested(desc, window_number);
this->LowerWidget(this->map_type + SM_WIDGET_CONTOUR); 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->SetWidgetLoweredState(SM_WIDGET_TOGGLETOWNNAME, this->show_towns);
this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECTINDUSTRIES)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY); this->GetWidget<NWidgetStacked>(SM_WIDGET_SELECTINDUSTRIES)->SetDisplayedPlane(this->map_type != SMT_INDUSTRY);
@ -1024,6 +1030,12 @@ public:
this->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES); this->LowerWidget(SM_WIDGET_DISABLEINDUSTRIES);
this->SetDirty(); this->SetDirty();
break; 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_HORIZONTAL),
NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECTINDUSTRIES), NWidget(NWID_SELECTION, INVALID_COLOUR, SM_WIDGET_SELECTINDUSTRIES),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), 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_ENABLEINDUSTRIES), 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_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(), EndContainer(),
NWidget(NWID_SPACER), SetFill(1, 1), NWidget(NWID_SPACER), SetFill(1, 1),
EndContainer(), EndContainer(),