Add a chicken bit setting to enable periodic CheckCaches
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
enum ChickenBitFlags {
|
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,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool HasChickenBit(ChickenBitFlags flag)
|
inline bool HasChickenBit(ChickenBitFlags flag)
|
||||||
|
@@ -78,6 +78,7 @@
|
|||||||
#include "cargopacket.h"
|
#include "cargopacket.h"
|
||||||
#include "core/checksum_func.hpp"
|
#include "core/checksum_func.hpp"
|
||||||
#include "tbtr_template_vehicle_func.h"
|
#include "tbtr_template_vehicle_func.h"
|
||||||
|
#include "debug_settings.h"
|
||||||
|
|
||||||
#include "linkgraph/linkgraphschedule.h"
|
#include "linkgraph/linkgraphschedule.h"
|
||||||
#include "tracerestrict.h"
|
#include "tracerestrict.h"
|
||||||
@@ -1360,11 +1361,15 @@ void WriteVehicleInfo(char *&p, const char *last, const Vehicle *u, const Vehicl
|
|||||||
void CheckCaches(bool force_check, std::function<void(const char *)> log)
|
void CheckCaches(bool force_check, std::function<void(const char *)> log)
|
||||||
{
|
{
|
||||||
if (!force_check) {
|
if (!force_check) {
|
||||||
|
int desync_level = _debug_desync_level;
|
||||||
|
|
||||||
|
if (unlikely(HasChickenBit(DCBF_DESYNC_CHECK_PERIODIC)) && desync_level < 1) desync_level = 1;
|
||||||
|
|
||||||
/* Return here so it is easy to add checks that are run
|
/* Return here so it is easy to add checks that are run
|
||||||
* always to aid testing of caches. */
|
* always to aid testing of caches. */
|
||||||
if (_debug_desync_level < 1) return;
|
if (desync_level < 1) return;
|
||||||
|
|
||||||
if (_debug_desync_level == 1 && _scaled_date_ticks % 500 != 0) return;
|
if (desync_level == 1 && _scaled_date_ticks % 500 != 0) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char cclog_buffer[1024];
|
char cclog_buffer[1024];
|
||||||
|
Reference in New Issue
Block a user