changeset 15756:4f8174ec69c1 draft

(svn r20423) -Change [FS#3947]: Make snow on bridges depend on bridgeheight.
author frosch <frosch@openttd.org>
date Mon, 09 Aug 2010 07:32:04 +0000
parents 7363ffaf0a0a
children 1e5355f1ea66
files src/elrail.cpp src/newgrf_commons.cpp src/newgrf_commons.h src/tunnelbridge_cmd.cpp
diffstat 4 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -503,14 +503,14 @@
 
 	height = GetBridgeHeight(end);
 
-	SpriteID wire_base = GetWireBase(end);
+	SpriteID wire_base = GetWireBase(end, TC_ON_BRIDGE);
 
 	AddSortableSpriteToDraw(wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
 		sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
 		IsTransparencySet(TO_CATENARY)
 	);
 
-	SpriteID pylon_base = GetPylonBase(end);
+	SpriteID pylon_base = GetPylonBase(end, TC_ON_BRIDGE);
 
 	/* Finished with wires, draw pylons
 	 * every other tile needs a pylon on the northern end */
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -333,9 +333,13 @@
 				}
 
 				case MP_TUNNELBRIDGE:
-					/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
-					if (_generating_world) goto genworld; // we do not care about foundations here
-					has_snow = HasTunnelBridgeSnowOrDesert(tile);
+					if (context == TC_ON_BRIDGE) {
+						has_snow = (GetBridgeHeight(tile) > GetSnowLine());
+					} else {
+						/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
+						if (_generating_world) goto genworld; // we do not care about foundations here
+						has_snow = HasTunnelBridgeSnowOrDesert(tile);
+					}
 					break;
 
 				case MP_STATION:
--- a/src/newgrf_commons.h
+++ b/src/newgrf_commons.h
@@ -21,6 +21,7 @@
 enum TileContext {
 	TC_NORMAL,         ///< Nothing special.
 	TC_UPPER_HALFTILE, ///< Querying information about the upper part of a tile with halftile foundation.
+	TC_ON_BRIDGE,      ///< Querying information about stuff on the bridge (via some bridgehead).
 };
 
 /**
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -1253,7 +1253,7 @@
 	} else if (transport_type == TRANSPORT_RAIL) {
 		const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(rampsouth));
 		if (rti->UsesOverlay()) {
-			SpriteID surface = GetCustomRailSprite(rti, rampsouth, RTSG_BRIDGE);
+			SpriteID surface = GetCustomRailSprite(rti, rampsouth, RTSG_BRIDGE, TC_ON_BRIDGE);
 			if (surface != 0) {
 				AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
 			}