Fix captured trade ships rendering yellow in alt-view

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) <noreply@anthropic.com>
This commit is contained in:
evanpelle
2026-06-14 12:16:42 -07:00
parent bb5e7dc954
commit 44f5e14a0f
+7 -2
View File
@@ -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));
}
}