Check/print tick skip counter in desync and random logging.
This commit is contained in:
@@ -74,7 +74,7 @@ void SetRandomSeed(uint32 seed)
|
||||
uint32 DoRandom(int line, const char *file)
|
||||
{
|
||||
if (_networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE))) {
|
||||
DEBUG(random, 0, "%08x; %02x; %04x; %02x; %s:%d", _date, _date_fract, _frame_counter, (byte)_current_company, file, line);
|
||||
DEBUG(random, 0, "%08x; %02x; %02X; %04x; %02x; %s:%d", _date, _date_fract, _tick_skip_counter, _frame_counter, (byte)_current_company, file, line);
|
||||
}
|
||||
|
||||
return _random.Next();
|
||||
|
@@ -318,7 +318,7 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) const
|
||||
|
||||
YearMonthDay ymd;
|
||||
ConvertDateToYMD(_date, &ymd);
|
||||
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i)\n\n", ymd.year, ymd.month + 1, ymd.day, _date_fract);
|
||||
buffer += seprintf(buffer, last, "In game date: %i-%02i-%02i (%i, %i)\n\n", ymd.year, ymd.month + 1, ymd.day, _date_fract, _tick_skip_counter);
|
||||
|
||||
buffer = this->LogError(buffer, last, CrashLog::message);
|
||||
buffer = this->LogOpenTTDVersion(buffer, last);
|
||||
|
@@ -874,7 +874,7 @@ void NetworkGameLoop()
|
||||
|
||||
if (_network_server) {
|
||||
/* Log the sync state to check for in-syncedness of replays. */
|
||||
if (_date_fract == 0) {
|
||||
if (_date_fract == 0 && _tick_skip_counter == 0) {
|
||||
/* We don't want to log multiple times if paused. */
|
||||
static Date last_log;
|
||||
if (last_log != _date) {
|
||||
|
@@ -253,7 +253,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
|
||||
if (_sync_seed_1 != _random.state[0]) {
|
||||
#endif
|
||||
NetworkError(STR_NETWORK_ERROR_DESYNC);
|
||||
DEBUG(desync, 1, "sync_err: %08x; %02x", _date, _date_fract);
|
||||
DEBUG(desync, 1, "sync_err: %08x; %02x; %02X", _date, _date_fract, _tick_skip_counter);
|
||||
DEBUG(net, 0, "Sync error detected!");
|
||||
my_client->ClientError(NETWORK_RECV_STATUS_DESYNC);
|
||||
return false;
|
||||
|
@@ -953,7 +953,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
|
||||
strecpy(ci->client_name, name, lastof(ci->client_name));
|
||||
ci->client_playas = playas;
|
||||
ci->client_lang = client_lang;
|
||||
DEBUG(desync, 1, "client: %08x; %02x; %02x; %02x", _date, _date_fract, (int)ci->client_playas, (int)ci->index);
|
||||
DEBUG(desync, 1, "client: %08x; %02x; %02X; %02x; %02x", _date, _date_fract, _tick_skip_counter, (int)ci->client_playas, (int)ci->index);
|
||||
|
||||
/* Make sure companies to which people try to join are not autocleaned */
|
||||
if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0;
|
||||
@@ -1606,7 +1606,7 @@ void NetworkUpdateClientInfo(ClientID client_id)
|
||||
|
||||
if (ci == NULL) return;
|
||||
|
||||
DEBUG(desync, 1, "client: %08x; %02x; %02x; %04x", _date, _date_fract, (int)ci->client_playas, client_id);
|
||||
DEBUG(desync, 1, "client: %08x; %02x; %02X; %02x; %04x", _date, _date_fract, _tick_skip_counter, (int)ci->client_playas, client_id);
|
||||
|
||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||
cs->SendClientInfo(ci);
|
||||
|
@@ -1363,7 +1363,7 @@ void StateGameLoop()
|
||||
CallWindowTickEvent();
|
||||
NewsLoop();
|
||||
} else {
|
||||
if (_debug_desync_level > 2 && _date_fract == 0 && (_date & 0x1F) == 0) {
|
||||
if (_debug_desync_level > 2 && _tick_skip_counter == 0 && _date_fract == 0 && (_date & 0x1F) == 0) {
|
||||
/* Save the desync savegame if needed. */
|
||||
char name[MAX_PATH];
|
||||
seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);
|
||||
|
@@ -2828,7 +2828,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
|
||||
}
|
||||
|
||||
if (mode == SL_SAVE) { // SAVE game
|
||||
DEBUG(desync, 1, "save: %08x; %02x; %s", _date, _date_fract, filename);
|
||||
DEBUG(desync, 1, "save: %08x; %02x; %02X; %s", _date, _date_fract, _tick_skip_counter, filename);
|
||||
if (_network_server || !_settings_client.gui.threaded_saves) threaded = false;
|
||||
|
||||
return DoSave(new FileWriter(fh), threaded);
|
||||
|
Reference in New Issue
Block a user