fixed buggy behaviour when only one player needed to solve a level
authorHolger Schemel <info@artsoft.org>
Wed, 3 Oct 2018 10:01:15 +0000 (12:01 +0200)
committerHolger Schemel <info@artsoft.org>
Wed, 3 Oct 2018 10:01:15 +0000 (12:01 +0200)
Before, when setting "[x] only one player must enter exit", a level
with two players was solved when one player was killed, and then the
other player entered an exit. But it was not yet solved if one player
entered an exit and the other player was still on the playfield.

Now, the first player really solves the level when entering an exit,
regardless of any other players still around on the playfield.

src/game.c

index 70b9b81..03dca6b 100644 (file)
@@ -13433,6 +13433,10 @@ void ExitPlayer(struct PlayerInfo *player)
 
   if (local_player->players_still_needed > 0)
     local_player->players_still_needed--;
+
+  /* also set if some players not yet gone, but not needed to solve level */
+  if (local_player->players_still_needed == 0)
+    AllPlayersGone = TRUE;
 }
 
 static void setFieldForSnapping(int x, int y, int element, int direction)