mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 08:20:50 +00:00
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:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user