aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/GridService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/GridService/GridService.cs')
-rw-r--r--OpenSim/Services/GridService/GridService.cs32
1 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index b37a51b..cd462ab 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Console; 35using OpenSim.Framework.Console;
36using OpenSim.Data; 36using OpenSim.Data;
37using OpenSim.Services.Interfaces; 37using OpenSim.Services.Interfaces;
38using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38using OpenMetaverse; 39using OpenMetaverse;
39 40
40namespace OpenSim.Services.GridService 41namespace OpenSim.Services.GridService
@@ -48,6 +49,7 @@ namespace OpenSim.Services.GridService
48 public GridService(IConfigSource config) 49 public GridService(IConfigSource config)
49 : base(config) 50 : base(config)
50 { 51 {
52 m_log.DebugFormat("[GRID SERVICE]: Starting...");
51 MainConsole.Instance.Commands.AddCommand("kfs", false, 53 MainConsole.Instance.Commands.AddCommand("kfs", false,
52 "show digest", 54 "show digest",
53 "show digest <ID>", 55 "show digest <ID>",
@@ -62,7 +64,7 @@ namespace OpenSim.Services.GridService
62 64
63 #region IGridService 65 #region IGridService
64 66
65 public bool RegisterRegion(UUID scopeID, SimpleRegionInfo regionInfos) 67 public bool RegisterRegion(UUID scopeID, GridRegion regionInfos)
66 { 68 {
67 if (m_Database.Get(regionInfos.RegionID, scopeID) != null) 69 if (m_Database.Get(regionInfos.RegionID, scopeID) != null)
68 { 70 {
@@ -88,9 +90,9 @@ namespace OpenSim.Services.GridService
88 return m_Database.Delete(regionID); 90 return m_Database.Delete(regionID);
89 } 91 }
90 92
91 public List<SimpleRegionInfo> GetNeighbours(UUID scopeID, UUID regionID) 93 public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID)
92 { 94 {
93 List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); 95 List<GridRegion> rinfos = new List<GridRegion>();
94 RegionData region = m_Database.Get(regionID, scopeID); 96 RegionData region = m_Database.Get(regionID, scopeID);
95 if (region != null) 97 if (region != null)
96 { 98 {
@@ -105,7 +107,7 @@ namespace OpenSim.Services.GridService
105 return rinfos; 107 return rinfos;
106 } 108 }
107 109
108 public SimpleRegionInfo GetRegionByUUID(UUID scopeID, UUID regionID) 110 public GridRegion GetRegionByUUID(UUID scopeID, UUID regionID)
109 { 111 {
110 RegionData rdata = m_Database.Get(regionID, scopeID); 112 RegionData rdata = m_Database.Get(regionID, scopeID);
111 if (rdata != null) 113 if (rdata != null)
@@ -114,7 +116,7 @@ namespace OpenSim.Services.GridService
114 return null; 116 return null;
115 } 117 }
116 118
117 public SimpleRegionInfo GetRegionByPosition(UUID scopeID, int x, int y) 119 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
118 { 120 {
119 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; 121 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
120 int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize; 122 int snapY = (int)(y / Constants.RegionSize) * (int)Constants.RegionSize;
@@ -125,7 +127,7 @@ namespace OpenSim.Services.GridService
125 return null; 127 return null;
126 } 128 }
127 129
128 public SimpleRegionInfo GetRegionByName(UUID scopeID, string regionName) 130 public GridRegion GetRegionByName(UUID scopeID, string regionName)
129 { 131 {
130 List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID); 132 List<RegionData> rdatas = m_Database.Get(regionName + "%", scopeID);
131 if ((rdatas != null) && (rdatas.Count > 0)) 133 if ((rdatas != null) && (rdatas.Count > 0))
@@ -134,12 +136,12 @@ namespace OpenSim.Services.GridService
134 return null; 136 return null;
135 } 137 }
136 138
137 public List<SimpleRegionInfo> GetRegionsByName(UUID scopeID, string name, int maxNumber) 139 public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber)
138 { 140 {
139 List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID); 141 List<RegionData> rdatas = m_Database.Get("%" + name + "%", scopeID);
140 142
141 int count = 0; 143 int count = 0;
142 List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); 144 List<GridRegion> rinfos = new List<GridRegion>();
143 145
144 if (rdatas != null) 146 if (rdatas != null)
145 { 147 {
@@ -153,7 +155,7 @@ namespace OpenSim.Services.GridService
153 return rinfos; 155 return rinfos;
154 } 156 }
155 157
156 public List<SimpleRegionInfo> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) 158 public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax)
157 { 159 {
158 int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; 160 int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize;
159 int xmaxSnap = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize; 161 int xmaxSnap = (int)(xmax / Constants.RegionSize) * (int)Constants.RegionSize;
@@ -161,7 +163,7 @@ namespace OpenSim.Services.GridService
161 int ymaxSnap = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize; 163 int ymaxSnap = (int)(ymax / Constants.RegionSize) * (int)Constants.RegionSize;
162 164
163 List<RegionData> rdatas = m_Database.Get(xminSnap, yminSnap, xmaxSnap, ymaxSnap, scopeID); 165 List<RegionData> rdatas = m_Database.Get(xminSnap, yminSnap, xmaxSnap, ymaxSnap, scopeID);
164 List<SimpleRegionInfo> rinfos = new List<SimpleRegionInfo>(); 166 List<GridRegion> rinfos = new List<GridRegion>();
165 foreach (RegionData rdata in rdatas) 167 foreach (RegionData rdata in rdatas)
166 rinfos.Add(RegionData2RegionInfo(rdata)); 168 rinfos.Add(RegionData2RegionInfo(rdata));
167 169
@@ -172,7 +174,7 @@ namespace OpenSim.Services.GridService
172 174
173 #region Data structure conversions 175 #region Data structure conversions
174 176
175 protected RegionData RegionInfo2RegionData(SimpleRegionInfo rinfo) 177 protected RegionData RegionInfo2RegionData(GridRegion rinfo)
176 { 178 {
177 RegionData rdata = new RegionData(); 179 RegionData rdata = new RegionData();
178 rdata.posX = (int)rinfo.RegionLocX; 180 rdata.posX = (int)rinfo.RegionLocX;
@@ -184,11 +186,11 @@ namespace OpenSim.Services.GridService
184 return rdata; 186 return rdata;
185 } 187 }
186 188
187 protected SimpleRegionInfo RegionData2RegionInfo(RegionData rdata) 189 protected GridRegion RegionData2RegionInfo(RegionData rdata)
188 { 190 {
189 SimpleRegionInfo rinfo = new SimpleRegionInfo(rdata.Data); 191 GridRegion rinfo = new GridRegion(rdata.Data);
190 rinfo.RegionLocX = (uint)rdata.posX; 192 rinfo.RegionLocX = rdata.posX;
191 rinfo.RegionLocY = (uint)rdata.posY; 193 rinfo.RegionLocY = rdata.posY;
192 rinfo.RegionID = rdata.RegionID; 194 rinfo.RegionID = rdata.RegionID;
193 rinfo.RegionName = rdata.RegionName; 195 rinfo.RegionName = rdata.RegionName;
194 196