diff options
author | Justin Clark-Casey (justincc) | 2011-08-02 01:06:32 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-02 01:06:32 +0100 |
commit | b7f81d34928cb2d7296b91a8569adb488c264e36 (patch) | |
tree | 9cb4d04d13995d052628ce4c5f2f7916627a8980 /OpenSim/Services/GridService/GridService.cs | |
parent | remove ancient late 2008 cruft that handles the situation where the GetRegion... (diff) | |
download | opensim-SC-b7f81d34928cb2d7296b91a8569adb488c264e36.zip opensim-SC-b7f81d34928cb2d7296b91a8569adb488c264e36.tar.gz opensim-SC-b7f81d34928cb2d7296b91a8569adb488c264e36.tar.bz2 opensim-SC-b7f81d34928cb2d7296b91a8569adb488c264e36.tar.xz |
If GetRegionByName can't match something in the local db, then search the hypergrid if that functionality has been enabled.
This should fix the problem today where old style HG addresses (e.g. "hg.osgrid.org:80:Vue-6400") stopped working since 8c3eb324c4b666e7abadef4a714d1bd8d5f71ac2
Diffstat (limited to 'OpenSim/Services/GridService/GridService.cs')
-rw-r--r-- | OpenSim/Services/GridService/GridService.cs | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs index a6fbc00..f663dd6 100644 --- a/OpenSim/Services/GridService/GridService.cs +++ b/OpenSim/Services/GridService/GridService.cs | |||
@@ -320,18 +320,25 @@ namespace OpenSim.Services.GridService | |||
320 | return null; | 320 | return null; |
321 | } | 321 | } |
322 | 322 | ||
323 | public GridRegion GetRegionByName(UUID scopeID, string regionName) | 323 | public GridRegion GetRegionByName(UUID scopeID, string name) |
324 | { | 324 | { |
325 | List<RegionData> rdatas = m_Database.Get(regionName, scopeID); | 325 | List<RegionData> rdatas = m_Database.Get(name, scopeID); |
326 | if ((rdatas != null) && (rdatas.Count > 0)) | 326 | if ((rdatas != null) && (rdatas.Count > 0)) |
327 | return RegionData2RegionInfo(rdatas[0]); // get the first | 327 | return RegionData2RegionInfo(rdatas[0]); // get the first |
328 | 328 | ||
329 | if (m_AllowHypergridMapSearch) | ||
330 | { | ||
331 | GridRegion r = GetHypergridRegionByName(scopeID, name); | ||
332 | if (r != null) | ||
333 | return r; | ||
334 | } | ||
335 | |||
329 | return null; | 336 | return null; |
330 | } | 337 | } |
331 | 338 | ||
332 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) | 339 | public List<GridRegion> GetRegionsByName(UUID scopeID, string name, int maxNumber) |
333 | { | 340 | { |
334 | m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); | 341 | // m_log.DebugFormat("[GRID SERVICE]: GetRegionsByName {0}", name); |
335 | 342 | ||
336 | List<RegionData> rdatas = m_Database.Get(name + "%", scopeID); | 343 | List<RegionData> rdatas = m_Database.Get(name + "%", scopeID); |
337 | 344 | ||
@@ -340,7 +347,7 @@ namespace OpenSim.Services.GridService | |||
340 | 347 | ||
341 | if (rdatas != null) | 348 | if (rdatas != null) |
342 | { | 349 | { |
343 | m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); | 350 | // m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count); |
344 | foreach (RegionData rdata in rdatas) | 351 | foreach (RegionData rdata in rdatas) |
345 | { | 352 | { |
346 | if (count++ < maxNumber) | 353 | if (count++ < maxNumber) |
@@ -348,9 +355,9 @@ namespace OpenSim.Services.GridService | |||
348 | } | 355 | } |
349 | } | 356 | } |
350 | 357 | ||
351 | if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)) && name.Contains(".")) | 358 | if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0))) |
352 | { | 359 | { |
353 | GridRegion r = m_HypergridLinker.LinkRegion(scopeID, name); | 360 | GridRegion r = GetHypergridRegionByName(scopeID, name); |
354 | if (r != null) | 361 | if (r != null) |
355 | rinfos.Add(r); | 362 | rinfos.Add(r); |
356 | } | 363 | } |
@@ -358,6 +365,20 @@ namespace OpenSim.Services.GridService | |||
358 | return rinfos; | 365 | return rinfos; |
359 | } | 366 | } |
360 | 367 | ||
368 | /// <summary> | ||
369 | /// Get a hypergrid region. | ||
370 | /// </summary> | ||
371 | /// <param name="scopeID"></param> | ||
372 | /// <param name="name"></param> | ||
373 | /// <returns>null if no hypergrid region could be found.</returns> | ||
374 | protected GridRegion GetHypergridRegionByName(UUID scopeID, string name) | ||
375 | { | ||
376 | if (name.Contains(".")) | ||
377 | return m_HypergridLinker.LinkRegion(scopeID, name); | ||
378 | else | ||
379 | return null; | ||
380 | } | ||
381 | |||
361 | public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) | 382 | public List<GridRegion> GetRegionRange(UUID scopeID, int xmin, int xmax, int ymin, int ymax) |
362 | { | 383 | { |
363 | int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; | 384 | int xminSnap = (int)(xmin / Constants.RegionSize) * (int)Constants.RegionSize; |