Use tinting for industry funding highlight, also cache it

This commit is contained in:
Pavel Stupnikov
2020-02-05 02:00:36 +03:00
parent abbc38728e
commit 830f265f55
6 changed files with 74 additions and 56 deletions

View File

@@ -219,8 +219,6 @@ bool _draw_dirty_blocks = false;
uint _dirty_block_colour = 0;
static VpSpriteSorter _vp_sprite_sorter = nullptr;
static IndustryType _industry_forbidden_tiles = INVALID_INDUSTRYTYPE;
static RailSnapMode _rail_snap_mode = RSM_NO_SNAP; ///< Type of rail track snapping (polyline tool).
static LineSnapPoints _tile_snap_points; ///< Tile to which a rail track will be snapped to (polyline tool).
static LineSnapPoints _rail_snap_points; ///< Set of points where a rail track will be snapped to (polyline tool).
@@ -1185,22 +1183,6 @@ static void DrawTileSelection(const TileInfo *ti)
}
}
void SetIndustryForbiddenTilesHighlight(IndustryType type) {
if (_settings_client.gui.show_industry_forbidden_tiles &&
_industry_forbidden_tiles != type) {
MarkWholeScreenDirty();
}
_industry_forbidden_tiles = type;
}
static void DrawIndustryForbiddenTiles(const TileInfo *ti) {
if (_settings_client.gui.show_industry_forbidden_tiles &&
_industry_forbidden_tiles != INVALID_INDUSTRYTYPE &&
!CanBuildIndustryOnTile(_industry_forbidden_tiles, ti->tile)) {
DrawTileSelectionRect(ti, PALETTE_SEL_TILE_RED);
}
}
/**
* Returns the y coordinate in the viewport coordinate system where the given
* tile is painted.
@@ -1329,7 +1311,6 @@ static void ViewportAddLandscape()
if (tile_info.tile != INVALID_TILE){
DrawTileZoning(&tile_info);
citymania::DrawTileSelection(&tile_info, _vd.cm_highlight);
DrawIndustryForbiddenTiles(&tile_info);
DrawTileSelection(&tile_info);
}
}