added showing player number if network game was stopped by remote player
[rocksndiamonds.git] / src / network.c
index b7c753b45f9e429b56b07116e1b5323d9cfaa011..010e8b33f6c6bef3931c50b2cf5884ca0b52575c 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()
@@ -645,11 +659,13 @@ static void Handle_OP_STOP_PLAYING()
     int index_nr = client_nr - 1;
     struct PlayerInfo *client_player = &stored_player[index_nr];
     boolean stopped_by_remote_player = (!client_player->connected_locally);
-    char *message = (buffer[2] == NETWORK_STOP_BY_PLAYER ?
-                    "Network game stopped by player!" :
-                    buffer[2] == NETWORK_STOP_BY_ERROR ?
-                    "Network game stopped due to internal error!" :
-                    "Network game stopped!");
+    char message[100];
+
+    sprintf(message, (buffer[2] == NETWORK_STOP_BY_PLAYER ?
+                     "Network game stopped by player %d!" :
+                     buffer[2] == NETWORK_STOP_BY_ERROR ?
+                     "Network game stopped due to internal error!" :
+                     "Network game stopped!"), client_nr);
 
     if (buffer[2] != NETWORK_STOP_BY_PLAYER || stopped_by_remote_player)
       Request(message, REQ_CONFIRM | REQ_STAY_CLOSED);