Merge branch 'master' into jgrpp

# Conflicts:
#	config.lib
#	src/linkgraph/demands.cpp
#	src/linkgraph/mcf.cpp
#	src/linkgraph/refresh.cpp
#	src/linkgraph/refresh.h
#	src/smallmap_gui.cpp
This commit is contained in:
Jonathan G Rennison
2016-07-24 10:16:55 +01:00
17 changed files with 144 additions and 114 deletions

View File

@@ -320,26 +320,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)
@@ -352,7 +336,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)
@@ -365,23 +349,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]);
}
@@ -390,7 +362,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)
@@ -423,7 +395,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)
@@ -435,7 +407,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)
@@ -462,7 +434,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)
@@ -660,7 +632,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;