fix: store embargoes as smallID numbers (drop string[] wart)

PlayerState.embargoes was string[] of stringified smallIDs — the
renderer parsed each entry with parseInt() to use as an array index.
Flagged in the integration handoff as something that should be number[].

Switch to number[] end-to-end: renderer type, relation-matrix derive
(no parseInt), PlayerView.setEmbargoSmallIDs / hasEmbargoAgainst
(numeric Array.includes, no String() temporaries), and GameView's
embargo translation pass. Also updates the PlayerView test that pinned
the old format.
This commit is contained in:
evanpelle
2026-05-16 17:45:29 -07:00
parent e87e2cd58c
commit 8955be7667
5 changed files with 14 additions and 16 deletions
@@ -67,8 +67,7 @@ export function buildRelationMatrix(
}
if (ps.embargoes) {
for (const eStr of ps.embargoes) {
const eID = parseInt(eStr, 10);
for (const eID of ps.embargoes) {
if (eID > 0 && eID < RELATION_SIZE) {
matrix[sid * RELATION_SIZE + eID] = RELATION_EMBARGO;
matrix[eID * RELATION_SIZE + sid] = RELATION_EMBARGO;
+1 -1
View File
@@ -63,7 +63,7 @@ export interface PlayerState {
hasSpawned: boolean;
lastDeleteUnitTick: number;
allies: number[];
embargoes: string[];
embargoes: number[];
targets: number[];
outgoingAttacks: AttackData[];
incomingAttacks: AttackData[];