added using preferred network player also in single-player mode
authorHolger Schemel <info@artsoft.org>
Fri, 4 Jan 2019 17:03:14 +0000 (18:03 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 4 Jan 2019 17:03:14 +0000 (18:03 +0100)
src/game.c

index 99540b18d9622ef055a0066d41c7e32f8dbb53d6..52ea43293cebaf68c232005cd88121809568ab26 100644 (file)
@@ -3738,6 +3738,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;