added connecting to network server from setup menu without program restart
authorHolger Schemel <info@artsoft.org>
Tue, 26 Jun 2018 20:10:04 +0000 (22:10 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 26 Jun 2018 20:10:04 +0000 (22:10 +0200)
src/init.h
src/screens.c

index bd4ba9c13f1cd1c57667604f70caff3e3a1ae74c..7a90d8805ce7863f1409a868f0af4410a16498da 100644 (file)
@@ -44,6 +44,8 @@ void InitGfxBuffers();
 void InitGadgets();
 void InitImageTextures();
 
+void InitNetworkServer();
+
 void DisplayExitMessage(char *, va_list);
 
 void OpenAll(void);
index d545ef304fbc1c979e6abaebb62902f806e0e163..54e27e311f8c4d0f086cb4a1e7207f2eaf291207 100644 (file)
@@ -6447,7 +6447,27 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx)
   if (si->value == &setup.network_mode &&
       setup.network_mode &&
       !network.enabled)
-    Request("Please restart game to enable network games!", REQ_CONFIRM);
+  {
+    network.enabled = TRUE;
+
+    SetGameStatus(GAME_MODE_LOADING);
+    SetDrawBackgroundMask(REDRAW_NONE);
+
+    FadeOut(REDRAW_ALL);
+
+    ClearRectangle(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
+
+    FadeIn(REDRAW_ALL);
+
+    InitNetworkServer();
+
+    SetGameStatus(GAME_MODE_SETUP);
+    SetDrawBackgroundMask(REDRAW_FIELD);
+
+    redraw_mask = REDRAW_ALL;
+
+    DrawSetupScreen();
+  }
 }
 
 static struct TokenInfo *getSetupInfoFinal(struct TokenInfo *setup_info_orig)