Minor optimization. Save a call to IsAlliedWith if not disguised. #18791.
This commit is contained in:
@@ -261,15 +261,14 @@ namespace OpenRA
|
|||||||
|
|
||||||
public Color PlayerRelationshipColor(Actor a)
|
public Color PlayerRelationshipColor(Actor a)
|
||||||
{
|
{
|
||||||
var player = a.World.RenderPlayer ?? a.World.LocalPlayer;
|
var renderPlayer = a.World.RenderPlayer;
|
||||||
|
var player = renderPlayer ?? a.World.LocalPlayer;
|
||||||
if (player != null && !player.Spectating)
|
if (player != null && !player.Spectating)
|
||||||
{
|
{
|
||||||
var apparentOwner = a.EffectiveOwner != null && a.EffectiveOwner.Disguised
|
var effectiveOwner = a.EffectiveOwner;
|
||||||
? a.EffectiveOwner.Owner
|
var apparentOwner = a.Owner;
|
||||||
: a.Owner;
|
if (effectiveOwner != null && effectiveOwner.Disguised && !a.Owner.IsAlliedWith(renderPlayer))
|
||||||
|
apparentOwner = effectiveOwner.Owner;
|
||||||
if (a.Owner.IsAlliedWith(a.World.RenderPlayer))
|
|
||||||
apparentOwner = a.Owner;
|
|
||||||
|
|
||||||
if (apparentOwner == player)
|
if (apparentOwner == player)
|
||||||
return stanceColors.Self;
|
return stanceColors.Self;
|
||||||
|
|||||||
Reference in New Issue
Block a user