From 2bce1716afb4df36c4c67b2f17f6f0f18b341987 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 1 Nov 2010 13:07:24 +0100 Subject: Fix HypergridLinker.Check4096() Make the optimization with IEnumerable.Except() in Check4096 actually work by providing an appropriate equality definition for GridRegion objects. --- OpenSim/Services/Interfaces/IGridService.cs | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'OpenSim/Services') diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 77230a3..ee06225 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs @@ -97,7 +97,7 @@ namespace OpenSim.Services.Interfaces int GetRegionFlags(UUID scopeID, UUID regionID); } - public class GridRegion + public class GridRegion : Object { /// @@ -225,6 +225,33 @@ namespace OpenSim.Services.Interfaces EstateOwner = ConvertFrom.EstateOwner; } + # region Definition of equality + + /// + /// Define equality as two regions having the same, non-zero UUID. + /// + public bool Equals(GridRegion region) + { + if ((object)region == null) + return false; + // Return true if the non-zero UUIDs are equal: + return (RegionID != UUID.Zero) && RegionID.Equals(region.RegionID); + } + + public override bool Equals(Object obj) + { + if (obj == null) + return false; + return Equals(obj as GridRegion); + } + + public override int GetHashCode() + { + return RegionID.GetHashCode() ^ TerrainImage.GetHashCode(); + } + + #endregion + /// /// This accessor can throw all the exceptions that Dns.GetHostAddresses can throw. /// -- cgit v1.1