summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pathfind.c16
-rw-r--r--rail.c38
-rw-r--r--rail.h32
-rw-r--r--rail_cmd.c116
-rw-r--r--rail_map.h2
-rw-r--r--road_cmd.c4
-rw-r--r--station_cmd.c6
-rw-r--r--waypoint.c4
8 files changed, 108 insertions, 110 deletions
diff --git a/pathfind.c b/pathfind.c
index 6da852771..9ece86052 100644
--- a/pathfind.c
+++ b/pathfind.c
@@ -623,18 +623,18 @@ static bool NtpCheck(NewTrackPathFinder *tpf, TileIndex tile, uint dir, uint len
static const uint16 _is_upwards_slope[15] = {
0, // no tileh
- (1 << TRACKDIR_DIAG1_SW) | (1 << TRACKDIR_DIAG2_NW), // 1
- (1 << TRACKDIR_DIAG1_SW) | (1 << TRACKDIR_DIAG2_SE), // 2
- (1 << TRACKDIR_DIAG1_SW), // 3
- (1 << TRACKDIR_DIAG1_NE) | (1 << TRACKDIR_DIAG2_SE), // 4
+ (1 << TRACKDIR_X_SW) | (1 << TRACKDIR_Y_NW), // 1
+ (1 << TRACKDIR_X_SW) | (1 << TRACKDIR_Y_SE), // 2
+ (1 << TRACKDIR_X_SW), // 3
+ (1 << TRACKDIR_X_NE) | (1 << TRACKDIR_Y_SE), // 4
0, // 5
- (1 << TRACKDIR_DIAG2_SE), // 6
+ (1 << TRACKDIR_Y_SE), // 6
0, // 7
- (1 << TRACKDIR_DIAG1_NE) | (1 << TRACKDIR_DIAG2_NW), // 8,
- (1 << TRACKDIR_DIAG2_NW), // 9
+ (1 << TRACKDIR_X_NE) | (1 << TRACKDIR_Y_NW), // 8,
+ (1 << TRACKDIR_Y_NW), // 9
0, //10
0, //11,
- (1 << TRACKDIR_DIAG1_NE), //12
+ (1 << TRACKDIR_X_NE), //12
0, //13
0, //14
};
diff --git a/rail.c b/rail.c
index 7435411b2..286bf3e49 100644
--- a/rail.c
+++ b/rail.c
@@ -30,21 +30,21 @@ const byte _signal_on_track[] = {
* track entering in this direction (including those making 90 degree turns)
*/
const TrackdirBits _exitdir_reaches_trackdirs[] = {
- TRACKDIR_BIT_DIAG1_NE | TRACKDIR_BIT_LOWER_E | TRACKDIR_BIT_LEFT_N, /* DIAGDIR_NE */
- TRACKDIR_BIT_DIAG2_SE | TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_UPPER_E, /* DIAGDIR_SE */
- TRACKDIR_BIT_DIAG1_SW | TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_RIGHT_S, /* DIAGDIR_SW */
- TRACKDIR_BIT_DIAG2_NW | TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_W /* DIAGDIR_NW */
+ TRACKDIR_BIT_X_NE | TRACKDIR_BIT_LOWER_E | TRACKDIR_BIT_LEFT_N, /* DIAGDIR_NE */
+ TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_LEFT_S | TRACKDIR_BIT_UPPER_E, /* DIAGDIR_SE */
+ TRACKDIR_BIT_X_SW | TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_RIGHT_S, /* DIAGDIR_SW */
+ TRACKDIR_BIT_Y_NW | TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_LOWER_W /* DIAGDIR_NW */
};
const Trackdir _next_trackdir[] = {
- TRACKDIR_DIAG1_NE, TRACKDIR_DIAG2_SE, TRACKDIR_LOWER_E, TRACKDIR_UPPER_E, TRACKDIR_RIGHT_S, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR,
- TRACKDIR_DIAG1_SW, TRACKDIR_DIAG2_NW, TRACKDIR_LOWER_W, TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N
+ TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_LOWER_E, TRACKDIR_UPPER_E, TRACKDIR_RIGHT_S, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR,
+ TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_LOWER_W, TRACKDIR_UPPER_W, TRACKDIR_RIGHT_N, TRACKDIR_LEFT_N
};
/* Maps a trackdir to all trackdirs that make 90 deg turns with it. */
const TrackdirBits _track_crosses_trackdirs[] = {
- TRACKDIR_BIT_DIAG2_SE | TRACKDIR_BIT_DIAG2_NW, /* TRACK_DIAG1 */
- TRACKDIR_BIT_DIAG1_NE | TRACKDIR_BIT_DIAG1_SW, /* TRACK_DIAG2 */
+ TRACKDIR_BIT_Y_SE | TRACKDIR_BIT_Y_NW, /* TRACK_X */
+ TRACKDIR_BIT_X_NE | TRACKDIR_BIT_X_SW, /* TRACK_Y */
TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, /* TRACK_UPPER */
TRACKDIR_BIT_RIGHT_N | TRACKDIR_BIT_RIGHT_S | TRACKDIR_BIT_LEFT_N | TRACKDIR_BIT_LEFT_S, /* TRACK_LOWER */
TRACKDIR_BIT_UPPER_W | TRACKDIR_BIT_UPPER_E | TRACKDIR_BIT_LOWER_W | TRACKDIR_BIT_LOWER_E, /* TRACK_LEFT */
@@ -53,8 +53,8 @@ const TrackdirBits _track_crosses_trackdirs[] = {
/* Maps a track to all tracks that make 90 deg turns with it. */
const TrackBits _track_crosses_tracks[] = {
- TRACK_BIT_DIAG2, /* TRACK_DIAG1 */
- TRACK_BIT_DIAG1, /* TRACK_DIAG2 */
+ TRACK_BIT_Y, /* TRACK_X */
+ TRACK_BIT_X, /* TRACK_Y */
TRACK_BIT_LEFT | TRACK_BIT_RIGHT, /* TRACK_UPPER */
TRACK_BIT_LEFT | TRACK_BIT_RIGHT, /* TRACK_LOWER */
TRACK_BIT_UPPER | TRACK_BIT_LOWER, /* TRACK_LEFT */
@@ -69,8 +69,8 @@ const DiagDirection _trackdir_to_exitdir[] = {
};
const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
- {TRACKDIR_DIAG1_NE, INVALID_TRACKDIR, TRACKDIR_DIAG1_SW, INVALID_TRACKDIR},
- {INVALID_TRACKDIR, TRACKDIR_DIAG2_SE, INVALID_TRACKDIR, TRACKDIR_DIAG2_NW},
+ {TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR},
+ {INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW},
{TRACKDIR_UPPER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_W},
{INVALID_TRACKDIR, TRACKDIR_LOWER_E, TRACKDIR_LOWER_W, INVALID_TRACKDIR},
{INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LEFT_S, TRACKDIR_LEFT_N},
@@ -78,8 +78,8 @@ const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
};
const Trackdir _track_enterdir_to_trackdir[][DIAGDIR_END] = { // TODO: replace magic with enums
- {TRACKDIR_DIAG1_NE, INVALID_TRACKDIR, TRACKDIR_DIAG1_SW, INVALID_TRACKDIR},
- {INVALID_TRACKDIR, TRACKDIR_DIAG2_SE, INVALID_TRACKDIR, TRACKDIR_DIAG2_NW},
+ {TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR},
+ {INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, TRACKDIR_Y_NW},
{INVALID_TRACKDIR, TRACKDIR_UPPER_E, TRACKDIR_UPPER_W, INVALID_TRACKDIR},
{TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W},
{TRACKDIR_LEFT_N, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR},
@@ -87,8 +87,8 @@ const Trackdir _track_enterdir_to_trackdir[][DIAGDIR_END] = { // TODO: replace m
};
const Trackdir _track_direction_to_trackdir[][DIR_END] = {
- {INVALID_TRACKDIR, TRACKDIR_DIAG1_NE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_DIAG1_SW, INVALID_TRACKDIR, INVALID_TRACKDIR},
- {INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_DIAG2_SE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_DIAG2_NW},
+ {INVALID_TRACKDIR, TRACKDIR_X_NE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR, INVALID_TRACKDIR},
+ {INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_Y_SE, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_Y_NW},
{INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_UPPER_W, INVALID_TRACKDIR},
{INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_E, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LOWER_W, INVALID_TRACKDIR},
{TRACKDIR_LEFT_N, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_LEFT_S, INVALID_TRACKDIR, INVALID_TRACKDIR, INVALID_TRACKDIR},
@@ -96,7 +96,7 @@ const Trackdir _track_direction_to_trackdir[][DIR_END] = {
};
const Trackdir _dir_to_diag_trackdir[] = {
- TRACKDIR_DIAG1_NE, TRACKDIR_DIAG2_SE, TRACKDIR_DIAG1_SW, TRACKDIR_DIAG2_NW,
+ TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_X_SW, TRACKDIR_Y_NW,
};
const DiagDirection _reverse_diagdir[] = {
@@ -104,8 +104,8 @@ const DiagDirection _reverse_diagdir[] = {
};
const Trackdir _reverse_trackdir[] = {
- TRACKDIR_DIAG1_SW, TRACKDIR_DIAG2_NW, TRACKDIR_UPPER_W, TRACKDIR_LOWER_W, TRACKDIR_LEFT_N, TRACKDIR_RIGHT_N, INVALID_TRACKDIR, INVALID_TRACKDIR,
- TRACKDIR_DIAG1_NE, TRACKDIR_DIAG2_SE, TRACKDIR_UPPER_E, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S, TRACKDIR_RIGHT_S
+ TRACKDIR_X_SW, TRACKDIR_Y_NW, TRACKDIR_UPPER_W, TRACKDIR_LOWER_W, TRACKDIR_LEFT_N, TRACKDIR_RIGHT_N, INVALID_TRACKDIR, INVALID_TRACKDIR,
+ TRACKDIR_X_NE, TRACKDIR_Y_SE, TRACKDIR_UPPER_E, TRACKDIR_LOWER_E, TRACKDIR_LEFT_S, TRACKDIR_RIGHT_S
};
RailType GetTileRailType(TileIndex tile, Trackdir trackdir)
diff --git a/rail.h b/rail.h
index 9938bdb7f..794a9fe9a 100644
--- a/rail.h
+++ b/rail.h
@@ -67,8 +67,8 @@ enum {
/** These are used to specify a single track. Can be translated to a trackbit
* with TrackToTrackbit */
typedef enum Tracks {
- TRACK_DIAG1 = 0,
- TRACK_DIAG2 = 1,
+ TRACK_X = 0,
+ TRACK_Y = 1,
TRACK_UPPER = 2,
TRACK_LOWER = 3,
TRACK_LEFT = 4,
@@ -79,8 +79,8 @@ typedef enum Tracks {
/** These are the bitfield variants of the above */
typedef enum TrackBits {
- TRACK_BIT_DIAG1 = 1U, // 0
- TRACK_BIT_DIAG2 = 2U, // 1
+ TRACK_BIT_X = 1U, // 0
+ TRACK_BIT_Y = 2U, // 1
TRACK_BIT_UPPER = 4U, // 2
TRACK_BIT_LOWER = 8U, // 3
TRACK_BIT_LEFT = 16U, // 4
@@ -91,16 +91,16 @@ typedef enum TrackBits {
/** These are a combination of tracks and directions. Values are 0-5 in one
direction (corresponding to the Track enum) and 8-13 in the other direction. */
typedef enum Trackdirs {
- TRACKDIR_DIAG1_NE = 0,
- TRACKDIR_DIAG2_SE = 1,
+ TRACKDIR_X_NE = 0,
+ TRACKDIR_Y_SE = 1,
TRACKDIR_UPPER_E = 2,
TRACKDIR_LOWER_E = 3,
TRACKDIR_LEFT_S = 4,
TRACKDIR_RIGHT_S = 5,
/* Note the two missing values here. This enables trackdir -> track
* conversion by doing (trackdir & 7) */
- TRACKDIR_DIAG1_SW = 8,
- TRACKDIR_DIAG2_NW = 9,
+ TRACKDIR_X_SW = 8,
+ TRACKDIR_Y_NW = 9,
TRACKDIR_UPPER_W = 10,
TRACKDIR_LOWER_W = 11,
TRACKDIR_LEFT_N = 12,
@@ -112,15 +112,15 @@ typedef enum Trackdirs {
/** These are a combination of tracks and directions. Values are 0-5 in one
direction (corresponding to the Track enum) and 8-13 in the other direction. */
typedef enum TrackdirBits {
- TRACKDIR_BIT_DIAG1_NE = 0x1,
- TRACKDIR_BIT_DIAG2_SE = 0x2,
+ TRACKDIR_BIT_X_NE = 0x1,
+ TRACKDIR_BIT_Y_SE = 0x2,
TRACKDIR_BIT_UPPER_E = 0x4,
TRACKDIR_BIT_LOWER_E = 0x8,
TRACKDIR_BIT_LEFT_S = 0x10,
TRACKDIR_BIT_RIGHT_S = 0x20,
/* Again, note the two missing values here. This enables trackdir -> track conversion by doing (trackdir & 0xFF) */
- TRACKDIR_BIT_DIAG1_SW = 0x0100,
- TRACKDIR_BIT_DIAG2_NW = 0x0200,
+ TRACKDIR_BIT_X_SW = 0x0100,
+ TRACKDIR_BIT_Y_NW = 0x0200,
TRACKDIR_BIT_UPPER_W = 0x0400,
TRACKDIR_BIT_LOWER_W = 0x0800,
TRACKDIR_BIT_LEFT_N = 0x1000,
@@ -481,7 +481,7 @@ static inline DiagDirection DirToDiagdir(Direction dir) {
}
/* Checks if a given Track is diagonal */
-static inline bool IsDiagonalTrack(Track track) { return (track == TRACK_DIAG1) || (track == TRACK_DIAG2); }
+static inline bool IsDiagonalTrack(Track track) { return (track == TRACK_X) || (track == TRACK_Y); }
/* Checks if a given Trackdir is diagonal. */
static inline bool IsDiagonalTrackdir(Trackdir trackdir) { return IsDiagonalTrack(TrackdirToTrack(trackdir)); }
@@ -586,10 +586,10 @@ static inline TransportType GetCrossingTransportType(TileIndex tile, Track track
{
/* XXX: Nicer way to write this? */
switch (track) {
- /* When map5 bit 3 is set, the road runs in the y direction (DIAG2) */
- case TRACK_DIAG1:
+ /* When map5 bit 3 is set, the road runs in the y direction */
+ case TRACK_X:
return (HASBIT(_m[tile].m5, 3) ? TRANSPORT_RAIL : TRANSPORT_ROAD);
- case TRACK_DIAG2:
+ case TRACK_Y:
return (HASBIT(_m[tile].m5, 3) ? TRANSPORT_ROAD : TRANSPORT_RAIL);
default:
assert(0);
diff --git a/rail_cmd.c b/rail_cmd.c
index eb98ce8b8..6b33d4d67 100644
--- a/rail_cmd.c
+++ b/rail_cmd.c
@@ -134,22 +134,22 @@ static const byte _valid_tileh_slopes[4][15] = {
// set of normal ones
{
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
TRACK_BIT_RIGHT,
TRACK_BIT_UPPER,
- TRACK_BIT_DIAG1,
+ TRACK_BIT_X,
TRACK_BIT_LEFT,
0,
- TRACK_BIT_DIAG2,
+ TRACK_BIT_Y,
TRACK_BIT_LOWER,
TRACK_BIT_LOWER,
- TRACK_BIT_DIAG2,
+ TRACK_BIT_Y,
0,
TRACK_BIT_LEFT,
- TRACK_BIT_DIAG1,
+ TRACK_BIT_X,
TRACK_BIT_UPPER,
TRACK_BIT_RIGHT,
},
@@ -159,21 +159,21 @@ static const byte _valid_tileh_slopes[4][15] = {
0,
TRACK_BIT_LEFT,
TRACK_BIT_LOWER,
- TRACK_BIT_DIAG2 | TRACK_BIT_LOWER | TRACK_BIT_LEFT,
+ TRACK_BIT_Y | TRACK_BIT_LOWER | TRACK_BIT_LEFT,
TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1 | TRACK_BIT_LOWER | TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X | TRACK_BIT_LOWER | TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
TRACK_BIT_UPPER,
- TRACK_BIT_DIAG1 | TRACK_BIT_UPPER | TRACK_BIT_LEFT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X | TRACK_BIT_UPPER | TRACK_BIT_LEFT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG2 | TRACK_BIT_UPPER | TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_Y | TRACK_BIT_UPPER | TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
},
// allowed rail on coast tile
@@ -181,21 +181,21 @@ static const byte _valid_tileh_slopes[4][15] = {
0,
TRACK_BIT_LEFT,
TRACK_BIT_LOWER,
- TRACK_BIT_DIAG2|TRACK_BIT_LEFT|TRACK_BIT_LOWER,
+ TRACK_BIT_Y|TRACK_BIT_LEFT|TRACK_BIT_LOWER,
TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_RIGHT|TRACK_BIT_LOWER,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_RIGHT|TRACK_BIT_LOWER,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
TRACK_BIT_UPPER,
- TRACK_BIT_DIAG1|TRACK_BIT_LEFT|TRACK_BIT_UPPER,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_LEFT|TRACK_BIT_UPPER,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG2|TRACK_BIT_RIGHT|TRACK_BIT_UPPER,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
- TRACK_BIT_DIAG1|TRACK_BIT_DIAG2|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_Y|TRACK_BIT_RIGHT|TRACK_BIT_UPPER,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
+ TRACK_BIT_X|TRACK_BIT_Y|TRACK_BIT_UPPER|TRACK_BIT_LOWER|TRACK_BIT_LEFT|TRACK_BIT_RIGHT,
},
// valid railway crossings on slopes
@@ -224,8 +224,8 @@ uint GetRailFoundation(uint tileh, uint bits)
(i += 2, tileh == 4) ||
(i += 2, tileh == 8)
) && (
- bits == TRACK_BIT_DIAG1 ||
- (i++, bits == TRACK_BIT_DIAG2)
+ bits == TRACK_BIT_X ||
+ (i++, bits == TRACK_BIT_Y)
)) {
return i + 15;
} else {
@@ -251,7 +251,7 @@ static uint32 CheckRailSlope(uint tileh, TrackBits rail_bits, TrackBits existing
return 0;
if ((~_valid_tileh_slopes[1][tileh] & rail_bits) == 0 || ( // whole tile is leveled up
- (rail_bits == TRACK_BIT_DIAG1 || rail_bits == TRACK_BIT_DIAG2) &&
+ (rail_bits == TRACK_BIT_X || rail_bits == TRACK_BIT_Y) &&
(tileh == 1 || tileh == 2 || tileh == 4 || tileh == 8)
)) { // partly up
if (existing != 0) {
@@ -296,7 +296,7 @@ int32 CmdBuildSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
switch (GetTileType(tile)) {
case MP_TUNNELBRIDGE:
if ((m5 & 0xC0) != 0xC0 || // not bridge middle part?
- (m5 & 0x01 ? TRACK_BIT_DIAG1 : TRACK_BIT_DIAG2) != trackbit) { // wrong direction?
+ (m5 & 0x01 ? TRACK_BIT_X : TRACK_BIT_Y) != trackbit) { // wrong direction?
// Get detailed error message
return DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
}
@@ -351,16 +351,16 @@ int32 CmdBuildSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
if (GetRoadType(tile) == ROAD_NORMAL && (
- (track == TRACK_DIAG1 && m5 == ROAD_Y) ||
- (track == TRACK_DIAG2 && m5 == ROAD_X) // correct direction?
+ (track == TRACK_X && m5 == ROAD_Y) ||
+ (track == TRACK_Y && m5 == ROAD_X) // correct direction?
)) {
if (flags & DC_EXEC) {
- MakeRoadCrossing(tile, GetTileOwner(tile), _current_player, (track == TRACK_DIAG1 ? AXIS_Y : AXIS_X), p1, _m[tile].m2);
+ MakeRoadCrossing(tile, GetTileOwner(tile), _current_player, (track == TRACK_X ? AXIS_Y : AXIS_X), p1, _m[tile].m2);
}
break;
}
- if (IsLevelCrossing(tile) && (m5 & 0x08 ? TRACK_DIAG1 : TRACK_DIAG2) == track)
+ if (IsLevelCrossing(tile) && (m5 & 0x08 ? TRACK_X : TRACK_Y) == track)
return_cmd_error(STR_1007_ALREADY_BUILT);
/* FALLTHROUGH */
@@ -423,7 +423,7 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if ((_m[tile].m5 & 0xF8) != 0xE0)
return CMD_ERROR;
- if ((_m[tile].m5 & 1 ? TRACK_BIT_DIAG1 : TRACK_BIT_DIAG2) != trackbit)
+ if ((_m[tile].m5 & 1 ? TRACK_BIT_X : TRACK_BIT_Y) != trackbit)
return CMD_ERROR;
if (!(flags & DC_EXEC))
@@ -440,12 +440,10 @@ int32 CmdRemoveSingleRail(int x, int y, uint32 flags, uint32 p1, uint32 p2)
/* This is a crossing, let's check if the direction is correct */
if (_m[tile].m5 & 8) {
- if (track != TRACK_DIAG1)
- return CMD_ERROR;
+ if (track != TRACK_X) return CMD_ERROR;
bits = ROAD_Y;
} else {
- if (track != TRACK_DIAG2)
- return CMD_ERROR;
+ if (track != TRACK_Y) return CMD_ERROR;
bits = ROAD_X;
}
@@ -1072,8 +1070,8 @@ static int32 ClearTile_Track(TileIndex tile, byte flags)
switch (GetRailTileType(tile)) {
/* XXX: Why the fuck do we remove these thow signals first? */
case RAIL_TYPE_SIGNALS:
- if (HasSignalOnTrack(tile, TRACK_DIAG1)) {
- ret = DoCommandByTile(tile, TRACK_DIAG1, 0, flags, CMD_REMOVE_SIGNALS);
+ if (HasSignalOnTrack(tile, TRACK_X)) {
+ ret = DoCommandByTile(tile, TRACK_X, 0, flags, CMD_REMOVE_SIGNALS);
if (CmdFailed(ret)) return CMD_ERROR;
cost += ret;
}
@@ -1305,22 +1303,22 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track, bool earth, bool snow,
bool junction = false;
// Select the sprite to use.
- (image = rti->base_sprites.track_y, track == TRACK_BIT_DIAG2) ||
- (image++, track == TRACK_BIT_DIAG1) ||
+ (image = rti->base_sprites.track_y, track == TRACK_BIT_Y) ||
+ (image++, track == TRACK_BIT_X) ||
(image++, track == TRACK_BIT_UPPER) ||
(image++, track == TRACK_BIT_LOWER) ||
(image++, track == TRACK_BIT_RIGHT) ||
(image++, track == TRACK_BIT_LEFT) ||
- (image++, track == (TRACK_BIT_DIAG1 | TRACK_BIT_DIAG2)) ||
+ (image++, track == (TRACK_BIT_X | TRACK_BIT_Y)) ||
(image = rti->base_sprites.track_ns, track == (TRACK_BIT_UPPER | TRACK_BIT_LOWER)) ||
(image++, track == (TRACK_BIT_LEFT | TRACK_BIT_RIGHT)) ||
(junction = true, false) ||
- (image = rti->base_sprites.ground, !(track & (TRACK_BIT_RIGHT | TRACK_BIT_UPPER | TRACK_BIT_DIAG1))) ||
- (image++, !(track & (TRACK_BIT_LEFT | TRACK_BIT_LOWER | TRACK_BIT_DIAG1))) ||
- (image++, !(track & (TRACK_BIT_LEFT | TRACK_BIT_UPPER | TRACK_BIT_DIAG2))) ||
- (image++, !(track & (TRACK_BIT_RIGHT | TRACK_BIT_LOWER | TRACK_BIT_DIAG2))) ||
+ (image = rti->base_sprites.ground, !(track & (TRACK_BIT_RIGHT | TRACK_BIT_UPPER | TRACK_BIT_X))) ||
+ (image++, !(track & (TRACK_BIT_LEFT | TRACK_BIT_LOWER | TRACK_BIT_X))) ||
+ (image++, !(track & (TRACK_BIT_LEFT | TRACK_BIT_UPPER | TRACK_BIT_Y))) ||
+ (image++, !(track & (TRACK_BIT_RIGHT | TRACK_BIT_LOWER | TRACK_BIT_Y))) ||
(image++, true);
if (ti->tileh != 0) {
@@ -1351,8 +1349,8 @@ static void DrawTrackBits(TileInfo* ti, TrackBits track, bool earth, bool snow,
// Draw track pieces individually for junction tiles
if (junction) {
- if (track & TRACK_BIT_DIAG1) DrawGroundSprite(rti->base_sprites.single_y);
- if (track & TRACK_BIT_DIAG2) DrawGroundSprite(rti->base_sprites.single_x);
+ if (track & TRACK_BIT_X) DrawGroundSprite(rti->base_sprites.single_y);
+ if (track & TRACK_BIT_Y) DrawGroundSprite(rti->base_sprites.single_x);
if (track & TRACK_BIT_UPPER) DrawGroundSprite(rti->base_sprites.single_n);
if (track & TRACK_BIT_LOWER) DrawGroundSprite(rti->base_sprites.single_s);
if (track & TRACK_BIT_LEFT) DrawGroundSprite(rti->base_sprites.single_w);
@@ -1392,8 +1390,8 @@ static void DrawTile_Track(TileInfo *ti)
#define ISON_SIGNAL(x) (m23 & (byte)(0x10 << (x)))
#define MAYBE_DRAW_SIGNAL(x,y,z) if (HAS_SIGNAL(x)) DrawSignalHelper(ti, ISON_SIGNAL(x), ((y-0x4FB) << 4)|(z))
- if (!(m5 & TRACK_BIT_DIAG2)) {
- if (!(m5 & TRACK_BIT_DIAG1)) {
+ if (!(m5 & TRACK_BIT_Y)) {
+ if (!(m5 & TRACK_BIT_X)) {
if (m5 & TRACK_BIT_LEFT) {
MAYBE_DRAW_SIGNAL(2, 0x509, 0);
MAYBE_DRAW_SIGNAL(3, 0x507, 1);
@@ -1909,8 +1907,8 @@ static void TileLoop_Track(TileIndex tile)
PlayerID owner = GetTileOwner(tile);
if (rail == (TRACK_BIT_LOWER | TRACK_BIT_RIGHT) || (
- !(rail & (TRACK_BIT_DIAG2 | TRACK_BIT_UPPER | TRACK_BIT_LEFT)) &&
- (rail & TRACK_BIT_DIAG1)
+ !(rail & (TRACK_BIT_Y | TRACK_BIT_UPPER | TRACK_BIT_LEFT)) &&
+ (rail & TRACK_BIT_X)
)) {
TileIndex n = tile + TileDiffXY(0, -1);
@@ -1923,8 +1921,8 @@ static void TileLoop_Track(TileIndex tile)
}
if (rail == (TRACK_BIT_UPPER | TRACK_BIT_LEFT) || (
- !(rail & (TRACK_BIT_DIAG2 | TRACK_BIT_LOWER | TRACK_BIT_RIGHT)) &&
- (rail & TRACK_BIT_DIAG1)
+ !(rail & (TRACK_BIT_Y | TRACK_BIT_LOWER | TRACK_BIT_RIGHT)) &&
+ (rail & TRACK_BIT_X)
)) {
TileIndex n = tile + TileDiffXY(0, 1);
@@ -1938,8 +1936,8 @@ static void TileLoop_Track(TileIndex tile)
}
if (rail == (TRACK_BIT_LOWER | TRACK_BIT_LEFT) || (
- !(rail & (TRACK_BIT_DIAG1 | TRACK_BIT_UPPER | TRACK_BIT_RIGHT)) &&
- (rail & TRACK_BIT_DIAG2)
+ !(rail & (TRACK_BIT_X | TRACK_BIT_UPPER | TRACK_BIT_RIGHT)) &&
+ (rail & TRACK_BIT_Y)
)) {
TileIndex n = tile + TileDiffXY(-1, 0);
@@ -1952,8 +1950,8 @@ static void TileLoop_Track(TileIndex tile)
}
if (rail == (TRACK_BIT_UPPER | TRACK_BIT_RIGHT) || (
- !(rail & (TRACK_BIT_DIAG1 | TRACK_BIT_LOWER | TRACK_BIT_LEFT)) &&
- (rail & TRACK_BIT_DIAG2)
+ !(rail & (TRACK_BIT_X | TRACK_BIT_LOWER | TRACK_BIT_LEFT)) &&
+ (rail & TRACK_BIT_Y)
)) {
TileIndex n = tile + TileDiffXY(1, 0);
diff --git a/rail_map.h b/rail_map.h
index 35a0ddfd3..9affa2247 100644
--- a/rail_map.h
+++ b/rail_map.h
@@ -10,7 +10,7 @@
static inline TrackBits GetRailWaypointBits(TileIndex t)
{
- return _m[t].m5 & RAIL_WAYPOINT_TRACK_MASK ? TRACK_BIT_DIAG2 : TRACK_BIT_DIAG1;
+ return _m[t].m5 & RAIL_WAYPOINT_TRACK_MASK ? TRACK_BIT_Y : TRACK_BIT_X;
}
diff --git a/road_cmd.c b/road_cmd.c
index 3b2c8164e..152933390 100644
--- a/road_cmd.c
+++ b/road_cmd.c
@@ -239,10 +239,10 @@ int32 CmdRemoveRoad(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (!(ti.map5 & 8)) {
if (pieces & ROAD_Y) goto return_error;
- track = TRACK_BIT_DIAG2;
+ track = TRACK_BIT_Y;
} else {
if (pieces & ROAD_X) goto return_error;
- track = TRACK_BIT_DIAG1;
+ track = TRACK_BIT_X;
}
cost = _price.remove_road * 2;
diff --git a/station_cmd.c b/station_cmd.c
index 98cdaf127..9ff2c3e7a 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -1033,7 +1033,7 @@ int32 CmdBuildRailroadStation(int x, int y, uint32 flags, uint32 p1, uint32 p2)
st->build_date = _date;
tile_delta = direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
- track = direction ? TRACK_DIAG2 : TRACK_DIAG1;
+ track = direction ? TRACK_Y : TRACK_X;
statspec = (p2 & 0x10) != 0 ? GetCustomStation(STAT_CLASS_DFLT, p2 >> 8) : NULL;
layout_ptr = alloca(numtracks * plat_len);
@@ -1149,7 +1149,7 @@ int32 CmdRemoveFromRailroadStation(int x, int y, uint32 flags, uint32 p1, uint32
// if we reached here, it means we can actually delete it. do that.
if (flags & DC_EXEC) {
- Track track = HASBIT(_m[tile].m5, 0) ? TRACK_DIAG2 : TRACK_DIAG1;
+ Track track = HASBIT(_m[tile].m5, 0) ? TRACK_Y : TRACK_X;
DoClearSquare(tile);
SetSignalsOnBothDir(tile, track);
// now we need to make the "spanned" area of the railway station smaller if we deleted something at the edges.
@@ -1228,7 +1228,7 @@ static int32 RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
if (!EnsureNoVehicle(tile))
return CMD_ERROR;
if (flags & DC_EXEC) {
- Track track = HASBIT(_m[tile].m5, 0) ? TRACK_DIAG2 : TRACK_DIAG1;
+ Track track = HASBIT(_m[tile].m5, 0) ? TRACK_Y : TRACK_X;
DoClearSquare(tile);
SetSignalsOnBothDir(tile, track);
}
diff --git a/waypoint.c b/waypoint.c
index dbe5728ea..a999ef2c3 100644
--- a/waypoint.c
+++ b/waypoint.c
@@ -183,8 +183,8 @@ int32 CmdBuildTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
if (p1 >= GetNumCustomStations(STAT_CLASS_WAYP)) return CMD_ERROR;
if (!IsTileType(tile, MP_RAILWAY) || (
- (axis = AXIS_X, _m[tile].m5 != TRACK_BIT_DIAG1) &&
- (axis = AXIS_Y, _m[tile].m5 != TRACK_BIT_DIAG2)
+ (axis = AXIS_X, _m[tile].m5 != TRACK_BIT_X) &&
+ (axis = AXIS_Y, _m[tile].m5 != TRACK_BIT_Y)
)) {
return_cmd_error(STR_1005_NO_SUITABLE_RAILROAD_TRACK);
}