rnd-20030913-2-src
[rocksndiamonds.git] / src / game.c
index 750c70a91e01a7ddfaeb6f63bf296c168b6bc7e9..f571fd1f62e9455751e79c1c80ad204f6f1f8ff8 100644 (file)
@@ -241,6 +241,14 @@ static struct ChangingElementInfo change_delay_list[] =
     NULL,
     NULL
   },
+  {
+    EL_EXIT_CLOSING,
+    EL_EXIT_CLOSED,
+    29,
+    NULL,
+    NULL,
+    NULL
+  },
   {
     EL_SWITCHGATE_OPENING,
     EL_SWITCHGATE_OPEN,
@@ -1646,6 +1654,14 @@ void GameWon()
       StopSound(SND_GAME_LEVELTIME_BONUS);
   }
 
+  /* close exit door after last player */
+  if (Feld[ExitX][ExitY] == EL_EXIT_OPEN && AllPlayersGone)
+  {
+    Feld[ExitX][ExitY] = EL_EXIT_CLOSING;
+
+    PlaySoundLevelElementAction(ExitX, ExitY, EL_EXIT_OPEN, ACTION_CLOSING);
+  }
+
   /* Hero disappears */
   DrawLevelField(ExitX, ExitY);
   BackToFront();
@@ -2294,8 +2310,10 @@ void Explode(int ex, int ey, int phase, int mode)
 
   if (GfxElement[x][y] == EL_UNDEFINED)
   {
+    printf("\n\n\n");
     printf("Explode(): x = %d, y = %d: GfxElement == EL_UNDEFINED\n", x, y);
     printf("Explode(): This should never happen!\n");
+    printf("\n\n\n");
 
     GfxElement[x][y] = EL_EMPTY;
   }
@@ -4989,6 +5007,9 @@ void CheckExit(int x, int y)
     return;
   }
 
+  if (AllPlayersGone)  /* do not re-open exit door closed after last player */
+    return;
+
   Feld[x][y] = EL_EXIT_OPENING;
 
   PlaySoundLevelNearest(x, y, SND_CLASS_EXIT_OPENING);