(svn r12853) -Fix: catenary on tunnel entrances and middle bridge pieces was drawn twice in some cases
authorsmatz
Wed, 23 Apr 2008 19:47:23 +0000
changeset 10312 53a9159f194d
parent 10311 0b057db7a87f
child 10313 53b9d5708068
(svn r12853) -Fix: catenary on tunnel entrances and middle bridge pieces was drawn twice in some cases
src/elrail.cpp
src/rail.h
src/tunnelbridge_cmd.cpp
--- a/src/elrail.cpp	Wed Apr 23 19:07:18 2008 +0000
+++ b/src/elrail.cpp	Wed Apr 23 19:47:23 2008 +0000
@@ -377,8 +377,13 @@
 	}
 }
 
-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 @@
 	/* 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)) {
--- a/src/rail.h	Wed Apr 23 19:07:18 2008 +0000
+++ b/src/rail.h	Wed Apr 23 19:47:23 2008 +0000
@@ -216,6 +216,7 @@
  */
 void DrawCatenary(const TileInfo *ti);
 void DrawCatenaryOnTunnel(const TileInfo *ti);
+void DrawCatenaryOnBridge(const TileInfo *ti);
 
 Foundation GetRailFoundation(Slope tileh, TrackBits bits);
 
--- a/src/tunnelbridge_cmd.cpp	Wed Apr 23 19:07:18 2008 +0000
+++ b/src/tunnelbridge_cmd.cpp	Wed Apr 23 19:47:23 2008 +0000
@@ -886,8 +886,6 @@
 				}
 			}
 		} else if (!IsInvisibilitySet(TO_CATENARY) && HasCatenary(GetRailType(ti->tile))) {
-			DrawCatenary(ti);
-
 			catenary = true;
 			StartSpriteCombine();
 			DrawCatenaryOnTunnel(ti);
@@ -1089,7 +1087,7 @@
 			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 */