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
|
|
@ -142,10 +142,8 @@ namespace Server.Multis
|
|||
|
||||
items.Clear();
|
||||
|
||||
for (var i = 0; i < sector.Items.Count; ++i)
|
||||
foreach (var item in sector.Items)
|
||||
{
|
||||
var item = sector.Items[i];
|
||||
|
||||
if (item.Visible && item.X == tileX && item.Y == tileY)
|
||||
{
|
||||
items.Add(item);
|
||||
|
|
@ -366,12 +364,9 @@ namespace Server.Multis
|
|||
}
|
||||
|
||||
var sector = map.GetSector(borderPoint.X, borderPoint.Y);
|
||||
var sectorItems = sector.Items;
|
||||
|
||||
for (var j = 0; j < sectorItems.Count; ++j)
|
||||
foreach (var item in sector.Items)
|
||||
{
|
||||
var item = sectorItems[j];
|
||||
|
||||
if (item.X != borderPoint.X || item.Y != borderPoint.Y || item.Movable)
|
||||
{
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue