summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2006-04-12 12:12:51 +0000
committercelestar <celestar@openttd.org>2006-04-12 12:12:51 +0000
commite53edaf173af506889f6936999bb71208a3fc5a6 (patch)
treea4cd8f9d6569c2667208b9e1f1dc748a188f0283
parent7109274de438c06d7e30b9fc57a41c3bc8918ac0 (diff)
downloadopenttd-e53edaf173af506889f6936999bb71208a3fc5a6.tar.xz
(svn r4380) -Codechange: Make use of GetTrackBits where appropriate
-rw-r--r--rail_cmd.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/rail_cmd.c b/rail_cmd.c
index 407b8a687..a150286b1 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -1781,11 +1781,12 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_X)
)) {
TileIndex n = tile + TileDiffXY(0, -1);
+ TrackBits nrail = GetTrackBits(n);
if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_UPPER ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_LEFT) {
+ nrail == TRACK_BIT_UPPER ||
+ nrail == TRACK_BIT_LEFT) {
new_ground = RAIL_GROUND_FENCE_NW;
}
}
@@ -1795,11 +1796,12 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_X)
)) {
TileIndex n = tile + TileDiffXY(0, 1);
+ TrackBits nrail = GetTrackBits(n);
if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_LOWER ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_RIGHT) {
+ nrail == TRACK_BIT_LOWER ||
+ nrail == TRACK_BIT_RIGHT) {
new_ground = (new_ground == RAIL_GROUND_FENCE_NW) ?
RAIL_GROUND_FENCE_SENW : RAIL_GROUND_FENCE_SE;
}
@@ -1810,11 +1812,12 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_Y)
)) {
TileIndex n = tile + TileDiffXY(-1, 0);
+ TrackBits nrail = GetTrackBits(n);
if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_UPPER ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_RIGHT) {
+ nrail == TRACK_BIT_UPPER ||
+ nrail == TRACK_BIT_RIGHT) {
new_ground = RAIL_GROUND_FENCE_NE;
}
}
@@ -1824,11 +1827,12 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_Y)
)) {
TileIndex n = tile + TileDiffXY(1, 0);
+ TrackBits nrail = GetTrackBits(n);
if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_LOWER ||
- (_m[n].m5 & TRACK_BIT_MASK) == TRACK_BIT_LEFT) {
+ nrail == TRACK_BIT_LOWER ||
+ nrail == TRACK_BIT_LEFT) {
new_ground = (new_ground == RAIL_GROUND_FENCE_NE) ?
RAIL_GROUND_FENCE_NESW : RAIL_GROUND_FENCE_SW;
}