mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:10:42 +00:00
b85d1fc372
## Problem In team games, alternate view (space-hold) colored teammates' units red (enemy color) instead of yellow (ally color). Teammates' territory borders had the same problem. ## Root cause `buildRelationMatrix()` in `src/client/render/frame/derive/RelationMatrix.ts` already supports an optional `teams` map that marks same-team pairs as `RELATION_FRIENDLY`, but the call site in `GameView.populateFrame()` never passed it (the companion `buildTeamMap` helper was dead code). Only explicit alliances were marked friendly, so a teammate without a formal alliance read as neutral — and the alt-view unit palette maps neutral to the enemy color. ## Fix - `GameView` now tracks a `smallID → team` map, populated when each `PlayerView` is first created (team is a static field, so once per player is enough). - The map is passed through to `buildRelationMatrix()`, which feeds both the `AffiliationPalette` (unit colors) and `BorderComputePass` (border colors). ## Testing - New regression test in `tests/client/view/GameView.test.ts`: same-team players are `RELATION_FRIENDLY` in `frame.relationMatrix`, cross-team players stay neutral. - All 36 GameView tests pass; typecheck clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Fable 5 <noreply@anthropic.com>