rnd-19981123-3
[rocksndiamonds.git] / src / game.c
index e9f9d041c82b9475046f91eb1b1d7560e27b2006..2cb218582f2d7a39980a7f2b162debf97d6084ce 100644 (file)
@@ -427,20 +427,38 @@ void InitGame()
     }
   }
 
-  /* when in single player mode, eliminate all but the first active player */
-  if (!options.network && !setup.team_mode)
+  if (tape.playing)
+  {
+    /* when playing a tape, eliminate all players who do not participate */
+
+    for (i=0; i<MAX_PLAYERS; i++)
+    {
+      if (stored_player[i].active && !tape.player_participates[i])
+      {
+       struct PlayerInfo *player = &stored_player[i];
+       int jx = player->jx, jy = player->jy;
+
+       player->active = FALSE;
+       StorePlayer[jx][jy] = 0;
+       Feld[jx][jy] = EL_LEERRAUM;
+      }
+    }
+  }
+  else if (!options.network && !setup.team_mode)       /* && !tape.playing */
   {
+    /* when in single player mode, eliminate all but the first active player */
+
     for (i=0; i<MAX_PLAYERS; i++)
     {
       if (stored_player[i].active)
       {
        for (j=i+1; j<MAX_PLAYERS; j++)
        {
-         struct PlayerInfo *player = &stored_player[j];
-         int jx = player->jx, jy = player->jy;
-
-         if (player->active)
+         if (stored_player[j].active)
          {
+           struct PlayerInfo *player = &stored_player[j];
+           int jx = player->jx, jy = player->jy;
+
            player->active = FALSE;
            StorePlayer[jx][jy] = 0;
            Feld[jx][jy] = EL_LEERRAUM;
@@ -450,6 +468,14 @@ void InitGame()
     }
   }
 
+  /* when recording the game, store which players take part in the game */
+  if (tape.recording)
+  {
+    for (i=0; i<MAX_PLAYERS; i++)
+      if (stored_player[i].active)
+       tape.player_participates[i] = TRUE;
+  }
+
   if (options.verbose)
   {
     for (i=0; i<MAX_PLAYERS; i++)