Skip to content

Commit

Permalink
fix: Changes IPAddress comparison to use UInt128 (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamronbatman authored Aug 4, 2024
1 parent 83db1f9 commit 4d47b38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Projects/UOContent/Commands/AddonGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private static void PickerCallback(Mobile from, Map map, Point3D start, Point3D

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)
{
Expand All @@ -189,7 +189,7 @@ private static void PickerCallback(Mobile from, Map map, Point3D start, Point3D
}

// Get correct bounds
foreach(Item item in target)
foreach (Item item in target)
{
if (item.Z < center.Z)
{
Expand Down Expand Up @@ -241,7 +241,7 @@ private static void PickerCallback(Mobile from, Map map, Point3D start, Point3D
}
}

foreach(Item item in target)
foreach (Item item in target)
{
int xOffset = item.X - center.X;
int yOffset = item.Y - center.Y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,17 +324,10 @@ public int Compare(RaffleEntry x, RaffleEntry y)
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);
Expand Down

0 comments on commit 4d47b38

Please sign in to comment.