added stopping game (with request dialog) if network player disconnected
authorHolger Schemel <info@artsoft.org>
Sun, 1 Jul 2018 11:04:25 +0000 (13:04 +0200)
committerHolger Schemel <info@artsoft.org>
Sun, 1 Jul 2018 11:04:25 +0000 (13:04 +0200)
src/network.c

index b7c753b45f9e429b56b07116e1b5323d9cfaa011..c4e2ee6e09016cd6b9aab2c7af937986a8241c9b 100644 (file)
@@ -577,6 +577,20 @@ static void Handle_OP_PLAYER_DISCONNECTED()
 
   stored_player[index_nr].connected_locally = FALSE;
   stored_player[index_nr].connected_network = FALSE;
+
+  if (game_status == GAME_MODE_PLAYING)
+  {
+    char message[100];
+
+    sprintf(message, "Player %d left network server! Network game stopped!",
+           player_nr);
+
+    Request(message, REQ_CONFIRM | REQ_STAY_CLOSED);
+
+    SetGameStatus(GAME_MODE_MAIN);
+
+    DrawMainMenu();
+  }
 }
 
 static void Handle_OP_START_PLAYING()