Replace usage of the Stances dict by a method call

This commit is contained in:
abcdefg30
2020-09-25 17:02:25 +02:00
committed by Paul Chote
parent eda9966d27
commit 10f645bf77
55 changed files with 104 additions and 107 deletions

View File

@@ -167,7 +167,7 @@ namespace OpenRA.Mods.Common.Traits
foreach (var bp in world.ActorsWithTrait<BaseProvider>())
{
var validOwner = bp.Actor.Owner == p || (allyBuildEnabled && bp.Actor.Owner.Stances[p] == PlayerRelationship.Ally);
var validOwner = bp.Actor.Owner == p || (allyBuildEnabled && bp.Actor.Owner.RelationshipWith(p) == PlayerRelationship.Ally);
if (!validOwner || !bp.Trait.Ready())
continue;
@@ -211,13 +211,12 @@ namespace OpenRA.Mods.Common.Traits
for (var x = scanStart.X; x < scanEnd.X; x++)
{
var pos = new CPos(x, y);
foreach (var a in world.ActorMap.GetActorsAt(pos))
{
if (!a.IsInWorld)
continue;
if (a.Owner != p && (!allyBuildEnabled || a.Owner.Stances[p] != PlayerRelationship.Ally))
if (a.Owner != p && (!allyBuildEnabled || a.Owner.RelationshipWith(p) != PlayerRelationship.Ally))
continue;
if (ActorGrantsValidArea(a, requiresBuildableArea))