fixed network games, part 2: set player focus after setting local player
authorHolger Schemel <info@artsoft.org>
Fri, 18 May 2018 08:04:37 +0000 (10:04 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 18 May 2018 08:04:37 +0000 (10:04 +0200)
There was also a bug with setting the focussed player to the local
player where the local player potentially changed afterwards (if the
player for network games was assigned to any player in the playfield
different from the player that was selected for network games by the
user on program start).

To fix this, the code to set the focussed player for network games was
moved to a point after setting the local player.

src/game.c

index a17dc326f05e0a3a97c9490cb0fd39024c0982bb..fbe9fd00ba8e1d705ad07b4d9d36c8ff873107f8 100644 (file)
@@ -3545,18 +3545,6 @@ void InitGame()
 
   game.envelope_active = FALSE;
 
-  /* set focus to local player for network games, else to all players */
-  game.centered_player_nr = (network_playing ? local_player->index_nr : -1);
-  game.centered_player_nr_next = game.centered_player_nr;
-  game.set_centered_player = FALSE;
-
-  if (network_playing && tape.recording)
-  {
-    /* store client dependent player focus when recording network games */
-    tape.centered_player_nr_next = game.centered_player_nr_next;
-    tape.set_centered_player = TRUE;
-  }
-
   for (i = 0; i < NUM_BELTS; i++)
   {
     game.belt_dir[i] = MV_NONE;
@@ -3895,6 +3883,18 @@ void InitGame()
   printf("::: local_player->present == %d\n", local_player->present);
 #endif
 
+  /* set focus to local player for network games, else to all players */
+  game.centered_player_nr = (network_playing ? local_player->index_nr : -1);
+  game.centered_player_nr_next = game.centered_player_nr;
+  game.set_centered_player = FALSE;
+
+  if (network_playing && tape.recording)
+  {
+    /* store client dependent player focus when recording network games */
+    tape.centered_player_nr_next = game.centered_player_nr_next;
+    tape.set_centered_player = TRUE;
+  }
+
   if (tape.playing)
   {
     /* when playing a tape, eliminate all players who do not participate */