summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-08-09 07:32:04 +0000
committerfrosch <frosch@openttd.org>2010-08-09 07:32:04 +0000
commit7f1425c333327858dcd48db7c2718cd1d9d777c7 (patch)
tree69afdaff7326a8a2a9630b3ba6e62169a95d7d3a /src
parentb6cf38a9123bc560fe8b4dfcbfe492f5577c64ce (diff)
downloadopenttd-7f1425c333327858dcd48db7c2718cd1d9d777c7.tar.xz
(svn r20423) -Change [FS#3947]: Make snow on bridges depend on bridgeheight.
Diffstat (limited to 'src')
-rw-r--r--src/elrail.cpp4
-rw-r--r--src/newgrf_commons.cpp10
-rw-r--r--src/newgrf_commons.h1
-rw-r--r--src/tunnelbridge_cmd.cpp2
4 files changed, 11 insertions, 6 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 9743507c5..cbfa487ab 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -503,14 +503,14 @@ void DrawCatenaryOnBridge(const TileInfo *ti)
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 */
diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp
index 6fe8e56e4..7306f28cc 100644
--- a/src/newgrf_commons.cpp
+++ b/src/newgrf_commons.cpp
@@ -333,9 +333,13 @@ uint32 GetTerrainType(TileIndex tile, TileContext context)
}
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:
diff --git a/src/newgrf_commons.h b/src/newgrf_commons.h
index 9ff994a2e..a260eb0d5 100644
--- 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).
};
/**
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index 0c08fd11d..7cfa11c5c 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -1253,7 +1253,7 @@ void DrawBridgeMiddle(const TileInfo *ti)
} 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));
}