Add chicken bit for CheckCaches call after DoCommandP

This commit is contained in:
Jonathan G Rennison
2021-10-03 22:26:25 +01:00
parent 5ed7aee8d3
commit 1b8bbdaf76
2 changed files with 11 additions and 0 deletions

View File

@@ -30,6 +30,8 @@
#include "core/random_func.hpp"
#include "settings_func.h"
#include "signal_func.h"
#include "debug_settings.h"
#include "debug_desync.h"
#include <array>
#include "table/strings.h"
@@ -889,6 +891,10 @@ bool DoCommandPEx(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, uint32 cmd, C
if (!random_state.Check()) log_flags |= CLEF_RANDOM;
AppendCommandLogEntry(res, tile, p1, p2, p3, cmd, log_flags);
if (unlikely(HasChickenBit(DCBF_DESYNC_CHECK_POST_COMMAND)) && !(GetCommandFlags(cmd) & CMD_LOG_AUX)) {
CheckCaches(true, nullptr, CHECK_CACHE_INFRA_TOTALS);
}
if (res.Failed()) {
/* Only show the error when it's for us. */
StringID error_part1 = GB(cmd, 16, 16);
@@ -929,6 +935,10 @@ CommandCost DoCommandPScript(TileIndex tile, uint32 p1, uint32 p2, uint64 p3, ui
if (!random_state.Check()) log_flags |= CLEF_RANDOM;
AppendCommandLogEntry(res, tile, p1, p2, p3, cmd, log_flags);
if (unlikely(HasChickenBit(DCBF_DESYNC_CHECK_POST_COMMAND)) && !(GetCommandFlags(cmd) & CMD_LOG_AUX)) {
CheckCaches(true, nullptr, CHECK_CACHE_INFRA_TOTALS);
}
return res;
}