fix(complement-race): show only first active player's passengers on train

In multiplayer steam sprint games, the train was displaying passengers from
all players (including inactive ones) instead of only showing passengers
belonging to the first active player.

The issue was that boardedPassengers was filtering for any claimed passenger,
not checking if the claiming player was still active.

Changes to SteamTrainJourney.tsx:
- Filter boardedPassengers to only include passengers where claimedBy matches
  the firstActivePlayer's ID
- Add firstActivePlayer.id to the useMemo dependency array
- Update comment to clarify filtering logic

Now the train correctly displays only the first active player's passengers
in their train cars, matching the player emoji shown as the engineer.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Thomas Hallock 2025-10-22 10:45:25 -05:00
parent 6dabb71600
commit 2bfd5d2bda
1 changed files with 7 additions and 2 deletions

View File

@ -164,9 +164,14 @@ export function SteamTrainJourney({
// Memoize filtered passenger lists to avoid recalculating on every render
// Arcade room multiplayer uses claimedBy/deliveredBy instead of isBoarded/isDelivered
// Only show passengers claimed by the first active player
const boardedPassengers = useMemo(
() => displayPassengers.filter((p) => p.claimedBy !== null && p.deliveredBy === null),
[displayPassengers]
() =>
displayPassengers.filter(
(p) =>
p.claimedBy === firstActivePlayer?.id && p.claimedBy !== null && p.deliveredBy === null
),
[displayPassengers, firstActivePlayer?.id]
)
const nonDeliveredPassengers = useMemo(