diff options
Diffstat (limited to 'OpenSim/Data/IRegionData.cs')
-rw-r--r-- | OpenSim/Data/IRegionData.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Data/IRegionData.cs b/OpenSim/Data/IRegionData.cs index 7a607ab..546b5e8 100644 --- a/OpenSim/Data/IRegionData.cs +++ b/OpenSim/Data/IRegionData.cs | |||
@@ -37,10 +37,30 @@ namespace OpenSim.Data | |||
37 | public UUID RegionID; | 37 | public UUID RegionID; |
38 | public UUID ScopeID; | 38 | public UUID ScopeID; |
39 | public string RegionName; | 39 | public string RegionName; |
40 | |||
41 | /// <summary> | ||
42 | /// The position in meters of this region. | ||
43 | /// </summary> | ||
40 | public int posX; | 44 | public int posX; |
45 | |||
46 | /// <summary> | ||
47 | /// The position in meters of this region. | ||
48 | /// </summary> | ||
41 | public int posY; | 49 | public int posY; |
50 | |||
42 | public int sizeX; | 51 | public int sizeX; |
43 | public int sizeY; | 52 | public int sizeY; |
53 | |||
54 | /// <summary> | ||
55 | /// Return the x-coordinate of this region. | ||
56 | /// </summary> | ||
57 | public int coordX { get { return posX / (int)Constants.RegionSize; } } | ||
58 | |||
59 | /// <summary> | ||
60 | /// Return the y-coordinate of this region. | ||
61 | /// </summary> | ||
62 | public int coordY { get { return posY / (int)Constants.RegionSize; } } | ||
63 | |||
44 | public Dictionary<string, object> Data; | 64 | public Dictionary<string, object> Data; |
45 | } | 65 | } |
46 | 66 | ||
@@ -60,5 +80,45 @@ namespace OpenSim.Data | |||
60 | 80 | ||
61 | bool Delete(UUID regionID); | 81 | bool Delete(UUID regionID); |
62 | 82 | ||
83 | List<RegionData> GetDefaultRegions(UUID scopeID); | ||
84 | List<RegionData> GetFallbackRegions(UUID scopeID, int x, int y); | ||
85 | List<RegionData> GetHyperlinks(UUID scopeID); | ||
86 | } | ||
87 | |||
88 | [Flags] | ||
89 | public enum RegionFlags : int | ||
90 | { | ||
91 | DefaultRegion = 1, // Used for new Rez. Random if multiple defined | ||
92 | FallbackRegion = 2, // Regions we redirect to when the destination is down | ||
93 | RegionOnline = 4, // Set when a region comes online, unset when it unregisters and DeleteOnUnregister is false | ||
94 | NoDirectLogin = 8, // Region unavailable for direct logins (by name) | ||
95 | Persistent = 16, // Don't remove on unregister | ||
96 | LockedOut = 32, // Don't allow registration | ||
97 | NoMove = 64, // Don't allow moving this region | ||
98 | Reservation = 128, // This is an inactive reservation | ||
99 | Authenticate = 256, // Require authentication | ||
100 | Hyperlink = 512 // Record represents a HG link | ||
101 | } | ||
102 | |||
103 | public class RegionDataDistanceCompare : IComparer<RegionData> | ||
104 | { | ||
105 | private Vector2 m_origin; | ||
106 | |||
107 | public RegionDataDistanceCompare(int x, int y) | ||
108 | { | ||
109 | m_origin = new Vector2(x, y); | ||
110 | } | ||
111 | |||
112 | public int Compare(RegionData regionA, RegionData regionB) | ||
113 | { | ||
114 | Vector2 vectorA = new Vector2(regionA.posX, regionA.posY); | ||
115 | Vector2 vectorB = new Vector2(regionB.posX, regionB.posY); | ||
116 | return Math.Sign(VectorDistance(m_origin, vectorA) - VectorDistance(m_origin, vectorB)); | ||
117 | } | ||
118 | |||
119 | private float VectorDistance(Vector2 x, Vector2 y) | ||
120 | { | ||
121 | return (x - y).Length(); | ||
122 | } | ||
63 | } | 123 | } |
64 | } | 124 | } |