changeset 15757:1e5355f1ea66 draft

(svn r20424) -Fix: Rename members of TileContext (TC_NORMAL conflicted with an existing define on MinGW).
author terkhen <terkhen@openttd.org>
date Mon, 09 Aug 2010 10:59:30 +0000
parents 4f8174ec69c1
children 496f75db586c
files src/elrail.cpp src/newgrf_commons.cpp src/newgrf_commons.h src/newgrf_railtype.cpp src/newgrf_railtype.h src/rail_cmd.cpp src/tunnelbridge_cmd.cpp
diffstat 7 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -166,7 +166,7 @@
 /**
  * Get the base wire sprite to use.
  */
-static inline SpriteID GetWireBase(TileIndex tile, TileContext context = TC_NORMAL)
+static inline SpriteID GetWireBase(TileIndex tile, TileContext context = TCX_NORMAL)
 {
 	const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
 	SpriteID wires = GetCustomRailSprite(rti, tile, RTSG_WIRES, context);
@@ -176,7 +176,7 @@
 /**
  * Get the base pylon sprite to use.
  */
-static inline SpriteID GetPylonBase(TileIndex tile, TileContext context = TC_NORMAL)
+static inline SpriteID GetPylonBase(TileIndex tile, TileContext context = TCX_NORMAL)
 {
 	const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
 	SpriteID pylons = GetCustomRailSprite(rti, tile, RTSG_PYLONS, context);
@@ -303,7 +303,7 @@
 	AdjustTileh(ti->tile, &tileh[TS_HOME]);
 
 	SpriteID pylon_normal = GetPylonBase(ti->tile);
-	SpriteID pylon_halftile = (halftile_corner != CORNER_INVALID) ? GetPylonBase(ti->tile, TC_UPPER_HALFTILE) : pylon_normal;
+	SpriteID pylon_halftile = (halftile_corner != CORNER_INVALID) ? GetPylonBase(ti->tile, TCX_UPPER_HALFTILE) : pylon_normal;
 
 	for (DiagDirection i = DIAGDIR_BEGIN; i < DIAGDIR_END; i++) {
 		static const uint edge_corners[] = {
@@ -442,7 +442,7 @@
 	}
 
 	SpriteID wire_normal = GetWireBase(ti->tile);
-	SpriteID wire_halftile = (halftile_corner != CORNER_INVALID) ? GetWireBase(ti->tile, TC_UPPER_HALFTILE) : wire_normal;
+	SpriteID wire_halftile = (halftile_corner != CORNER_INVALID) ? GetWireBase(ti->tile, TCX_UPPER_HALFTILE) : wire_normal;
 	Track halftile_track;
 	switch (halftile_corner) {
 		case CORNER_W: halftile_track = TRACK_LEFT; break;
@@ -503,14 +503,14 @@
 
 	height = GetBridgeHeight(end);
 
-	SpriteID wire_base = GetWireBase(end, TC_ON_BRIDGE);
+	SpriteID wire_base = GetWireBase(end, TCX_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, TC_ON_BRIDGE);
+	SpriteID pylon_base = GetPylonBase(end, TCX_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
@@ -314,7 +314,7 @@
 					/* 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
 					RailGroundType ground = GetRailGroundType(tile);
-					has_snow = (ground == RAIL_GROUND_ICE_DESERT || (context == TC_UPPER_HALFTILE && ground == RAIL_GROUND_HALF_SNOW));
+					has_snow = (ground == RAIL_GROUND_ICE_DESERT || (context == TCX_UPPER_HALFTILE && ground == RAIL_GROUND_HALF_SNOW));
 					break;
 				}
 
@@ -333,7 +333,7 @@
 				}
 
 				case MP_TUNNELBRIDGE:
-					if (context == TC_ON_BRIDGE) {
+					if (context == TCX_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. */
--- a/src/newgrf_commons.h
+++ b/src/newgrf_commons.h
@@ -19,9 +19,9 @@
 
 /** Contextx for tile accesses */
 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).
+	TCX_NORMAL,         ///< Nothing special.
+	TCX_UPPER_HALFTILE, ///< Querying information about the upper part of a tile with halftile foundation.
+	TCX_ON_BRIDGE,      ///< Querying information about stuff on the bridge (via some bridgehead).
 };
 
 /**
@@ -131,7 +131,7 @@
 extern AirportOverrideManager _airport_mngr;
 extern AirportTileOverrideManager _airporttile_mngr;
 
-uint32 GetTerrainType(TileIndex tile, TileContext context = TC_NORMAL);
+uint32 GetTerrainType(TileIndex tile, TileContext context = TCX_NORMAL);
 TileIndex GetNearbyTile(byte parameter, TileIndex tile);
 uint32 GetNearbyTileInformation(TileIndex tile);
 
--- a/src/newgrf_railtype.cpp
+++ b/src/newgrf_railtype.cpp
@@ -135,5 +135,5 @@
  */
 void GetRailTypeResolver(ResolverObject *ro, uint index)
 {
-	NewRailTypeResolver(ro, index, TC_NORMAL);
+	NewRailTypeResolver(ro, index, TCX_NORMAL);
 }
--- a/src/newgrf_railtype.h
+++ b/src/newgrf_railtype.h
@@ -15,7 +15,7 @@
 #include "rail.h"
 #include "newgrf_commons.h"
 
-SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TC_NORMAL);
+SpriteID GetCustomRailSprite(const RailtypeInfo *rti, TileIndex tile, RailTypeSpriteGroup rtsg, TileContext context = TCX_NORMAL);
 
 uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile);
 
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -1809,7 +1809,7 @@
 {
 	/* Base sprite for track fences.
 	 * Note: Halftile slopes only have fences on the upper part. */
-	SpriteID base_image = GetCustomRailSprite(rti, ti->tile, RTSG_FENCES, IsHalftileSlope(ti->tileh) ? TC_UPPER_HALFTILE : TC_NORMAL);
+	SpriteID base_image = GetCustomRailSprite(rti, ti->tile, RTSG_FENCES, IsHalftileSlope(ti->tileh) ? TCX_UPPER_HALFTILE : TCX_NORMAL);
 	if (base_image == 0) base_image = SPR_TRACK_FENCE_FLAT_X;
 
 	switch (GetRailGroundType(ti->tile)) {
@@ -1968,8 +1968,8 @@
 
 	if (IsValidCorner(halftile_corner)) {
 		DrawFoundation(ti, HalftileFoundation(halftile_corner));
-		overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY, TC_UPPER_HALFTILE);
-		ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND, TC_UPPER_HALFTILE);
+		overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY, TCX_UPPER_HALFTILE);
+		ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND, TCX_UPPER_HALFTILE);
 
 		/* Draw higher halftile-overlay: Use the sloped sprites with three corners raised. They probably best fit the lightning. */
 		Slope fake_slope = SlopeWithThreeCornersRaised(OppositeCorner(halftile_corner));
--- 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, TC_ON_BRIDGE);
+			SpriteID surface = GetCustomRailSprite(rti, rampsouth, RTSG_BRIDGE, TCX_ON_BRIDGE);
 			if (surface != 0) {
 				AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
 			}