summaryrefslogtreecommitdiff
path: root/src/road_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-02-17 21:27:44 +0000
committersmatz <smatz@openttd.org>2008-02-17 21:27:44 +0000
commitd75cccf5d53d5c8c206993b8aa34114e7e9844f1 (patch)
tree5dc8053aac29a312881ef952893822dae5870eeb /src/road_cmd.cpp
parent6bf44158c5a88caf59d9915a49cdbaba5774de46 (diff)
downloadopenttd-d75cccf5d53d5c8c206993b8aa34114e7e9844f1.tar.xz
(svn r12170) -Fix: do not draw trees along road and street lights under low bridges (spotted by _minime_)
Diffstat (limited to 'src/road_cmd.cpp')
-rw-r--r--src/road_cmd.cpp10
1 files changed, 10 insertions, 0 deletions
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);