fixed exiting players with custom elements when playing multi-player games
[rocksndiamonds.git] / src / game.c
index 7076d52c6c70bfbb809c435d9ecd83d94929f8a7..c51b7ece8e596108139c1ebc94670c66497faa6a 100644 (file)
@@ -9776,7 +9776,10 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page)
     {
       for (i = 0; i < MAX_PLAYERS; i++)
        if (action_arg_player_bits & (1 << i))
-         PlayerWins(&stored_player[i]);
+         RemovePlayerWithCleanup(&stored_player[i]);
+
+      if (AllPlayersGone)
+       PlayerWins(local_player);
 
       break;
     }
@@ -12644,9 +12647,10 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
     {
       RemovePlayerWithCleanup(player);
 
-      if (local_player->friends_still_needed == 0 ||
-         IS_SP_ELEMENT(Feld[jx][jy]))
-       PlayerWins(player);
+      if ((local_player->friends_still_needed == 0 ||
+          IS_SP_ELEMENT(Feld[jx][jy])) &&
+         AllPlayersGone)
+       PlayerWins(local_player);
     }
 
     /* this breaks one level: "machine", level 000 */