fixed exiting players with custom elements when playing multi-player games
authorHolger Schemel <info@artsoft.org>
Fri, 17 Aug 2018 09:30:02 +0000 (11:30 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 17 Aug 2018 09:30:02 +0000 (11:30 +0200)
Before, exiting a player using custom element actions only worked in
single-player mode. (In multi-player mode, the level was either
immediately solved if the exited player was the "local player"
(ignoring other players still existing on the playfield), or the
exited player was not removed from the playfield, if it was not the
"local player".)

Now it works correctly also in multi-player games.

src/game.c

index 4edcf7e8c16fe8cf0e9f902014b4f35c45a6832a..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))
     {
       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;
     }
 
       break;
     }