- Index: docs/desync.txt
- ===================================================================
- --- docs/desync.txt (revision 26785)
- +++ docs/desync.txt (working copy)
- @@ -194,6 +194,7 @@
- - Get the same version of OpenTTD as the original server was running.
- - Uncomment/enable the define 'DEBUG_DUMP_COMMANDS' in
- 'src/network/network_func.h'.
- + (DEBUG_FAILED_DUMP_COMMANDS is explained later)
- - Put the 'commands-out.log' into the root save folder, and rename
- it to 'commands.log'.
- - Run 'openttd -D -d desync=3 -g startsavegame.sav'.
- @@ -217,6 +218,11 @@
- the last dmp_cmds that reproduces the replay and the first one
- that fails.
- + If the replay does not succeed without mismatch, you can check the logs
- + whether there were failed commands. Then you may try to replay with
- + DEBUG_FAILED_DUMP_COMMANDS enabled. If the replay then fails, the
- + command test-run of the failed command modified the game state.
- +
- If you have the original 'dmp_cmds_*.sav', you can also compare those
- savegames with your own ones from the replay. You can also comment/disable
- the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
- Index: src/network/network_func.h
- ===================================================================
- --- src/network/network_func.h (revision 26785)
- +++ src/network/network_func.h (working copy)
- @@ -17,6 +17,7 @@
- * See docs/desync.txt for details.
- */
- // #define DEBUG_DUMP_COMMANDS
- +// #define DEBUG_FAILED_DUMP_COMMANDS
- #include "core/address.h"
- #include "network_type.h"
- Index: src/network/network.cpp
- ===================================================================
- --- src/network/network.cpp (revision 26786)
- +++ src/network/network.cpp (working copy)
- @@ -929,7 +929,11 @@
- p += 2;
- }
- - if (strncmp(p, "cmd: ", 5) == 0 || strncmp(p, "cmdf: ", 6) == 0) {
- + if (strncmp(p, "cmd: ", 5) == 0
- +#ifdef DEBUG_FAILED_DUMP_COMMANDS
- + || strncmp(p, "cmdf: ", 6) == 0
- +#endif
- + ) {
- p += 5;
- if (*p == ' ') p++;
- cp = CallocT<CommandPacket>(1);
- @@ -958,6 +962,10 @@
- } else if (strncmp(p, "msg: ", 5) == 0 || strncmp(p, "client: ", 8) == 0 ||
- strncmp(p, "load: ", 6) == 0 || strncmp(p, "save: ", 6) == 0) {
- /* A message that is not very important to the log playback, but part of the log. */
- +#ifndef DEBUG_FAILED_DUMP_COMMANDS
- + } else if (strncmp(p, "cmdf: ", 6) == 0) {
- + DEBUG(net, 0, "Skipping replay of failed command: %s", p + 6);
- +#endif
- } else {
- /* Can't parse a line; what's wrong here? */
- DEBUG(net, 0, "trying to parse: %s", p);