From 0cf60456a5185367d8c50c50ef072d3e26ef7ebd Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 23 Dec 2016 15:09:08 +0000 Subject: [PATCH] Remove upgrade shim code. --- .../Traits/Upgrades/ConditionManager.cs | 51 ------------------- 1 file changed, 51 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs index d219297ee8..11940b4fd4 100644 --- a/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs +++ b/OpenRA.Mods.Common/Traits/Upgrades/ConditionManager.cs @@ -74,9 +74,6 @@ namespace OpenRA.Mods.Common.Traits int nextToken = 1; - /// Temporary shim between the old and new upgrade/condition grant and revoke methods. - readonly Dictionary, int> objectTokenShim = new Dictionary, int>(); - /// Cache of condition -> enabled state for quick evaluation of boolean conditions. readonly Dictionary conditionCache = new Dictionary(); @@ -267,53 +264,5 @@ namespace OpenRA.Mods.Common.Traits timersToRemove.Clear(); } - - #region Shim methods for legacy upgrade granting code - - void CheckCanManageConditions() - { - if (state == null) - throw new InvalidOperationException("Conditions cannot be managed until the actor has been fully created."); - } - - public void GrantTimedUpgrade(Actor self, string upgrade, int duration, object source = null, int dupesAllowed = 1) - { - CheckCanManageConditions(); - var token = GrantCondition(self, upgrade, false, duration); - if (source != null) - objectTokenShim[Pair.New(source, upgrade)] = token; - } - - public void GrantUpgrade(Actor self, string upgrade, object source) - { - CheckCanManageConditions(); - objectTokenShim[Pair.New(source, upgrade)] = GrantCondition(self, upgrade); - } - - public void RevokeUpgrade(Actor self, string upgrade, object source) - { - CheckCanManageConditions(); - RevokeCondition(self, objectTokenShim[Pair.New(source, upgrade)]); - } - - /// Returns true if the actor uses the given upgrade. Does not check the actual level of the upgrade. - public bool AcknowledgesUpgrade(Actor self, string upgrade) - { - CheckCanManageConditions(); - return state.ContainsKey(upgrade); - } - - /// Returns true only if the actor can accept another level of the upgrade. - public bool AcceptsUpgrade(Actor self, string upgrade) - { - CheckCanManageConditions(); - bool enabled; - if (!conditionCache.TryGetValue(upgrade, out enabled)) - return false; - - return !enabled; - } - - #endregion } }