diff options
-rw-r--r-- | ai/default/default.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ai/default/default.c b/ai/default/default.c index 8ccb375a2..3287bf442 100644 --- a/ai/default/default.c +++ b/ai/default/default.c @@ -2,11 +2,13 @@ #include "../../stdafx.h" #include "../../openttd.h" +#include "../../aircraft.h" #include "../../bridge_map.h" #include "../../functions.h" #include "../../map.h" #include "../../rail_map.h" #include "../../road_map.h" +#include "../../roadveh.h" #include "../../station_map.h" #include "../../tile.h" #include "../../player.h" @@ -331,7 +333,7 @@ static void AiHandleReplaceRoadVeh(Player *p) BackuppedOrders orderbak[1]; EngineID veh; - if (!IsTileDepotType(v->tile, TRANSPORT_ROAD) || v->u.road.state != 254 || !(v->vehstatus&VS_STOPPED)) { + if (!IsRoadVehInDepotStopped(v)) { AiHandleGotoDepot(p, CMD_SEND_ROADVEH_TO_DEPOT); return; } @@ -360,7 +362,7 @@ static void AiHandleReplaceAircraft(Player *p) BackuppedOrders orderbak[1]; EngineID veh; - if (!IsHangarTile(v->tile) || !(v->vehstatus & VS_STOPPED)) { + if (!IsAircraftInHangarStopped(v)) { AiHandleGotoDepot(p, CMD_SEND_AIRCRAFT_TO_HANGAR); return; } @@ -3516,7 +3518,7 @@ static void AiStateSellVeh(Player *p) DoCommand(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON); } else if (v->type == VEH_Road) { - if (!IsTileDepotType(v->tile, TRANSPORT_ROAD) || v->u.road.state != 254 || !(v->vehstatus&VS_STOPPED)) { + if (!IsRoadVehInDepotStopped(v)) { if (v->current_order.type != OT_GOTO_DEPOT) DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT); goto going_to_depot; @@ -3524,7 +3526,7 @@ static void AiStateSellVeh(Player *p) DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH); } else if (v->type == VEH_Aircraft) { - if (!IsHangarTile(v->tile) || !(v->vehstatus & VS_STOPPED)) { + if (!IsAircraftInHangarStopped(v)) { if (v->current_order.type != OT_GOTO_DEPOT) DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR); goto going_to_depot; |