refactor: don't allocate an array for no reason

This commit is contained in:
Anna 2020-08-08 17:49:35 -04:00
parent cd2acb4d19
commit d1ce85463c
1 changed files with 2 additions and 3 deletions

View File

@ -359,10 +359,9 @@ namespace PeepingTom {
}
if (this.plugin.Config.KeepHistory) {
// get a list of the previous targeters that aren't currently targeting
Targeter[] previous = previousTargeters
var previous = previousTargeters
.Where(old => targeting.All(actor => actor.ActorId != old.ActorId))
.Take(this.plugin.Config.NumHistory)
.ToArray();
.Take(this.plugin.Config.NumHistory);
// add previous targeters to the list
foreach (Targeter oldTargeter in previous) {
Actor actor = null;