projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed exiting players with custom elements when playing multi-player games
[rocksndiamonds.git]
/
src
/
game.c
diff --git
a/src/game.c
b/src/game.c
index 8340553f0af9059e4e58c9175b55cb9a067c61b4..c51b7ece8e596108139c1ebc94670c66497faa6a 100644
(file)
--- a/
src/game.c
+++ b/
src/game.c
@@
-1112,6
+1112,7
@@
void TestIfGoodThingGetsHitByBadThing(int, int, int);
void KillPlayer(struct PlayerInfo *);
void BuryPlayer(struct PlayerInfo *);
void RemovePlayer(struct PlayerInfo *);
void KillPlayer(struct PlayerInfo *);
void BuryPlayer(struct PlayerInfo *);
void RemovePlayer(struct PlayerInfo *);
+void RemovePlayerWithCleanup(struct PlayerInfo *);
static int getInvisibleActiveFromInvisibleElement(int);
static int getInvisibleFromInvisibleActiveElement(int);
static int getInvisibleActiveFromInvisibleElement(int);
static int getInvisibleFromInvisibleActiveElement(int);
@@
-4707,7
+4708,7
@@
void GameEnd()
hi_pos = NewHiScore(last_level_nr);
hi_pos = NewHiScore(last_level_nr);
- if (hi_pos >= 0)
+ if (hi_pos >= 0
&& !setup.skip_scores_after_game
)
{
SetGameStatus(GAME_MODE_SCORES);
{
SetGameStatus(GAME_MODE_SCORES);
@@
-9775,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;
}
@@
-12641,12
+12645,12
@@
void ScrollPlayer(struct PlayerInfo *player, int mode)
Feld[jx][jy] == EL_SP_EXIT_OPEN ||
Feld[jx][jy] == EL_SP_EXIT_OPENING) /* <-- special case */
{
Feld[jx][jy] == EL_SP_EXIT_OPEN ||
Feld[jx][jy] == EL_SP_EXIT_OPENING) /* <-- special case */
{
- DrawPlayer(player); /* needed here only to cleanup last field */
- RemovePlayer(player);
+ 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 */
}
/* this breaks one level: "machine", level 000 */
@@
-13402,6
+13406,12
@@
void RemovePlayer(struct PlayerInfo *player)
ExitY = ZY = jy;
}
ExitY = ZY = jy;
}
+void RemovePlayerWithCleanup(struct PlayerInfo *player)
+{
+ DrawPlayer(player); /* needed here only to cleanup last field */
+ RemovePlayer(player);
+}
+
static void setFieldForSnapping(int x, int y, int element, int direction)
{
struct ElementInfo *ei = &element_info[element];
static void setFieldForSnapping(int x, int y, int element, int direction)
{
struct ElementInfo *ei = &element_info[element];