free(player);
clients--;
+#if 0 /* do not terminate network server if last player disconnected */
if (onceonly && clients == 0)
{
if (options.verbose)
}
exit(0);
}
+#endif
}
static void AddPlayer(TCPsocket fd)
}
}
}
+
+void DisconnectFromNetworkServer()
+{
+ DrawNetworkText_Title("Terminating Network");
+ DrawNetworkText("Disconnecting from network server ...");
+
+ HandleNetworkingDisconnect();
+
+ DrawNetworkText_Success("Successfully disconnected!");
+
+ /* short time to recognize result of network initialization */
+ Delay(1000);
+}
void SendToServer_StopPlaying(int);
void SendToServer_MovePlayer(byte);
void HandleNetworking(void);
+void DisconnectFromNetworkServer(void);
#endif
ToggleFullscreenOrChangeWindowScalingIfNeeded();
if (si->value == &setup.network_mode &&
- setup.network_mode &&
- !network.enabled)
+ setup.network_mode != network.enabled)
{
- network.enabled = TRUE;
+ network.enabled = setup.network_mode;
SetGameStatus(GAME_MODE_LOADING);
SetDrawBackgroundMask(REDRAW_NONE);
FadeIn(REDRAW_ALL);
- InitNetworkServer();
+ if (network.enabled)
+ InitNetworkServer();
+ else
+ DisconnectFromNetworkServer();
SetGameStatus(GAME_MODE_SETUP);
SetDrawBackgroundMask(REDRAW_FIELD);