src/ai/trolly/pathfinder.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9912 1ac8aac92385
child 6743 cabfaa4a0295
--- a/src/ai/trolly/pathfinder.cpp	Wed Jun 13 12:05:56 2007 +0000
+++ b/src/ai/trolly/pathfinder.cpp	Tue Jun 19 07:21:01 2007 +0000
@@ -23,18 +23,18 @@
 	Player *p = GetPlayer(_current_player);
 
 	if (dir == TEST_STATION_NO_DIR) {
-		int32 ret;
+		CommandCost ret;
 		// TODO: currently we only allow spots that can be access from al 4 directions...
 		//  should be fixed!!!
 		for (dir = 0; dir < 4; dir++) {
 			ret = AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST);
-			if (!CmdFailed(ret)) return true;
+			if (CmdSucceeded(ret)) return true;
 		}
 		return false;
 	}
 
 	// return true if command succeeded, so the inverse of CmdFailed()
-	return !CmdFailed(AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST));
+	return CmdSucceeded(AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST));
 }
 
 
@@ -214,7 +214,7 @@
 // What tiles are around us.
 static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current)
 {
-	int ret;
+	CommandCost ret;
 	int dir;
 
 	Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
@@ -352,7 +352,7 @@
 			// Now simply check if a tunnel can be build
 			ret = AI_DoCommand(tile, (PathFinderInfo->rail_or_road?0:0x200), 0, DC_AUTO, CMD_BUILD_TUNNEL);
 			tileh = GetTileSlope(_build_tunnel_endtile, NULL);
-			if (!CmdFailed(ret) && (tileh == SLOPE_SW || tileh == SLOPE_SE || tileh == SLOPE_NW || tileh == SLOPE_NE)) {
+			if (CmdSucceeded(ret) && (tileh == SLOPE_SW || tileh == SLOPE_SE || tileh == SLOPE_NW || tileh == SLOPE_NE)) {
 				aystar->neighbours[aystar->num_neighbours].tile = _build_tunnel_endtile;
 				aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_TUNNEL + (dir << 8);
 				aystar->neighbours[aystar->num_neighbours++].direction = 0;