Improve some usages of Aggregate.

This commit is contained in:
RoosterDragon
2017-12-22 12:55:53 +00:00
committed by abcdefg30
parent adc4538c44
commit 63810220e4
4 changed files with 6 additions and 6 deletions

View File

@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
{
int old;
powerDrain.TryGetValue(a, out old); // old is 0 if a is not in powerDrain
var amount = a.TraitsImplementing<Power>().Where(t => !t.IsTraitDisabled).Aggregate(0, (v, p) => v + p.GetEnabledPower());
var amount = a.TraitsImplementing<Power>().Where(t => !t.IsTraitDisabled).Sum(p => p.GetEnabledPower());
powerDrain[a] = amount;
if (amount == old || devMode.UnlimitedPower)
return;