mirror of https://github.com/OpenTTD/OpenTTD
(svn r20424) -Fix: Rename members of TileContext (TC_NORMAL conflicted with an existing define on MinGW).
parent
7f1425c333
commit
78fd08c7b2
|
@ -166,7 +166,7 @@ static TrackBits MaskWireBits(TileIndex t, TrackBits tracks)
|
||||||
/**
|
/**
|
||||||
* Get the base wire sprite to use.
|
* 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));
|
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||||
SpriteID wires = GetCustomRailSprite(rti, tile, RTSG_WIRES, context);
|
SpriteID wires = GetCustomRailSprite(rti, tile, RTSG_WIRES, context);
|
||||||
|
@ -176,7 +176,7 @@ static inline SpriteID GetWireBase(TileIndex tile, TileContext context = TC_NORM
|
||||||
/**
|
/**
|
||||||
* Get the base pylon sprite to use.
|
* 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));
|
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(tile));
|
||||||
SpriteID pylons = GetCustomRailSprite(rti, tile, RTSG_PYLONS, context);
|
SpriteID pylons = GetCustomRailSprite(rti, tile, RTSG_PYLONS, context);
|
||||||
|
@ -303,7 +303,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||||
AdjustTileh(ti->tile, &tileh[TS_HOME]);
|
AdjustTileh(ti->tile, &tileh[TS_HOME]);
|
||||||
|
|
||||||
SpriteID pylon_normal = GetPylonBase(ti->tile);
|
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++) {
|
for (DiagDirection i = DIAGDIR_BEGIN; i < DIAGDIR_END; i++) {
|
||||||
static const uint edge_corners[] = {
|
static const uint edge_corners[] = {
|
||||||
|
@ -442,7 +442,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteID wire_normal = GetWireBase(ti->tile);
|
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;
|
Track halftile_track;
|
||||||
switch (halftile_corner) {
|
switch (halftile_corner) {
|
||||||
case CORNER_W: halftile_track = TRACK_LEFT; break;
|
case CORNER_W: halftile_track = TRACK_LEFT; break;
|
||||||
|
@ -503,14 +503,14 @@ void DrawCatenaryOnBridge(const TileInfo *ti)
|
||||||
|
|
||||||
height = GetBridgeHeight(end);
|
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,
|
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,
|
sss->x_size, sss->y_size, sss->z_size, height + sss->z_offset,
|
||||||
IsTransparencySet(TO_CATENARY)
|
IsTransparencySet(TO_CATENARY)
|
||||||
);
|
);
|
||||||
|
|
||||||
SpriteID pylon_base = GetPylonBase(end, TC_ON_BRIDGE);
|
SpriteID pylon_base = GetPylonBase(end, TCX_ON_BRIDGE);
|
||||||
|
|
||||||
/* Finished with wires, draw pylons
|
/* Finished with wires, draw pylons
|
||||||
* every other tile needs a pylon on the northern end */
|
* every other tile needs a pylon on the northern end */
|
||||||
|
|
|
@ -314,7 +314,7 @@ uint32 GetTerrainType(TileIndex tile, TileContext context)
|
||||||
/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
|
/* 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
|
if (_generating_world) goto genworld; // we do not care about foundations here
|
||||||
RailGroundType ground = GetRailGroundType(tile);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +333,7 @@ uint32 GetTerrainType(TileIndex tile, TileContext context)
|
||||||
}
|
}
|
||||||
|
|
||||||
case MP_TUNNELBRIDGE:
|
case MP_TUNNELBRIDGE:
|
||||||
if (context == TC_ON_BRIDGE) {
|
if (context == TCX_ON_BRIDGE) {
|
||||||
has_snow = (GetBridgeHeight(tile) > GetSnowLine());
|
has_snow = (GetBridgeHeight(tile) > GetSnowLine());
|
||||||
} else {
|
} else {
|
||||||
/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
|
/* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */
|
||||||
|
|
|
@ -19,9 +19,9 @@
|
||||||
|
|
||||||
/** Contextx for tile accesses */
|
/** Contextx for tile accesses */
|
||||||
enum TileContext {
|
enum TileContext {
|
||||||
TC_NORMAL, ///< Nothing special.
|
TCX_NORMAL, ///< Nothing special.
|
||||||
TC_UPPER_HALFTILE, ///< Querying information about the upper part of a tile with halftile foundation.
|
TCX_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_ON_BRIDGE, ///< Querying information about stuff on the bridge (via some bridgehead).
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,7 +131,7 @@ extern IndustryTileOverrideManager _industile_mngr;
|
||||||
extern AirportOverrideManager _airport_mngr;
|
extern AirportOverrideManager _airport_mngr;
|
||||||
extern AirportTileOverrideManager _airporttile_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);
|
TileIndex GetNearbyTile(byte parameter, TileIndex tile);
|
||||||
uint32 GetNearbyTileInformation(TileIndex tile);
|
uint32 GetNearbyTileInformation(TileIndex tile);
|
||||||
|
|
||||||
|
|
|
@ -135,5 +135,5 @@ uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile)
|
||||||
*/
|
*/
|
||||||
void GetRailTypeResolver(ResolverObject *ro, uint index)
|
void GetRailTypeResolver(ResolverObject *ro, uint index)
|
||||||
{
|
{
|
||||||
NewRailTypeResolver(ro, index, TC_NORMAL);
|
NewRailTypeResolver(ro, index, TCX_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include "rail.h"
|
#include "rail.h"
|
||||||
#include "newgrf_commons.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);
|
uint8 GetReverseRailTypeTranslation(RailType railtype, const GRFFile *grffile);
|
||||||
|
|
||||||
|
|
|
@ -1809,7 +1809,7 @@ static void DrawTrackDetails(const TileInfo *ti, const RailtypeInfo *rti)
|
||||||
{
|
{
|
||||||
/* Base sprite for track fences.
|
/* Base sprite for track fences.
|
||||||
* Note: Halftile slopes only have fences on the upper part. */
|
* 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;
|
if (base_image == 0) base_image = SPR_TRACK_FENCE_FLAT_X;
|
||||||
|
|
||||||
switch (GetRailGroundType(ti->tile)) {
|
switch (GetRailGroundType(ti->tile)) {
|
||||||
|
@ -1968,8 +1968,8 @@ static void DrawTrackBitsOverlay(TileInfo *ti, TrackBits track, const RailtypeIn
|
||||||
|
|
||||||
if (IsValidCorner(halftile_corner)) {
|
if (IsValidCorner(halftile_corner)) {
|
||||||
DrawFoundation(ti, HalftileFoundation(halftile_corner));
|
DrawFoundation(ti, HalftileFoundation(halftile_corner));
|
||||||
overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY, TC_UPPER_HALFTILE);
|
overlay = GetCustomRailSprite(rti, ti->tile, RTSG_OVERLAY, TCX_UPPER_HALFTILE);
|
||||||
ground = GetCustomRailSprite(rti, ti->tile, RTSG_GROUND, TC_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. */
|
/* 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));
|
Slope fake_slope = SlopeWithThreeCornersRaised(OppositeCorner(halftile_corner));
|
||||||
|
|
|
@ -1253,7 +1253,7 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
||||||
} else if (transport_type == TRANSPORT_RAIL) {
|
} else if (transport_type == TRANSPORT_RAIL) {
|
||||||
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(rampsouth));
|
const RailtypeInfo *rti = GetRailTypeInfo(GetRailType(rampsouth));
|
||||||
if (rti->UsesOverlay()) {
|
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) {
|
if (surface != 0) {
|
||||||
AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
|
AddSortableSpriteToDraw(surface + axis, PAL_NONE, x, y, 16, 16, 0, bridge_z, IsTransparencySet(TO_BRIDGES));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue