fix: Changes IPAddress comparison to use UInt128 (#1897)

This commit is contained in:
Kamron Batman 2024-08-04 09:32:41 -07:00 committed by GitHub
parent 83db1f91f6
commit 4d47b3849f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 13 deletions

View file

@ -174,7 +174,7 @@ public class AddonGenerator
using var target = PooledRefList<Item>.Create();
foreach(Static s in map.GetItemsInBounds<Static>(bounds))
foreach (Static s in map.GetItemsInBounds<Static>(bounds))
{
if (!range || s.Z >= min && s.Z <= max)
{
@ -189,7 +189,7 @@ public class AddonGenerator
}
// Get correct bounds
foreach(Item item in target)
foreach (Item item in target)
{
if (item.Z < center.Z)
{
@ -241,7 +241,7 @@ public class AddonGenerator
}
}
foreach(Item item in target)
foreach (Item item in target)
{
int xOffset = item.X - center.X;
int yOffset = item.Y - center.Y;

View file

@ -324,17 +324,10 @@ public class HouseRaffleManagementGump : Gump
return 1;
}
var a = x.Address.GetAddressBytes();
var b = y.Address.GetAddressBytes();
for (var i = 0; i < a.Length && i < b.Length; i++)
var addressCompare = x.Address.ToUInt128().CompareTo(y.Address.ToUInt128());
if (addressCompare != 0)
{
var compare = a[i].CompareTo(b[i]);
if (compare != 0)
{
return compare;
}
return addressCompare;
}
return x.Date.CompareTo(y.Date);