mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r19589) -Change: add some more useful information to the desync log and unify the formatting
This commit is contained in:
parent
9ad86b776f
commit
d8baa1342c
|
@ -632,7 +632,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
|
||||||
return_dcpi(CommandCost(), false);
|
return_dcpi(CommandCost(), false);
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_NETWORK */
|
#endif /* ENABLE_NETWORK */
|
||||||
DEBUG(desync, 1, "cmd: %08x; %08x; %1x; %06x; %08x; %08x; %04x; %s\n", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text);
|
DEBUG(desync, 1, "cmd: %08x; %02x; %02x; %06x; %08x; %08x; %08x; %s", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text);
|
||||||
|
|
||||||
/* Actually try and execute the command. If no cost-type is given
|
/* Actually try and execute the command. If no cost-type is given
|
||||||
* use the construction one */
|
* use the construction one */
|
||||||
|
|
|
@ -93,7 +93,7 @@ static void debug_print(const char *dbg, const char *buf)
|
||||||
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
|
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
|
||||||
if (f == NULL) return;
|
if (f == NULL) return;
|
||||||
|
|
||||||
fprintf(f, "%s%s", GetLogPrefix(), buf);
|
fprintf(f, "%s%s\n", GetLogPrefix(), buf);
|
||||||
fflush(f);
|
fflush(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,7 +176,7 @@ static void _GenerateWorld(void *)
|
||||||
ShowNewGRFError();
|
ShowNewGRFError();
|
||||||
|
|
||||||
if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
|
if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
|
||||||
DEBUG(desync, 1, "new_map: %i\n", _settings_game.game_creation.generation_seed);
|
DEBUG(desync, 1, "new_map: %08x", _settings_game.game_creation.generation_seed);
|
||||||
|
|
||||||
if (_settings_client.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
|
if (_settings_client.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, PM_PAUSED_NORMAL, 1, CMD_PAUSE);
|
||||||
if (_debug_desync_level > 0) {
|
if (_debug_desync_level > 0) {
|
||||||
|
|
|
@ -249,7 +249,7 @@ void NetworkTextMessage(NetworkAction action, ConsoleColour colour, bool self_se
|
||||||
SetDParam(2, data);
|
SetDParam(2, data);
|
||||||
GetString(message, strid, lastof(message));
|
GetString(message, strid, lastof(message));
|
||||||
|
|
||||||
DEBUG(desync, 1, "msg: %d; %d; %s\n", _date, _date_fract, message);
|
DEBUG(desync, 1, "msg: %08x; %02x; %s", _date, _date_fract, message);
|
||||||
IConsolePrintF(colour, "%s", message);
|
IConsolePrintF(colour, "%s", message);
|
||||||
NetworkAddChatMessage((TextColour)colour, duration, "%s", message);
|
NetworkAddChatMessage((TextColour)colour, duration, "%s", message);
|
||||||
}
|
}
|
||||||
|
@ -1024,7 +1024,7 @@ static bool NetworkDoClientLoop()
|
||||||
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: %d; %d\n", _date, _date_fract);
|
DEBUG(desync, 1, "sync_err: %08x; %02x", _date, _date_fract);
|
||||||
DEBUG(net, 0, "Sync error detected!");
|
DEBUG(net, 0, "Sync error detected!");
|
||||||
NetworkClientError(NETWORK_RECV_STATUS_DESYNC, NetworkClientSocket::Get(0));
|
NetworkClientError(NETWORK_RECV_STATUS_DESYNC, NetworkClientSocket::Get(0));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -716,6 +716,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
|
||||||
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; %04x", _date, _date_fract, (int)ci->client_playas, 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;
|
||||||
|
@ -1396,6 +1397,8 @@ 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);
|
||||||
|
|
||||||
FOR_ALL_CLIENT_SOCKETS(cs) {
|
FOR_ALL_CLIENT_SOCKETS(cs) {
|
||||||
SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci);
|
SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ static void CheckCaches()
|
||||||
RoadVehUpdateCache(rv);
|
RoadVehUpdateCache(rv);
|
||||||
|
|
||||||
if (memcmp(&cache, &rv->rcache, sizeof(RoadVehicleCache)) != 0) {
|
if (memcmp(&cache, &rv->rcache, sizeof(RoadVehicleCache)) != 0) {
|
||||||
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i\n", v->index, (int)v->owner, v->unitnumber);
|
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i", v->index, (int)v->owner, v->unitnumber);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -1135,7 +1135,7 @@ static void CheckCaches()
|
||||||
length = 0;
|
length = 0;
|
||||||
for (Train *u = t; u != NULL; u = u->Next()) {
|
for (Train *u = t; u != NULL; u = u->Next()) {
|
||||||
if (memcmp(&wagons[length], &u->tcache, sizeof(TrainCache)) != 0) {
|
if (memcmp(&wagons[length], &u->tcache, sizeof(TrainCache)) != 0) {
|
||||||
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i, wagon %i\n", v->index, (int)v->owner, v->unitnumber, length);
|
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
|
||||||
}
|
}
|
||||||
length++;
|
length++;
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1151,7 @@ static void CheckCaches()
|
||||||
UpdateAircraftCache(a);
|
UpdateAircraftCache(a);
|
||||||
|
|
||||||
if (memcmp(&cache, &a->acache, sizeof(AircraftCache)) != 0) {
|
if (memcmp(&cache, &a->acache, sizeof(AircraftCache)) != 0) {
|
||||||
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i\n", v->index, (int)v->owner, v->unitnumber);
|
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i", v->index, (int)v->owner, v->unitnumber);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -1884,7 +1884,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
|
||||||
/* General tactic is to first save the game to memory, then use an available writer
|
/* General tactic is to first save the game to memory, then use an available writer
|
||||||
* to write it to file, either in threaded mode if possible, or single-threaded */
|
* to write it to file, either in threaded mode if possible, or single-threaded */
|
||||||
if (mode == SL_SAVE) { // SAVE game
|
if (mode == SL_SAVE) { // SAVE game
|
||||||
DEBUG(desync, 1, "save: %s\n", filename);
|
DEBUG(desync, 1, "save: %s", filename);
|
||||||
|
|
||||||
_sl.write_bytes = WriteMem;
|
_sl.write_bytes = WriteMem;
|
||||||
_sl.excpt_uninit = UnInitMem;
|
_sl.excpt_uninit = UnInitMem;
|
||||||
|
@ -1908,7 +1908,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
|
||||||
}
|
}
|
||||||
} else { // LOAD game
|
} else { // LOAD game
|
||||||
assert(mode == SL_LOAD);
|
assert(mode == SL_LOAD);
|
||||||
DEBUG(desync, 1, "load: %s\n", filename);
|
DEBUG(desync, 1, "load: %s", filename);
|
||||||
|
|
||||||
/* Can't fseek to 0 as in tar files that is not correct */
|
/* Can't fseek to 0 as in tar files that is not correct */
|
||||||
long pos = ftell(_sl.fh);
|
long pos = ftell(_sl.fh);
|
||||||
|
|
Loading…
Reference in New Issue