diff options
author | frosch <frosch@openttd.org> | 2016-07-22 21:29:04 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2016-07-22 21:29:04 +0000 |
commit | ed27cec0942ea73e538424448e2bd9affaec073c (patch) | |
tree | c0e664e22eacb0df6b366fa3bda4da2bfcaa7d24 /src | |
parent | 7a180dbb4eb2a466604ccaacc95888e66dd4e3c0 (diff) | |
download | openttd-ed27cec0942ea73e538424448e2bd9affaec073c.tar.xz |
(svn r27620) -Codechange: Inline GetEffectiveTileType (adf88)
Diffstat (limited to 'src')
-rw-r--r-- | src/smallmap_gui.cpp | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp index 571d8d765..3d14a3d54 100644 --- a/src/smallmap_gui.cpp +++ b/src/smallmap_gui.cpp @@ -413,26 +413,10 @@ static const byte _tiletype_importance[] = { }; -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) @@ -445,7 +429,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) @@ -458,7 +442,7 @@ 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) @@ -483,7 +467,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) @@ -516,7 +500,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) @@ -539,7 +523,7 @@ static const uint32 _vegetation_clear_bits[] = { * 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) @@ -566,7 +550,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) @@ -754,7 +738,24 @@ 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(tile); + + switch (ttype) { + case MP_TUNNELBRIDGE: { + TransportType tt = GetTunnelBridgeTransportType(tile); + + switch (tt) { + case TRANSPORT_RAIL: ttype = MP_RAILWAY; break; + case TRANSPORT_ROAD: ttype = MP_ROAD; break; + default: ttype = MP_WATER; break; + } + break; + } + + default: + break; + } + if (_tiletype_importance[ttype] > importance) { importance = _tiletype_importance[ttype]; tile = ti; |