summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-09-07 14:21:16 +0000
committerfrosch <frosch@openttd.org>2014-09-07 14:21:16 +0000
commite2f5081f40706c389473639165c3cb95b72a4d1b (patch)
treed1d889cf27ab2e7737feb024d9a6e5057c1a30b5 /src
parent9b72a9f6b804fd3bad86e156fea53776eef4b480 (diff)
downloadopenttd-e2f5081f40706c389473639165c3cb95b72a4d1b.tar.xz
(svn r26788) -Add: Desync replay option to skip/replay failed commands
Diffstat (limited to 'src')
-rw-r--r--src/network/network.cpp10
-rw-r--r--src/network/network_func.h1
2 files changed, 10 insertions, 1 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index d9645a595..ce37aaa3f 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -929,7 +929,11 @@ void NetworkGameLoop()
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 @@ void NetworkGameLoop()
} 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);
diff --git a/src/network/network_func.h b/src/network/network_func.h
index 67d4c8d48..375cc3da5 100644
--- a/src/network/network_func.h
+++ b/src/network/network_func.h
@@ -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"