fix: Cleans up LINQ calls. (#965)

- [X] Removes several `ToList()` uses with `PooledRefQueue`
- [X] Adds a `PeekRandom` to PooledRefQueue
- [X] Updates EV/BS so they dispel each other in a more efficient manner.
- [X] Fixes Firebomb so it works like a normal firefield.
- [X] Fixes field spells so they aren't unnecessarily using a Point3D ref more than necessary.
- [X] Removes extra allocation in campfire by using reverse loop.
- [X] Removes other LINQ calls that aren't needed.
This commit is contained in:
Kamron Batman 2022-03-20 19:20:54 -07:00 • committed by GitHub
parent daf89686d1
commit 23532db603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 585 additions and 447 deletions

View file

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Server.Accounting;
using Server.Collections;
using Server.ContextMenus;
using Server.Ethics;
using Server.Guilds;
@ -3227,16 +3228,21 @@ namespace Server.Multis
private void FixLockdowns_Sandbox()
{
var conts = LockDowns?.Where(item => item is Container).ToList();
if (conts == null)
if (LockDowns?.Count > 0)
{
return;
}
using var queue = PooledRefQueue<Item>.Create();
foreach (var item in LockDowns)
{
if (item is Container)
{
queue.Enqueue(item);
}
}
foreach (var cont in conts)
{
SetLockdown(cont, true, true);
while (queue.Count > 0)
{
SetLockdown(queue.Dequeue(), true, true);
}
}
}