summaryrefslogtreecommitdiff
path: root/src/elrail.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-04 10:18:13 +0000
committerrubidium <rubidium@openttd.org>2011-11-04 10:18:13 +0000
commit7757a2ed406996be35c7179185f2e4e7cba37e12 (patch)
treeccf4b25e4efba9fee88cfb65ccabd68972c09400 /src/elrail.cpp
parent47203dbeb5080a5d24131a61ec12d1d3164bcb42 (diff)
downloadopenttd-7757a2ed406996be35c7179185f2e4e7cba37e12.tar.xz
(svn r23091) -Codechange: rename some Get*Z functions to Get*PixelZ functions if they return the Z in pixels (like TilePixelHeight)
Diffstat (limited to 'src/elrail.cpp')
-rw-r--r--src/elrail.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 74d0e45a5..b85cfcadb 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -216,16 +216,16 @@ static byte GetPCPElevation(TileIndex tile, DiagDirection PCPpos)
*
* This position can be outside of the tile, i.e. ?_pcp_offset == TILE_SIZE > TILE_SIZE - 1.
* So we have to move it inside the tile, because if the neighboured tile has a foundation,
- * that does not smoothly connect to the current tile, we will get a wrong elevation from GetSlopeZ().
+ * that does not smoothly connect to the current tile, we will get a wrong elevation from GetSlopePixelZ().
*
* When we move the position inside the tile, we will get a wrong elevation if we have a slope.
* To catch all cases we round the Z position to the next (TILE_HEIGHT / 2).
* This will return the correct elevation for slopes and will also detect non-continuous elevation on edges.
*
- * Also note that the result of GetSlopeZ() is very special on bridge-ramps.
+ * Also note that the result of GetSlopePixelZ() is very special on bridge-ramps.
*/
- byte z = GetSlopeZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1));
+ byte z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1));
return (z + 2) & ~3; // this means z = (z + TILE_HEIGHT / 4) / (TILE_HEIGHT / 2) * (TILE_HEIGHT / 2);
}
@@ -255,7 +255,7 @@ void DrawCatenaryOnTunnel(const TileInfo *ti)
AddSortableSpriteToDraw(
wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1,
- GetTileZ(ti->tile) + sss->z_offset,
+ GetTilePixelZ(ti->tile) + sss->z_offset,
IsTransparencySet(TO_CATENARY),
BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset
);
@@ -317,9 +317,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
TileIndex neighbour = ti->tile + TileOffsByDiagDir(i);
byte elevation = GetPCPElevation(ti->tile, i);
- /* Here's one of the main headaches. GetTileSlope does not correct for possibly
+ /* Here's one of the main headaches. GetTilePixelSlope does not correct for possibly
* existing foundataions, so we do have to do that manually later on.*/
- tileh[TS_NEIGHBOUR] = GetTileSlope(neighbour, NULL);
+ tileh[TS_NEIGHBOUR] = GetTilePixelSlope(neighbour, NULL);
trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, NULL);
wireconfig[TS_NEIGHBOUR] = MaskWireBits(neighbour, trackconfig[TS_NEIGHBOUR]);
if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;
@@ -376,7 +376,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour)));
}
- ApplyFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]);
+ ApplyPixelFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]);
/* Half tile slopes coincide only with horizontal/vertical track.
* Faking a flat slope results in the correct sprites on positions. */
@@ -401,9 +401,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile)) {
Track bridgetrack = GetBridgeAxis(ti->tile) == AXIS_X ? TRACK_X : TRACK_Y;
- uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
+ uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile));
- if ((height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) &&
+ if ((height <= GetTileMaxPixelZ(ti->tile) + TILE_HEIGHT) &&
(i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) {
SetBit(OverridePCP, i);
}
@@ -438,9 +438,9 @@ static void DrawCatenaryRailway(const TileInfo *ti)
/* Don't draw a wire under a low bridge */
if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) {
- uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
+ uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile));
- if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return;
+ if (height <= GetTileMaxPixelZ(ti->tile) + TILE_HEIGHT) return;
}
SpriteID wire_normal = GetWireBase(ti->tile);
@@ -470,11 +470,11 @@ static void DrawCatenaryRailway(const TileInfo *ti)
/*
* The "wire"-sprite position is inside the tile, i.e. 0 <= sss->?_offset < TILE_SIZE.
- * Therefore it is safe to use GetSlopeZ() for the elevation.
- * Also note that the result of GetSlopeZ() is very special for bridge-ramps.
+ * Therefore it is safe to use GetSlopePixelZ() for the elevation.
+ * Also note that the result of GetSlopePixelZ() is very special for bridge-ramps.
*/
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, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
+ sss->x_size, sss->y_size, sss->z_size, GetSlopePixelZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset,
IsTransparencySet(TO_CATENARY));
}
}
@@ -510,7 +510,7 @@ void DrawCatenaryOnBridge(const TileInfo *ti)
sss = &CatenarySpriteData[WIRE_X_FLAT_SW + (num % 2) + offset];
}
- height = GetBridgeHeight(end);
+ height = GetBridgePixelHeight(end);
SpriteID wire_base = GetWireBase(end, TCX_ON_BRIDGE);
@@ -561,7 +561,7 @@ void DrawCatenary(const TileInfo *ti)
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,
- GetTileMaxZ(ti->tile) + sss->z_offset,
+ GetTileMaxPixelZ(ti->tile) + sss->z_offset,
IsTransparencySet(TO_CATENARY)
);
return;