Remove incorrect comment and merge nested conditionals.

This commit is contained in:
Paul Chote
2021-09-25 17:34:21 +01:00
committed by abcdefg30
parent a0d49729f5
commit 3d73d5ef29

View File

@@ -121,17 +121,13 @@ namespace OpenRA.Mods.Common.Traits
if (Info.TotalCap > 0)
{
var totalCount = permanentTokens.Values.Sum(t => t.Count) + timedTokens.Count;
if (totalCount >= Info.TotalCap)
if (totalCount >= Info.TotalCap && timedTokens.Count > 0)
{
// Prefer tokens from the same source
if (timedTokens.Count > 0)
{
var expire = timedTokens[0].Token;
if (self.TokenValid(expire))
self.RevokeCondition(expire);
var expire = timedTokens[0].Token;
if (self.TokenValid(expire))
self.RevokeCondition(expire);
timedTokens.RemoveAt(0);
}
timedTokens.RemoveAt(0);
}
}