(svn r19589) -Change: add some more useful information to the desync log and unify the formatting

This commit is contained in:
rubidium 2010-04-08 21:14:49 +00:00
parent 9ad86b776f
commit d8baa1342c
7 changed files with 13 additions and 10 deletions

View File

@ -632,7 +632,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
return_dcpi(CommandCost(), false);
}
#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
* use the construction one */

View File

@ -93,7 +93,7 @@ static void debug_print(const char *dbg, const char *buf)
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
if (f == NULL) return;
fprintf(f, "%s%s", GetLogPrefix(), buf);
fprintf(f, "%s%s\n", GetLogPrefix(), buf);
fflush(f);
}
}

View File

@ -176,7 +176,7 @@ static void _GenerateWorld(void *)
ShowNewGRFError();
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 (_debug_desync_level > 0) {

View File

@ -249,7 +249,7 @@ void NetworkTextMessage(NetworkAction action, ConsoleColour colour, bool self_se
SetDParam(2, data);
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);
NetworkAddChatMessage((TextColour)colour, duration, "%s", message);
}
@ -1024,7 +1024,7 @@ static bool NetworkDoClientLoop()
if (_sync_seed_1 != _random.state[0]) {
#endif
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!");
NetworkClientError(NETWORK_RECV_STATUS_DESYNC, NetworkClientSocket::Get(0));
return false;

View File

@ -716,6 +716,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
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; %04x", _date, _date_fract, (int)ci->client_playas, 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;
@ -1396,6 +1397,8 @@ 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);
FOR_ALL_CLIENT_SOCKETS(cs) {
SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci);
}

View File

@ -1117,7 +1117,7 @@ static void CheckCaches()
RoadVehUpdateCache(rv);
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;
@ -1135,7 +1135,7 @@ static void CheckCaches()
length = 0;
for (Train *u = t; u != NULL; u = u->Next()) {
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++;
}
@ -1151,7 +1151,7 @@ static void CheckCaches()
UpdateAircraftCache(a);
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;

View File

@ -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
* to write it to file, either in threaded mode if possible, or single-threaded */
if (mode == SL_SAVE) { // SAVE game
DEBUG(desync, 1, "save: %s\n", filename);
DEBUG(desync, 1, "save: %s", filename);
_sl.write_bytes = WriteMem;
_sl.excpt_uninit = UnInitMem;
@ -1908,7 +1908,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, boo
}
} else { // LOAD game
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 */
long pos = ftell(_sl.fh);