summaryrefslogtreecommitdiff
path: root/src/pathfinder
diff options
context:
space:
mode:
authorrubidium42 <rubidium@openttd.org>2021-06-12 09:10:17 +0200
committerrubidium42 <rubidium42@users.noreply.github.com>2021-06-13 12:45:45 +0200
commit55a11710a6c0f7942f3947711f2050c34782c39d (patch)
tree491b3009324e623236977614e91371a0ea4abac7 /src/pathfinder
parenta99ac62c1ab816ee48cac85fdf834f9fdc599cb1 (diff)
downloadopenttd-55a11710a6c0f7942f3947711f2050c34782c39d.tar.xz
Codechange: convert printf DEBUG statements to fmt Debug statements
Diffstat (limited to 'src/pathfinder')
-rw-r--r--src/pathfinder/npf/npf.cpp20
-rw-r--r--src/pathfinder/yapf/yapf_base.hpp2
-rw-r--r--src/pathfinder/yapf/yapf_rail.cpp8
3 files changed, 15 insertions, 15 deletions
diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp
index 604ead52b..733b2eba9 100644
--- a/src/pathfinder/npf/npf.cpp
+++ b/src/pathfinder/npf/npf.cpp
@@ -178,7 +178,7 @@ static int32 NPFCalcStationOrTileHeuristic(AyStar *as, AyStarNode *current, Open
dist = NPFDistanceTrack(from, to);
}
- DEBUG(npf, 4, "Calculating H for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), dist);
+ Debug(npf, 4, "Calculating H for: ({}, {}). Result: {}", TileX(current->tile), TileY(current->tile), dist);
if (dist < ftd->best_bird_dist) {
ftd->best_bird_dist = dist;
@@ -198,7 +198,7 @@ static void NPFFillTrackdirChoice(AyStarNode *current, OpenListNode *parent)
/* This is a first order decision, so we'd better save the
* direction we chose */
current->user_data[NPF_TRACKDIR_CHOICE] = trackdir;
- DEBUG(npf, 6, "Saving trackdir: 0x%X", trackdir);
+ Debug(npf, 6, "Saving trackdir: 0x{:X}", trackdir);
} else {
/* We've already made the decision, so just save our parent's decision */
current->user_data[NPF_TRACKDIR_CHOICE] = parent->path.node.user_data[NPF_TRACKDIR_CHOICE];
@@ -394,7 +394,7 @@ static int32 NPFRoadPathCost(AyStar *as, AyStarNode *current, OpenListNode *pare
}
NPFMarkTile(tile);
- DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
+ Debug(npf, 4, "Calculating G for: ({}, {}). Result: {}", TileX(current->tile), TileY(current->tile), cost);
return cost;
}
@@ -546,7 +546,7 @@ static int32 NPFRailPathCost(AyStar *as, AyStarNode *current, OpenListNode *pare
cost += NPFReservedTrackCost(current);
NPFMarkTile(tile);
- DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
+ Debug(npf, 4, "Calculating G for: ({}, {}). Result: {}", TileX(current->tile), TileY(current->tile), cost);
return cost;
}
@@ -865,7 +865,7 @@ static TrackdirBits GetDriveableTrackdirBits(TileIndex dst_tile, TileIndex src_t
}
}
- DEBUG(npf, 4, "Next node: (%d, %d) [%d], possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits);
+ Debug(npf, 4, "Next node: ({}, {}) [{}], possible trackdirs: 0x{:X}", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits);
/* Select only trackdirs we can reach from our current trackdir */
trackdirbits &= TrackdirReachesTrackdirs(src_trackdir);
@@ -875,7 +875,7 @@ static TrackdirBits GetDriveableTrackdirBits(TileIndex dst_tile, TileIndex src_t
trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir);
}
- DEBUG(npf, 6, "After filtering: (%d, %d), possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), trackdirbits);
+ Debug(npf, 6, "After filtering: ({}, {}), possible trackdirs: 0x{:X}", TileX(dst_tile), TileY(dst_tile), trackdirbits);
return trackdirbits;
}
@@ -901,7 +901,7 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
/* Initialize to 0, so we can jump out (return) somewhere an have no neighbours */
aystar->num_neighbours = 0;
- DEBUG(npf, 4, "Expanding: (%d, %d, %d) [%d]", TileX(src_tile), TileY(src_tile), src_trackdir, src_tile);
+ Debug(npf, 4, "Expanding: ({}, {}, {}) [{}]", TileX(src_tile), TileY(src_tile), src_trackdir, src_tile);
/* We want to determine the tile we arrive, and which choices we have there */
TileIndex dst_tile;
@@ -966,7 +966,7 @@ static void NPFFollowTrack(AyStar *aystar, OpenListNode *current)
uint i = 0;
while (trackdirbits != TRACKDIR_BIT_NONE) {
Trackdir dst_trackdir = RemoveFirstTrackdir(&trackdirbits);
- DEBUG(npf, 5, "Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits);
+ Debug(npf, 5, "Expanded into trackdir: {}, remaining trackdirs: 0x{:X}", dst_trackdir, trackdirbits);
/* Tile with signals? */
if (IsTileType(dst_tile, MP_RAILWAY) && GetRailTileType(dst_tile) == RAIL_TILE_SIGNALS) {
@@ -1050,10 +1050,10 @@ static NPFFoundTargetData NPFRouteInternal(AyStarNode *start1, bool ignore_start
if (result.best_bird_dist != 0) {
if (target != nullptr) {
- DEBUG(npf, 1, "Could not find route to tile 0x%X from 0x%X.", target->dest_coords, start1->tile);
+ Debug(npf, 1, "Could not find route to tile 0x{:X} from 0x{:X}.", target->dest_coords, start1->tile);
} else {
/* Assumption: target == nullptr, so we are looking for a depot */
- DEBUG(npf, 1, "Could not find route to a depot from tile 0x%X.", start1->tile);
+ Debug(npf, 1, "Could not find route to a depot from tile 0x{:X}.", start1->tile);
}
}
diff --git a/src/pathfinder/yapf/yapf_base.hpp b/src/pathfinder/yapf/yapf_base.hpp
index c548cfd97..8c45efa1e 100644
--- a/src/pathfinder/yapf/yapf_base.hpp
+++ b/src/pathfinder/yapf/yapf_base.hpp
@@ -146,7 +146,7 @@ public:
int cost = bDestFound ? m_pBestDestNode->m_cost : -1;
int dist = bDestFound ? m_pBestDestNode->m_estimate - m_pBestDestNode->m_cost : -1;
- DEBUG(yapf, 3, "[YAPF%c]%c%4d- %d rounds - %d open - %d closed - CHR %4.1f%% - C %d D %d",
+ Debug(yapf, 3, "[YAPF{}]{}{:4d} - {} rounds - {} open - {} closed - CHR {:4.1f}% - C {} D {}",
ttc, bDestFound ? '-' : '!', veh_idx, m_num_steps, m_nodes.OpenCount(), m_nodes.ClosedCount(), cache_hit_ratio, cost, dist
);
}
diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp
index 41aa5fdbd..8933c6f29 100644
--- a/src/pathfinder/yapf/yapf_rail.cpp
+++ b/src/pathfinder/yapf/yapf_rail.cpp
@@ -241,7 +241,7 @@ public:
pf2.DisableCache(true);
FindDepotData result2 = pf2.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty);
if (result1.tile != result2.tile || (result1.reverse != result2.reverse)) {
- DEBUG(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [%s, %s]",
+ Debug(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [{}, {}]",
result1.tile != INVALID_TILE ? "T" : "F",
result2.tile != INVALID_TILE ? "T" : "F");
DumpState(pf1, pf2);
@@ -325,7 +325,7 @@ public:
pf2.DisableCache(true);
result1 = pf2.FindNearestSafeTile(v, t1, td, override_railtype, false);
if (result1 != result2) {
- DEBUG(desync, 2, "CACHE ERROR: FindSafeTile() = [%s, %s]", result2 ? "T" : "F", result1 ? "T" : "F");
+ Debug(desync, 2, "CACHE ERROR: FindSafeTile() = [{}, {}]", result2 ? "T" : "F", result1 ? "T" : "F");
DumpState(pf1, pf2);
}
}
@@ -409,7 +409,7 @@ public:
pf2.DisableCache(true);
Trackdir result2 = pf2.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target);
if (result1 != result2) {
- DEBUG(desync, 2, "CACHE ERROR: ChooseRailTrack() = [%d, %d]", result1, result2);
+ Debug(desync, 2, "CACHE ERROR: ChooseRailTrack() = [{}, {}]", result1, result2);
DumpState(pf1, pf2);
}
}
@@ -467,7 +467,7 @@ public:
pf2.DisableCache(true);
bool result2 = pf2.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty);
if (result1 != result2) {
- DEBUG(desync, 2, "CACHE ERROR: CheckReverseTrain() = [%s, %s]", result1 ? "T" : "F", result2 ? "T" : "F");
+ Debug(desync, 2, "CACHE ERROR: CheckReverseTrain() = [{}, {}]", result1 ? "T" : "F", result2 ? "T" : "F");
DumpState(pf1, pf2);
}
}