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

This commit is contained in:
rubidium 2007-12-06 22:29:47 +00:00
parent 39b1a8302b
commit 2b9f51219f
4 changed files with 20 additions and 1 deletions

View File

@ -609,6 +609,9 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
return true; return true;
} }
#endif /* ENABLE_NETWORK */ #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. */ /* update last build coordinate of player. */
if (tile != 0 && IsValidPlayer(_current_player)) { if (tile != 0 && IsValidPlayer(_current_player)) {

View File

@ -267,6 +267,21 @@ void IncreaseDate()
/* yes, call various monthly loops */ /* yes, call various monthly loops */
if (_game_mode != GM_MENU) { if (_game_mode != GM_MENU) {
#ifdef DEBUG_DUMP_COMMANDS #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]; char name[MAX_PATH];
snprintf(name, lengthof(name), "dmp_cmds_%d.sav", _date); snprintf(name, lengthof(name), "dmp_cmds_%d.sav", _date);
SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR); SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR);

View File

@ -1466,7 +1466,7 @@ bool IsNetworkCompatibleVersion(const char *other)
#ifdef DEBUG_DUMP_COMMANDS #ifdef DEBUG_DUMP_COMMANDS
void CDECL debug_dump_commands(const char *s, ...) 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; if (f == NULL) return;
va_list va; va_list va;

View File

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