Implement equality on TraitPair.

This commit is contained in:
RoosterDragon
2015-12-31 01:38:09 +00:00
parent addbe6d564
commit 3026bdcea5
4 changed files with 17 additions and 10 deletions

View File

@@ -236,7 +236,7 @@ namespace OpenRA.Mods.Common.Orders
var blockers = allTiles.SelectMany(world.ActorMap.GetActorsAt)
.Where(a => a.Owner == queue.Actor.Owner && a.IsIdle)
.Select(a => new TraitPair<Mobile> { Actor = a, Trait = a.TraitOrDefault<Mobile>() });
.Select(a => new TraitPair<Mobile>(a, a.TraitOrDefault<Mobile>()));
foreach (var blocker in blockers.Where(x => x.Trait != null))
{

View File

@@ -361,7 +361,7 @@ namespace OpenRA.Mods.Common.Traits
public virtual TraitPair<Production> MostLikelyProducer()
{
var trait = self.TraitsImplementing<Production>().FirstOrDefault(p => p.Info.Produces.Contains(Info.Type));
return new TraitPair<Production> { Actor = self, Trait = trait };
return new TraitPair<Production>(self, trait);
}
// Builds a unit from the actor that holds this queue (1 queue per building)