(svn r11584) -Change: add some extra checking in the hope to find the cause of FS#1482.

pull/155/head
rubidium 17 years ago
parent 39b1a8302b
commit 2b9f51219f

@ -609,6 +609,9 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
return true;
}
#endif /* ENABLE_NETWORK */
#ifdef DEBUG_DUMP_COMMANDS
debug_dump_commands("ddc:cmd:%d;%d;%d;%d;%d;%d;%d;%s\n", _date, _date_fract, (int)_current_player, tile, p1, p2, cmd, _cmd_text);
#endif /* DUMP_COMMANDS */
/* update last build coordinate of player. */
if (tile != 0 && IsValidPlayer(_current_player)) {

@ -267,6 +267,21 @@ void IncreaseDate()
/* yes, call various monthly loops */
if (_game_mode != GM_MENU) {
#ifdef DEBUG_DUMP_COMMANDS
int data[MAX_PLAYERS][TOTAL_NUM_ENGINES + 1];
memset(data, 0, sizeof(data));
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (!IsEngineCountable(v)) continue;
data[v->owner][v->engine_type]++;
}
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
const Player *p = GetPlayer(i);
if (!p->is_active) continue;
for (int j = 0; j < TOTAL_NUM_ENGINES; j++) assert(data[i][j] == p->num_engines[j]);
}
char name[MAX_PATH];
snprintf(name, lengthof(name), "dmp_cmds_%d.sav", _date);
SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR);

@ -1466,7 +1466,7 @@ bool IsNetworkCompatibleVersion(const char *other)
#ifdef DEBUG_DUMP_COMMANDS
void CDECL debug_dump_commands(const char *s, ...)
{
static FILE *f = FioFOpenFile("commands-out.log", "wb", SAVE_DIR);
static FILE *f = FioFOpenFile("commands-out.log", "wb", AUTOSAVE_DIR);
if (f == NULL) return;
va_list va;

@ -4,6 +4,7 @@
#ifndef STDAFX_H
#define STDAFX_H
#define DEBUG_DUMP_COMMANDS
/* It seems that we need to include stdint.h before anything else
* We need INT64_MAX, which for most systems comes from stdint.h. However, MSVC

Loading…
Cancel
Save