Fix AI unable to activate AllowMultiple support powers.

This commit is contained in:
Zimmermann Gyula
2016-12-05 10:02:30 +01:00
parent a8f3172c6b
commit f927d54db7
2 changed files with 7 additions and 6 deletions

View File

@@ -1027,7 +1027,7 @@ namespace OpenRA.Mods.Common.AI
// Valid target found, delay by a few ticks to avoid rescanning before power fires via order // Valid target found, delay by a few ticks to avoid rescanning before power fires via order
BotDebug("AI: {2} found new target location {0} for support power {1}.", attackLocation, sp.Info.OrderName, Player.PlayerName); BotDebug("AI: {2} found new target location {0} for support power {1}.", attackLocation, sp.Info.OrderName, Player.PlayerName);
waitingPowers[sp] += 10; waitingPowers[sp] += 10;
QueueOrder(new Order(sp.Info.OrderName, supportPowerMngr.Self, false) { TargetLocation = attackLocation.Value, SuppressVisualFeedback = true }); QueueOrder(new Order(sp.Key, supportPowerMngr.Self, false) { TargetLocation = attackLocation.Value, SuppressVisualFeedback = true });
} }
} }
} }

View File

@@ -153,7 +153,8 @@ namespace OpenRA.Mods.Common.Traits
public class SupportPowerInstance public class SupportPowerInstance
{ {
readonly SupportPowerManager manager; readonly SupportPowerManager manager;
readonly string key;
public readonly string Key;
public List<SupportPower> Instances; public List<SupportPower> Instances;
public int RemainingTime; public int RemainingTime;
@@ -170,7 +171,7 @@ namespace OpenRA.Mods.Common.Traits
public SupportPowerInstance(string key, SupportPowerManager manager) public SupportPowerInstance(string key, SupportPowerManager manager)
{ {
this.manager = manager; this.manager = manager;
this.key = key; Key = key;
} }
public void PrerequisitesAvailable(bool available) public void PrerequisitesAvailable(bool available)
@@ -205,14 +206,14 @@ namespace OpenRA.Mods.Common.Traits
--RemainingTime; --RemainingTime;
if (!notifiedCharging) if (!notifiedCharging)
{ {
power.Charging(power.Self, key); power.Charging(power.Self, Key);
notifiedCharging = true; notifiedCharging = true;
} }
if (RemainingTime == 0 if (RemainingTime == 0
&& !notifiedReady) && !notifiedReady)
{ {
power.Charged(power.Self, key); power.Charged(power.Self, Key);
notifiedReady = true; notifiedReady = true;
} }
} }
@@ -227,7 +228,7 @@ namespace OpenRA.Mods.Common.Traits
if (power == null) if (power == null)
return; return;
power.SelectTarget(power.Self, key, manager); power.SelectTarget(power.Self, Key, manager);
} }
public void Activate(Order order) public void Activate(Order order)