summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-04-23 19:47:23 +0000
committersmatz <smatz@openttd.org>2008-04-23 19:47:23 +0000
commit112afdf7d8fe4551227f53a7fc416e4255764380 (patch)
tree6fa1915d48d50bfa1dae69dd8c4e8f57eba77ed1 /src
parentac0cfcde339c03dd0c6dabd77dd6f9b174bc0099 (diff)
downloadopenttd-112afdf7d8fe4551227f53a7fc416e4255764380.tar.xz
(svn r12853) -Fix: catenary on tunnel entrances and middle bridge pieces was drawn twice in some cases
Diffstat (limited to 'src')
-rw-r--r--src/elrail.cpp15
-rw-r--r--src/rail.h1
-rw-r--r--src/tunnelbridge_cmd.cpp4
3 files changed, 8 insertions, 12 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 3637f0ba5..a043863b6 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -377,8 +377,13 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
}
-static void DrawCatenaryOnBridge(const TileInfo *ti)
+void DrawCatenaryOnBridge(const TileInfo *ti)
{
+ if (_patches.disable_elrails) return;
+
+ /* Do not draw catenary if it is invisible */
+ if (IsInvisibilitySet(TO_CATENARY)) return;
+
TileIndex end = GetSouthernBridgeEnd(ti->tile);
TileIndex start = GetOtherBridgeEnd(end);
@@ -437,14 +442,6 @@ void DrawCatenary(const TileInfo *ti)
/* Do not draw catenary if it is invisible */
if (IsInvisibilitySet(TO_CATENARY)) return;
- if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile)) {
- TileIndex head = GetNorthernBridgeEnd(ti->tile);
-
- if (GetTunnelBridgeTransportType(head) == TRANSPORT_RAIL && HasCatenary(GetRailType(head))) {
- DrawCatenaryOnBridge(ti);
- }
- }
-
switch (GetTileType(ti->tile)) {
case MP_RAILWAY:
if (IsRailDepot(ti->tile)) {
diff --git a/src/rail.h b/src/rail.h
index 04a712d1c..85c648baa 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -216,6 +216,7 @@ static inline bool HasCatenary(RailType rt)
*/
void DrawCatenary(const TileInfo *ti);
void DrawCatenaryOnTunnel(const TileInfo *ti);
+void DrawCatenaryOnBridge(const TileInfo *ti);
Foundation GetRailFoundation(Slope tileh, TrackBits bits);
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 109f86baf..d95aa9f1c 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -886,8 +886,6 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
}
}
} else if (!IsInvisibilitySet(TO_CATENARY) && HasCatenary(GetRailType(ti->tile))) {
- DrawCatenary(ti);
-
catenary = true;
StartSpriteCombine();
DrawCatenaryOnTunnel(ti);
@@ -1089,7 +1087,7 @@ void DrawBridgeMiddle(const TileInfo* ti)
StartSpriteCombine();
}
} else if (HasCatenary(GetRailType(rampsouth))) {
- DrawCatenary(ti);
+ DrawCatenaryOnBridge(ti);
}
/* draw roof, the component of the bridge which is logically between the vehicle and the camera */