changeset 15818:519a31ac7e5b draft

(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
author rubidium <rubidium@openttd.org>
date Sun, 15 Aug 2010 11:58:20 +0000
parents 2c000e996b9f
children 6a1b604d137f
files src/network/network.cpp src/openttd.cpp
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -937,6 +937,9 @@
 	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
 	NetworkClose();
+
+	/* Reinitialize the UDP stack, i.e. close all existing connections. */
+	NetworkUDPInitialize();
 }
 
 /**
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -877,6 +877,7 @@
 		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 @@
 				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: