Rename Stance to PlayerRelationship
This commit is contained in:
@@ -229,11 +229,11 @@ namespace OpenRA
|
||||
return "{0} ({1})".F(PlayerName, ClientIndex);
|
||||
}
|
||||
|
||||
public Dictionary<Player, Stance> Stances = new Dictionary<Player, Stance>();
|
||||
public Dictionary<Player, PlayerRelationship> Stances = new Dictionary<Player, PlayerRelationship>();
|
||||
public bool IsAlliedWith(Player p)
|
||||
{
|
||||
// Observers are considered allies to active combatants
|
||||
return p == null || Stances[p] == Stance.Ally || (p.Spectating && !NonCombatant);
|
||||
return p == null || Stances[p] == PlayerRelationship.Ally || (p.Spectating && !NonCombatant);
|
||||
}
|
||||
|
||||
public Color PlayerStanceColor(Actor a)
|
||||
|
||||
@@ -38,9 +38,9 @@ namespace OpenRA.Traits
|
||||
|
||||
switch (viewer.Stances[a.Owner])
|
||||
{
|
||||
case Stance.Ally: return basePriority - PriorityRange;
|
||||
case Stance.Neutral: return basePriority - 2 * PriorityRange;
|
||||
case Stance.Enemy: return basePriority - 3 * PriorityRange;
|
||||
case PlayerRelationship.Ally: return basePriority - PriorityRange;
|
||||
case PlayerRelationship.Neutral: return basePriority - 2 * PriorityRange;
|
||||
case PlayerRelationship.Enemy: return basePriority - 3 * PriorityRange;
|
||||
|
||||
default:
|
||||
throw new InvalidOperationException();
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum Stance
|
||||
public enum PlayerRelationship
|
||||
{
|
||||
None = 0,
|
||||
Enemy = 1,
|
||||
@@ -78,7 +78,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public static class StanceExts
|
||||
{
|
||||
public static bool HasStance(this Stance s, Stance stance)
|
||||
public static bool HasStance(this PlayerRelationship s, PlayerRelationship stance)
|
||||
{
|
||||
// PERF: Enum.HasFlag is slower and requires allocations.
|
||||
return (s & stance) == stance;
|
||||
@@ -196,7 +196,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public interface ITooltipInfo : ITraitInfoInterface
|
||||
{
|
||||
string TooltipForPlayerStance(Stance stance);
|
||||
string TooltipForPlayerStance(PlayerRelationship stance);
|
||||
bool IsOwnerRowVisible { get; }
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace OpenRA
|
||||
SetUpPlayerMask(p, q);
|
||||
|
||||
if (!p.Stances.ContainsKey(q))
|
||||
p.Stances[q] = Stance.Neutral;
|
||||
p.Stances[q] = PlayerRelationship.Neutral;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,11 +254,11 @@ namespace OpenRA
|
||||
|
||||
switch (p.Stances[q])
|
||||
{
|
||||
case Stance.Enemy:
|
||||
case Stance.Neutral:
|
||||
case PlayerRelationship.Enemy:
|
||||
case PlayerRelationship.Neutral:
|
||||
p.EnemyPlayersMask = p.EnemyPlayersMask.Union(bitSet);
|
||||
break;
|
||||
case Stance.Ally:
|
||||
case PlayerRelationship.Ally:
|
||||
p.AlliedPlayersMask = p.AlliedPlayersMask.Union(bitSet);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -90,8 +90,8 @@ namespace OpenRA
|
||||
|
||||
public static bool AreMutualAllies(Player a, Player b)
|
||||
{
|
||||
return a.Stances[b] == Stance.Ally &&
|
||||
b.Stances[a] == Stance.Ally;
|
||||
return a.Stances[b] == PlayerRelationship.Ally &&
|
||||
b.Stances[a] == PlayerRelationship.Ally;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user