diff options
Diffstat (limited to 'OpenSim/Services')
13 files changed, 323 insertions, 129 deletions
diff --git a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs index c9c6c31..5d7dcfd 100644 --- a/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/GatekeeperServiceConnector.cs | |||
@@ -255,6 +255,18 @@ namespace OpenSim.Services.Connectors.Hypergrid | |||
255 | region.RegionLocY = n; | 255 | region.RegionLocY = n; |
256 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | 256 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); |
257 | } | 257 | } |
258 | if (hash["size_x"] != null) | ||
259 | { | ||
260 | Int32.TryParse((string)hash["size_x"], out n); | ||
261 | region.RegionSizeX = n; | ||
262 | //m_log.Debug(">> HERE, x: " + region.RegionLocX); | ||
263 | } | ||
264 | if (hash["size_y"] != null) | ||
265 | { | ||
266 | Int32.TryParse((string)hash["size_y"], out n); | ||
267 | region.RegionSizeY = n; | ||
268 | //m_log.Debug(">> HERE, y: " + region.RegionLocY); | ||
269 | } | ||
258 | if (hash["region_name"] != null) | 270 | if (hash["region_name"] != null) |
259 | { | 271 | { |
260 | region.RegionName = (string)hash["region_name"]; | 272 | region.RegionName = (string)hash["region_name"]; |
diff --git a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs index 30a73a4..644331a 100644 --- a/OpenSim/Services/Connectors/Land/LandServicesConnector.cs +++ b/OpenSim/Services/Connectors/Land/LandServicesConnector.cs | |||
@@ -78,7 +78,7 @@ namespace OpenSim.Services.Connectors | |||
78 | try | 78 | try |
79 | { | 79 | { |
80 | uint xpos = 0, ypos = 0; | 80 | uint xpos = 0, ypos = 0; |
81 | Utils.LongToUInts(regionHandle, out xpos, out ypos); | 81 | Util.RegionHandleToWorldLoc(regionHandle, out xpos, out ypos); |
82 | GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); | 82 | GridRegion info = m_GridService.GetRegionByPosition(scopeID, (int)xpos, (int)ypos); |
83 | if (info != null) // just to be sure | 83 | if (info != null) // just to be sure |
84 | { | 84 | { |
diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 96a756d..0f8033d 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Services.Connectors | |||
69 | public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) | 69 | public virtual GridRegion HelloNeighbour(ulong regionHandle, RegionInfo thisRegion) |
70 | { | 70 | { |
71 | uint x = 0, y = 0; | 71 | uint x = 0, y = 0; |
72 | Utils.LongToUInts(regionHandle, out x, out y); | 72 | Util.RegionHandleToWorldLoc(regionHandle, out x, out y); |
73 | GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y); | 73 | GridRegion regInfo = m_GridService.GetRegionByPosition(thisRegion.ScopeID, (int)x, (int)y); |
74 | if ((regInfo != null) && | 74 | if ((regInfo != null) && |
75 | // Don't remote-call this instance; that's a startup hickup | 75 | // Don't remote-call this instance; that's a startup hickup |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs index b999509..8375c95 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs | |||
@@ -181,7 +181,6 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
181 | m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName); | 181 | m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for {0}",scene.RegionInfo.RegionName); |
182 | 182 | ||
183 | // Create a PNG map tile and upload it to the AddMapTile API | 183 | // Create a PNG map tile and upload it to the AddMapTile API |
184 | byte[] pngData = Utils.EmptyBytes; | ||
185 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); | 184 | IMapImageGenerator tileGenerator = scene.RequestModuleInterface<IMapImageGenerator>(); |
186 | if (tileGenerator == null) | 185 | if (tileGenerator == null) |
187 | { | 186 | { |
@@ -189,93 +188,79 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
189 | return; | 188 | return; |
190 | } | 189 | } |
191 | 190 | ||
192 | using (Image mapTile = tileGenerator.CreateMapTile()) | 191 | using (Bitmap mapTile = tileGenerator.CreateMapTile()) |
193 | { | 192 | { |
194 | using (MemoryStream stream = new MemoryStream()) | 193 | if (mapTile != null) |
194 | { | ||
195 | // If the region/maptile is legacy sized, just upload the one tile like it has always been done | ||
196 | if (mapTile.Width == Constants.RegionSize && mapTile.Height == Constants.RegionSize) | ||
197 | { | ||
198 | ConvertAndUploadMaptile(mapTile, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY); | ||
199 | } | ||
200 | else | ||
201 | { | ||
202 | // For larger regions (varregion) we must cut the region image into legacy sized | ||
203 | // pieces since that is how the maptile system works. | ||
204 | // Note the assumption that varregions are always a multiple of legacy size. | ||
205 | for (uint xx = 0; xx < mapTile.Width; xx += Constants.RegionSize) | ||
206 | { | ||
207 | for (uint yy = 0; yy < mapTile.Height; yy += Constants.RegionSize) | ||
208 | { | ||
209 | // Images are addressed from the upper left corner so have to do funny | ||
210 | // math to pick out the sub-tile since regions are numbered from | ||
211 | // the lower left. | ||
212 | Rectangle rect = new Rectangle( | ||
213 | (int)xx, | ||
214 | mapTile.Height - (int)yy - (int)Constants.RegionSize, | ||
215 | (int)Constants.RegionSize, (int)Constants.RegionSize); | ||
216 | |||
217 | using (Bitmap subMapTile = mapTile.Clone(rect, mapTile.PixelFormat)) | ||
218 | { | ||
219 | uint locX = scene.RegionInfo.RegionLocX + (xx / Constants.RegionSize); | ||
220 | uint locY = scene.RegionInfo.RegionLocY + (yy / Constants.RegionSize); | ||
221 | |||
222 | ConvertAndUploadMaptile(subMapTile, locX, locY); | ||
223 | } | ||
224 | } | ||
225 | } | ||
226 | } | ||
227 | } | ||
228 | else | ||
195 | { | 229 | { |
196 | mapTile.Save(stream, ImageFormat.Png); | 230 | m_log.WarnFormat("[SIMIAN MAPTILE] Tile image generation failed"); |
197 | pngData = stream.ToArray(); | ||
198 | } | 231 | } |
199 | } | 232 | } |
200 | 233 | ||
234 | } | ||
235 | |||
236 | ///<summary> | ||
237 | /// | ||
238 | ///</summary> | ||
239 | private void ConvertAndUploadMaptile(Image mapTile, uint locX, uint locY) | ||
240 | { | ||
241 | //m_log.DebugFormat("[SIMIAN MAPTILE]: upload maptile for location {0}, {1}", locX, locY); | ||
242 | |||
243 | byte[] pngData = Utils.EmptyBytes; | ||
244 | using (MemoryStream stream = new MemoryStream()) | ||
245 | { | ||
246 | mapTile.Save(stream, ImageFormat.Png); | ||
247 | pngData = stream.ToArray(); | ||
248 | } | ||
249 | |||
201 | NameValueCollection requestArgs = new NameValueCollection | 250 | NameValueCollection requestArgs = new NameValueCollection |
202 | { | 251 | { |
203 | { "RequestMethod", "xAddMapTile" }, | 252 | { "RequestMethod", "xAddMapTile" }, |
204 | { "X", scene.RegionInfo.RegionLocX.ToString() }, | 253 | { "X", locX.ToString() }, |
205 | { "Y", scene.RegionInfo.RegionLocY.ToString() }, | 254 | { "Y", locY.ToString() }, |
206 | { "ContentType", "image/png" }, | 255 | { "ContentType", "image/png" }, |
207 | { "EncodedData", System.Convert.ToBase64String(pngData) } | 256 | { "EncodedData", System.Convert.ToBase64String(pngData) } |
208 | }; | 257 | }; |
209 | 258 | ||
210 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); | 259 | OSDMap response = SimianGrid.PostToService(m_serverUrl,requestArgs); |
211 | if (! response["Success"].AsBoolean()) | 260 | if (! response["Success"].AsBoolean()) |
212 | { | 261 | { |
213 | m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString()); | 262 | m_log.WarnFormat("[SIMIAN MAPTILE] failed to store map tile; {0}",response["Message"].AsString()); |
214 | return; | ||
215 | } | 263 | } |
216 | |||
217 | // List<MultipartForm.Element> postParameters = new List<MultipartForm.Element>() | ||
218 | // { | ||
219 | // new MultipartForm.Parameter("X", scene.RegionInfo.RegionLocX.ToString()), | ||
220 | // new MultipartForm.Parameter("Y", scene.RegionInfo.RegionLocY.ToString()), | ||
221 | // new MultipartForm.File("Tile", "tile.png", "image/png", pngData) | ||
222 | // }; | ||
223 | |||
224 | // string errorMessage = null; | ||
225 | // int tickstart = Util.EnvironmentTickCount(); | ||
226 | |||
227 | // // Make the remote storage request | ||
228 | // try | ||
229 | // { | ||
230 | // HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); | ||
231 | // request.Timeout = 20000; | ||
232 | // request.ReadWriteTimeout = 5000; | ||
233 | |||
234 | // using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) | ||
235 | // { | ||
236 | // using (Stream responseStream = response.GetResponseStream()) | ||
237 | // { | ||
238 | // string responseStr = responseStream.GetStreamString(); | ||
239 | // OSD responseOSD = OSDParser.Deserialize(responseStr); | ||
240 | // if (responseOSD.Type == OSDType.Map) | ||
241 | // { | ||
242 | // OSDMap responseMap = (OSDMap)responseOSD; | ||
243 | // if (responseMap["Success"].AsBoolean()) | ||
244 | // return; | ||
245 | |||
246 | // errorMessage = "Upload failed: " + responseMap["Message"].AsString(); | ||
247 | // } | ||
248 | // else | ||
249 | // { | ||
250 | // errorMessage = "Response format was invalid:\n" + responseStr; | ||
251 | // } | ||
252 | // } | ||
253 | // } | ||
254 | // } | ||
255 | // catch (WebException we) | ||
256 | // { | ||
257 | // errorMessage = we.Message; | ||
258 | // if (we.Status == WebExceptionStatus.ProtocolError) | ||
259 | // { | ||
260 | // HttpWebResponse webResponse = (HttpWebResponse)we.Response; | ||
261 | // errorMessage = String.Format("[{0}] {1}", | ||
262 | // webResponse.StatusCode,webResponse.StatusDescription); | ||
263 | // } | ||
264 | // } | ||
265 | // catch (Exception ex) | ||
266 | // { | ||
267 | // errorMessage = ex.Message; | ||
268 | // } | ||
269 | // finally | ||
270 | // { | ||
271 | // // This just dumps a warning for any operation that takes more than 100 ms | ||
272 | // int tickdiff = Util.EnvironmentTickCountSubtract(tickstart); | ||
273 | // m_log.DebugFormat("[SIMIAN MAPTILE]: map tile uploaded in {0}ms",tickdiff); | ||
274 | // } | ||
275 | |||
276 | // m_log.WarnFormat("[SIMIAN MAPTILE]: Failed to store {0} byte tile for {1}: {2}", | ||
277 | // pngData.Length, scene.RegionInfo.RegionName, errorMessage); | ||
278 | |||
279 | } | 264 | } |
280 | } | 265 | } |
281 | } \ No newline at end of file | 266 | } \ No newline at end of file |
diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs index 816591b..6b59f94 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridServiceConnector.cs | |||
@@ -101,7 +101,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
101 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) | 101 | public string RegisterRegion(UUID scopeID, GridRegion regionInfo) |
102 | { | 102 | { |
103 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); | 103 | Vector3d minPosition = new Vector3d(regionInfo.RegionLocX, regionInfo.RegionLocY, 0.0); |
104 | Vector3d maxPosition = minPosition + new Vector3d(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight); | 104 | Vector3d maxPosition = minPosition + new Vector3d(regionInfo.RegionSizeX, regionInfo.RegionSizeY, Constants.RegionHeight); |
105 | 105 | ||
106 | OSDMap extraData = new OSDMap | 106 | OSDMap extraData = new OSDMap |
107 | { | 107 | { |
@@ -156,15 +156,15 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
156 | 156 | ||
157 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) | 157 | public List<GridRegion> GetNeighbours(UUID scopeID, UUID regionID) |
158 | { | 158 | { |
159 | const int NEIGHBOR_RADIUS = 128; | ||
160 | |||
161 | GridRegion region = GetRegionByUUID(scopeID, regionID); | 159 | GridRegion region = GetRegionByUUID(scopeID, regionID); |
162 | 160 | ||
161 | int NEIGHBOR_RADIUS = Math.Max(region.RegionSizeX, region.RegionSizeY) / 2; | ||
162 | |||
163 | if (region != null) | 163 | if (region != null) |
164 | { | 164 | { |
165 | List<GridRegion> regions = GetRegionRange(scopeID, | 165 | List<GridRegion> regions = GetRegionRange(scopeID, |
166 | region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + (int)Constants.RegionSize + NEIGHBOR_RADIUS, | 166 | region.RegionLocX - NEIGHBOR_RADIUS, region.RegionLocX + region.RegionSizeX + NEIGHBOR_RADIUS, |
167 | region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + (int)Constants.RegionSize + NEIGHBOR_RADIUS); | 167 | region.RegionLocY - NEIGHBOR_RADIUS, region.RegionLocY + region.RegionSizeY + NEIGHBOR_RADIUS); |
168 | 168 | ||
169 | for (int i = 0; i < regions.Count; i++) | 169 | for (int i = 0; i < regions.Count; i++) |
170 | { | 170 | { |
@@ -229,7 +229,7 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
229 | else | 229 | else |
230 | { | 230 | { |
231 | // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", | 231 | // m_log.InfoFormat("[SIMIAN GRID CONNECTOR]: Grid service did not find a match for region at {0},{1}", |
232 | // x / Constants.RegionSize, y / Constants.RegionSize); | 232 | // Util.WorldToRegionLoc(x), Util.WorldToRegionLoc(y)); |
233 | return null; | 233 | return null; |
234 | } | 234 | } |
235 | } | 235 | } |
@@ -443,9 +443,13 @@ namespace OpenSim.Services.Connectors.SimianGrid | |||
443 | region.RegionName = response["Name"].AsString(); | 443 | region.RegionName = response["Name"].AsString(); |
444 | 444 | ||
445 | Vector3d minPosition = response["MinPosition"].AsVector3d(); | 445 | Vector3d minPosition = response["MinPosition"].AsVector3d(); |
446 | Vector3d maxPosition = response["MaxPosition"].AsVector3d(); | ||
446 | region.RegionLocX = (int)minPosition.X; | 447 | region.RegionLocX = (int)minPosition.X; |
447 | region.RegionLocY = (int)minPosition.Y; | 448 | region.RegionLocY = (int)minPosition.Y; |
448 | 449 | ||
450 | region.RegionSizeX = (int)maxPosition.X - (int)minPosition.X; | ||
451 | region.RegionSizeY = (int)maxPosition.Y - (int)minPosition.Y; | ||
452 | |||
449 | if ( ! extraData["HyperGrid"] ) { | 453 | if ( ! extraData["HyperGrid"] ) { |
450 | Uri httpAddress = response["Address"].AsUri(); | 454 | Uri httpAddress = response["Address"].AsUri(); |
451 | region.ExternalHostName = httpAddress.Host; | 455 | region.ExternalHostName = httpAddress.Host; |
diff --git a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs index 504fcaf..2cbf967 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationDataService.cs | |||
@@ -100,6 +100,11 @@ namespace OpenSim.Services.Connectors | |||
100 | return m_database.LoadObjects(regionUUID); | 100 | return m_database.LoadObjects(regionUUID); |
101 | } | 101 | } |
102 | 102 | ||
103 | public void StoreTerrain(TerrainData terrain, UUID regionID) | ||
104 | { | ||
105 | m_database.StoreTerrain(terrain, regionID); | ||
106 | } | ||
107 | |||
103 | public void StoreTerrain(double[,] terrain, UUID regionID) | 108 | public void StoreTerrain(double[,] terrain, UUID regionID) |
104 | { | 109 | { |
105 | m_database.StoreTerrain(terrain, regionID); | 110 | m_database.StoreTerrain(terrain, regionID); |
@@ -110,6 +115,11 @@ namespace OpenSim.Services.Connectors | |||
110 | return m_database.LoadTerrain(regionID); | 115 | return m_database.LoadTerrain(regionID); |
111 | } | 116 | } |
112 | 117 | ||
118 | public TerrainData LoadTerrain(UUID regionID, int pSizeX, int pSizeY, int pSizeZ) | ||
119 | { | ||
120 | return m_database.LoadTerrain(regionID, pSizeX, pSizeY, pSizeZ); | ||
121 | } | ||
122 | |||
113 | public void StoreLandObject(ILandObject Parcel) | 123 | public void StoreLandObject(ILandObject Parcel) |
114 | { | 124 | { |
115 | m_database.StoreLandObject(Parcel); | 125 | m_database.StoreLandObject(Parcel); |
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index e72b7f9..8198592 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -313,8 +313,10 @@ namespace OpenSim.Services.GridService | |||
313 | if (region != null) | 313 | if (region != null) |
314 | { | 314 | { |
315 | // Not really? Maybe? | 315 | // Not really? Maybe? |
316 | List<RegionData> rdatas = m_Database.Get(region.posX - (int)Constants.RegionSize - 1, region.posY - (int)Constants.RegionSize - 1, | 316 | // The adjacent regions are presumed to be the same size as the current region |
317 | region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); | 317 | List<RegionData> rdatas = m_Database.Get( |
318 | region.posX - region.sizeX - 1, region.posY - region.sizeY - 1, | ||
319 | region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID); | ||
318 | 320 | ||
319 | foreach (RegionData rdata in rdatas) | 321 | foreach (RegionData rdata in rdatas) |
320 | { | 322 | { |
@@ -347,6 +349,11 @@ namespace OpenSim.Services.GridService | |||
347 | return null; | 349 | return null; |
348 | } | 350 | } |
349 | 351 | ||
352 | // Get a region given its base coordinates. | ||
353 | // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST | ||
354 | // be the base coordinate of the region. | ||
355 | // The snapping is technically unnecessary but is harmless because regions are always | ||
356 | // multiples of the legacy region size (256). | ||
350 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) | 357 | public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) |
351 | { | 358 | { |
352 | int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; | 359 | int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; |
@@ -441,6 +448,8 @@ namespace OpenSim.Services.GridService | |||
441 | RegionData rdata = new RegionData(); | 448 | RegionData rdata = new RegionData(); |
442 | rdata.posX = (int)rinfo.RegionLocX; | 449 | rdata.posX = (int)rinfo.RegionLocX; |
443 | rdata.posY = (int)rinfo.RegionLocY; | 450 | rdata.posY = (int)rinfo.RegionLocY; |
451 | rdata.sizeX = rinfo.RegionSizeX; | ||
452 | rdata.sizeY = rinfo.RegionSizeY; | ||
444 | rdata.RegionID = rinfo.RegionID; | 453 | rdata.RegionID = rinfo.RegionID; |
445 | rdata.RegionName = rinfo.RegionName; | 454 | rdata.RegionName = rinfo.RegionName; |
446 | rdata.Data = rinfo.ToKeyValuePairs(); | 455 | rdata.Data = rinfo.ToKeyValuePairs(); |
@@ -454,6 +463,8 @@ namespace OpenSim.Services.GridService | |||
454 | GridRegion rinfo = new GridRegion(rdata.Data); | 463 | GridRegion rinfo = new GridRegion(rdata.Data); |
455 | rinfo.RegionLocX = rdata.posX; | 464 | rinfo.RegionLocX = rdata.posX; |
456 | rinfo.RegionLocY = rdata.posY; | 465 | rinfo.RegionLocY = rdata.posY; |
466 | rinfo.RegionSizeX = rdata.sizeX; | ||
467 | rinfo.RegionSizeY = rdata.sizeY; | ||
457 | rinfo.RegionID = rdata.RegionID; | 468 | rinfo.RegionID = rdata.RegionID; |
458 | rinfo.RegionName = rdata.RegionName; | 469 | rinfo.RegionName = rdata.RegionName; |
459 | rinfo.ScopeID = rdata.ScopeID; | 470 | rinfo.ScopeID = rdata.ScopeID; |
@@ -633,20 +644,20 @@ namespace OpenSim.Services.GridService | |||
633 | return; | 644 | return; |
634 | } | 645 | } |
635 | 646 | ||
636 | int x, y; | 647 | uint x, y; |
637 | if (!int.TryParse(cmd[3], out x)) | 648 | if (!uint.TryParse(cmd[3], out x)) |
638 | { | 649 | { |
639 | MainConsole.Instance.Output("x-coord must be an integer"); | 650 | MainConsole.Instance.Output("x-coord must be an integer"); |
640 | return; | 651 | return; |
641 | } | 652 | } |
642 | 653 | ||
643 | if (!int.TryParse(cmd[4], out y)) | 654 | if (!uint.TryParse(cmd[4], out y)) |
644 | { | 655 | { |
645 | MainConsole.Instance.Output("y-coord must be an integer"); | 656 | MainConsole.Instance.Output("y-coord must be an integer"); |
646 | return; | 657 | return; |
647 | } | 658 | } |
648 | 659 | ||
649 | RegionData region = m_Database.Get(x * (int)Constants.RegionSize, y * (int)Constants.RegionSize, UUID.Zero); | 660 | RegionData region = m_Database.Get((int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y), UUID.Zero); |
650 | if (region == null) | 661 | if (region == null) |
651 | { | 662 | { |
652 | MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); | 663 | MainConsole.Instance.OutputFormat("No region found at {0},{1}", x, y); |
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 4024295..4ebfd5c 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -183,8 +183,8 @@ namespace OpenSim.Services.GridService | |||
183 | public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) | 183 | public GridRegion LinkRegion(UUID scopeID, string regionDescriptor) |
184 | { | 184 | { |
185 | string reason = string.Empty; | 185 | string reason = string.Empty; |
186 | int xloc = random.Next(0, Int16.MaxValue) * (int)Constants.RegionSize; | 186 | uint xloc = Util.RegionToWorldLoc((uint)random.Next(0, Int16.MaxValue)); |
187 | return TryLinkRegionToCoords(scopeID, regionDescriptor, xloc, 0, out reason); | 187 | return TryLinkRegionToCoords(scopeID, regionDescriptor, (int)xloc, 0, out reason); |
188 | } | 188 | } |
189 | 189 | ||
190 | private static Random random = new Random(); | 190 | private static Random random = new Random(); |
@@ -260,7 +260,7 @@ namespace OpenSim.Services.GridService | |||
260 | { | 260 | { |
261 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", | 261 | m_log.DebugFormat("[HYPERGRID LINKER]: Link to {0} {1}, in {2}-{3}", |
262 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), | 262 | ((serverURI == null) ? (externalHostName + ":" + externalPort) : serverURI), |
263 | remoteRegionName, xloc / Constants.RegionSize, yloc / Constants.RegionSize); | 263 | remoteRegionName, Util.WorldToRegionLoc((uint)xloc), Util.WorldToRegionLoc((uint)yloc)); |
264 | 264 | ||
265 | reason = string.Empty; | 265 | reason = string.Empty; |
266 | Uri uri = null; | 266 | Uri uri = null; |
@@ -311,7 +311,7 @@ namespace OpenSim.Services.GridService | |||
311 | if (region != null) | 311 | if (region != null) |
312 | { | 312 | { |
313 | m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", | 313 | m_log.WarnFormat("[HYPERGRID LINKER]: Coordinates {0}-{1} are already occupied by region {2} with uuid {3}", |
314 | regInfo.RegionLocX / Constants.RegionSize, regInfo.RegionLocY / Constants.RegionSize, | 314 | Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY), |
315 | region.RegionName, region.RegionID); | 315 | region.RegionName, region.RegionID); |
316 | reason = "Coordinates are already in use"; | 316 | reason = "Coordinates are already in use"; |
317 | return false; | 317 | return false; |
@@ -347,7 +347,7 @@ namespace OpenSim.Services.GridService | |||
347 | if (region != null) | 347 | if (region != null) |
348 | { | 348 | { |
349 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", | 349 | m_log.DebugFormat("[HYPERGRID LINKER]: Region already exists in coordinates {0} {1}", |
350 | region.RegionLocX / Constants.RegionSize, region.RegionLocY / Constants.RegionSize); | 350 | Util.WorldToRegionLoc((uint)regInfo.RegionLocX), Util.WorldToRegionLoc((uint)regInfo.RegionLocY)); |
351 | regInfo = region; | 351 | regInfo = region; |
352 | return true; | 352 | return true; |
353 | } | 353 | } |
@@ -424,10 +424,10 @@ namespace OpenSim.Services.GridService | |||
424 | // { | 424 | // { |
425 | // uint ux = 0, uy = 0; | 425 | // uint ux = 0, uy = 0; |
426 | // Utils.LongToUInts(realHandle, out ux, out uy); | 426 | // Utils.LongToUInts(realHandle, out ux, out uy); |
427 | // x = ux / Constants.RegionSize; | 427 | // x = Util.WorldToRegionLoc(ux); |
428 | // y = uy / Constants.RegionSize; | 428 | // y = Util.WorldToRegionLoc(uy); |
429 | // | 429 | // |
430 | // const uint limit = (4096 - 1) * Constants.RegionSize; | 430 | // const uint limit = Util.RegionToWorldLoc(4096 - 1); |
431 | // uint xmin = ux - limit; | 431 | // uint xmin = ux - limit; |
432 | // uint xmax = ux + limit; | 432 | // uint xmax = ux + limit; |
433 | // uint ymin = uy - limit; | 433 | // uint ymin = uy - limit; |
@@ -502,9 +502,14 @@ namespace OpenSim.Services.GridService | |||
502 | MainConsole.Instance.Output(new string('-', 72)); | 502 | MainConsole.Instance.Output(new string('-', 72)); |
503 | foreach (RegionData r in regions) | 503 | foreach (RegionData r in regions) |
504 | { | 504 | { |
505 | MainConsole.Instance.Output(String.Format("{0}\n{2,-32} {1}\n", | 505 | MainConsole.Instance.Output( |
506 | r.RegionName, r.RegionID, String.Format("{0},{1} ({2},{3})", r.posX, r.posY, | 506 | String.Format("{0}\n{2,-32} {1}\n", |
507 | r.posX / Constants.RegionSize, r.posY / Constants.RegionSize))); | 507 | r.RegionName, r.RegionID, |
508 | String.Format("{0},{1} ({2},{3})", r.posX, r.posY, | ||
509 | Util.WorldToRegionLoc((uint)r.posX), Util.WorldToRegionLoc((uint)r.posY) | ||
510 | ) | ||
511 | ) | ||
512 | ); | ||
508 | } | 513 | } |
509 | return; | 514 | return; |
510 | } | 515 | } |
@@ -529,8 +534,8 @@ namespace OpenSim.Services.GridService | |||
529 | int xloc, yloc; | 534 | int xloc, yloc; |
530 | string serverURI; | 535 | string serverURI; |
531 | string remoteName = null; | 536 | string remoteName = null; |
532 | xloc = Convert.ToInt32(cmdparams[0]) * (int)Constants.RegionSize; | 537 | xloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[0])); |
533 | yloc = Convert.ToInt32(cmdparams[1]) * (int)Constants.RegionSize; | 538 | yloc = (int)Util.RegionToWorldLoc((uint)Convert.ToInt32(cmdparams[1])); |
534 | serverURI = cmdparams[2]; | 539 | serverURI = cmdparams[2]; |
535 | if (cmdparams.Length > 3) | 540 | if (cmdparams.Length > 3) |
536 | remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3); | 541 | remoteName = string.Join(" ", cmdparams, 3, cmdparams.Length - 3); |
@@ -601,13 +606,13 @@ namespace OpenSim.Services.GridService | |||
601 | { | 606 | { |
602 | // old format | 607 | // old format |
603 | GridRegion regInfo; | 608 | GridRegion regInfo; |
604 | int xloc, yloc; | 609 | uint xloc, yloc; |
605 | uint externalPort; | 610 | uint externalPort; |
606 | string externalHostName; | 611 | string externalHostName; |
607 | try | 612 | try |
608 | { | 613 | { |
609 | xloc = Convert.ToInt32(cmdparams[0]); | 614 | xloc = Convert.ToUInt32(cmdparams[0]); |
610 | yloc = Convert.ToInt32(cmdparams[1]); | 615 | yloc = Convert.ToUInt32(cmdparams[1]); |
611 | externalPort = Convert.ToUInt32(cmdparams[3]); | 616 | externalPort = Convert.ToUInt32(cmdparams[3]); |
612 | externalHostName = cmdparams[2]; | 617 | externalHostName = cmdparams[2]; |
613 | //internalPort = Convert.ToUInt32(cmdparams[4]); | 618 | //internalPort = Convert.ToUInt32(cmdparams[4]); |
@@ -621,10 +626,11 @@ namespace OpenSim.Services.GridService | |||
621 | } | 626 | } |
622 | 627 | ||
623 | // Convert cell coordinates given by the user to meters | 628 | // Convert cell coordinates given by the user to meters |
624 | xloc = xloc * (int)Constants.RegionSize; | 629 | xloc = Util.RegionToWorldLoc(xloc); |
625 | yloc = yloc * (int)Constants.RegionSize; | 630 | yloc = Util.RegionToWorldLoc(yloc); |
626 | string reason = string.Empty; | 631 | string reason = string.Empty; |
627 | if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) | 632 | if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc, |
633 | string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) | ||
628 | { | 634 | { |
629 | // What is this? The GridRegion instance will be discarded anyway, | 635 | // What is this? The GridRegion instance will be discarded anyway, |
630 | // which effectively ignores any local name given with the command. | 636 | // which effectively ignores any local name given with the command. |
@@ -704,13 +710,13 @@ namespace OpenSim.Services.GridService | |||
704 | private void ReadLinkFromConfig(IConfig config) | 710 | private void ReadLinkFromConfig(IConfig config) |
705 | { | 711 | { |
706 | GridRegion regInfo; | 712 | GridRegion regInfo; |
707 | int xloc, yloc; | 713 | uint xloc, yloc; |
708 | uint externalPort; | 714 | uint externalPort; |
709 | string externalHostName; | 715 | string externalHostName; |
710 | uint realXLoc, realYLoc; | 716 | uint realXLoc, realYLoc; |
711 | 717 | ||
712 | xloc = Convert.ToInt32(config.GetString("xloc", "0")); | 718 | xloc = Convert.ToUInt32(config.GetString("xloc", "0")); |
713 | yloc = Convert.ToInt32(config.GetString("yloc", "0")); | 719 | yloc = Convert.ToUInt32(config.GetString("yloc", "0")); |
714 | externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); | 720 | externalPort = Convert.ToUInt32(config.GetString("externalPort", "0")); |
715 | externalHostName = config.GetString("externalHostName", ""); | 721 | externalHostName = config.GetString("externalHostName", ""); |
716 | realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); | 722 | realXLoc = Convert.ToUInt32(config.GetString("real-xloc", "0")); |
@@ -718,18 +724,19 @@ namespace OpenSim.Services.GridService | |||
718 | 724 | ||
719 | if (m_enableAutoMapping) | 725 | if (m_enableAutoMapping) |
720 | { | 726 | { |
721 | xloc = (int)((xloc % 100) + m_autoMappingX); | 727 | xloc = (xloc % 100) + m_autoMappingX; |
722 | yloc = (int)((yloc % 100) + m_autoMappingY); | 728 | yloc = (yloc % 100) + m_autoMappingY; |
723 | } | 729 | } |
724 | 730 | ||
725 | if (((realXLoc == 0) && (realYLoc == 0)) || | 731 | if (((realXLoc == 0) && (realYLoc == 0)) || |
726 | (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && | 732 | (((realXLoc - xloc < 3896) || (xloc - realXLoc < 3896)) && |
727 | ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) | 733 | ((realYLoc - yloc < 3896) || (yloc - realYLoc < 3896)))) |
728 | { | 734 | { |
729 | xloc = xloc * (int)Constants.RegionSize; | 735 | xloc = Util.RegionToWorldLoc(xloc); |
730 | yloc = yloc * (int)Constants.RegionSize; | 736 | yloc = Util.RegionToWorldLoc(yloc); |
731 | string reason = string.Empty; | 737 | string reason = string.Empty; |
732 | if (TryCreateLink(UUID.Zero, xloc, yloc, string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) | 738 | if (TryCreateLink(UUID.Zero, (int)xloc, (int)yloc, |
739 | string.Empty, externalPort, externalHostName, UUID.Zero, out regInfo, out reason)) | ||
733 | { | 740 | { |
734 | regInfo.RegionName = config.GetString("localName", ""); | 741 | regInfo.RegionName = config.GetString("localName", ""); |
735 | } | 742 | } |
diff --git a/OpenSim/Services/Interfaces/IBakedTextureService.cs b/OpenSim/Services/Interfaces/IBakedTextureService.cs new file mode 100644 index 0000000..69df4a0 --- /dev/null +++ b/OpenSim/Services/Interfaces/IBakedTextureService.cs | |||
@@ -0,0 +1,38 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using Nini.Config; | ||
30 | |||
31 | namespace OpenSim.Services.Interfaces | ||
32 | { | ||
33 | public interface IBakedTextureService | ||
34 | { | ||
35 | string Get(string id); | ||
36 | void Store(string id, string data); | ||
37 | } | ||
38 | } | ||
diff --git a/OpenSim/Services/Interfaces/IGridService.cs b/OpenSim/Services/Interfaces/IGridService.cs index 88ac5b3..8e6279e 100644 --- a/OpenSim/Services/Interfaces/IGridService.cs +++ b/OpenSim/Services/Interfaces/IGridService.cs | |||
@@ -29,9 +29,13 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Net; | 30 | using System.Net; |
31 | using System.Net.Sockets; | 31 | using System.Net.Sockets; |
32 | using System.Reflection; | ||
33 | |||
32 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
33 | using OpenMetaverse; | 35 | using OpenMetaverse; |
34 | 36 | ||
37 | using log4net; | ||
38 | |||
35 | namespace OpenSim.Services.Interfaces | 39 | namespace OpenSim.Services.Interfaces |
36 | { | 40 | { |
37 | public interface IGridService | 41 | public interface IGridService |
@@ -119,6 +123,9 @@ namespace OpenSim.Services.Interfaces | |||
119 | 123 | ||
120 | public class GridRegion | 124 | public class GridRegion |
121 | { | 125 | { |
126 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
127 | private static readonly string LogHeader = "[GRID REGION]"; | ||
128 | |||
122 | /// <summary> | 129 | /// <summary> |
123 | /// The port by which http communication occurs with the region | 130 | /// The port by which http communication occurs with the region |
124 | /// </summary> | 131 | /// </summary> |
@@ -168,15 +175,16 @@ namespace OpenSim.Services.Interfaces | |||
168 | /// <summary> | 175 | /// <summary> |
169 | /// The co-ordinate of this region. | 176 | /// The co-ordinate of this region. |
170 | /// </summary> | 177 | /// </summary> |
171 | public int RegionCoordX { get { return RegionLocX / (int)Constants.RegionSize; } } | 178 | public int RegionCoordX { get { return (int)Util.WorldToRegionLoc((uint)RegionLocX); } } |
172 | 179 | ||
173 | /// <summary> | 180 | /// <summary> |
174 | /// The co-ordinate of this region | 181 | /// The co-ordinate of this region |
175 | /// </summary> | 182 | /// </summary> |
176 | public int RegionCoordY { get { return RegionLocY / (int)Constants.RegionSize; } } | 183 | public int RegionCoordY { get { return (int)Util.WorldToRegionLoc((uint)RegionLocY); } } |
177 | 184 | ||
178 | /// <summary> | 185 | /// <summary> |
179 | /// The location of this region in meters. | 186 | /// The location of this region in meters. |
187 | /// DANGER DANGER! Note that this name means something different in RegionInfo. | ||
180 | /// </summary> | 188 | /// </summary> |
181 | public int RegionLocX | 189 | public int RegionLocX |
182 | { | 190 | { |
@@ -185,8 +193,12 @@ namespace OpenSim.Services.Interfaces | |||
185 | } | 193 | } |
186 | protected int m_regionLocX; | 194 | protected int m_regionLocX; |
187 | 195 | ||
196 | public int RegionSizeX { get; set; } | ||
197 | public int RegionSizeY { get; set; } | ||
198 | |||
188 | /// <summary> | 199 | /// <summary> |
189 | /// The location of this region in meters. | 200 | /// The location of this region in meters. |
201 | /// DANGER DANGER! Note that this name means something different in RegionInfo. | ||
190 | /// </summary> | 202 | /// </summary> |
191 | public int RegionLocY | 203 | public int RegionLocY |
192 | { | 204 | { |
@@ -215,13 +227,18 @@ namespace OpenSim.Services.Interfaces | |||
215 | 227 | ||
216 | public GridRegion() | 228 | public GridRegion() |
217 | { | 229 | { |
230 | RegionSizeX = (int)Constants.RegionSize; | ||
231 | RegionSizeY = (int)Constants.RegionSize; | ||
218 | m_serverURI = string.Empty; | 232 | m_serverURI = string.Empty; |
219 | } | 233 | } |
220 | 234 | ||
235 | /* | ||
221 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) | 236 | public GridRegion(int regionLocX, int regionLocY, IPEndPoint internalEndPoint, string externalUri) |
222 | { | 237 | { |
223 | m_regionLocX = regionLocX; | 238 | m_regionLocX = regionLocX; |
224 | m_regionLocY = regionLocY; | 239 | m_regionLocY = regionLocY; |
240 | RegionSizeX = (int)Constants.RegionSize; | ||
241 | RegionSizeY = (int)Constants.RegionSize; | ||
225 | 242 | ||
226 | m_internalEndPoint = internalEndPoint; | 243 | m_internalEndPoint = internalEndPoint; |
227 | m_externalHostName = externalUri; | 244 | m_externalHostName = externalUri; |
@@ -231,23 +248,30 @@ namespace OpenSim.Services.Interfaces | |||
231 | { | 248 | { |
232 | m_regionLocX = regionLocX; | 249 | m_regionLocX = regionLocX; |
233 | m_regionLocY = regionLocY; | 250 | m_regionLocY = regionLocY; |
251 | RegionSizeX = (int)Constants.RegionSize; | ||
252 | RegionSizeY = (int)Constants.RegionSize; | ||
234 | 253 | ||
235 | m_externalHostName = externalUri; | 254 | m_externalHostName = externalUri; |
236 | 255 | ||
237 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); | 256 | m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int)port); |
238 | } | 257 | } |
258 | */ | ||
239 | 259 | ||
240 | public GridRegion(uint xcell, uint ycell) | 260 | public GridRegion(uint xcell, uint ycell) |
241 | { | 261 | { |
242 | m_regionLocX = (int)(xcell * Constants.RegionSize); | 262 | m_regionLocX = (int)Util.RegionToWorldLoc(xcell); |
243 | m_regionLocY = (int)(ycell * Constants.RegionSize); | 263 | m_regionLocY = (int)Util.RegionToWorldLoc(ycell); |
264 | RegionSizeX = (int)Constants.RegionSize; | ||
265 | RegionSizeY = (int)Constants.RegionSize; | ||
244 | } | 266 | } |
245 | 267 | ||
246 | public GridRegion(RegionInfo ConvertFrom) | 268 | public GridRegion(RegionInfo ConvertFrom) |
247 | { | 269 | { |
248 | m_regionName = ConvertFrom.RegionName; | 270 | m_regionName = ConvertFrom.RegionName; |
249 | m_regionLocX = (int)(ConvertFrom.RegionLocX * Constants.RegionSize); | 271 | m_regionLocX = (int)(ConvertFrom.WorldLocX); |
250 | m_regionLocY = (int)(ConvertFrom.RegionLocY * Constants.RegionSize); | 272 | m_regionLocY = (int)(ConvertFrom.WorldLocY); |
273 | RegionSizeX = (int)ConvertFrom.RegionSizeX; | ||
274 | RegionSizeY = (int)ConvertFrom.RegionSizeY; | ||
251 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | 275 | m_internalEndPoint = ConvertFrom.InternalEndPoint; |
252 | m_externalHostName = ConvertFrom.ExternalHostName; | 276 | m_externalHostName = ConvertFrom.ExternalHostName; |
253 | m_httpPort = ConvertFrom.HttpPort; | 277 | m_httpPort = ConvertFrom.HttpPort; |
@@ -266,6 +290,8 @@ namespace OpenSim.Services.Interfaces | |||
266 | m_regionName = ConvertFrom.RegionName; | 290 | m_regionName = ConvertFrom.RegionName; |
267 | m_regionLocX = ConvertFrom.RegionLocX; | 291 | m_regionLocX = ConvertFrom.RegionLocX; |
268 | m_regionLocY = ConvertFrom.RegionLocY; | 292 | m_regionLocY = ConvertFrom.RegionLocY; |
293 | RegionSizeX = ConvertFrom.RegionSizeX; | ||
294 | RegionSizeY = ConvertFrom.RegionSizeY; | ||
269 | m_internalEndPoint = ConvertFrom.InternalEndPoint; | 295 | m_internalEndPoint = ConvertFrom.InternalEndPoint; |
270 | m_externalHostName = ConvertFrom.ExternalHostName; | 296 | m_externalHostName = ConvertFrom.ExternalHostName; |
271 | m_httpPort = ConvertFrom.HttpPort; | 297 | m_httpPort = ConvertFrom.HttpPort; |
@@ -373,6 +399,8 @@ namespace OpenSim.Services.Interfaces | |||
373 | kvp["uuid"] = RegionID.ToString(); | 399 | kvp["uuid"] = RegionID.ToString(); |
374 | kvp["locX"] = RegionLocX.ToString(); | 400 | kvp["locX"] = RegionLocX.ToString(); |
375 | kvp["locY"] = RegionLocY.ToString(); | 401 | kvp["locY"] = RegionLocY.ToString(); |
402 | kvp["sizeX"] = RegionSizeX.ToString(); | ||
403 | kvp["sizeY"] = RegionSizeY.ToString(); | ||
376 | kvp["regionName"] = RegionName; | 404 | kvp["regionName"] = RegionName; |
377 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); | 405 | kvp["serverIP"] = ExternalHostName; //ExternalEndPoint.Address.ToString(); |
378 | kvp["serverHttpPort"] = HttpPort.ToString(); | 406 | kvp["serverHttpPort"] = HttpPort.ToString(); |
@@ -399,6 +427,16 @@ namespace OpenSim.Services.Interfaces | |||
399 | if (kvp.ContainsKey("locY")) | 427 | if (kvp.ContainsKey("locY")) |
400 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); | 428 | RegionLocY = Convert.ToInt32((string)kvp["locY"]); |
401 | 429 | ||
430 | if (kvp.ContainsKey("sizeX")) | ||
431 | RegionSizeX = Convert.ToInt32((string)kvp["sizeX"]); | ||
432 | else | ||
433 | RegionSizeX = (int)Constants.RegionSize; | ||
434 | |||
435 | if (kvp.ContainsKey("sizeY")) | ||
436 | RegionSizeY = Convert.ToInt32((string)kvp["sizeY"]); | ||
437 | else | ||
438 | RegionSizeX = (int)Constants.RegionSize; | ||
439 | |||
402 | if (kvp.ContainsKey("regionName")) | 440 | if (kvp.ContainsKey("regionName")) |
403 | RegionName = (string)kvp["regionName"]; | 441 | RegionName = (string)kvp["regionName"]; |
404 | 442 | ||
@@ -446,6 +484,9 @@ namespace OpenSim.Services.Interfaces | |||
446 | 484 | ||
447 | if (kvp.ContainsKey("Token")) | 485 | if (kvp.ContainsKey("Token")) |
448 | Token = kvp["Token"].ToString(); | 486 | Token = kvp["Token"].ToString(); |
487 | |||
488 | // m_log.DebugFormat("{0} New GridRegion. id={1}, loc=<{2},{3}>, size=<{4},{5}>", | ||
489 | // LogHeader, RegionID, RegionLocX, RegionLocY, RegionSizeX, RegionSizeY); | ||
449 | } | 490 | } |
450 | } | 491 | } |
451 | } | 492 | } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginResponse.cs b/OpenSim/Services/LLLoginService/LLLoginResponse.cs index 6ab5258..e67ecf0 100644 --- a/OpenSim/Services/LLLoginService/LLLoginResponse.cs +++ b/OpenSim/Services/LLLoginService/LLLoginResponse.cs | |||
@@ -254,11 +254,11 @@ namespace OpenSim.Services.LLLoginService | |||
254 | Currency = currency; | 254 | Currency = currency; |
255 | ClassifiedFee = classifiedFee; | 255 | ClassifiedFee = classifiedFee; |
256 | 256 | ||
257 | |||
258 | FillOutHomeData(pinfo, home); | 257 | FillOutHomeData(pinfo, home); |
259 | LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); | 258 | LookAt = String.Format("[r{0},r{1},r{2}]", lookAt.X, lookAt.Y, lookAt.Z); |
260 | 259 | ||
261 | FillOutRegionData(destination); | 260 | FillOutRegionData(destination); |
261 | m_log.DebugFormat("[LOGIN RESPONSE] LLLoginResponse create. sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); | ||
262 | 262 | ||
263 | FillOutSeedCap(aCircuit, destination, clientIP); | 263 | FillOutSeedCap(aCircuit, destination, clientIP); |
264 | 264 | ||
@@ -361,7 +361,8 @@ namespace OpenSim.Services.LLLoginService | |||
361 | 361 | ||
362 | private void FillOutHomeData(GridUserInfo pinfo, GridRegion home) | 362 | private void FillOutHomeData(GridUserInfo pinfo, GridRegion home) |
363 | { | 363 | { |
364 | int x = 1000 * (int)Constants.RegionSize, y = 1000 * (int)Constants.RegionSize; | 364 | int x = (int)Util.RegionToWorldLoc(1000); |
365 | int y = (int)Util.RegionToWorldLoc(1000); | ||
365 | if (home != null) | 366 | if (home != null) |
366 | { | 367 | { |
367 | x = home.RegionLocX; | 368 | x = home.RegionLocX; |
@@ -384,6 +385,8 @@ namespace OpenSim.Services.LLLoginService | |||
384 | SimPort = (uint)endPoint.Port; | 385 | SimPort = (uint)endPoint.Port; |
385 | RegionX = (uint)destination.RegionLocX; | 386 | RegionX = (uint)destination.RegionLocX; |
386 | RegionY = (uint)destination.RegionLocY; | 387 | RegionY = (uint)destination.RegionLocY; |
388 | RegionSizeX = destination.RegionSizeX; | ||
389 | RegionSizeY = destination.RegionSizeY; | ||
387 | } | 390 | } |
388 | 391 | ||
389 | private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) | 392 | private void FillOutSeedCap(AgentCircuitData aCircuit, GridRegion destination, IPEndPoint ipepClient) |
@@ -433,10 +436,23 @@ namespace OpenSim.Services.LLLoginService | |||
433 | ErrorReason = "key"; | 436 | ErrorReason = "key"; |
434 | welcomeMessage = "Welcome to OpenSim!"; | 437 | welcomeMessage = "Welcome to OpenSim!"; |
435 | seedCapability = String.Empty; | 438 | seedCapability = String.Empty; |
436 | home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" + | 439 | home = "{'region_handle':[" |
437 | userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + | 440 | + "r" + Util.RegionToWorldLoc(1000).ToString() |
438 | userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + | 441 | + "," |
439 | userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; | 442 | + "r" + Util.RegionToWorldLoc(1000).ToString() |
443 | + "], 'position':[" | ||
444 | + "r" + userProfile.homepos.X.ToString() | ||
445 | + "," | ||
446 | + "r" + userProfile.homepos.Y.ToString() | ||
447 | + "," | ||
448 | + "r" + userProfile.homepos.Z.ToString() | ||
449 | + "], 'look_at':[" | ||
450 | + "r" + userProfile.homelookat.X.ToString() | ||
451 | + "," | ||
452 | + "r" + userProfile.homelookat.Y.ToString() | ||
453 | + "," | ||
454 | + "r" + userProfile.homelookat.Z.ToString() | ||
455 | + "]}"; | ||
440 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; | 456 | lookAt = "[r0.99949799999999999756,r0.03166859999999999814,r0]"; |
441 | RegionX = (uint) 255232; | 457 | RegionX = (uint) 255232; |
442 | RegionY = (uint) 254976; | 458 | RegionY = (uint) 254976; |
@@ -529,6 +545,9 @@ namespace OpenSim.Services.LLLoginService | |||
529 | responseData["message"] = welcomeMessage; | 545 | responseData["message"] = welcomeMessage; |
530 | responseData["region_x"] = (Int32)(RegionX); | 546 | responseData["region_x"] = (Int32)(RegionX); |
531 | responseData["region_y"] = (Int32)(RegionY); | 547 | responseData["region_y"] = (Int32)(RegionY); |
548 | responseData["region_size_x"] = (Int32)RegionSizeX; | ||
549 | responseData["region_size_y"] = (Int32)RegionSizeY; | ||
550 | m_log.DebugFormat("[LOGIN RESPONSE] returning sizeX={0}, sizeY={1}", RegionSizeX, RegionSizeY); | ||
532 | 551 | ||
533 | if (searchURL != String.Empty) | 552 | if (searchURL != String.Empty) |
534 | responseData["search"] = searchURL; | 553 | responseData["search"] = searchURL; |
@@ -918,6 +937,9 @@ namespace OpenSim.Services.LLLoginService | |||
918 | set { regionY = value; } | 937 | set { regionY = value; } |
919 | } | 938 | } |
920 | 939 | ||
940 | public int RegionSizeX { get; private set; } | ||
941 | public int RegionSizeY { get; private set; } | ||
942 | |||
921 | public string SunTexture | 943 | public string SunTexture |
922 | { | 944 | { |
923 | get { return sunTexture; } | 945 | get { return sunTexture; } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 6a748fe..46a5c18 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -50,6 +50,8 @@ namespace OpenSim.Services.LLLoginService | |||
50 | public class LLLoginService : ILoginService | 50 | public class LLLoginService : ILoginService |
51 | { | 51 | { |
52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 52 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
53 | private static readonly string LogHeader = "[LLOGIN SERVICE]"; | ||
54 | |||
53 | private static bool Initialized = false; | 55 | private static bool Initialized = false; |
54 | 56 | ||
55 | protected IUserAccountService m_UserAccountService; | 57 | protected IUserAccountService m_UserAccountService; |
@@ -408,6 +410,7 @@ namespace OpenSim.Services.LLLoginService | |||
408 | else | 410 | else |
409 | { | 411 | { |
410 | // something went wrong, make something up, so that we don't have to test this anywhere else | 412 | // something went wrong, make something up, so that we don't have to test this anywhere else |
413 | m_log.DebugFormat("{0} Failed to fetch GridUserInfo. Creating empty GridUserInfo as home", LogHeader); | ||
411 | guinfo = new GridUserInfo(); | 414 | guinfo = new GridUserInfo(); |
412 | guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); | 415 | guinfo.LastPosition = guinfo.HomePosition = new Vector3(128, 128, 30); |
413 | } | 416 | } |
@@ -696,7 +699,7 @@ namespace OpenSim.Services.LLLoginService | |||
696 | private GridRegion FindAlternativeRegion(UUID scopeID) | 699 | private GridRegion FindAlternativeRegion(UUID scopeID) |
697 | { | 700 | { |
698 | List<GridRegion> hyperlinks = null; | 701 | List<GridRegion> hyperlinks = null; |
699 | List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, 1000 * (int)Constants.RegionSize, 1000 * (int)Constants.RegionSize); | 702 | List<GridRegion> regions = m_GridService.GetFallbackRegions(scopeID, (int)Util.RegionToWorldLoc(1000), (int)Util.RegionToWorldLoc(1000)); |
700 | if (regions != null && regions.Count > 0) | 703 | if (regions != null && regions.Count > 0) |
701 | { | 704 | { |
702 | hyperlinks = m_GridService.GetHyperlinks(scopeID); | 705 | hyperlinks = m_GridService.GetHyperlinks(scopeID); |
diff --git a/OpenSim/Services/UserProfilesService/UserProfilesService.cs b/OpenSim/Services/UserProfilesService/UserProfilesService.cs index 69c7b91..dd26cdc 100644 --- a/OpenSim/Services/UserProfilesService/UserProfilesService.cs +++ b/OpenSim/Services/UserProfilesService/UserProfilesService.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Data; | |||
37 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | using OpenMetaverse.StructuredData; | 38 | using OpenMetaverse.StructuredData; |
39 | using OpenSim.Framework; | 39 | using OpenSim.Framework; |
40 | using OpenSim.Services.UserAccountService; | ||
40 | 41 | ||
41 | namespace OpenSim.Services.ProfilesService | 42 | namespace OpenSim.Services.ProfilesService |
42 | { | 43 | { |
@@ -166,11 +167,71 @@ namespace OpenSim.Services.ProfilesService | |||
166 | #region User Preferences | 167 | #region User Preferences |
167 | public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) | 168 | public bool UserPreferencesUpdate(ref UserPreferences pref, ref string result) |
168 | { | 169 | { |
170 | if(string.IsNullOrEmpty(pref.EMail)) | ||
171 | { | ||
172 | UserAccount account = new UserAccount(); | ||
173 | if(userAccounts is UserAccountService.UserAccountService) | ||
174 | { | ||
175 | try | ||
176 | { | ||
177 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | ||
178 | if(string.IsNullOrEmpty(account.Email)) | ||
179 | { | ||
180 | result = "No Email address on record!"; | ||
181 | return false; | ||
182 | } | ||
183 | else | ||
184 | pref.EMail = account.Email; | ||
185 | } | ||
186 | catch | ||
187 | { | ||
188 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | ||
189 | result = "Missing Email address!"; | ||
190 | return false; | ||
191 | } | ||
192 | } | ||
193 | else | ||
194 | { | ||
195 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | ||
196 | result = "Missing Email address!"; | ||
197 | return false; | ||
198 | } | ||
199 | } | ||
169 | return ProfilesData.UpdateUserPreferences(ref pref, ref result); | 200 | return ProfilesData.UpdateUserPreferences(ref pref, ref result); |
170 | } | 201 | } |
171 | 202 | ||
172 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) | 203 | public bool UserPreferencesRequest(ref UserPreferences pref, ref string result) |
173 | { | 204 | { |
205 | if(string.IsNullOrEmpty(pref.EMail)) | ||
206 | { | ||
207 | UserAccount account = new UserAccount(); | ||
208 | if(userAccounts is UserAccountService.UserAccountService) | ||
209 | { | ||
210 | try | ||
211 | { | ||
212 | account = userAccounts.GetUserAccount(UUID.Zero, pref.UserId); | ||
213 | if(string.IsNullOrEmpty(account.Email)) | ||
214 | { | ||
215 | result = "No Email address on record!"; | ||
216 | return false; | ||
217 | } | ||
218 | else | ||
219 | pref.EMail = account.Email; | ||
220 | } | ||
221 | catch | ||
222 | { | ||
223 | m_log.Info ("[PROFILES]: UserAccountService Exception: Could not get user account"); | ||
224 | result = "Missing Email address!"; | ||
225 | return false; | ||
226 | } | ||
227 | } | ||
228 | else | ||
229 | { | ||
230 | m_log.Info ("[PROFILES]: UserAccountService: Could not get user account"); | ||
231 | result = "Missing Email address!"; | ||
232 | return false; | ||
233 | } | ||
234 | } | ||
174 | return ProfilesData.GetUserPreferences(ref pref, ref result); | 235 | return ProfilesData.GetUserPreferences(ref pref, ref result); |
175 | } | 236 | } |
176 | #endregion User Preferences | 237 | #endregion User Preferences |