summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ai/default/default.cpp6
-rw-r--r--src/ai/trolly/pathfinder.cpp2
-rw-r--r--src/ai/trolly/trolly.cpp4
-rw-r--r--src/npf.cpp12
-rw-r--r--src/openttd.cpp2
-rw-r--r--src/order_cmd.cpp6
-rw-r--r--src/order_gui.cpp3
-rw-r--r--src/pathfind.cpp4
-rw-r--r--src/rail_cmd.cpp2
-rw-r--r--src/roadveh_cmd.cpp4
-rw-r--r--src/ship_cmd.cpp4
-rw-r--r--src/train_cmd.cpp16
-rw-r--r--src/vehicle.cpp2
-rw-r--r--src/yapf/yapf_destrail.hpp2
-rw-r--r--src/yapf/yapf_road.cpp8
15 files changed, 38 insertions, 39 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 430f487c9..dcdf2f2c4 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -330,7 +330,7 @@ static void AiHandleReplaceTrain(Player *p)
EngineID veh;
// wait until the vehicle reaches the depot.
- if (!IsDepotTypeTile(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
+ if (!IsRailDepotTile(v->tile) || v->u.rail.track != TRACK_BIT_DEPOT || !(v->vehstatus & VS_STOPPED)) {
AiHandleGotoDepot(p, CMD_SEND_TRAIN_TO_DEPOT);
return;
}
@@ -2886,7 +2886,7 @@ static bool AiCheckRoadFinished(Player *p)
are.dest = _players_ai[p->index].cur_tile_b;
tile = TILE_MASK(_players_ai[p->index].cur_tile_a + TileOffsByDiagDir(dir));
- if (IsRoadStopTile(tile) || IsDepotTypeTile(tile, TRANSPORT_ROAD)) return false;
+ if (IsRoadStopTile(tile) || IsRoadDepotTile(tile)) return false;
TrackdirBits bits = TrackStatusToTrackdirBits(GetTileTrackStatus(tile, TRANSPORT_ROAD, ROADTYPES_ROAD)) & DiagdirReachesTrackdirs(dir);
if (bits == TRACKDIR_BIT_NONE) return false;
@@ -3606,7 +3606,7 @@ static void AiStateSellVeh(Player *p)
if (v->owner == _current_player) {
if (v->type == VEH_TRAIN) {
- if (!IsDepotTypeTile(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
+ if (!IsRailDepotTile(v->tile) || v->u.rail.track != TRACK_BIT_DEPOT || !(v->vehstatus & VS_STOPPED)) {
if (!v->current_order.IsType(OT_GOTO_DEPOT))
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_TRAIN_TO_DEPOT);
goto going_to_depot;
diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp
index 36bbb748a..15052cc39 100644
--- a/src/ai/trolly/pathfinder.cpp
+++ b/src/ai/trolly/pathfinder.cpp
@@ -45,7 +45,7 @@ static bool IsRoad(TileIndex tile)
{
return
// MP_ROAD, but not a road depot?
- (IsTileType(tile, MP_ROAD) && !IsDepotTypeTile(tile, TRANSPORT_ROAD)) ||
+ (IsTileType(tile, MP_ROAD) && !IsRoadDepot(tile)) ||
(IsTileType(tile, MP_TUNNELBRIDGE) && GetTunnelBridgeTransportType(tile) == TRANSPORT_ROAD);
}
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 8a419ca09..851f1092e 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -1254,8 +1254,8 @@ static void AiNew_CheckVehicle(Player *p, Vehicle *v)
// We are already sending him back
if (AiNew_GetSpecialVehicleFlag(p, v) & AI_VEHICLEFLAG_SELL) {
- if (v->type == VEH_ROAD && IsDepotTypeTile(v->tile, TRANSPORT_ROAD) &&
- (v->vehstatus&VS_STOPPED)) {
+ if (v->type == VEH_ROAD && IsRoadDepotTile(v->tile) &&
+ (v->vehstatus & VS_STOPPED)) {
// We are at the depot, sell the vehicle
AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
}
diff --git a/src/npf.cpp b/src/npf.cpp
index 01c5c00c3..b0f762c25 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -231,14 +231,14 @@ static void NPFMarkTile(TileIndex tile)
switch (GetTileType(tile)) {
case MP_RAILWAY:
/* DEBUG: mark visited tiles by mowing the grass under them ;-) */
- if (!IsDepotTypeTile(tile, TRANSPORT_RAIL)) {
+ if (!IsRailDepot(tile)) {
SetRailGroundType(tile, RAIL_GROUND_BARREN);
MarkTileDirtyByTile(tile);
}
break;
case MP_ROAD:
- if (!IsDepotTypeTile(tile, TRANSPORT_ROAD)) {
+ if (!IsRoadDepot(tile)) {
SetRoadside(tile, ROADSIDE_BARREN);
MarkTileDirtyByTile(tile);
}
@@ -397,7 +397,7 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
* curves should be taken into account, as this affects the speed limit. */
/* Check for reverse in depot */
- if (IsDepotTypeTile(tile, TRANSPORT_RAIL) && as->EndNodeCheck(as, &new_node) != AYSTAR_FOUND_END_NODE) {
+ if (IsRailDepotTile(tile) && as->EndNodeCheck(as, &new_node) != AYSTAR_FOUND_END_NODE) {
/* Penalise any depot tile that is not the last tile in the path. This
* _should_ penalise every occurence of reversing in a depot (and only
* that) */
@@ -464,9 +464,9 @@ static void NPFSaveTargetData(AyStar* as, OpenListNode* current)
*/
static bool CanEnterTileOwnerCheck(Owner owner, TileIndex tile, DiagDirection enterdir)
{
- if (IsTileType(tile, MP_RAILWAY) || /* Rail tile (also rail depot) */
- IsRailwayStationTile(tile) || /* Rail station tile */
- IsDepotTypeTile(tile, TRANSPORT_ROAD) || /* Road depot tile */
+ if (IsTileType(tile, MP_RAILWAY) || /* Rail tile (also rail depot) */
+ IsRailwayStationTile(tile) || /* Rail station tile */
+ IsRoadDepotTile(tile) || /* Road depot tile */
IsStandardRoadStopTile(tile)) { /* Road station tile (but not drive-through stops) */
return IsTileOwner(tile, owner); /* You need to own these tiles entirely to use them */
}
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 3bcbfb9da..92a70d6cf 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1874,7 +1874,7 @@ bool AfterLoadGame()
}
/* Clear PBS reservation on track */
- if (!IsDepotTypeTile(t, TRANSPORT_RAIL)) {
+ if (!IsRailDepotTile(t)) {
SB(_m[t].m4, 4, 4, 0);
} else {
ClrBit(_m[t].m3, 6);
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index e2caa7196..2b2cc2870 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -392,15 +392,15 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
switch (v->type) {
case VEH_TRAIN:
- if (!IsDepotTypeTile(dp->xy, TRANSPORT_RAIL)) return CMD_ERROR;
+ if (!IsRailDepotTile(dp->xy)) return CMD_ERROR;
break;
case VEH_ROAD:
- if (!IsDepotTypeTile(dp->xy, TRANSPORT_ROAD)) return CMD_ERROR;
+ if (!IsRoadDepotTile(dp->xy)) return CMD_ERROR;
break;
case VEH_SHIP:
- if (!IsDepotTypeTile(dp->xy, TRANSPORT_WATER)) return CMD_ERROR;
+ if (!IsShipDepotTile(dp->xy)) return CMD_ERROR;
break;
default: return CMD_ERROR;
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index f5c2611f9..4631db958 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -462,8 +462,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_WATER:
if (v->type != VEH_SHIP) break;
- if (IsDepotTypeTile(tile, TRANSPORT_WATER) &&
- IsTileOwner(tile, _local_player)) {
+ if (IsShipDepot(tile) && IsTileOwner(tile, _local_player)) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS);
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index 24180db12..ccbe47a14 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -170,10 +170,10 @@ static inline bool CanAccessTileInDir(TileIndex tile, DiagDirection side, Transp
{
if (tracktype == TRANSPORT_RAIL) {
/* depot from wrong side */
- if (IsDepotTypeTile(tile, TRANSPORT_RAIL) && GetRailDepotDirection(tile) != side) return false;
+ if (IsRailDepotTile(tile) && GetRailDepotDirection(tile) != side) return false;
} else if (tracktype == TRANSPORT_ROAD) {
/* depot from wrong side */
- if (IsDepotTypeTile(tile, TRANSPORT_ROAD) && GetRoadDepotDirection(tile) != side) return false;
+ if (IsRoadDepotTile(tile) && GetRoadDepotDirection(tile) != side) return false;
/* non-driverthrough road station from wrong side */
if (IsStandardRoadStopTile(tile) && GetRoadStopDir(tile) != side) return false;
}
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index 4d4a596ee..1f033bdea 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -2268,7 +2268,7 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *v, TileIndex tile, int
int length;
/* this routine applies only to trains in depot tiles */
- if (v->type != VEH_TRAIN || !IsDepotTypeTile(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
+ if (v->type != VEH_TRAIN || !IsRailDepotTile(tile)) return VETSB_CONTINUE;
/* depot direction */
dir = GetRailDepotDirection(tile);
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index f146b3ada..476239e32 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -178,7 +178,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* The ai_new queries the vehicle cost before building the route,
* so we must check against cheaters no sooner than now. --pasky */
- if (!IsDepotTypeTile(tile, TRANSPORT_ROAD)) return CMD_ERROR;
+ if (!IsRoadDepotTile(tile)) return CMD_ERROR;
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
if (HasTileRoadType(tile, ROADTYPE_TRAM) != HasBit(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
@@ -340,7 +340,7 @@ static bool CheckRoadVehInDepotStopped(const Vehicle *v)
{
TileIndex tile = v->tile;
- if (!IsDepotTypeTile(tile, TRANSPORT_ROAD)) return false;
+ if (!IsRoadDepotTile(tile)) return false;
if (IsRoadVehFront(v) && !(v->vehstatus & VS_STOPPED)) return false;
for (; v != NULL; v = v->Next()) {
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 7f66ea806..e7a22b6e8 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -130,7 +130,7 @@ static const Depot* FindClosestShipDepot(const Vehicle* v)
FOR_ALL_DEPOTS(depot) {
TileIndex tile = depot->xy;
- if (IsDepotTypeTile(tile, TRANSPORT_WATER) && IsTileOwner(tile, v->owner)) {
+ if (IsShipDepotTile(tile) && IsTileOwner(tile, v->owner)) {
uint dist = DistanceManhattan(tile, v->tile);
if (dist < best_dist) {
best_dist = dist;
@@ -762,7 +762,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* The ai_new queries the vehicle cost before building the route,
* so we must check against cheaters no sooner than now. --pasky */
- if (!IsDepotTypeTile(tile, TRANSPORT_WATER)) return CMD_ERROR;
+ if (!IsShipDepotTile(tile)) return CMD_ERROR;
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 9f05d9af3..408d88487 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -678,7 +678,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
/* Check if the train is actually being built in a depot belonging
* to the player. Doesn't matter if only the cost is queried */
if (!(flags & DC_QUERY_COST)) {
- if (!IsDepotTypeTile(tile, TRANSPORT_RAIL)) return CMD_ERROR;
+ if (!IsRailDepotTile(tile)) return CMD_ERROR;
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
}
@@ -806,7 +806,7 @@ int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped)
TileIndex tile = v->tile;
/* check if stopped in a depot */
- if (!IsDepotTypeTile(tile, TRANSPORT_RAIL) || v->cur_speed != 0) return -1;
+ if (!IsRailDepotTile(tile) || v->cur_speed != 0) return -1;
int count = 0;
for (; v != NULL; v = v->Next()) {
@@ -1787,7 +1787,7 @@ static void AdvanceWagonsAfterSwap(Vehicle *v)
static void ReverseTrainDirection(Vehicle *v)
{
- if (IsDepotTypeTile(v->tile, TRANSPORT_RAIL)) {
+ if (IsRailDepotTile(v->tile)) {
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
@@ -1807,7 +1807,7 @@ static void ReverseTrainDirection(Vehicle *v)
AdvanceWagonsAfterSwap(v);
- if (IsDepotTypeTile(v->tile, TRANSPORT_RAIL)) {
+ if (IsRailDepotTile(v->tile)) {
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
@@ -2035,7 +2035,7 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v, int max_distance)
tfdd.reverse = false;
TileIndex tile = v->tile;
- if (IsDepotTypeTile(tile, TRANSPORT_RAIL)) {
+ if (IsRailDepotTile(tile)) {
tfdd.tile = tile;
tfdd.best_length = 0;
return tfdd;
@@ -2154,7 +2154,7 @@ static void HandleLocomotiveSmokeCloud(const Vehicle *v)
}
/* No smoke in depots or tunnels */
- if (IsDepotTypeTile(v->tile, TRANSPORT_RAIL) || IsTunnelTile(v->tile)) continue;
+ if (IsRailDepotTile(v->tile) || IsTunnelTile(v->tile)) continue;
/* No sparks for electric vehicles on nonelectrified tracks */
if (!HasPowerOnRail(v->u.rail.railtype, GetTileRailType(v->tile))) continue;
@@ -3149,7 +3149,7 @@ static void DeleteLastWagon(Vehicle *v)
if (IsLevelCrossingTile(tile)) UpdateLevelCrossing(tile);
/* Update signals */
- if (IsTileType(tile, MP_TUNNELBRIDGE) || IsDepotTypeTile(tile, TRANSPORT_RAIL)) {
+ if (IsTileType(tile, MP_TUNNELBRIDGE) || IsRailDepotTile(tile)) {
UpdateSignalsOnSegment(tile, INVALID_DIAGDIR, owner);
} else {
SetSignalsOnBothDir(tile, (Track)(FIND_FIRST_BIT(track)), owner);
@@ -3311,7 +3311,7 @@ static bool TrainCanLeaveTile(const Vehicle *v)
}
/* entering a depot? */
- if (IsDepotTypeTile(tile, TRANSPORT_RAIL)) {
+ if (IsRailDepotTile(tile)) {
DiagDirection dir = ReverseDiagDir(GetRailDepotDirection(tile));
if (DiagDirToDir(dir) == v->direction) return false;
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 432774210..8a65c8d02 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -3217,7 +3217,7 @@ CommandCost Vehicle::SendToDepot(uint32 flags, DepotCommand command)
/* check if at a standstill (not stopped only) in a depot
* the check is down here to make it possible to alter stop/service for trains entering the depot */
- if (this->type == VEH_TRAIN && IsDepotTypeTile(this->tile, TRANSPORT_RAIL) && this->cur_speed == 0) return CMD_ERROR;
+ if (this->type == VEH_TRAIN && IsRailDepotTile(this->tile) && this->cur_speed == 0) return CMD_ERROR;
TileIndex location;
DestinationID destination;
diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp
index b666999c3..fab8400d1 100644
--- a/src/yapf/yapf_destrail.hpp
+++ b/src/yapf/yapf_destrail.hpp
@@ -43,7 +43,7 @@ public:
/// Called by YAPF to detect if node ends in the desired destination
FORCEINLINE bool PfDetectDestination(TileIndex tile, Trackdir td)
{
- bool bDest = IsDepotTypeTile(tile, TRANSPORT_RAIL);
+ bool bDest = IsRailDepotTile(tile);
return bDest;
}
diff --git a/src/yapf/yapf_road.cpp b/src/yapf/yapf_road.cpp
index 81a6eeb73..853b68e5b 100644
--- a/src/yapf/yapf_road.cpp
+++ b/src/yapf/yapf_road.cpp
@@ -87,7 +87,7 @@ public:
if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
// stop if we have just entered the depot
- if (IsDepotTypeTile(tile, TRANSPORT_ROAD) && trackdir == DiagdirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
+ if (IsRoadDepotTile(tile) && trackdir == DiagdirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
// next time we will reverse and leave the depot
break;
}
@@ -148,7 +148,7 @@ public:
/// Called by YAPF to detect if node ends in the desired destination
FORCEINLINE bool PfDetectDestination(Node& n)
{
- bool bDest = IsDepotTypeTile(n.m_segment_last_tile, TRANSPORT_ROAD);
+ bool bDest = IsRoadDepotTile(n.m_segment_last_tile);
return bDest;
}
@@ -370,7 +370,7 @@ public:
// get found depot tile
Node *n = Yapf().GetBestNode();
TileIndex depot_tile = n->m_segment_last_tile;
- assert(IsDepotTypeTile(depot_tile, TRANSPORT_ROAD));
+ assert(IsRoadDepotTile(depot_tile));
Depot* ret = GetDepotByTile(depot_tile);
return ret;
}
@@ -439,7 +439,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v)
return NULL;
// handle the case when our vehicle is already in the depot tile
- if (IsTileType(tile, MP_ROAD) && IsDepotTypeTile(tile, TRANSPORT_ROAD)) {
+ if (IsRoadDepotTile(tile)) {
// only what we need to return is the Depot*
return GetDepotByTile(tile);
}