check name for Actor.GrantCondition()

This commit is contained in:
atlimit8
2020-04-26 01:19:31 -05:00
committed by abcdefg30
parent 1d2d8ed107
commit 1ef27d18c1
21 changed files with 38 additions and 44 deletions

View File

@@ -528,10 +528,16 @@ namespace OpenRA
notify(this, readOnlyConditionCache);
}
/// <summary>Grants a specified condition.</summary>
/// <summary>
/// Grants a specified condition if it is valid.
/// Otherwise, just returns InvalidConditionToken.
/// </summary>
/// <returns>The token that is used to revoke this condition.</returns>
public int GrantCondition(string condition)
{
if (string.IsNullOrEmpty(condition))
return InvalidConditionToken;
var token = nextConditionToken++;
conditionTokens.Add(token, condition);
UpdateConditionState(condition, token, false);