From: Holger Schemel Date: Fri, 17 Aug 2018 11:00:04 +0000 (+0200) Subject: added counter of players that still have to enter an exit (not used yet) X-Git-Tag: 4.1.1.0~76 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2bf392f1;p=rocksndiamonds.git added counter of players that still have to enter an exit (not used yet) --- diff --git a/src/game.c b/src/game.c index 2aa79df8..2e504df5 100644 --- a/src/game.c +++ b/src/game.c @@ -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); diff --git a/src/game.h b/src/game.h index d65ebd9a..8610916c 100644 --- a/src/game.h +++ b/src/game.h @@ -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;