fix: Changes Map.Sector.Items to link list. (#1547)
### Summary
Eliminates `IPooledEnumerable<T>` and `eable.Free()` from `Map` for items. This drastically simplifies code that iterates in range, for example:
```cs
foreach (var item in m.GetItemsInRange(5))
{
}
```
The code above no longer requires an eable and calling `Free()`.
This commit is contained in:
parent
1330c4a830
commit
24858f3989
42 changed files with 577 additions and 419 deletions
|
|
@ -467,10 +467,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (landTile.ID == 0x244 && statics.Length == 0) // 0x244 = invalid land tile
|
||||
{
|
||||
var eable = Map.GetItemsInRange(point, 0);
|
||||
|
||||
var empty = true;
|
||||
foreach (var item in eable)
|
||||
foreach (var item in Map.GetItemsInRange(point, 0))
|
||||
{
|
||||
if (item != this)
|
||||
{
|
||||
|
|
@ -513,8 +511,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
var rect = new Rectangle2D(pTop.X, pTop.Y, pBottom.X - pTop.X + 1, pBottom.Y - pTop.Y + 1);
|
||||
|
||||
var area = Map.GetItemsInBounds(rect);
|
||||
foreach (var i in area)
|
||||
foreach (var i in Map.GetItemsInBounds(rect))
|
||||
{
|
||||
if (i == this || i.ItemID >= 0x4000)
|
||||
{
|
||||
|
|
@ -567,6 +564,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i is BRGoal goal)
|
||||
{
|
||||
var oldLoc = new Point3D(GetWorldLocation());
|
||||
|
|
@ -662,8 +660,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
var eable = GetItemsInRange(0);
|
||||
foreach (var item in eable)
|
||||
foreach (var item in GetItemsInRange(0))
|
||||
{
|
||||
if (item.Visible && item != this)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue