mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-11 13:10:45 +00:00
Add a chicken bit setting to enable periodic CheckCaches
This commit is contained in:
parent
96ea775b24
commit
d4d54c9b90
@ -16,6 +16,7 @@
|
||||
enum ChickenBitFlags {
|
||||
DCBF_VEH_TICK_CACHE = 0,
|
||||
DCBF_MP_NO_STATE_CSUM_CHECK = 1,
|
||||
DCBF_DESYNC_CHECK_PERIODIC = 2,
|
||||
};
|
||||
|
||||
inline bool HasChickenBit(ChickenBitFlags flag)
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "cargopacket.h"
|
||||
#include "core/checksum_func.hpp"
|
||||
#include "tbtr_template_vehicle_func.h"
|
||||
#include "debug_settings.h"
|
||||
|
||||
#include "linkgraph/linkgraphschedule.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)
|
||||
{
|
||||
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
|
||||
* 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];
|
||||
|
Loading…
Reference in New Issue
Block a user