Implements an AcknowledgesUpgrade method in UpgradeManager to allow checking for truly applicable upgrades - AcceptsUpgrade returns false if the upgrade has reached max level.

This commit is contained in:
Zimmermann Gyula
2015-06-21 14:26:20 +02:00
parent 8a94caab3c
commit 32eed88de5
2 changed files with 8 additions and 1 deletions

View File

@@ -125,6 +125,13 @@ namespace OpenRA.Mods.Common.Traits
NotifyUpgradeLevelChanged(s.Traits, self, upgrade, -1);
}
/// <summary>Returns true if the actor uses the given upgrade. Does not check the actual level of the upgrade.</summary>
public bool AcknowledgesUpgrade(Actor self, string upgrade)
{
return upgrades.Value.ContainsKey(upgrade);
}
/// <summary>Returns true only if the actor can accept another level of the upgrade.</summary>
public bool AcceptsUpgrade(Actor self, string upgrade)
{
UpgradeState s;

View File

@@ -166,7 +166,7 @@ namespace OpenRA.Mods.RA.Traits
{
foreach (var u in info.Upgrades)
{
if (!um.Value.AcceptsUpgrade(self, u))
if (!um.Value.AcknowledgesUpgrade(self, u))
continue;
if (Disguised)