From 44f5e14a0f80575e876adc47771e01dec76d51e1 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Sun, 14 Jun 2026 12:16:42 -0700 Subject: [PATCH] Fix captured trade ships rendering yellow in alt-view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In alt-view, trade ships are colored by their owner's affiliation: self green, ally yellow, enemy red. The FLAG_TRADE_FRIENDLY override recolors an enemy ship red→yellow when it's heading to a self/allied port. That flag was decided solely from the destination port's owner, ignoring who owns the ship — so a captured trade ship (now owned by us, heading to our port) got flagged yellow instead of keeping its green affiliation color. Gate FLAG_TRADE_FRIENDLY on the ship being enemy-owned, since self/allied ships already render the correct color without the override. Also fixes our own trade ships heading to an ally's port flipping green→yellow. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/client/render/gl/passes/UnitPass.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/client/render/gl/passes/UnitPass.ts b/src/client/render/gl/passes/UnitPass.ts index 320bd5beb..e79720c48 100644 --- a/src/client/render/gl/passes/UnitPass.ts +++ b/src/client/render/gl/passes/UnitPass.ts @@ -450,9 +450,14 @@ export class UnitPass { const targetPort = this.structures.get(unit.targetUnitId); if (targetPort) { const portOwner = targetPort.ownerID; + // Only recolor enemy-owned ships: a self/allied ship already renders + // green/yellow via its affiliation color (e.g. a captured trade ship + // heading to our port is ours and must stay green, not yellow). isTradeFriendly = - portOwner === this.localPlayerID || - this.friendlyOwners.has(portOwner); + unit.ownerID !== this.localPlayerID && + !this.friendlyOwners.has(unit.ownerID) && + (portOwner === this.localPlayerID || + this.friendlyOwners.has(portOwner)); } }