removed preprocessor definition for network mode that is always true now
[rocksndiamonds.git] / src / network.c
index 1c9e0b0d30a10b063a504ddbc5af5fb6ff670f81..2bc8f5c4d477984d761f3094b9fe820e93d3a24d 100644 (file)
@@ -9,19 +9,14 @@
 // network.c
 // ============================================================================
 
-#include "libgame/platform.h"
-
-#if defined(NETWORK_AVALIABLE)
-
 #include <signal.h>
 #include <sys/time.h>
 
-#include "main.h"
-
 #include "libgame/libgame.h"
 
 #include "network.h"
 #include "netserv.h"
+#include "main.h"
 #include "game.h"
 #include "tape.h"
 #include "files.h"
@@ -56,7 +51,7 @@ static boolean stop_network_game = FALSE;
 
 static void SendBufferToServer(int size)
 {
-  if (!options.network)
+  if (!network.enabled)
     return;
 
   realbuffer[0] = realbuffer[1] = realbuffer[2] = 0;
@@ -544,12 +539,17 @@ static void Handle_OP_STOP_PLAYING()
 
   if (game_status == GAME_MODE_PLAYING)
   {
-    if (buffer[2] == NETWORK_STOP_BY_PLAYER)
-      Request("Network game stopped by player!", REQ_CONFIRM);
-    else if (buffer[2] == NETWORK_STOP_BY_ERROR)
-      Request("Network game stopped due to internal error!", REQ_CONFIRM);
-    else
-      Request("Network game stopped!", REQ_CONFIRM);
+    int client_nr = buffer[0];
+    int index_nr = client_nr - 1;
+    boolean stopped_by_remote_player = (index_nr != local_player->index_nr);
+    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!");
+
+    if (buffer[2] != NETWORK_STOP_BY_PLAYER || stopped_by_remote_player)
+      Request(message, REQ_CONFIRM | REQ_STAY_CLOSED);
   }
 
   SetGameStatus(GAME_MODE_MAIN);
@@ -692,5 +692,3 @@ void HandleNetworking()
   }
   while (r > 0);
 }
-
-#endif /* NETWORK_AVALIABLE */