summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-08-15 11:58:20 +0000
committerrubidium <rubidium@openttd.org>2010-08-15 11:58:20 +0000
commite1d35cba6ddf6bb1589dca62d5d0adf99f0995b0 (patch)
tree5da92dcb895adf74ded8520a51670f89eefe3dc3 /src
parentbdb4ae940dbcf5d6d2dcedce7936012aea891a8e (diff)
downloadopenttd-e1d35cba6ddf6bb1589dca62d5d0adf99f0995b0.tar.xz
(svn r20497) -Fix [FS#3960]: non-dedicated servers failing to load a game caused the introgame to be the server's game causing desyncs when people tried to join
Diffstat (limited to 'src')
-rw-r--r--src/network/network.cpp3
-rw-r--r--src/openttd.cpp6
2 files changed, 9 insertions, 0 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index 3ad86d843..e868bbd2f 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -937,6 +937,9 @@ void NetworkDisconnect(bool blocking)
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
NetworkClose();
+
+ /* Reinitialize the UDP stack, i.e. close all existing connections. */
+ NetworkUDPInitialize();
}
/**
diff --git a/src/openttd.cpp b/src/openttd.cpp
index cf61ab9d1..20e3bae0c 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -877,6 +877,7 @@ bool SafeSaveOrLoad(const char *filename, int mode, GameMode newgm, Subdirectory
case SL_OK: return true;
case SL_REINIT:
+#ifdef ENABLE_NETWORK
if (_network_dedicated) {
/*
* We need to reinit a network map...
@@ -888,6 +889,11 @@ bool SafeSaveOrLoad(const char *filename, int mode, GameMode newgm, Subdirectory
MakeNewGame(false, true);
return false;
}
+ if (_network_server) {
+ /* We can't load the intro game as server, so disconnect first. */
+ NetworkDisconnect();
+ }
+#endif /* ENABLE_NETWORK */
switch (ogm) {
default: