minor whitespace change
[rocksndiamonds.git] / src / game.c
index 99540b18d9622ef055a0066d41c7e32f8dbb53d6..9b91031193dda070ee3285f3f9c976682c80e8ab 100644 (file)
@@ -3402,6 +3402,7 @@ void InitGame(void)
     player->action = 0;
     player->effective_action = 0;
     player->programmed_action = 0;
+    player->snap_action = 0;
 
     player->mouse_action.lx = 0;
     player->mouse_action.ly = 0;
@@ -3738,6 +3739,19 @@ void InitGame(void)
       game.belt_dir_nr[i] = 3;         // not moving, next moving left
 
 #if USE_NEW_PLAYER_ASSIGNMENTS
+  // use preferred player also in local single-player mode
+  if (!network.enabled && !game.team_mode)
+  {
+    int old_index_nr = local_player->index_nr;
+    int new_index_nr = setup.network_player_nr;
+
+    if (new_index_nr >= 0 && new_index_nr < MAX_PLAYERS)
+    {
+      stored_player[old_index_nr].connected_locally = FALSE;
+      stored_player[new_index_nr].connected_locally = TRUE;
+    }
+  }
+
   for (i = 0; i < MAX_PLAYERS; i++)
   {
     stored_player[i].connected = FALSE;
@@ -11045,10 +11059,7 @@ static void CheckSingleStepMode(struct PlayerInfo *player)
     if (!player->is_moving &&
        !player->is_pushing &&
        !player->is_dropping_pressed)
-    {
       TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
-      SnapField(player, 0, 0);                 // stop snapping
-    }
   }
 
   CheckSaveEngineSnapshot(player);
@@ -11983,7 +11994,7 @@ void GameActions_RND(void)
           element == EL_DC_MAGIC_WALL_FULL ||
           element == EL_DC_MAGIC_WALL_ACTIVE ||
           element == EL_DC_MAGIC_WALL_EMPTYING) &&
-         ABS(x-jx) + ABS(y-jy) < ABS(magic_wall_x-jx) + ABS(magic_wall_y-jy))
+         ABS(x - jx) + ABS(y - jy) < ABS(magic_wall_x - jx) + ABS(magic_wall_y - jy))
       {
        magic_wall_x = x;
        magic_wall_y = y;
@@ -12517,7 +12528,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
       {
        if ((player->MovDir == MV_LEFT  && scroll_x > jx - MIDPOSX + offset) ||
            (player->MovDir == MV_RIGHT && scroll_x < jx - MIDPOSX - offset))
-         scroll_x = jx-MIDPOSX + (scroll_x < jx-MIDPOSX ? -offset : +offset);
+         scroll_x = jx - MIDPOSX + (scroll_x < jx - MIDPOSX ? -offset : +offset);
 
        // don't scroll over playfield boundaries
        if (scroll_x < SBX_Left || scroll_x > SBX_Right)
@@ -12535,7 +12546,7 @@ boolean MovePlayer(struct PlayerInfo *player, int dx, int dy)
       {
        if ((player->MovDir == MV_UP   && scroll_y > jy - MIDPOSY + offset) ||
            (player->MovDir == MV_DOWN && scroll_y < jy - MIDPOSY - offset))
-         scroll_y = jy-MIDPOSY + (scroll_y < jy-MIDPOSY ? -offset : +offset);
+         scroll_y = jy - MIDPOSY + (scroll_y < jy - MIDPOSY ? -offset : +offset);
 
        // don't scroll over playfield boundaries
        if (scroll_y < SBY_Upper || scroll_y > SBY_Lower)