mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-19 15:25:39 +00:00
(svn r2039) IS_RAIL_DEPOT -> IsRailDepot, IS_RAIL_WAYPOINT -> IsRailWaypoint
remove now unused enums and remove a redundant condition in one if
This commit is contained in:
parent
2695b93fee
commit
ca83a54490
29
rail_cmd.c
29
rail_cmd.c
@ -36,19 +36,28 @@ enum { /* These values are bitmasks for the map5 byte */
|
|||||||
|
|
||||||
RAIL_DEPOT_TRACK_MASK = 1,
|
RAIL_DEPOT_TRACK_MASK = 1,
|
||||||
RAIL_DEPOT_DIR = 3,
|
RAIL_DEPOT_DIR = 3,
|
||||||
RAIL_DEPOT_UNUSED_BITS = 0x3C,
|
|
||||||
|
|
||||||
RAIL_TYPE_WAYPOINT = 0xC4,
|
RAIL_TYPE_WAYPOINT = 0xC4,
|
||||||
RAIL_WAYPOINT_TRACK_MASK = 1,
|
RAIL_WAYPOINT_TRACK_MASK = 1,
|
||||||
RAIL_WAYPOINT_UNUSED_BITS = 0x3E,
|
|
||||||
|
|
||||||
RAIL_SUBTYPE_MASK = 0x3C,
|
RAIL_SUBTYPE_MASK = 0x3C,
|
||||||
RAIL_SUBTYPE_DEPOT = 0x00,
|
RAIL_SUBTYPE_DEPOT = 0x00,
|
||||||
RAIL_SUBTYPE_WAYPOINT = 0x04
|
RAIL_SUBTYPE_WAYPOINT = 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
#define IS_RAIL_DEPOT(x) (((x) & (RAIL_TYPE_DEPOT|RAIL_DEPOT_UNUSED_BITS)) == RAIL_TYPE_DEPOT)
|
static inline bool IsRailDepot(byte m5)
|
||||||
#define IS_RAIL_WAYPOINT(x) (((x) & (RAIL_TYPE_WAYPOINT|RAIL_WAYPOINT_UNUSED_BITS)) == RAIL_TYPE_WAYPOINT)
|
{
|
||||||
|
return
|
||||||
|
(m5 & RAIL_TYPE_MASK) == RAIL_TYPE_DEPOT &&
|
||||||
|
(m5 & RAIL_SUBTYPE_MASK) == RAIL_SUBTYPE_DEPOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline bool IsRailWaypoint(byte m5)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(m5 & RAIL_TYPE_MASK) == RAIL_TYPE_DEPOT &&
|
||||||
|
(m5 & RAIL_SUBTYPE_MASK) == RAIL_SUBTYPE_WAYPOINT;
|
||||||
|
}
|
||||||
|
|
||||||
/* Format of rail map5 byte.
|
/* Format of rail map5 byte.
|
||||||
* 00 abcdef => Normal rail
|
* 00 abcdef => Normal rail
|
||||||
@ -800,7 +809,7 @@ static int32 RemoveTrainWaypoint(uint tile, uint32 flags, bool justremove)
|
|||||||
Waypoint *cp;
|
Waypoint *cp;
|
||||||
|
|
||||||
// make sure it's a waypoint
|
// make sure it's a waypoint
|
||||||
if (!IsTileType(tile, MP_RAILWAY) || !IS_RAIL_WAYPOINT(_map5[tile]))
|
if (!IsTileType(tile, MP_RAILWAY) || !IsRailWaypoint(_map5[tile]))
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
|
|
||||||
if (!CheckTileOwnership(tile) && !(_current_player==17))
|
if (!CheckTileOwnership(tile) && !(_current_player==17))
|
||||||
@ -1621,7 +1630,7 @@ static void DrawTile_Track(TileInfo *ti)
|
|||||||
|
|
||||||
if (ti->tileh != 0) { DrawFoundation(ti, ti->tileh); }
|
if (ti->tileh != 0) { DrawFoundation(ti, ti->tileh); }
|
||||||
|
|
||||||
if (!IS_RAIL_DEPOT(m5) && IS_RAIL_WAYPOINT(m5) && _map3_lo[ti->tile]&16) {
|
if (IsRailWaypoint(m5) && _map3_lo[ti->tile] & 16) {
|
||||||
// look for customization
|
// look for customization
|
||||||
StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _map3_hi[ti->tile]);
|
StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _map3_hi[ti->tile]);
|
||||||
|
|
||||||
@ -1813,7 +1822,7 @@ static bool SetSignalsEnumProc(uint tile, SetSignalsData *ssd, int track, uint l
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (IS_RAIL_DEPOT(_map5[tile]))
|
} else if (IsRailDepot(_map5[tile]))
|
||||||
return true; // don't look further if the tile is a depot
|
return true; // don't look further if the tile is a depot
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -2163,9 +2172,9 @@ static uint32 GetTileTrackStatus_Track(uint tile, TransportType mode) {
|
|||||||
|
|
||||||
static void ClickTile_Track(uint tile)
|
static void ClickTile_Track(uint tile)
|
||||||
{
|
{
|
||||||
if (IS_RAIL_DEPOT(_map5[tile]))
|
if (IsRailDepot(_map5[tile]))
|
||||||
ShowTrainDepotWindow(tile);
|
ShowTrainDepotWindow(tile);
|
||||||
else if (IS_RAIL_WAYPOINT(_map5[tile]))
|
else if (IsRailWaypoint(_map5[tile]))
|
||||||
ShowRenameWaypointWindow(&_waypoints[GetWaypointByTile(tile)]);
|
ShowRenameWaypointWindow(&_waypoints[GetWaypointByTile(tile)]);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -2221,7 +2230,7 @@ static uint32 VehicleEnter_Track(Vehicle *v, uint tile, int x, int y)
|
|||||||
int dir;
|
int dir;
|
||||||
|
|
||||||
// this routine applies only to trains in depot tiles
|
// this routine applies only to trains in depot tiles
|
||||||
if (v->type != VEH_Train || !IS_RAIL_DEPOT(_map5[tile]))
|
if (v->type != VEH_Train || !IsRailDepot(_map5[tile]))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* depot direction */
|
/* depot direction */
|
||||||
|
Loading…
Reference in New Issue
Block a user