Favour newer buildings over older buildings when a unit can appear from multiple buildings after being built

This commit is contained in:
ScottNZ
2013-06-24 09:16:35 +12:00
parent b93e9a5945
commit 9f1d9e153a

View File

@@ -11,9 +11,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Mods.RA.Buildings;
using OpenRA.Traits;
using OpenRA.FileFormats;
namespace OpenRA.Mods.RA
{
@@ -70,7 +70,8 @@ namespace OpenRA.Mods.RA
var producers = self.World.ActorsWithTrait<Production>()
.Where(x => x.Actor.Owner == self.Owner
&& x.Trait.Info.Produces.Contains(Info.Type))
.OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary.
.OrderByDescending(x => x.Actor.IsPrimaryBuilding())
.ThenByDescending(x => x.Actor.ActorID);
if (!producers.Any())
{