aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService/GridService.cs
diff options
context:
space:
mode:
authorRobert Adams2013-12-28 06:58:15 -0800
committerRobert Adams2013-12-28 06:58:15 -0800
commit6869633d76b2a6664743a608e4284b8dd7df85a6 (patch)
treee976908cac58662ac37b0dfee8c748f314a259c7 /OpenSim/Services/GridService/GridService.cs
parentMerge branch 'justincc-master' (diff)
downloadopensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.zip
opensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.tar.gz
opensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.tar.bz2
opensim-SC_OLD-6869633d76b2a6664743a608e4284b8dd7df85a6.tar.xz
Add serialization/deserialization of region size to RegionInfo, GridRegion, and RegionData.
This does not modify interfaces or handling of variable sized regions. This only enables the loading and storing of the region size and the reporting of the region size in grid service responses. The database tables already have the code to load and store the region size.
Diffstat (limited to 'OpenSim/Services/GridService/GridService.cs')
-rw-r--r--OpenSim/Services/GridService/GridService.cs14
1 files changed, 12 insertions, 2 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index e72b7f9..137ce04 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -313,8 +313,9 @@ 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 List<RegionData> rdatas = m_Database.Get(
317 region.posX + (int)Constants.RegionSize + 1, region.posY + (int)Constants.RegionSize + 1, scopeID); 317 region.posX - region.sizeX - 1, region.posY - region.sizeY - 1,
318 region.posX + region.sizeX + 1, region.posY + region.sizeY + 1, scopeID);
318 319
319 foreach (RegionData rdata in rdatas) 320 foreach (RegionData rdata in rdatas)
320 { 321 {
@@ -347,6 +348,11 @@ namespace OpenSim.Services.GridService
347 return null; 348 return null;
348 } 349 }
349 350
351 // Get a region given its base coordinates.
352 // NOTE: this is NOT 'get a region by some point in the region'. The coordinate MUST
353 // be the base coordinate of the region.
354 // The snapping is technically unnecessary but is harmless because regions are always
355 // multiples of the legacy region size (256).
350 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) 356 public GridRegion GetRegionByPosition(UUID scopeID, int x, int y)
351 { 357 {
352 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize; 358 int snapX = (int)(x / Constants.RegionSize) * (int)Constants.RegionSize;
@@ -441,6 +447,8 @@ namespace OpenSim.Services.GridService
441 RegionData rdata = new RegionData(); 447 RegionData rdata = new RegionData();
442 rdata.posX = (int)rinfo.RegionLocX; 448 rdata.posX = (int)rinfo.RegionLocX;
443 rdata.posY = (int)rinfo.RegionLocY; 449 rdata.posY = (int)rinfo.RegionLocY;
450 rdata.sizeX = rinfo.RegionSizeX;
451 rdata.sizeY = rinfo.RegionSizeY;
444 rdata.RegionID = rinfo.RegionID; 452 rdata.RegionID = rinfo.RegionID;
445 rdata.RegionName = rinfo.RegionName; 453 rdata.RegionName = rinfo.RegionName;
446 rdata.Data = rinfo.ToKeyValuePairs(); 454 rdata.Data = rinfo.ToKeyValuePairs();
@@ -454,6 +462,8 @@ namespace OpenSim.Services.GridService
454 GridRegion rinfo = new GridRegion(rdata.Data); 462 GridRegion rinfo = new GridRegion(rdata.Data);
455 rinfo.RegionLocX = rdata.posX; 463 rinfo.RegionLocX = rdata.posX;
456 rinfo.RegionLocY = rdata.posY; 464 rinfo.RegionLocY = rdata.posY;
465 rinfo.RegionSizeX = rdata.sizeX;
466 rinfo.RegionSizeY = rdata.sizeY;
457 rinfo.RegionID = rdata.RegionID; 467 rinfo.RegionID = rdata.RegionID;
458 rinfo.RegionName = rdata.RegionName; 468 rinfo.RegionName = rdata.RegionName;
459 rinfo.ScopeID = rdata.ScopeID; 469 rinfo.ScopeID = rdata.ScopeID;