fix: Prepares for IPooledEnumerable removal (#1548)

### Summary

- Removes `IPooledEnumerable` (non-generic)
- Changes `IPooledEnumerable<T>` so that  `Free()` is replaced with the `IDisposable` pattern
This commit is contained in:
Kamron Batman 2023-10-15 11:20:49 -07:00 • committed by GitHub
parent c2d6578955
commit d57f1fecc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
92 changed files with 644 additions and 907 deletions

View file

@ -479,8 +479,6 @@ namespace Server.Engines.ConPVP
}
}
eable.Free();
if (empty)
{
HitObject(point, landTop, 0);
@ -569,8 +567,6 @@ namespace Server.Engines.ConPVP
{
continue;
}
area.Free();
if (i is BRGoal goal)
{
var oldLoc = new Point3D(GetWorldLocation());
@ -591,8 +587,6 @@ namespace Server.Engines.ConPVP
return;
}
area.Free();
var clients = Map.GetClientsInBounds(rect);
foreach (var ns in clients)
{
@ -622,16 +616,12 @@ namespace Server.Engines.ConPVP
continue;
}
clients.Free();
// TODO: probably need to change this a lot...
DoCatch(m);
return;
}
clients.Free();
m_PathIdx = pathCheckEnd;
if (m_PathIdx > 0 && m_PathIdx - 1 < m_Path.Count)
@ -685,8 +675,6 @@ namespace Server.Engines.ConPVP
}
}
eable.Free();
Z = myZ;
m_Flying = false;
Visible = true;

View file

@ -393,7 +393,6 @@ namespace Server.Engines.Craft
{
if (item.Z + 16 > item.Z && item.Z + 16 > item.Z && Find(item.ItemID, itemIDs))
{
eable.Free();
return true;
}
}

View file

@ -65,8 +65,6 @@ public class DefBlacksmithy : CraftSystem
}
}
eable.Free();
for (var x = -range; (!anvil || !forge) && x <= range; ++x)
{
for (var y = -range; (!anvil || !forge) && y <= range; ++y)

View file

@ -203,14 +203,11 @@ public partial class LeverPuzzleController : Item
{
if (item is LeverPuzzleController)
{
eable.Free();
e.Mobile.SendMessage("Lamp room puzzle already exists: please delete the existing controller first ...");
return;
}
}
eable.Free();
e.Mobile.SendMessage("Generating Lamp Room puzzle...");
NetState.FlushAll();
@ -533,8 +530,6 @@ public partial class LeverPuzzleController : Item
state.Send(buffer);
}
eable.Free();
}
private void Deserialize(IGenericReader reader, int version)
@ -620,7 +615,6 @@ public partial class LeverPuzzleController : Item
var eable = m_IEntity.Map.GetMobilesInRange(m_IEntity.Location, 2);
var mobiles = new List<Mobile>();
mobiles.AddRange(eable);
eable.Free();
for (var k = 0; k < mobiles.Count; k++)
{

View file

@ -167,8 +167,6 @@ namespace Server.Ethics
}
}
eable.Free();
if (!found)
{
continue;

View file

@ -273,13 +273,10 @@ namespace Server.Factions
if (type.IsInstanceOfType(obj))
{
eable.Free();
return true;
}
}
eable.Free();
return false;
}
@ -292,13 +289,10 @@ namespace Server.Factions
{
if (types[i].IsInstanceOfType(obj))
{
eable.Free();
return true;
}
}
}
eable.Free();
return false;
}

View file

@ -83,12 +83,9 @@ namespace Server.Factions
{
if (type.IsInstanceOfType(item))
{
eable.Free();
return true;
}
}
eable.Free();
return false;
}
}

View file

@ -102,8 +102,6 @@ namespace Server
}
}
eable.Free();
foreach (var mob in targets)
{
var damage = mob.Hits * 6 / 10;

View file

@ -312,13 +312,10 @@ namespace Server.Engines.Harvest
{
if (i.StackWith(m, i, false))
{
eable.Free();
return true;
}
}
eable.Free();
item.MoveToWorld(m.Location, map);
return true;
}

View file

@ -26,8 +26,6 @@ namespace Server.Commands
break;
}
}
eable.Free();
return found;
}
@ -44,8 +42,6 @@ namespace Server.Commands
break;
}
}
eable.Free();
return found;
}
@ -53,7 +49,6 @@ namespace Server.Commands
{
var eable = Map.Felucca.GetItemsInBounds<T>(new Rectangle2D(x, y, 1, 1));
var t = eable.FirstOrDefault(item => item.GetType() == srcItem.GetType());
eable.Free();
if (t != null)
{
srcItem.Delete();

View file

@ -22,7 +22,7 @@ namespace Server.Movement
private readonly List<Item>[] _pools = { new(), new(), new(), new() };
private readonly HashSet<Sector> _sectors = new();
private readonly HashSet<Map.Sector> _sectors = new();
private MovementImpl()
{

View file

@ -162,8 +162,6 @@ namespace Server.Engines.Spawners
queue.Dequeue().Delete();
}
eable.Free();
try
{
var spawner = type.CreateInstance<ISpawner>(json, options);

View file

@ -380,8 +380,6 @@ public partial class CharacterStatue : Mobile, IRewardItem
CharacterStatuePackets.CreateStatueAnimation(animPacket, Serial, 1, m_Animation, m_Frames);
state.Send(animPacket);
}
eable.Free();
}
private class DemolishEntry : ContextMenuEntry