Merge branch 'cpp-11' into enhanced_viewport_overlay
# Conflicts: # src/rail_gui.cpp # src/saveload/saveload.cpp # src/smallmap_gui.cpp
This commit is contained in:
@@ -319,26 +319,10 @@ void BuildOwnerLegend()
|
||||
_smallmap_company_count = i;
|
||||
}
|
||||
|
||||
static inline TileType GetEffectiveTileType(TileIndex tile)
|
||||
{
|
||||
TileType t = GetTileType(tile);
|
||||
|
||||
if (t == MP_TUNNELBRIDGE) {
|
||||
TransportType tt = GetTunnelBridgeTransportType(tile);
|
||||
|
||||
switch (tt) {
|
||||
case TRANSPORT_RAIL: t = MP_RAILWAY; break;
|
||||
case TRANSPORT_ROAD: t = MP_ROAD; break;
|
||||
default: t = MP_WATER; break;
|
||||
}
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the colour a tile would be displayed with in the small map in mode "Contour".
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the small map in mode "Contour"
|
||||
*/
|
||||
static inline uint32 GetSmallMapContoursPixels(TileIndex tile, TileType t)
|
||||
@@ -351,7 +335,7 @@ static inline uint32 GetSmallMapContoursPixels(TileIndex tile, TileType t)
|
||||
* Return the colour a tile would be displayed with in the small map in mode "Vehicles".
|
||||
*
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the small map in mode "Vehicles"
|
||||
*/
|
||||
static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile, TileType t)
|
||||
@@ -364,23 +348,11 @@ static inline uint32 GetSmallMapVehiclesPixels(TileIndex tile, TileType t)
|
||||
* Return the colour a tile would be displayed with in the small map in mode "Industries".
|
||||
*
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the small map in mode "Industries"
|
||||
*/
|
||||
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]);
|
||||
}
|
||||
@@ -389,7 +361,7 @@ static inline uint32 GetSmallMapIndustriesPixels(TileIndex tile, TileType t)
|
||||
* Return the colour a tile would be displayed with in the small map in mode "Routes".
|
||||
*
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the small map in mode "Routes"
|
||||
*/
|
||||
static inline uint32 GetSmallMapRoutesPixels(TileIndex tile, TileType t)
|
||||
@@ -422,7 +394,7 @@ static inline uint32 GetSmallMapRoutesPixels(TileIndex tile, TileType t)
|
||||
* Return the colour a tile would be displayed with in the small map in mode "link stats".
|
||||
*
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the small map in mode "link stats"
|
||||
*/
|
||||
static inline uint32 GetSmallMapLinkStatsPixels(TileIndex tile, TileType t)
|
||||
@@ -434,7 +406,7 @@ static inline uint32 GetSmallMapLinkStatsPixels(TileIndex tile, TileType t)
|
||||
* Return the colour a tile would be displayed with in the smallmap in mode "Vegetation".
|
||||
*
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the smallmap in mode "Vegetation"
|
||||
*/
|
||||
static inline uint32 GetSmallMapVegetationPixels(TileIndex tile, TileType t)
|
||||
@@ -461,7 +433,7 @@ static inline uint32 GetSmallMapVegetationPixels(TileIndex tile, TileType t)
|
||||
* Return the colour a tile would be displayed with in the small map in mode "Owner".
|
||||
*
|
||||
* @param tile The tile of which we would like to get the colour.
|
||||
* @param t Effective tile type of the tile (see #GetEffectiveTileType).
|
||||
* @param t Effective tile type of the tile (see #GetTileColours).
|
||||
* @return The colour of tile in the small map in mode "Owner"
|
||||
*/
|
||||
static inline uint32 GetSmallMapOwnerPixels(TileIndex tile, TileType t)
|
||||
@@ -659,7 +631,42 @@ inline uint32 SmallMapWindow::GetTileColours(const TileArea &ta) const
|
||||
TileType et = MP_VOID; // Effective tile type at that position.
|
||||
|
||||
TILE_AREA_LOOP(ti, ta) {
|
||||
TileType ttype = GetEffectiveTileType(ti);
|
||||
TileType ttype = GetTileType(ti);
|
||||
|
||||
switch (ttype) {
|
||||
case MP_TUNNELBRIDGE: {
|
||||
TransportType tt = GetTunnelBridgeTransportType(ti);
|
||||
|
||||
switch (tt) {
|
||||
case TRANSPORT_RAIL: ttype = MP_RAILWAY; break;
|
||||
case TRANSPORT_ROAD: ttype = MP_ROAD; break;
|
||||
default: ttype = MP_WATER; break;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
if (_tiletype_importance[ttype] > importance) {
|
||||
importance = _tiletype_importance[ttype];
|
||||
tile = ti;
|
||||
|
Reference in New Issue
Block a user