diff --git a/Projects/Server/Maps/Map.ClientEnumerator.cs b/Projects/Server/Maps/Map.ClientEnumerator.cs index 82efbb07b..4321a0fc5 100644 --- a/Projects/Server/Maps/Map.ClientEnumerator.cs +++ b/Projects/Server/Maps/Map.ClientEnumerator.cs @@ -212,6 +212,11 @@ public bool MoveNext() return false; } + if (!Unsafe.IsNullRef(in _linkList) && _linkList.Version != _currentVersion) + { + throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion); + } + Mobile m; NetState current = _current; ref Rectangle2D bounds = ref _bounds; @@ -247,11 +252,6 @@ public bool MoveNext() current = _linkList._first; } - if (_linkList.Version != _currentVersion) - { - throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion); - } - m = current.Mobile; if (m?.Deleted == false && bounds.Contains(m.Location)) { diff --git a/Projects/Server/Maps/Map.ItemEnumerator.cs b/Projects/Server/Maps/Map.ItemEnumerator.cs index 7fec42b7e..9eab2effb 100644 --- a/Projects/Server/Maps/Map.ItemEnumerator.cs +++ b/Projects/Server/Maps/Map.ItemEnumerator.cs @@ -243,6 +243,11 @@ public bool MoveNext() return false; } + if (!Unsafe.IsNullRef(in _linkList) && _linkList.Version != _currentVersion) + { + throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion); + } + Item current = _current; ref Rectangle2D bounds = ref _bounds; var currentSectorX = _currentSectorX; @@ -277,11 +282,6 @@ public bool MoveNext() current = _linkList._first; } - if (_linkList.Version != _currentVersion) - { - throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion); - } - if (current is T { Deleted: false, Parent: null } o && bounds.Contains(o.Location)) { _current = o; diff --git a/Projects/Server/Maps/Map.MobileEnumerator.cs b/Projects/Server/Maps/Map.MobileEnumerator.cs index bced5e1a7..9e7edee15 100644 --- a/Projects/Server/Maps/Map.MobileEnumerator.cs +++ b/Projects/Server/Maps/Map.MobileEnumerator.cs @@ -242,6 +242,11 @@ public bool MoveNext() return false; } + if (!Unsafe.IsNullRef(in _linkList) && _linkList.Version != _currentVersion) + { + throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion); + } + Mobile current = _current; ref Rectangle2D bounds = ref _bounds; var currentSectorX = _currentSectorX; @@ -276,11 +281,6 @@ public bool MoveNext() current = _linkList._first; } - if (_linkList.Version != _currentVersion) - { - throw new InvalidOperationException(CollectionThrowStrings.InvalidOperation_EnumFailedVersion); - } - if (current is T { Deleted: false } o && bounds.Contains(o.Location)) { _current = o; diff --git a/Projects/UOContent/Items/Resources/Tailor/Hides.cs b/Projects/UOContent/Items/Resources/Tailor/Hides.cs index 8068659b1..f9a6014c9 100644 --- a/Projects/UOContent/Items/Resources/Tailor/Hides.cs +++ b/Projects/UOContent/Items/Resources/Tailor/Hides.cs @@ -1,5 +1,4 @@ using ModernUO.Serialization; -using Server.Engines.Craft; namespace Server.Items;