Loading

Paste #pgjganewt

  1. Index: docs/desync.txt
  2. ===================================================================
  3. --- docs/desync.txt     (revision 26785)
  4. +++ docs/desync.txt     (working copy)
  5. @@ -194,6 +194,7 @@
  6.     - Get the same version of OpenTTD as the original server was running.
  7.     - Uncomment/enable the define 'DEBUG_DUMP_COMMANDS' in
  8.       'src/network/network_func.h'.
  9. +     (DEBUG_FAILED_DUMP_COMMANDS is explained later)
  10.     - Put the 'commands-out.log' into the root save folder, and rename
  11.        it to 'commands.log'.
  12.     - Run 'openttd -D -d desync=3 -g startsavegame.sav'.
  13. @@ -217,6 +218,11 @@
  14.       the last dmp_cmds that reproduces the replay and the first one
  15.       that fails.
  16.  
  17. +  If the replay does not succeed without mismatch, you can check the logs
  18. +  whether there were failed commands. Then you may try to replay with
  19. +  DEBUG_FAILED_DUMP_COMMANDS enabled. If the replay then fails, the
  20. +  command test-run of the failed command modified the game state.
  21. +
  22.    If you have the original 'dmp_cmds_*.sav', you can also compare those
  23.    savegames with your own ones from the replay. You can also comment/disable
  24.    the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
  25. Index: src/network/network_func.h
  26. ===================================================================
  27. --- src/network/network_func.h  (revision 26785)
  28. +++ src/network/network_func.h  (working copy)
  29. @@ -17,6 +17,7 @@
  30.   * See docs/desync.txt for details.
  31.   */
  32.  // #define DEBUG_DUMP_COMMANDS
  33. +// #define DEBUG_FAILED_DUMP_COMMANDS
  34.  
  35.  #include "core/address.h"
  36.  #include "network_type.h"
  37. Index: src/network/network.cpp
  38. ===================================================================
  39. --- src/network/network.cpp     (revision 26786)
  40. +++ src/network/network.cpp     (working copy)
  41. @@ -929,7 +929,11 @@
  42.                                 p += 2;
  43.                         }
  44.  
  45. -                       if (strncmp(p, "cmd: ", 5) == 0 || strncmp(p, "cmdf: ", 6) == 0) {
  46. +                       if (strncmp(p, "cmd: ", 5) == 0
  47. +#ifdef DEBUG_FAILED_DUMP_COMMANDS
  48. +                               || strncmp(p, "cmdf: ", 6) == 0
  49. +#endif
  50. +                               ) {
  51.                                 p += 5;
  52.                                 if (*p == ' ') p++;
  53.                                 cp = CallocT<CommandPacket>(1);
  54. @@ -958,6 +962,10 @@
  55.                         } else if (strncmp(p, "msg: ", 5) == 0 || strncmp(p, "client: ", 8) == 0 ||
  56.                                                 strncmp(p, "load: ", 6) == 0 || strncmp(p, "save: ", 6) == 0) {
  57.                                 /* A message that is not very important to the log playback, but part of the log. */
  58. +#ifndef DEBUG_FAILED_DUMP_COMMANDS
  59. +                       } else if (strncmp(p, "cmdf: ", 6) == 0) {
  60. +                               DEBUG(net, 0, "Skipping replay of failed command: %s", p + 6);
  61. +#endif
  62.                         } else {
  63.                                 /* Can't parse a line; what's wrong here? */
  64.                                 DEBUG(net, 0, "trying to parse: %s", p);

Comments