ai/trolly/trolly.c
changeset 2737 fb1556b8f5e0
parent 2684 4df784e4be66
child 2749 c9312a4a1efe
--- a/ai/trolly/trolly.c	Sat Dec 10 11:16:45 2005 +0000
+++ b/ai/trolly/trolly.c	Sat Dec 10 12:05:39 2005 +0000
@@ -659,7 +659,7 @@
 					if (accepts[p->ainew.cargo] >> 3 == 0) continue;
 					// See if we can build the station
 					r = AiNew_Build_Station(p, p->ainew.tbt, new_tile, 0, 0, 0, DC_QUERY_COST);
-					if (r == CMD_ERROR) continue;
+					if (CmdFailed(r)) continue;
 					// We can build it, so add it to found_spot
 					found_spot[i] = new_tile;
 					found_best[i++] = accepts[p->ainew.cargo];
@@ -846,7 +846,7 @@
 				if (ti.tileh != 0) continue;
 				// Check if everything went okay..
 				r = AiNew_Build_Depot(p, tile + TileOffsByDir(j), j ^ 2, 0);
-				if (r == CMD_ERROR) continue;
+				if (CmdFailed(r)) continue;
 				// Found a spot!
 				p->ainew.new_cost += r;
 				p->ainew.depot_tile = tile + TileOffsByDir(j);
@@ -989,7 +989,7 @@
 			res = AiNew_Build_Station(p, p->ainew.tbt, p->ainew.to_tile, 0, 0, p->ainew.to_direction, DC_EXEC);
 		p->ainew.state = AI_STATE_BUILD_PATH;
 	}
-	if (res == CMD_ERROR) {
+	if (CmdFailed(res)) {
 		DEBUG(ai,0)("[AiNew - BuildStation] Strange but true... station can not be build!");
 		p->ainew.state = AI_STATE_NOTHING;
 		// If the first station _was_ build, destroy it
@@ -1119,7 +1119,7 @@
 		return;
 
 	res = AiNew_Build_Depot(p, p->ainew.depot_tile, p->ainew.depot_direction, DC_EXEC);
-	if (res == CMD_ERROR) {
+	if (CmdFailed(res)) {
 		DEBUG(ai,0)("[AiNew - BuildDepot] Strange but true... depot can not be build!");
 		p->ainew.state = AI_STATE_NOTHING;
 		return;
@@ -1152,7 +1152,7 @@
 
 	// Build the vehicle
 	res = AiNew_Build_Vehicle(p, p->ainew.depot_tile, DC_EXEC);
-	if (res == CMD_ERROR) {
+	if (CmdFailed(res)) {
 		// This happens when the AI can't build any more vehicles!
 		p->ainew.state = AI_STATE_NOTHING;
 		return;