From 2b9f51219f792b7c82ad8228e1dde0983a46094a Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 6 Dec 2007 22:29:47 +0000 Subject: (svn r11584) -Change: add some extra checking in the hope to find the cause of FS#1482. --- src/command.cpp | 3 +++ src/date.cpp | 15 +++++++++++++++ src/network/network.cpp | 2 +- src/stdafx.h | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/command.cpp b/src/command.cpp index e2133fe4f..b09d43318 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -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)) { diff --git a/src/date.cpp b/src/date.cpp index 23354cde1..24888177b 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -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); diff --git a/src/network/network.cpp b/src/network/network.cpp index 828fc3ee0..5b3b04a1c 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -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; diff --git a/src/stdafx.h b/src/stdafx.h index 34fc57ee8..a4dd583ee 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -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 -- cgit v1.2.3-70-g09d2