summaryrefslogtreecommitdiff
path: root/src/date.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-07-07 10:06:10 +0000
committerrubidium <rubidium@openttd.org>2007-07-07 10:06:10 +0000
commit3b52a6bfc47a496b13cc4bd59a509109bb078785 (patch)
tree294bf7c6be70bd0b4c892e7c43b2cd076eabfd2a /src/date.cpp
parent9a55c79fd11e9075b937abe0a6a077fa77a72823 (diff)
downloadopenttd-3b52a6bfc47a496b13cc4bd59a509109bb078785.tar.xz
(svn r10462) -Add: a command dumper/loader that could be enabled compile-time and server side only to aid debugging some desyncs, i.e. dump the stream of commands so it could be replayed in exactly the same way later. This should primarily be used to make desyncs more easily reproducable, so it can be properly debugged.
Diffstat (limited to 'src/date.cpp')
-rw-r--r--src/date.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/date.cpp b/src/date.cpp
index d577aa2dc..f8852dbc5 100644
--- a/src/date.cpp
+++ b/src/date.cpp
@@ -13,6 +13,9 @@
#include "network/network_server.h"
#include "functions.h"
#include "currency.h"
+#ifdef DEBUG_DUMP_COMMANDS
+#include "saveload.h"
+#endif
Year _cur_year;
Month _cur_month;
@@ -259,6 +262,12 @@ void IncreaseDate()
/* yes, call various monthly loops */
if (_game_mode != GM_MENU) {
+#ifdef DEBUG_DUMP_COMMANDS
+ char name[MAX_PATH];
+ snprintf(name, lengthof(name), "dmp_cmds_%d.sav", _date);
+ SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR);
+ debug_dump_commands("ddc:save:%s\n", name);
+#endif /* DUMP_COMMANDS */
if (_opt.autosave != 0 && (_cur_month % _autosave_months[_opt.autosave]) == 0) {
_do_autosave = true;
RedrawAutosave();