Skip to content

Commit

Permalink
fixed 741 -- use the correct superweapon building when more than one …
Browse files Browse the repository at this point in the history
…is available and some are disabled
  • Loading branch information
chrisforbes committed May 30, 2011
1 parent 7ac5701 commit 61cde67
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions OpenRA.Mods.RA/SupportPowers/SupportPowerManager.cs
Expand Up @@ -131,12 +131,17 @@ public SupportPowerInstance(string key, SupportPowerManager manager)
Manager = manager;
Key = key;
}

static bool InstanceDisabled(SupportPower sp)
{
return sp.self.TraitsImplementing<IDisable>().Any(d => d.Disabled);
}

bool notifiedCharging;
bool notifiedReady;
public void Tick()
{
Active = !Disabled && Instances.Any(i => !i.self.TraitsImplementing<IDisable>().Any(d => d.Disabled));
Active = !Disabled && Instances.Any(i => !InstanceDisabled(i));

if (Active)
{
Expand Down Expand Up @@ -173,7 +178,8 @@ public void Activate(Order order)
if (!Ready)
return;

var power = Instances.First();
var power = Instances.First(i => !InstanceDisabled(i));

// Note: order.Subject is the *player* actor
power.Activate(power.self, order);
RemainingTime = TotalTime;
Expand Down

0 comments on commit 61cde67

Please sign in to comment.