summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-23 23:59:24 +0000
committerrubidium <rubidium@openttd.org>2010-11-23 23:59:24 +0000
commitbb02e30a37b1b86bcf57cfed6e7f25b45c298e09 (patch)
treeb24c532c26d25e505789d655aea4061ef26b9ee8
parente0432a45856e7ddb70d0f3e5b6aa505ef71aa403 (diff)
downloadopenttd-bb02e30a37b1b86bcf57cfed6e7f25b45c298e09.tar.xz
(svn r21308) -Fix [FS#4262] (r20933-ish): crash upon desync
-rw-r--r--src/network/network.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 050b644ba..812217cc1 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -927,12 +927,16 @@ void NetworkGameLoop()
/* Make sure we are at the frame were the server is (quick-frames) */
if (_frame_counter_server > _frame_counter) {
+ /* Run a number of frames; when things go bad, get out. */
while (_frame_counter_server > _frame_counter) {
- if (!ClientNetworkGameSocketHandler::GameLoop()) break;
+ if (!ClientNetworkGameSocketHandler::GameLoop()) return;
}
} else {
/* Else, keep on going till _frame_counter_max */
- if (_frame_counter_max > _frame_counter) ClientNetworkGameSocketHandler::GameLoop();
+ if (_frame_counter_max > _frame_counter) {
+ /* Run one frame; if things went bad, get out. */
+ if (!ClientNetworkGameSocketHandler::GameLoop()) return;
+ }
}
}