Index: src/elrail.cpp =================================================================== --- src/elrail.cpp (revision 12735) +++ src/elrail.cpp (working copy) @@ -347,8 +347,11 @@ /* Don't draw a wire under a low bridge */ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) { uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); + uint height_here = ti->z + GetSlopeMaxZ(ti->tileh); - if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; + if (IsBridgeTile(ti->tile) && ti->tileh == SLOPE_FLAT) height_here += TILE_HEIGHT; // height of bridge ramp + + if (height <= height_here + TILE_HEIGHT) return; } /* Drawing of pylons is finished, now draw the wires */ @@ -416,7 +419,12 @@ if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos); uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos]; uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos]; - AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1); + /* Extent the pillar-BB onto the previous bridge piece (offset -1), + * but do not extent it onto the bridgehead (offset 0) to avoid interaction + * with another bridge over the bridgehead. */ + int x_offs = (axis == AXIS_X && num == 1) ? 0 : -1; + int y_offs = (axis == AXIS_Y && num == 1) ? 0 : -1; + AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), x_offs, y_offs); } /* need a pylon on the southern end of the bridge */ @@ -426,7 +434,10 @@ if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos); uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos]; uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos]; - AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1); + /* Same as above. Do not extent the pillar-BB onto the bridgehead */ + int x_size = axis == AXIS_X ? 0 : 1; + int y_size = axis == AXIS_Y ? 0 : 1; + AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, x_size, y_size, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_CATENARY), -1, -1); } }