summaryrefslogtreecommitdiff
path: root/ai
diff options
context:
space:
mode:
Diffstat (limited to 'ai')
-rw-r--r--ai/trolly/build.c10
-rw-r--r--ai/trolly/pathfinder.c4
-rw-r--r--ai/trolly/shared.c2
-rw-r--r--ai/trolly/trolly.c21
4 files changed, 17 insertions, 20 deletions
diff --git a/ai/trolly/build.c b/ai/trolly/build.c
index f61521ba7..9959d0d04 100644
--- a/ai/trolly/build.c
+++ b/ai/trolly/build.c
@@ -116,7 +116,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
PathFinderInfo->position++;
// TODO: problems!
if (CmdFailed(cost)) {
- DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be built!");
+ DEBUG(ai, 0, "[BuildPath] tunnel could not be built (0x%X)", route[part]);
return 0;
}
return cost;
@@ -127,7 +127,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
PathFinderInfo->position++;
// TODO: problems!
if (CmdFailed(cost)) {
- DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be built!");
+ DEBUG(ai, 0, "[BuildPath] bridge could not be built (0x%X, 0x%X)", route[part], route[part - 1]);
return 0;
}
return cost;
@@ -166,7 +166,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
PathFinderInfo->position++;
// TODO: problems!
if (CmdFailed(cost)) {
- DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be built!");
+ DEBUG(ai, 0, "[BuildPath] tunnel could not be built (0x%X)", route[part]);
return 0;
}
return cost;
@@ -177,7 +177,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
PathFinderInfo->position++;
// TODO: problems!
if (CmdFailed(cost)) {
- DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be built!");
+ DEBUG(ai, 0, "[BuildPath] bridge could not be built (0x%X, 0x%X)", route[part], route[part + 1]);
return 0;
}
return cost;
@@ -201,7 +201,7 @@ int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte fla
// Currently, we ignore CMD_ERRORs!
if (CmdFailed(res) && flag == DC_EXEC && !IsTileType(route[part], MP_STREET) && !EnsureNoVehicle(route[part])) {
// Problem.. let's just abort it all!
- DEBUG(ai,0)("Darn, the route could not be built.. aborting!");
+ DEBUG(ai, 0, "[BuidPath] route building failed at tile 0x%X, aborting", route[part]);
p->ainew.state = AI_STATE_NOTHING;
return 0;
}
diff --git a/ai/trolly/pathfinder.c b/ai/trolly/pathfinder.c
index c5ab35122..6ffdf1fec 100644
--- a/ai/trolly/pathfinder.c
+++ b/ai/trolly/pathfinder.c
@@ -200,14 +200,14 @@ static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *curre
PathFinderInfo->route[i++] = parent->node.tile;
if (i > lengthof(PathFinderInfo->route)) {
// We ran out of space for the PathFinder
- DEBUG(ai, 0)("[AiPathFinder] Ran out of space in the route[] array!!!");
+ DEBUG(ai, 0, "No more space in pathfinder route[] array");
PathFinderInfo->route_length = -1; // -1 indicates out of space
return;
}
parent = parent->parent;
} while (parent != NULL);
PathFinderInfo->route_length = i;
- DEBUG(ai, 1)("[Ai-PathFinding] Found route of %d nodes long in %d nodes of searching", i, Hash_Size(&aystar->ClosedListHash));
+ DEBUG(ai, 1, "Found route of %d nodes long in %d nodes of searching", i, Hash_Size(&aystar->ClosedListHash));
}
diff --git a/ai/trolly/shared.c b/ai/trolly/shared.c
index d41544ef0..e683b60ea 100644
--- a/ai/trolly/shared.c
+++ b/ai/trolly/shared.c
@@ -109,7 +109,7 @@ bool AiNew_SetSpecialVehicleFlag(Player* p, Vehicle* v, uint flag)
// Out of special_vehicle spots :s
if (new_id == -1) {
- DEBUG(ai, 1)("special_vehicles list is too small :(");
+ DEBUG(ai, 1, "special_vehicles list is too small");
return false;
}
p->ainew.special_vehicles[new_id].veh_id = v->index;
diff --git a/ai/trolly/trolly.c b/ai/trolly/trolly.c
index 23a700b06..d67a064b4 100644
--- a/ai/trolly/trolly.c
+++ b/ai/trolly/trolly.c
@@ -445,8 +445,7 @@ static void AiNew_State_LocateRoute(Player *p)
p->ainew.to_ic = p->ainew.temp;
p->ainew.state = AI_STATE_FIND_STATION;
- DEBUG(ai,1)(
- "[AiNew - LocateRoute] Found bus-route of %d tiles long (from %d to %d)",
+ DEBUG(ai, 1, "[LocateRoute] found bus-route of %d tiles long (from %d to %d)",
distance,
p->ainew.from_ic,
p->ainew.temp
@@ -508,8 +507,7 @@ static void AiNew_State_LocateRoute(Player *p)
}
p->ainew.state = AI_STATE_FIND_STATION;
- DEBUG(ai,1)(
- "[AiNew - LocateRoute] Found truck-route of %d tiles long (from %d to %d)",
+ DEBUG(ai, 1, "[LocateRoute] found truck-route of %d tiles long (from %d to %d)",
distance,
p->ainew.from_ic,
p->ainew.temp
@@ -763,7 +761,7 @@ static void AiNew_State_FindPath(Player *p)
r = p->ainew.pathfinder->main(p->ainew.pathfinder);
switch (r) {
case AYSTAR_NO_PATH:
- DEBUG(ai,1)("[AiNew] PathFinder found no route!");
+ DEBUG(ai, 1, "No route found by pathfinder");
// Start all over again
p->ainew.state = AI_STATE_NOTHING;
break;
@@ -955,7 +953,7 @@ static void AiNew_State_VerifyRoute(Player *p)
// Check if we have enough money for it!
if (p->ainew.new_cost > p->player_money - AI_MINIMUM_MONEY) {
// Too bad..
- DEBUG(ai,1)("[AiNew] Can't pay for this route (%d)", p->ainew.new_cost);
+ DEBUG(ai, 1, "Insufficient funds to build route (%d)", p->ainew.new_cost);
p->ainew.state = AI_STATE_NOTHING;
return;
}
@@ -975,7 +973,7 @@ static void AiNew_State_VerifyRoute(Player *p)
p->ainew.state = AI_STATE_BUILD_STATION;
p->ainew.temp = 0;
- DEBUG(ai,1)("[AiNew] The route is set and buildable.. going to build it!");
+ DEBUG(ai, 1, "The route is set and buildable, building 0x%X to 0x%X...", p->ainew.from_tile, p->ainew.to_tile);
}
@@ -993,7 +991,7 @@ static void AiNew_State_BuildStation(Player *p)
p->ainew.state = AI_STATE_BUILD_PATH;
}
if (CmdFailed(res)) {
- DEBUG(ai,0)("[AiNew - BuildStation] Strange but true... station can not be built!");
+ DEBUG(ai, 0, "[BuildStation] station could not be built (0x%X)", p->ainew.to_tile);
p->ainew.state = AI_STATE_NOTHING;
// If the first station _was_ build, destroy it
if (p->ainew.temp != 0)
@@ -1010,7 +1008,7 @@ static void AiNew_State_BuildPath(Player *p)
assert(p->ainew.state == AI_STATE_BUILD_PATH);
// p->ainew.temp is set to -1 when this function is called for the first time
if (p->ainew.temp == -1) {
- DEBUG(ai,1)("[AiNew] Starting to build the path..");
+ DEBUG(ai, 1, "Starting to build new path");
// Init the counter
p->ainew.counter = (4 - _opt.diff.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
// Set the position to the startingplace (-1 because in a minute we do ++)
@@ -1091,8 +1089,7 @@ static void AiNew_State_BuildPath(Player *p)
}
}
-
- DEBUG(ai,1)("[AiNew] Done building the path (cost: %d)", p->ainew.new_cost);
+ DEBUG(ai, 1, "Finished building path, cost: %d", p->ainew.new_cost);
p->ainew.state = AI_STATE_BUILD_DEPOT;
}
}
@@ -1122,7 +1119,7 @@ static void AiNew_State_BuildDepot(Player *p)
res = AiNew_Build_Depot(p, p->ainew.depot_tile, p->ainew.depot_direction, DC_EXEC);
if (CmdFailed(res)) {
- DEBUG(ai,0)("[AiNew - BuildDepot] Strange but true... depot can not be built!");
+ DEBUG(ai, 0, "[BuildDepot] depot could not be built (0x%X)", p->ainew.depot_tile);
p->ainew.state = AI_STATE_NOTHING;
return;
}