From b389425dda8a2a0cfe19a188cb1e0edc4aa72586 Mon Sep 17 00:00:00 2001 From: smatz Date: Sun, 17 Feb 2008 21:27:44 +0000 Subject: (svn r12170) -Fix: do not draw trees along road and street lights under low bridges (spotted by _minime_) --- src/road_cmd.cpp | 10 ++++++++++ src/tunnelbridge_cmd.cpp | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 22c978ae3..b6df0d704 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -1054,6 +1054,16 @@ static void DrawRoadBits(TileInfo* ti) /* Return if full detail is disabled, or we are zoomed fully out. */ if (!HasBit(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom > ZOOM_LVL_DETAIL) return; + /* Do not draw details (street lights, trees) under low bridge */ + if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && (roadside == ROADSIDE_TREES || roadside == ROADSIDE_STREET_LIGHTS)) { + uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); + uint minz = GetTileMaxZ(ti->tile) + 2 * TILE_HEIGHT; + + if (roadside == ROADSIDE_TREES) minz += TILE_HEIGHT; + + if (height < minz) return; + } + /* Draw extra details. */ for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) { DrawRoadDetail(drts->image, ti, drts->subcoord_x, drts->subcoord_y, 0x10); diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index d04c32ed6..c838b87b1 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -663,10 +663,16 @@ static CommandCost DoClearBridge(TileIndex tile, uint32 flags) /* read this value before actual removal of bridge */ bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL; Owner owner = GetTileOwner(tile); + uint height = GetBridgeHeight(tile); DoClearSquare(tile); DoClearSquare(endtile); for (TileIndex c = tile + delta; c != endtile; c += delta) { + /* do not let trees appear from 'nowhere' after removing bridge */ + if (IsNormalRoadTile(c) && GetRoadside(c) == ROADSIDE_TREES) { + uint minz = GetTileMaxZ(c) + 3 * TILE_HEIGHT; + if (height < minz) SetRoadside(c, ROADSIDE_PAVED); + } ClearBridgeMiddle(c); MarkTileDirtyByTile(c); } -- cgit v1.2.3-70-g09d2