diff --git a/src/debug.cpp b/src/debug.cpp index 8abe3a4780..140f14129f 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -40,6 +40,7 @@ int _debug_script_level; int _debug_sl_level; int _debug_gamelog_level; int _debug_desync_level; +int _debug_yapfdesync_level; int _debug_console_level; #ifdef RANDOM_DEBUG int _debug_random_level; @@ -68,6 +69,7 @@ struct DebugLevel { DEBUG_LEVEL(sl), DEBUG_LEVEL(gamelog), DEBUG_LEVEL(desync), + DEBUG_LEVEL(yapfdesync), DEBUG_LEVEL(console), #ifdef RANDOM_DEBUG DEBUG_LEVEL(random), diff --git a/src/debug.h b/src/debug.h index 7da72da1d3..590bc60204 100644 --- a/src/debug.h +++ b/src/debug.h @@ -52,6 +52,7 @@ extern int _debug_sl_level; extern int _debug_gamelog_level; extern int _debug_desync_level; + extern int _debug_yapfdesync_level; extern int _debug_console_level; #ifdef RANDOM_DEBUG extern int _debug_random_level; diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp index 7cd883847c..c4821c51ed 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -193,19 +193,19 @@ public: uint depth = 0; for (;;) { if ((n1 != NULL) != (n2 != NULL)) { - DEBUG(desync, 2, "%s: node nonnull state at %u = [%d, %d]", name, depth, (n1 != NULL), (n2 != NULL)); + DEBUG(desync, 0, "%s: node nonnull state at %u = [%d, %d]", name, depth, (n1 != NULL), (n2 != NULL)); DumpState(pf1, pf2); return; } if (n1 == NULL) break; if (n1->GetTile() != n2->GetTile()) { - DEBUG(desync, 2, "%s tile mismatch at %u = [0x%X, 0x%X]", name, depth, n1->GetTile(), n2->GetTile()); + DEBUG(desync, 0, "%s tile mismatch at %u = [0x%X, 0x%X]", name, depth, n1->GetTile(), n2->GetTile()); DumpState(pf1, pf2); return; } if (n1->GetTrackdir() != n2->GetTrackdir()) { - DEBUG(desync, 2, "%s trackdir mismatch at %u = [0x%X, 0x%X]", name, depth, n1->GetTrackdir(), n2->GetTrackdir()); + DEBUG(desync, 0, "%s trackdir mismatch at %u = [0x%X, 0x%X]", name, depth, n1->GetTrackdir(), n2->GetTrackdir()); DumpState(pf1, pf2); return; } @@ -215,7 +215,7 @@ public: } if (check_res && (pf1.m_res_dest != pf2.m_res_dest || pf1.m_res_dest_td != pf2.m_res_dest_td)) { - DEBUG(desync, 2, "%s reservation target mismatch = [(0x%X, %d), (0x%X, %d)]", name, pf1.m_res_dest, pf1.m_res_dest_td, pf2.m_res_dest, pf2.m_res_dest_td); + DEBUG(desync, 0, "%s reservation target mismatch = [(0x%X, %d), (0x%X, %d)]", name, pf1.m_res_dest, pf1.m_res_dest_td, pf2.m_res_dest, pf2.m_res_dest_td); DumpState(pf1, pf2); return; } @@ -273,14 +273,14 @@ public: if (max_penalty != 0) pf1.DisableCache(true); bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty, depot_tile, reversed); - if (_debug_desync_level >= 2) { + if (_debug_yapfdesync_level > 0 || _debug_desync_level >= 2) { Tpf pf2; TileIndex depot_tile2 = INVALID_TILE; bool reversed2 = false; pf2.DisableCache(true); bool result2 = pf2.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty, &depot_tile2, &reversed2); if (result1 != result2 || (result1 && (*depot_tile != depot_tile2 || *reversed != reversed2))) { - DEBUG(desync, 2, "CACHE ERROR: FindNearestDepotTwoWay() = [%s, %s]", result1 ? "T" : "F", result2 ? "T" : "F"); + DEBUG(desync, 0, "CACHE ERROR: FindNearestDepotTwoWay() = [%s, %s]", result1 ? "T" : "F", result2 ? "T" : "F"); DumpState(pf1, pf2); } } @@ -359,7 +359,7 @@ public: /* Create pathfinder instance */ Tpf pf1; bool result1; - if (_debug_desync_level < 2) { + if (_debug_yapfdesync_level < 1 && _debug_desync_level < 2) { result1 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, false); } else { bool result2 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, true); @@ -367,7 +367,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, 0, "CACHE ERROR: FindSafeTile() = [%s, %s]", result2 ? "T" : "F", result1 ? "T" : "F"); DumpState(pf1, pf2); } else if (result1) { CYapfFollowAnySafeTileRailT::stDesyncCheck(pf1, pf2, "CACHE ERROR: FindSafeTile()", true); @@ -445,7 +445,7 @@ public: Tpf pf1; Trackdir result1; - if (_debug_desync_level < 2) { + if (_debug_yapfdesync_level < 1 && _debug_desync_level < 2) { result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target); } else { result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, false, NULL); @@ -453,7 +453,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, 0, "CACHE ERROR: ChooseRailTrack() = [%d, %d]", result1, result2); DumpState(pf1, pf2); } else if (result1 != INVALID_TRACKDIR) { CYapfFollowRailT::stDesyncCheck(pf1, pf2, "CACHE ERROR: ChooseRailTrack()", true); @@ -508,7 +508,7 @@ public: Tpf pf1; bool result1 = pf1.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty); - if (_debug_desync_level >= 2) { + if (_debug_yapfdesync_level > 0 || _debug_desync_level >= 2) { Tpf pf2; pf2.DisableCache(true); bool result2 = pf2.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty);