changeset 3964:ae9d8c18a39c draft

(svn r5127) Use IsRoadVehInDepotStopped() and IsAircraftInHangarStopped()
author tron <tron@openttd.org>
date Mon, 05 Jun 2006 14:54:23 +0000
parents b8b3c73be0e9
children 6fc5fe6c5d36
files ai/default/default.c
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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 @@
 	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 @@
 	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 @@
 			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 @@
 
 			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;