diff --git a/src/genworld.cpp b/src/genworld.cpp index ff801a3..84d4610 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -201,11 +201,13 @@ static void _GenerateWorld(void *) if (_network_dedicated) DEBUG(net, 1, "Map generated, starting game"); DEBUG(desync, 1, "new_map: %08x", _settings_game.game_creation.generation_seed); + #ifndef NO_DEBUG_MESSAGES if (_debug_desync_level > 0) { char name[MAX_PATH]; seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date); SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false); } + #endif } catch (...) { BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true); if (_cur_company.IsValid()) _cur_company.Restore(); diff --git a/src/openttd.cpp b/src/openttd.cpp index cf438dd..4c2ee06 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1192,7 +1192,11 @@ static void CheckCaches() { /* Return here so it is easy to add checks that are run * always to aid testing of caches. */ + #ifndef NO_DEBUG_MESSAGES if (_debug_desync_level <= 1) return; + #else + return; + #endif /* Check the town caches. */ SmallVector old_town_caches; @@ -1364,12 +1368,14 @@ void StateGameLoop() CallWindowTickEvent(); NewsLoop(); } else { + #ifndef NO_DEBUG_MESSAGES if (_debug_desync_level > 2 && _date_fract == 0 && (_date & 0x1F) == 0) { /* Save the desync savegame if needed. */ char name[MAX_PATH]; seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date); SaveOrLoad(name, SLO_SAVE, DFT_GAME_FILE, AUTOSAVE_DIR, false); } + #endif CheckCaches(); diff --git a/src/pathfinder/yapf/yapf_rail.cpp b/src/pathfinder/yapf/yapf_rail.cpp index 52bbffe..4655072 100644 --- a/src/pathfinder/yapf/yapf_rail.cpp +++ b/src/pathfinder/yapf/yapf_rail.cpp @@ -238,6 +238,7 @@ public: if (max_penalty != 0) pf1.DisableCache(true); bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_penalty, reverse_penalty, depot_tile, reversed); + #ifndef NO_DEBUG_MESSAGES if (_debug_desync_level >= 2) { Tpf pf2; TileIndex depot_tile2 = INVALID_TILE; @@ -249,6 +250,7 @@ public: DumpState(pf1, pf2); } } + #endif return result1; } @@ -323,10 +325,10 @@ public: { /* Create pathfinder instance */ Tpf pf1; - bool result1; - if (_debug_desync_level < 2) { - result1 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, false); - } else { + bool result1 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, false); + + #ifndef NO_DEBUG_MESSAGES + if (_debug_desync_level >= 2) { bool result2 = pf1.FindNearestSafeTile(v, t1, td, override_railtype, true); Tpf pf2; pf2.DisableCache(true); @@ -336,6 +338,7 @@ public: DumpState(pf1, pf2); } } + #endif return result1; } @@ -406,11 +409,10 @@ public: { /* create pathfinder instance */ Tpf pf1; - Trackdir result1; + Trackdir result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target); - if (_debug_desync_level < 2) { - result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, reserve_track, target); - } else { + #ifndef NO_DEBUG_MESSAGES + if (_debug_desync_level >= 2) { result1 = pf1.ChooseRailTrack(v, tile, enterdir, tracks, path_found, false, NULL); Tpf pf2; pf2.DisableCache(true); @@ -420,6 +422,7 @@ public: DumpState(pf1, pf2); } } + #endif return result1; } @@ -469,6 +472,7 @@ public: Tpf pf1; bool result1 = pf1.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty); + #ifndef NO_DEBUG_MESSAGES if (_debug_desync_level >= 2) { Tpf pf2; pf2.DisableCache(true); @@ -478,6 +482,7 @@ public: DumpState(pf1, pf2); } } + #endif return result1; }