(svn r4788) - Codechange: RAILTYPE_{NORMAL,ELECTRIC,...} and RAIL_TYPE_{NORMAL,SIGNAL,...} have nearly the same name, rename RAIL_TYPE_* to RAIL_TILE_* of extra clarity
--- a/ai/default/default.c Tue May 09 06:56:09 2006 +0000
+++ b/ai/default/default.c Tue May 09 08:17:33 2006 +0000
@@ -2184,7 +2184,7 @@
// Then remove and signals if there are any.
if (IsTileType(tile, MP_RAILWAY) &&
- GetRailTileType(tile) == RAIL_TYPE_SIGNALS) {
+ GetRailTileType(tile) == RAIL_TILE_SIGNALS) {
DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_SIGNALS);
}
--- a/elrail.c Tue May 09 06:56:09 2006 +0000
+++ b/elrail.c Tue May 09 08:17:33 2006 +0000
@@ -76,9 +76,9 @@
case MP_RAILWAY:
if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
switch (GetRailTileType(t)) {
- case RAIL_TYPE_NORMAL: case RAIL_TYPE_SIGNALS:
+ case RAIL_TILE_NORMAL: case RAIL_TILE_SIGNALS:
return GetTrackBits(t);
- case RAIL_TYPE_DEPOT_WAYPOINT:
+ case RAIL_TILE_DEPOT_WAYPOINT:
if (GetRailTileSubtype(t) == RAIL_SUBTYPE_WAYPOINT) return GetRailWaypointBits(t);
default:
return 0;
@@ -346,7 +346,7 @@
{
switch (GetTileType(ti->tile)) {
case MP_RAILWAY:
- if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT && GetRailTileSubtype(ti->tile) == RAIL_SUBTYPE_DEPOT) {
+ if (GetRailTileType(ti->tile) == RAIL_TILE_DEPOT_WAYPOINT && GetRailTileSubtype(ti->tile) == RAIL_SUBTYPE_DEPOT) {
const SortableSpriteStruct *sss = &CatenarySpriteData[WIRE_DEPOT_SW + ReverseDiagDir(GetRailDepotDirection(ti->tile))];
AddSortableSpriteToDraw( sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset,
sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x, ti->y) + sss->z_offset);
--- a/newgrf_station.c Tue May 09 06:56:09 2006 +0000
+++ b/newgrf_station.c Tue May 09 08:17:33 2006 +0000
@@ -253,7 +253,7 @@
if (waypoint) {
if (!IsTileType(new_tile, MP_RAILWAY)) break;
- if (GetRailTileType(new_tile) != RAIL_TYPE_DEPOT_WAYPOINT) break;
+ if (GetRailTileType(new_tile) != RAIL_TILE_DEPOT_WAYPOINT) break;
if (GetRailTileSubtype(new_tile) != RAIL_SUBTYPE_WAYPOINT) break;
if (check_axis && GetWaypointAxis(new_tile) != orig_axis) break;
} else {
--- a/npf.c Tue May 09 06:56:09 2006 +0000
+++ b/npf.c Tue May 09 08:17:33 2006 +0000
@@ -625,7 +625,7 @@
DEBUG(npf, 5)("Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits);
/* Check for oneway signal against us */
- if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TYPE_SIGNALS) {
+ if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TILE_SIGNALS) {
if (HasSignalOnTrackdir(dst_tile, ReverseTrackdir(dst_trackdir)) && !HasSignalOnTrackdir(dst_tile, dst_trackdir))
// if one way signal not pointing towards us, stop going in this direction.
break;
--- a/oldloader.c Tue May 09 06:56:09 2006 +0000
+++ b/oldloader.c Tue May 09 08:17:33 2006 +0000
@@ -1523,7 +1523,7 @@
for (i = 0; i < OLD_MAP_SIZE; i ++) {
if (IsTileType(i, MP_RAILWAY)) {
/* We save presignals different from TTDPatch, convert them */
- if (GetRailTileType(i) == RAIL_TYPE_SIGNALS) {
+ if (GetRailTileType(i) == RAIL_TILE_SIGNALS) {
/* This byte is always zero in TTD for this type of tile */
if (_m[i].m4) /* Convert the presignals to our own format */
_m[i].m4 = (_m[i].m4 >> 1) & 7;
--- a/order_gui.c Tue May 09 06:56:09 2006 +0000
+++ b/order_gui.c Tue May 09 08:17:33 2006 +0000
@@ -200,7 +200,7 @@
switch (GetTileType(tile)) {
case MP_RAILWAY:
if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) {
- if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT &&
+ if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT &&
GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
--- a/rail.h Tue May 09 06:56:09 2006 +0000
+++ b/rail.h Tue May 09 08:17:33 2006 +0000
@@ -337,7 +337,7 @@
{
assert(IsValidTrack(track));
return
- GetRailTileType(tile) == RAIL_TYPE_SIGNALS &&
+ GetRailTileType(tile) == RAIL_TILE_SIGNALS &&
(_m[tile].m3 & SignalOnTrack(track)) != 0;
}
@@ -352,7 +352,7 @@
{
assert (IsValidTrackdir(trackdir));
return
- GetRailTileType(tile) == RAIL_TYPE_SIGNALS &&
+ GetRailTileType(tile) == RAIL_TILE_SIGNALS &&
_m[tile].m3 & SignalAlongTrackdir(trackdir);
}
--- a/rail_cmd.c Tue May 09 06:56:09 2006 +0000
+++ b/rail_cmd.c Tue May 09 08:17:33 2006 +0000
@@ -77,7 +77,7 @@
TrackBits future; /* The track layout we want to build */
_error_message = STR_1001_IMPOSSIBLE_TRACK_COMBINATION;
- if (type != RAIL_TYPE_NORMAL && type != RAIL_TYPE_SIGNALS)
+ if (type != RAIL_TILE_NORMAL && type != RAIL_TILE_SIGNALS)
return false; /* Cannot build anything on depots and checkpoints */
/* So, we have a tile with tracks on it (and possibly signals). Let's see
@@ -93,7 +93,7 @@
}
/* Let's see if we may build this */
- if ((flags & DC_NO_RAIL_OVERLAP) || type == RAIL_TYPE_SIGNALS) {
+ if ((flags & DC_NO_RAIL_OVERLAP) || type == RAIL_TILE_SIGNALS) {
/* If we are not allowed to overlap (flag is on for ai players or we have
* signals on the tile), check that */
return future == TRACK_BIT_HORZ || future == TRACK_BIT_VERT;
@@ -261,7 +261,7 @@
!EnsureNoVehicle(tile)) {
return CMD_ERROR;
}
- if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT ||
+ if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT ||
!IsTileOwner(tile, _current_player) ||
GetRailType(tile) != p1) {
// Get detailed error message
@@ -666,9 +666,9 @@
}
if (flags & DC_EXEC) {
- if (GetRailTileType(tile) != RAIL_TYPE_SIGNALS) {
+ if (GetRailTileType(tile) != RAIL_TILE_SIGNALS) {
// there are no signals at all on this tile yet
- _m[tile].m5 |= RAIL_TYPE_SIGNALS; // change into signals
+ _m[tile].m5 |= RAIL_TILE_SIGNALS; // change into signals
_m[tile].m2 |= 0xF0; // all signals are on
_m[tile].m3 &= ~0xF0; // no signals built by default
SetSignalType(tile, SIGTYPE_NORMAL);
@@ -744,7 +744,7 @@
track = TrackdirToTrack(trackdir); /* trackdir might have changed, keep track in sync */
// copy the signal-style of the first rail-piece if existing
- if (GetRailTileType(tile) == RAIL_TYPE_SIGNALS && GetTrackBits(tile) != 0) { /* XXX: GetTrackBits check useless? */
+ if (GetRailTileType(tile) == RAIL_TILE_SIGNALS && GetTrackBits(tile) != 0) { /* XXX: GetTrackBits check useless? */
signals = _m[tile].m3 & SignalOnTrack(track);
if (signals == 0) signals = SignalOnTrack(track); /* Can this actually occur? */
@@ -825,7 +825,7 @@
/* removed last signal from tile? */
if (GB(_m[tile].m3, 4, 4) == 0) {
SB(_m[tile].m2, 4, 4, 0);
- SB(_m[tile].m5, 6, 2, RAIL_TYPE_NORMAL >> 6); // XXX >> because the constant is meant for direct application, not use with SB
+ SB(_m[tile].m5, 6, 2, RAIL_TILE_NORMAL >> 6); // XXX >> because the constant is meant for direct application, not use with SB
SetSignalVariant(tile, SIG_ELECTRIC); // remove any possible semaphores
}
@@ -957,7 +957,7 @@
m5 = _m[tile].m5;
if (flags & DC_AUTO) {
- if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
+ if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT) {
return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
}
@@ -971,7 +971,7 @@
switch (GetRailTileType(tile)) {
/* XXX: Why the fuck do we remove these thow signals first? */
- case RAIL_TYPE_SIGNALS:
+ case RAIL_TILE_SIGNALS:
if (HasSignalOnTrack(tile, TRACK_X)) {
ret = DoCommand(tile, TRACK_X, 0, flags, CMD_REMOVE_SIGNALS);
if (CmdFailed(ret)) return CMD_ERROR;
@@ -990,7 +990,7 @@
}
/* FALLTHROUGH */
- case RAIL_TYPE_NORMAL: {
+ case RAIL_TILE_NORMAL: {
uint i;
for (i = 0; m5 != 0; i++, m5 >>= 1) {
@@ -1003,7 +1003,7 @@
return cost;
}
- case RAIL_TYPE_DEPOT_WAYPOINT:
+ case RAIL_TILE_DEPOT_WAYPOINT:
if (GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) {
return RemoveTrainDepot(tile, flags);
} else {
@@ -1298,7 +1298,7 @@
_drawtile_track_palette = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile)));
- if (GetRailTileType(ti->tile) != RAIL_TYPE_DEPOT_WAYPOINT) {
+ if (GetRailTileType(ti->tile) != RAIL_TILE_DEPOT_WAYPOINT) {
TrackBits rails = GetTrackBits(ti->tile);
DrawTrackBits(ti, rails, false);
@@ -1306,7 +1306,7 @@
if (_display_opt & DO_FULL_DETAIL) _detailed_track_proc[GetRailGroundType(ti->tile)](ti);
/* draw signals also? */
- if (GetRailTileType(ti->tile) == RAIL_TYPE_SIGNALS) DrawSignals(ti->tile, rails);
+ if (GetRailTileType(ti->tile) == RAIL_TILE_SIGNALS) DrawSignals(ti->tile, rails);
} else {
/* draw depots / waypoints */
@@ -1717,7 +1717,7 @@
uint z = ti->z;
if (tileh == SLOPE_FLAT) return z;
- if (GetRailTileType(ti->tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
+ if (GetRailTileType(ti->tile) == RAIL_TILE_DEPOT_WAYPOINT) {
return z + TILE_HEIGHT;
} else {
uint f = GetRailFoundation(ti->tileh, GetTrackBits(ti->tile));
@@ -1733,7 +1733,7 @@
static Slope GetSlopeTileh_Track(TileIndex tile, Slope tileh)
{
if (tileh == SLOPE_FLAT) return SLOPE_FLAT;
- if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) {
+ if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT) {
return SLOPE_FLAT;
} else {
uint f = GetRailFoundation(tileh, GetTrackBits(tile));
@@ -1784,7 +1784,7 @@
if (quick_return) return;
// Don't continue tile loop for depots
- if (GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT) return;
+ if (GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT) return;
new_ground = RAIL_GROUND_GRASS;
@@ -1881,11 +1881,11 @@
if (mode != TRANSPORT_RAIL) return 0;
- if (GetRailTileType(tile) != RAIL_TYPE_DEPOT_WAYPOINT) {
+ if (GetRailTileType(tile) != RAIL_TILE_DEPOT_WAYPOINT) {
TrackBits rails = GetTrackBits(tile);
uint32 ret = rails * 0x101;
- if (GetRailTileType(tile) != RAIL_TYPE_SIGNALS) {
+ if (GetRailTileType(tile) != RAIL_TILE_SIGNALS) {
if (rails == TRACK_BIT_CROSS) ret |= 0x40;
} else {
/* has_signals */
@@ -1930,11 +1930,11 @@
{
td->owner = GetTileOwner(tile);
switch (GetRailTileType(tile)) {
- case RAIL_TYPE_NORMAL:
+ case RAIL_TILE_NORMAL:
td->str = STR_1021_RAILROAD_TRACK;
break;
- case RAIL_TYPE_SIGNALS: {
+ case RAIL_TILE_SIGNALS: {
const StringID signal_type[] = {
STR_RAILROAD_TRACK_WITH_NORMAL_SIGNALS,
STR_RAILROAD_TRACK_WITH_PRESIGNALS,
@@ -1946,7 +1946,7 @@
break;
}
- case RAIL_TYPE_DEPOT_WAYPOINT:
+ case RAIL_TILE_DEPOT_WAYPOINT:
default:
td->str = (GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) ?
STR_1023_RAILROAD_TRAIN_DEPOT : STR_LANDINFO_WAYPOINT;
--- a/rail_gui.c Tue May 09 06:56:09 2006 +0000
+++ b/rail_gui.c Tue May 09 08:17:33 2006 +0000
@@ -90,7 +90,7 @@
static void PlaceExtraDepotRail(TileIndex tile, uint16 extra)
{
- if (GetRailTileType(tile) != RAIL_TYPE_NORMAL) return;
+ if (GetRailTileType(tile) != RAIL_TILE_NORMAL) return;
if ((GetTrackBits(tile) & GB(extra, 8, 8)) == 0) return;
DoCommandP(tile, _cur_railtype, extra & 0xFF, NULL, CMD_BUILD_SINGLE_RAIL | CMD_AUTO | CMD_NO_WATER);
--- a/rail_map.h Tue May 09 06:56:09 2006 +0000
+++ b/rail_map.h Tue May 09 08:17:33 2006 +0000
@@ -8,10 +8,10 @@
typedef enum RailTileType {
- RAIL_TYPE_NORMAL = 0x0,
- RAIL_TYPE_SIGNALS = 0x40,
- RAIL_TYPE_UNUSED = 0x80, /* XXX: Maybe this could become waypoints? */
- RAIL_TYPE_DEPOT_WAYPOINT = 0xC0, /* Is really depots and waypoints... */
+ RAIL_TILE_NORMAL = 0x0,
+ RAIL_TILE_SIGNALS = 0x40,
+ RAIL_TILE_UNUSED = 0x80, /* XXX: Maybe this could become waypoints? */
+ RAIL_TILE_DEPOT_WAYPOINT = 0xC0, /* Is really depots and waypoints... */
RAIL_TILE_TYPE_MASK = 0xC0
} RailTileType;
@@ -23,12 +23,12 @@
/**
* Returns whether this is plain rails, with or without signals. Iow, if this
- * tiles RailTileType is RAIL_TYPE_NORMAL or RAIL_TYPE_SIGNALS.
+ * tiles RailTileType is RAIL_TILE_NORMAL or RAIL_TILE_SIGNALS.
*/
static inline bool IsPlainRailTile(TileIndex tile)
{
RailTileType rtt = GetRailTileType(tile);
- return rtt == RAIL_TYPE_NORMAL || rtt == RAIL_TYPE_SIGNALS;
+ return rtt == RAIL_TILE_NORMAL || rtt == RAIL_TILE_SIGNALS;
}
/**
@@ -36,12 +36,12 @@
*/
static inline bool HasSignals(TileIndex tile)
{
- return GetRailTileType(tile) == RAIL_TYPE_SIGNALS;
+ return GetRailTileType(tile) == RAIL_TILE_SIGNALS;
}
/** These specify the subtype when the main rail type is
- * RAIL_TYPE_DEPOT_WAYPOINT */
+ * RAIL_TILE_DEPOT_WAYPOINT */
typedef enum RailTileSubtypes {
RAIL_SUBTYPE_DEPOT = 0x00,
RAIL_SUBTYPE_WAYPOINT = 0x04,
@@ -50,11 +50,11 @@
/**
* Returns the RailTileSubtype of a given rail tile with type
- * RAIL_TYPE_DEPOT_WAYPOINT
+ * RAIL_TILE_DEPOT_WAYPOINT
*/
static inline RailTileSubtype GetRailTileSubtype(TileIndex tile)
{
- assert(GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT);
+ assert(GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT);
return (RailTileSubtype)(_m[tile].m5 & RAIL_SUBTYPE_MASK);
}
@@ -201,13 +201,13 @@
static inline SignalType GetSignalType(TileIndex t)
{
- assert(GetRailTileType(t) == RAIL_TYPE_SIGNALS);
+ assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
return (SignalType)GB(_m[t].m4, 0, 2);
}
static inline void SetSignalType(TileIndex t, SignalType s)
{
- assert(GetRailTileType(t) == RAIL_TYPE_SIGNALS);
+ assert(GetRailTileType(t) == RAIL_TILE_SIGNALS);
SB(_m[t].m4, 0, 2, s);
}
@@ -287,7 +287,7 @@
static inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
{
- if (GetRailTileType(t) == RAIL_TYPE_DEPOT_WAYPOINT) {
+ if (GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT) {
SB(_m[t].m4, 0, 4, rgt);
return;
}
@@ -297,7 +297,7 @@
static inline RailGroundType GetRailGroundType(TileIndex t)
{
/* TODO Unify this */
- if (GetRailTileType(t) == RAIL_TYPE_DEPOT_WAYPOINT) return GB(_m[t].m4, 0, 4);
+ if (GetRailTileType(t) == RAIL_TILE_DEPOT_WAYPOINT) return GB(_m[t].m4, 0, 4);
return GB(_m[t].m2, 0, 4);
}
@@ -319,7 +319,7 @@
_m[t].m2 = 0;
_m[t].m3 = r;
_m[t].m4 = 0;
- _m[t].m5 = RAIL_TYPE_NORMAL | b;
+ _m[t].m5 = RAIL_TILE_NORMAL | b;
}
@@ -330,7 +330,7 @@
_m[t].m2 = 0;
_m[t].m3 = r;
_m[t].m4 = 0;
- _m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d;
+ _m[t].m5 = RAIL_TILE_DEPOT_WAYPOINT | RAIL_SUBTYPE_DEPOT | d;
}
@@ -341,7 +341,7 @@
_m[t].m2 = index;
_m[t].m3 = r;
_m[t].m4 = 0;
- _m[t].m5 = RAIL_TYPE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a;
+ _m[t].m5 = RAIL_TILE_DEPOT_WAYPOINT | RAIL_SUBTYPE_WAYPOINT | a;
}
#endif
--- a/road_cmd.c Tue May 09 06:56:09 2006 +0000
+++ b/road_cmd.c Tue May 09 08:17:33 2006 +0000
@@ -323,7 +323,7 @@
}
#undef M
- if (GetRailTileType(tile) != RAIL_TYPE_NORMAL) goto do_clear;
+ if (GetRailTileType(tile) != RAIL_TILE_NORMAL) goto do_clear;
switch (GetTrackBits(tile)) {
case TRACK_BIT_X:
if (pieces & ROAD_X) goto do_clear;
--- a/train_cmd.c Tue May 09 06:56:09 2006 +0000
+++ b/train_cmd.c Tue May 09 08:17:33 2006 +0000
@@ -1819,7 +1819,7 @@
{
if (IsTileType(tile, MP_RAILWAY) &&
IsTileOwner(tile, tfdd->owner) &&
- GetRailTileType(tile) == RAIL_TYPE_DEPOT_WAYPOINT &&
+ GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT &&
GetRailTileSubtype(tile) == RAIL_SUBTYPE_DEPOT) {
tfdd->best_length = length;
tfdd->tile = tile;
@@ -2700,7 +2700,7 @@
static void TrainMovedChangeSignals(TileIndex tile, DiagDirection dir)
{
if (IsTileType(tile, MP_RAILWAY) &&
- GetRailTileType(tile) == RAIL_TYPE_SIGNALS) {
+ GetRailTileType(tile) == RAIL_TILE_SIGNALS) {
uint i = FindFirstBit2x64(GetTrackBits(tile) * 0x101 & _reachable_tracks[dir]);
UpdateSignalsOnSegment(tile, _otherside_signal_directions[i]);
}
--- a/tunnelbridge_cmd.c Tue May 09 06:56:09 2006 +0000
+++ b/tunnelbridge_cmd.c Tue May 09 08:17:33 2006 +0000
@@ -334,7 +334,7 @@
break;
case MP_RAILWAY:
- if (GetRailTileType(tile) != RAIL_TYPE_NORMAL ||
+ if (GetRailTileType(tile) != RAIL_TILE_NORMAL ||
GetTrackBits(tile) != (direction == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X)) {
goto not_valid_below;
}
--- a/waypoint.c Tue May 09 06:56:09 2006 +0000
+++ b/waypoint.c Tue May 09 08:17:33 2006 +0000
@@ -182,7 +182,7 @@
if (p1 >= GetNumCustomStations(STAT_CLASS_WAYP)) return CMD_ERROR;
if (!IsTileType(tile, MP_RAILWAY) ||
- GetRailTileType(tile) != RAIL_TYPE_NORMAL || (
+ GetRailTileType(tile) != RAIL_TILE_NORMAL || (
(axis = AXIS_X, GetTrackBits(tile) != TRACK_BIT_X) &&
(axis = AXIS_Y, GetTrackBits(tile) != TRACK_BIT_Y)
)) {
--- a/waypoint.h Tue May 09 06:56:09 2006 +0000
+++ b/waypoint.h Tue May 09 08:17:33 2006 +0000
@@ -25,7 +25,7 @@
};
enum {
- RAIL_TYPE_WAYPOINT = 0xC4,
+ RAIL_TILE_WAYPOINT = 0xC4,
RAIL_WAYPOINT_TRACK_MASK = 1,
};