added function to remove player and cleanup last player field
authorHolger Schemel <info@artsoft.org>
Fri, 17 Aug 2018 09:04:25 +0000 (11:04 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 17 Aug 2018 09:04:25 +0000 (11:04 +0200)
src/game.c

index 2cf0e9aa46a468e4eacf98bf528d34964359d322..7076d52c6c70bfbb809c435d9ecd83d94929f8a7 100644 (file)
@@ -1112,6 +1112,7 @@ void TestIfGoodThingGetsHitByBadThing(int, int, int);
 void KillPlayer(struct PlayerInfo *);
 void BuryPlayer(struct PlayerInfo *);
 void RemovePlayer(struct PlayerInfo *);
+void RemovePlayerWithCleanup(struct PlayerInfo *);
 
 static int getInvisibleActiveFromInvisibleElement(int);
 static int getInvisibleFromInvisibleActiveElement(int);
@@ -12641,8 +12642,7 @@ void ScrollPlayer(struct PlayerInfo *player, int mode)
        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]))
@@ -13402,6 +13402,12 @@ void RemovePlayer(struct PlayerInfo *player)
   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];