diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 23 |
1 files changed, 17 insertions, 6 deletions
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); |