summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-04-17 18:24:45 +0000
committersmatz <smatz@openttd.org>2008-04-17 18:24:45 +0000
commit059e94e355c9172a42b70ff20b4b8a87dd4889ae (patch)
tree1d21e0ab2e3402600dc144e6cfc0d1e0b5725da1 /src/ai
parente098b50379219aeb0b8d22d652a3de514759eb3d (diff)
downloadopenttd-059e94e355c9172a42b70ff20b4b8a87dd4889ae.tar.xz
(svn r12753) -Codechange: do not use IsDepotTypeTile() where simpler function can be used
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/default/default.cpp6
-rw-r--r--src/ai/trolly/pathfinder.cpp2
-rw-r--r--src/ai/trolly/trolly.cpp4
3 files changed, 6 insertions, 6 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);
}