summaryrefslogtreecommitdiff
path: root/src/smallmap_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-07-22 21:44:54 +0000
committerfrosch <frosch@openttd.org>2016-07-22 21:44:54 +0000
commite56707bd4ed5b53b5655c6bbc83b9e7770a4916e (patch)
treef645041c099b5d3d42f8589a0b94c685cc50d402 /src/smallmap_gui.cpp
parenta5b7800aca3b1fd222e8c10d4122617ccd4941a3 (diff)
downloadopenttd-e56707bd4ed5b53b5655c6bbc83b9e7770a4916e.tar.xz
(svn r27622) -Change: In industry map view, give visible industry types the highest tile priority, and hidden industry types a lower one. This way filtered and highlighted industries are not hidden by overlapping tiles in zoomed-out smallmap. (adf88)
Diffstat (limited to 'src/smallmap_gui.cpp')
-rw-r--r--src/smallmap_gui.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 8b5d1e889..f4bcdece1 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -447,18 +447,6 @@ static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile, TileType t)
*/
static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile, TileType t)
{
- if (t == MP_INDUSTRY) {
- /* If industry is allowed to be seen, use its colour on the map */
- IndustryType type = Industry::GetByTile(tile)->type;
- if (_legend_from_industries[_industry_to_list_pos[type]].show_on_map &&
- (_smallmap_industry_highlight_state || type != _smallmap_industry_highlight)) {
- return (type == _smallmap_industry_highlight ? PC_WHITE : GetIndustrySpec(Industry::GetByTile(tile)->type)->map_colour) * 0x01010101;
- } else {
- /* Otherwise, return the colour which will make it disappear */
- t = (IsTileOnWater(tile) ? MP_WATER : MP_CLEAR);
- }
- }
-
const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
return ApplyMask(_smallmap_show_heightmap ? cs->height_colours[TileHeight(tile)] : cs->default_colour, &_smallmap_vehicles_andor[t]);
}
@@ -752,6 +740,24 @@ inline uint32 SmallMapWindow::GetTileColours(const TileArea &ta) const
break;
}
+ case MP_INDUSTRY:
+ /* Special handling of industries while in "Industries" smallmap view. */
+ if (this->map_type == SMT_INDUSTRY) {
+ /* If industry is allowed to be seen, use its colour on the map.
+ * This has the highest priority above any value in _tiletype_importance. */
+ IndustryType type = Industry::GetByTile(ti)->type;
+ if (_legend_from_industries[_industry_to_list_pos[type]].show_on_map) {
+ if (type == _smallmap_industry_highlight) {
+ if (_smallmap_industry_highlight_state) return MKCOLOUR_XXXX(PC_WHITE);
+ } else {
+ return GetIndustrySpec(type)->map_colour * 0x01010101;
+ }
+ }
+ /* Otherwise make it disappear */
+ ttype = IsTileOnWater(ti) ? MP_WATER : MP_CLEAR;
+ }
+ break;
+
default:
break;
}