Merge branch 'day_length-sx' into jgrpp

This commit is contained in:
Jonathan G Rennison
2015-09-27 23:18:33 +01:00
7 changed files with 8 additions and 8 deletions

View File

@@ -74,7 +74,7 @@ void SetRandomSeed(uint32 seed)
uint32 DoRandom(int line, const char *file) uint32 DoRandom(int line, const char *file)
{ {
if (_networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE))) { 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(); return _random.Next();

View File

@@ -324,7 +324,7 @@ char *CrashLog::FillCrashLog(char *buffer, const char *last) const
YearMonthDay ymd; YearMonthDay ymd;
ConvertDateToYMD(_date, &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->LogError(buffer, last, CrashLog::message);
buffer = this->LogOpenTTDVersion(buffer, last); buffer = this->LogOpenTTDVersion(buffer, last);

View File

@@ -875,7 +875,7 @@ void NetworkGameLoop()
if (_network_server) { if (_network_server) {
/* Log the sync state to check for in-syncedness of replays. */ /* 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. */ /* We don't want to log multiple times if paused. */
static Date last_log; static Date last_log;
if (last_log != _date) { if (last_log != _date) {

View File

@@ -253,7 +253,7 @@ void ClientNetworkGameSocketHandler::ClientError(NetworkRecvStatus res)
if (_sync_seed_1 != _random.state[0]) { if (_sync_seed_1 != _random.state[0]) {
#endif #endif
NetworkError(STR_NETWORK_ERROR_DESYNC); 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!"); DEBUG(net, 0, "Sync error detected!");
my_client->ClientError(NETWORK_RECV_STATUS_DESYNC); my_client->ClientError(NETWORK_RECV_STATUS_DESYNC);
return false; return false;

View File

@@ -953,7 +953,7 @@ NetworkRecvStatus ServerNetworkGameSocketHandler::Receive_CLIENT_JOIN(Packet *p)
strecpy(ci->client_name, name, lastof(ci->client_name)); strecpy(ci->client_name, name, lastof(ci->client_name));
ci->client_playas = playas; ci->client_playas = playas;
ci->client_lang = client_lang; 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 */ /* Make sure companies to which people try to join are not autocleaned */
if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0; if (Company::IsValidID(playas)) _network_company_states[playas].months_empty = 0;
@@ -1606,7 +1606,7 @@ void NetworkUpdateClientInfo(ClientID client_id)
if (ci == NULL) return; 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) { FOR_ALL_CLIENT_SOCKETS(cs) {
cs->SendClientInfo(ci); cs->SendClientInfo(ci);

View File

@@ -1449,7 +1449,7 @@ void StateGameLoop()
CallWindowTickEvent(); CallWindowTickEvent();
NewsLoop(); NewsLoop();
} else { } 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. */ /* Save the desync savegame if needed. */
char name[MAX_PATH]; char name[MAX_PATH];
seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date); seprintf(name, lastof(name), "dmp_cmds_%08x_%08x.sav", _settings_game.game_creation.generation_seed, _date);

View File

@@ -2940,7 +2940,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
} }
if (mode == SL_SAVE) { // SAVE game 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; if (_network_server || !_settings_client.gui.threaded_saves) threaded = false;
return DoSave(new FileWriter(fh), threaded); return DoSave(new FileWriter(fh), threaded);