tidy up disabled handling

This commit is contained in:
Chris Forbes
2012-04-06 19:34:43 +12:00
parent aa21ddaa4d
commit 10c1b996ed
9 changed files with 36 additions and 41 deletions

View File

@@ -55,16 +55,14 @@ namespace OpenRA.Mods.RA
&& x.Trait.Info.Produces.Contains(Info.Type))
.OrderByDescending(x => x.Actor.IsPrimaryBuilding() ? 1 : 0 ); // prioritize the primary.
if (producers.Count() == 0)
if (!producers.Any())
{
CancelProduction(name,1);
return true;
}
foreach (var p in producers)
foreach (var p in producers.Where(p => !p.Actor.IsDisabled()))
{
if (IsDisabledBuilding(p.Actor)) continue;
if (p.Trait.Produce(p.Actor, Rules.Info[ name ]))
{
FinishProduction();