summaryrefslogtreecommitdiff
path: root/src/ai/trolly
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-10-19 22:46:55 +0000
committerrubidium <rubidium@openttd.org>2007-10-19 22:46:55 +0000
commit95f2181a1dbd2ac1276bf3e044d6d9161b96ed50 (patch)
tree94325422edf35b6645a697ffa3bfd15ed090bf01 /src/ai/trolly
parent9371ac13078df51aa920ecaa99485b0b4081513a (diff)
downloadopenttd-95f2181a1dbd2ac1276bf3e044d6d9161b96ed50.tar.xz
(svn r11303) -Fix: EnsureNoVehicle and EnsureNoVehicleOnGround were both used to check whether there was no vehicle on the ground, except that the former didn't take care of aircraft shadows. So now we only use EnsureNoVehicleOnGround.
Diffstat (limited to 'src/ai/trolly')
-rw-r--r--src/ai/trolly/build.cpp10
-rw-r--r--src/ai/trolly/trolly.cpp2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/ai/trolly/build.cpp b/src/ai/trolly/build.cpp
index 6d5e9a32f..472956bf6 100644
--- a/src/ai/trolly/build.cpp
+++ b/src/ai/trolly/build.cpp
@@ -185,10 +185,10 @@ CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo,
// Build normal road
// Keep it doing till we go an other way
- // EnsureNoVehicle makes sure we don't build on a tile where a vehicle is. This way
+ // EnsureNoVehicleOnGround makes sure we don't build on a tile where a vehicle is. This way
// it will wait till the vehicle is gone..
- if (route_extra[part-1] == 0 && route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicle(route[part]))) {
- while (route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicle(route[part]))) {
+ if (route_extra[part-1] == 0 && route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicleOnGround(route[part]))) {
+ while (route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicleOnGround(route[part]))) {
// Get the current direction
dir = AiNew_GetRoadDirection(route[part-1], route[part], route[part+1]);
// Is it the same as the last one?
@@ -199,7 +199,7 @@ CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo,
// Build the tile
res = AI_DoCommand(route[part], dir, 0, flag | DC_NO_WATER, CMD_BUILD_ROAD);
// Currently, we ignore CMD_ERRORs!
- if (CmdFailed(res) && flag == DC_EXEC && !IsTileType(route[part], MP_ROAD) && !EnsureNoVehicle(route[part])) {
+ if (CmdFailed(res) && flag == DC_EXEC && !IsTileType(route[part], MP_ROAD) && !EnsureNoVehicleOnGround(route[part])) {
// Problem.. let's just abort it all!
DEBUG(ai, 0, "[BuidPath] route building failed at tile 0x%X, aborting", route[part]);
p->ainew.state = AI_STATE_NOTHING;
@@ -216,7 +216,7 @@ CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo,
part--;
// We want to return the last position, so we go back one
}
- if (!EnsureNoVehicle(route[part]) && flag == DC_EXEC) part--;
+ if (!EnsureNoVehicleOnGround(route[part]) && flag == DC_EXEC) part--;
PathFinderInfo->position = part;
}
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index c2e4f577e..2c30b682e 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -1111,7 +1111,7 @@ static void AiNew_State_BuildDepot(Player *p)
}
// There is a bus on the tile we want to build road on... idle till he is gone! (BAD PERSON! :p)
- if (!EnsureNoVehicle(p->ainew.depot_tile + TileOffsByDiagDir(p->ainew.depot_direction)))
+ if (!EnsureNoVehicleOnGround(p->ainew.depot_tile + TileOffsByDiagDir(p->ainew.depot_direction)))
return;
res = AiNew_Build_Depot(p, p->ainew.depot_tile, p->ainew.depot_direction, DC_EXEC);