fixed network games, part 3: enabled mapping input to reassigned players
authorHolger Schemel <info@artsoft.org>
Fri, 18 May 2018 08:39:00 +0000 (10:39 +0200)
committerHolger Schemel <info@artsoft.org>
Fri, 18 May 2018 08:39:00 +0000 (10:39 +0200)
Before this change, player input from connected network players was
only allowed for active players. However, the old code did not take
into account that players may have been reassigned to other players
in the level playfield, so their input actions have to be mapped to
that different player.

This change accepts input actions for all players, and later maps
them to the finally assigned player in the game.

src/network.c

index afce79981a9061ab4ec0dc7ac1dba355966e9072..b51402eb7299e7cb299018f9deebb74d2187b8c7 100644 (file)
@@ -508,7 +508,7 @@ static void Handle_OP_MOVE_PLAYER(unsigned int len)
   /* copy valid player actions */
   for (i = 0; i < MAX_PLAYERS; i++)
     stored_player[i].effective_action =
-      (i < len - 6 && stored_player[i].active ? buffer[6 + i] : 0);
+      (i < len - 6 ? buffer[6 + i] : 0);
 
   network_player_action_received = TRUE;
 }