fix: Removes GetObjectsInRange and fixes boat planks closing (#1579)
## BREAKING CHANGE - Deletes `map.GetObjectsInRange` and `map.GetObejctsInBounds` ### Notes Developers are expected to enumerate mobiles and items separately now using `map.GetMobilesInRange` and `map.GetItemsInRange`. This helps keep the code streamlined so we don't have to maintain multiple copies of ref struct enumerators that do the same thing. ### Fixes - [X] Fixes bug with planks closing - [X] Fixes issue with iterating items/mobiles from a null map
This commit is contained in:
parent
cb1638591b
commit
977fdc2c5a
21 changed files with 543 additions and 461 deletions
|
|
@ -21,6 +21,9 @@ namespace Server;
|
|||
|
||||
public partial class Map
|
||||
{
|
||||
private static ValueLinkList<Mobile> _emptyMobileLinkList = new();
|
||||
public static ref readonly ValueLinkList<Mobile> EmptyMobileLinkList => ref _emptyMobileLinkList;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public MobileAtEnumerable<Mobile> GetMobilesAt(Point3D p) => GetMobilesAt<Mobile>(p);
|
||||
|
||||
|
|
@ -110,7 +113,14 @@ public partial class Map
|
|||
{
|
||||
_started = false;
|
||||
_location = loc;
|
||||
_linkList = ref map.GetRealSector(loc.m_X, loc.m_Y).Mobiles;
|
||||
if (map == null)
|
||||
{
|
||||
_linkList = ref EmptyMobileLinkList;
|
||||
}
|
||||
else
|
||||
{
|
||||
_linkList = ref map.GetRealSector(loc.m_X, loc.m_Y).Mobiles;
|
||||
}
|
||||
_version = 0;
|
||||
_current = null;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue