Debug: Extend random debug logging to also include state checksum updates
This commit is contained in:
@@ -12,6 +12,16 @@
|
||||
|
||||
#include "bitmath_func.hpp"
|
||||
|
||||
#ifdef RANDOM_DEBUG
|
||||
#include "../network/network.h"
|
||||
#include "../network/network_server.h"
|
||||
#include "../network/network_internal.h"
|
||||
#include "../company_func.h"
|
||||
#include "../fileio_func.h"
|
||||
#include "../date_func.h"
|
||||
#include "../debug.h"
|
||||
#endif /* RANDOM_DEBUG */
|
||||
|
||||
struct SimpleChecksum64 {
|
||||
uint64 state = 0;
|
||||
|
||||
@@ -28,4 +38,15 @@ inline void UpdateStateChecksum(uint64 input)
|
||||
_state_checksum.Update(input);
|
||||
}
|
||||
|
||||
#ifdef RANDOM_DEBUG
|
||||
inline bool ShouldLogUpdateStateChecksum()
|
||||
{
|
||||
return _networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE));
|
||||
}
|
||||
# define DEBUG_UPDATESTATECHECKSUM(str, ...) if (ShouldLogUpdateStateChecksum()) DEBUG(statecsum, 0, "date{%08x; %02x; %02x}; %04x; %02x; " OTTD_PRINTFHEX64PAD "; %s:%d " str, \
|
||||
_date, _date_fract, _tick_skip_counter, _frame_counter, (byte)_current_company, _state_checksum.state, __FILE__, __LINE__, __VA_ARGS__);
|
||||
#else
|
||||
# define DEBUG_UPDATESTATECHECKSUM(str, ...)
|
||||
#endif /* RANDOM_DEBUG */
|
||||
|
||||
#endif /* CHECKSUM_FUNC_HPP */
|
||||
|
Reference in New Issue
Block a user