diff options
-rw-r--r-- | src/command.cpp | 3 | ||||
-rw-r--r-- | src/date.cpp | 15 | ||||
-rw-r--r-- | src/network/network.cpp | 2 | ||||
-rw-r--r-- | src/stdafx.h | 1 |
4 files changed, 20 insertions, 1 deletions
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 |