summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-06-26 20:03:17 +0000
committerpeter1138 <peter1138@openttd.org>2007-06-26 20:03:17 +0000
commitf8a5b61f4e4a6304653db240be40c399c1ae46a6 (patch)
treeae0f97068cff3c16f178754179ecf01f754bf34c
parent3a46ed0dd429d5f466c0a79ff09c4ed0ae09bae4 (diff)
downloadopenttd-f8a5b61f4e4a6304653db240be40c399c1ae46a6.tar.xz
(svn r10344) -Fix (r10317): confusion between TRACK_n and TRACK_BIT_n stopped NW/SE slopes being picked up, and compare middle of tile against current z, not previous.
-rw-r--r--src/train_cmd.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 92a30bcbf..cbd3548f4 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2530,14 +2530,14 @@ static void TrainEnterStation(Vehicle *v, StationID station)
static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
{
byte old_z = v->z_pos;
- v->z_pos= GetSlopeZ(v->x_pos, v->y_pos);
+ v->z_pos = GetSlopeZ(v->x_pos, v->y_pos);
if (new_tile) {
CLRBIT(v->u.rail.flags, VRF_GOINGUP);
CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
- if ((v->u.rail.track == TRACK_X || v->u.rail.track == TRACK_Y)) {
- /* Any track that isn't TRACK_X or TRACK_Y cannot be sloped.
+ if (v->u.rail.track == TRACK_BIT_X || v->u.rail.track == TRACK_BIT_Y) {
+ /* Any track that isn't TRACK_BIT_X or TRACK_BIT_Y cannot be sloped.
* To check whether the current tile is sloped, and in which
* direction it is sloped, we get the 'z' at the center of
* the tile (middle_z) and the edge of the tile (old_z),
@@ -2549,7 +2549,7 @@ static byte AfterSetTrainPos(Vehicle *v, bool new_tile)
/* For some reason tunnel tiles are always given as sloped :(
* But they are not sloped... */
- if (middle_z != old_z && !IsTunnelTile(TileVirtXY(v->x_pos, v->y_pos))) {
+ if (middle_z != v->z_pos && !IsTunnelTile(TileVirtXY(v->x_pos, v->y_pos))) {
SETBIT(v->u.rail.flags, (middle_z > old_z) ? VRF_GOINGUP : VRF_GOINGDOWN);
}
}