added counter of players that still have to enter an exit (not used yet)
authorHolger Schemel <info@artsoft.org>
Fri, 17 Aug 2018 11:00:04 +0000 (13:00 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 17 Aug 2018 11:02:11 +0000 (13:02 +0200)
src/game.c
src/game.h

index 2aa79df840c4cd417fa6edf55732a0258b1716c8..2e504df5d5188103bc46381436ec12bc71781972 100644 (file)
@@ -3392,6 +3392,7 @@ void InitGame()
     player->gems_still_needed = level.gems_needed;
     player->sokobanfields_still_needed = 0;
     player->lights_still_needed = 0;
+    player->players_still_needed = 0;
     player->friends_still_needed = 0;
 
     for (j = 0; j < MAX_NUM_KEYS; j++)
@@ -3949,6 +3950,10 @@ void InitGame()
     }
   }
 
+  for (i = 0; i < MAX_PLAYERS; i++)
+    if (stored_player[i].active)
+      local_player->players_still_needed++;
+
   /* when recording the game, store which players take part in the game */
   if (tape.recording)
   {
@@ -13410,6 +13415,8 @@ void ExitPlayer(struct PlayerInfo *player)
 {
   DrawPlayer(player);  /* needed here only to cleanup last field */
   RemovePlayer(player);
+
+  local_player->players_still_needed--;
 }
 
 static void setFieldForSnapping(int x, int y, int element, int direction)
@@ -13957,6 +13964,8 @@ static int DigField(struct PlayerInfo *player,
       if (local_player->sokobanfields_still_needed == 0 &&
          (game.emulation == EMU_SOKOBAN || level.auto_exit_sokoban))
       {
+       local_player->players_still_needed = 0;
+
        PlayerWins(player);
 
        PlayLevelSound(x, y, SND_GAME_SOKOBAN_SOLVING);
index d65ebd9af24268b575bae380dbaa85d53777edbd..8610916c734f355913ac5a3e0d022dbd043ae50e 100644 (file)
@@ -349,6 +349,7 @@ struct PlayerInfo
   int gems_still_needed;
   int sokobanfields_still_needed;
   int lights_still_needed;
+  int players_still_needed;
   int friends_still_needed;
   int key[MAX_NUM_KEYS];
   int num_white_keys;