Add chicken bit for CheckCaches call after DoCommandP

pull/326/head
Jonathan G Rennison 3 years ago
parent 5ed7aee8d3
commit 1b8bbdaf76

@ -30,6 +30,8 @@
#include "core/random_func.hpp" #include "core/random_func.hpp"
#include "settings_func.h" #include "settings_func.h"
#include "signal_func.h" #include "signal_func.h"
#include "debug_settings.h"
#include "debug_desync.h"
#include <array> #include <array>
#include "table/strings.h" #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; if (!random_state.Check()) log_flags |= CLEF_RANDOM;
AppendCommandLogEntry(res, tile, p1, p2, p3, cmd, log_flags); 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()) { if (res.Failed()) {
/* Only show the error when it's for us. */ /* Only show the error when it's for us. */
StringID error_part1 = GB(cmd, 16, 16); 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; if (!random_state.Check()) log_flags |= CLEF_RANDOM;
AppendCommandLogEntry(res, tile, p1, p2, p3, cmd, log_flags); 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; return res;
} }

@ -17,6 +17,7 @@ enum ChickenBitFlags {
DCBF_VEH_TICK_CACHE = 0, DCBF_VEH_TICK_CACHE = 0,
DCBF_MP_NO_STATE_CSUM_CHECK = 1, DCBF_MP_NO_STATE_CSUM_CHECK = 1,
DCBF_DESYNC_CHECK_PERIODIC = 2, DCBF_DESYNC_CHECK_PERIODIC = 2,
DCBF_DESYNC_CHECK_POST_COMMAND = 3,
}; };
inline bool HasChickenBit(ChickenBitFlags flag) inline bool HasChickenBit(ChickenBitFlags flag)

Loading…
Cancel
Save