fixed 741 -- use the correct superweapon building when more than one is available and some are disabled

This commit is contained in:
Chris Forbes
2011-05-30 21:26:05 +12:00
parent 7ac57014fb
commit 61cde675ea

View File

@@ -132,11 +132,16 @@ namespace OpenRA.Mods.RA
Key = key; Key = key;
} }
static bool InstanceDisabled(SupportPower sp)
{
return sp.self.TraitsImplementing<IDisable>().Any(d => d.Disabled);
}
bool notifiedCharging; bool notifiedCharging;
bool notifiedReady; bool notifiedReady;
public void Tick() 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) if (Active)
{ {
@@ -173,7 +178,8 @@ namespace OpenRA.Mods.RA
if (!Ready) if (!Ready)
return; return;
var power = Instances.First(); var power = Instances.First(i => !InstanceDisabled(i));
// Note: order.Subject is the *player* actor // Note: order.Subject is the *player* actor
power.Activate(power.self, order); power.Activate(power.self, order);
RemainingTime = TotalTime; RemainingTime = TotalTime;