aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/GridService
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r--OpenSim/Services/GridService/GridService.cs112
1 files changed, 17 insertions, 95 deletions
diff --git a/OpenSim/Services/GridService/GridService.cs b/OpenSim/Services/GridService/GridService.cs
index 66c918f..a340612 100644
--- a/OpenSim/Services/GridService/GridService.cs
+++ b/OpenSim/Services/GridService/GridService.cs
@@ -202,10 +202,24 @@ namespace OpenSim.Services.GridService
202 if (regionInfos.RegionID == UUID.Zero) 202 if (regionInfos.RegionID == UUID.Zero)
203 return "Invalid RegionID - cannot be zero UUID"; 203 return "Invalid RegionID - cannot be zero UUID";
204 204
205 String reason = "Region overlaps another region"; 205 String reason = "Region overlaps another region";
206 // we should not need to check for overlaps 206
207 List<RegionData> rdatas = m_Database.Get(
208 regionInfos.RegionLocX,
209 regionInfos.RegionLocY,
210 regionInfos.RegionLocX + regionInfos.RegionSizeX,
211 regionInfos.RegionLocY + regionInfos.RegionSizeY,
212 scopeID);
213
214 RegionData region = null;
215 if(rdatas.Count > 1)
216 {
217 m_log.WarnFormat("{0} Register region overlaps with {1} regions", LogHeader, scopeID, rdatas.Count);
218 return reason;
219 }
220 else if(rdatas.Count == 1)
221 region = rdatas[0];
207 222
208 RegionData region = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
209 if ((region != null) && (region.RegionID != regionInfos.RegionID)) 223 if ((region != null) && (region.RegionID != regionInfos.RegionID))
210 { 224 {
211 // If not same ID and same coordinates, this new region has conflicts and can't be registered. 225 // If not same ID and same coordinates, this new region has conflicts and can't be registered.
@@ -341,99 +355,7 @@ namespace OpenSim.Services.GridService
341 355
342 return String.Empty; 356 return String.Empty;
343 } 357 }
344/*
345 /// <summary>
346 /// Search the region map for regions conflicting with this region.
347 /// The region to be added is passed and we look for any existing regions that are
348 /// in the requested location, that are large varregions that overlap this region, or
349 /// are previously defined regions that would lie under this new region.
350 /// </summary>
351 /// <param name="regionInfos">Information on region requested to be added to the world map</param>
352 /// <param name="scopeID">Grid id for region</param>
353 /// <param name="reason">The reason the returned region conflicts with passed region</param>
354 /// <returns></returns>
355 private RegionData FindAnyConflictingRegion(GridRegion regionInfos, UUID scopeID, out string reason)
356 {
357 reason = "Reregistration";
358 // First see if there is an existing region right where this region is trying to go
359 // (We keep this result so it can be returned if suppressing errors)
360 RegionData noErrorRegion = m_Database.Get(regionInfos.RegionLocX, regionInfos.RegionLocY, scopeID);
361 RegionData region = noErrorRegion;
362 if (region != null
363 && region.RegionID == regionInfos.RegionID
364 && region.sizeX == regionInfos.RegionSizeX
365 && region.sizeY == regionInfos.RegionSizeY)
366 {
367 // If this seems to be exactly the same region, return this as it could be
368 // a re-registration (permissions checked by calling routine).
369 m_log.DebugFormat("{0} FindAnyConflictingRegion: re-register of {1}",
370 LogHeader, RegionString(regionInfos));
371 return region;
372 }
373
374 // No region exactly there or we're resizing an existing region.
375 // Fetch regions that could be varregions overlapping requested location.
376 int xmin = regionInfos.RegionLocX - (int)Constants.MaximumRegionSize + 10;
377 int xmax = regionInfos.RegionLocX;
378 int ymin = regionInfos.RegionLocY - (int)Constants.MaximumRegionSize + 10;
379 int ymax = regionInfos.RegionLocY;
380 List<RegionData> rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID);
381 foreach (RegionData rdata in rdatas)
382 {
383 // m_log.DebugFormat("{0} FindAnyConflictingRegion: find existing. Checking {1}", LogHeader, RegionString(rdata) );
384 if ( (rdata.posX + rdata.sizeX > regionInfos.RegionLocX)
385 && (rdata.posY + rdata.sizeY > regionInfos.RegionLocY) )
386 {
387 region = rdata;
388 m_log.WarnFormat("{0} FindAnyConflictingRegion: conflict of {1} by existing varregion {2}",
389 LogHeader, RegionString(regionInfos), RegionString(region));
390 reason = String.Format("Region location is overlapped by existing varregion {0}",
391 RegionString(region));
392
393 if (m_SuppressVarregionOverlapCheckOnRegistration)
394 region = noErrorRegion;
395 return region;
396 }
397 }
398 358
399 // There isn't a region that overlaps this potential region.
400 // See if this potential region overlaps an existing region.
401 // First, a shortcut of not looking for overlap if new region is legacy region sized
402 // and connot overlap anything.
403 if (regionInfos.RegionSizeX != Constants.RegionSize
404 || regionInfos.RegionSizeY != Constants.RegionSize)
405 {
406 // trim range looked for so we don't pick up neighbor regions just off the edges
407 xmin = regionInfos.RegionLocX;
408 xmax = regionInfos.RegionLocX + regionInfos.RegionSizeX - 10;
409 ymin = regionInfos.RegionLocY;
410 ymax = regionInfos.RegionLocY + regionInfos.RegionSizeY - 10;
411 rdatas = m_Database.Get(xmin, ymin, xmax, ymax, scopeID);
412
413 // If the region is being resized, the found region could be ourself.
414 foreach (RegionData rdata in rdatas)
415 {
416 // m_log.DebugFormat("{0} FindAnyConflictingRegion: see if overlap. Checking {1}", LogHeader, RegionString(rdata) );
417 if (region == null || region.RegionID != regionInfos.RegionID)
418 {
419 region = rdata;
420 m_log.WarnFormat("{0} FindAnyConflictingRegion: conflict of varregion {1} overlaps existing region {2}",
421 LogHeader, RegionString(regionInfos), RegionString(region));
422 reason = String.Format("Region {0} would overlap existing region {1}",
423 RegionString(regionInfos), RegionString(region));
424
425 if (m_SuppressVarregionOverlapCheckOnRegistration)
426 region = noErrorRegion;
427 return region;
428 }
429 }
430 }
431
432 // If we get here, region is either null (nothing found here) or
433 // is the non-conflicting region found at the location being requested.
434 return region;
435 }
436*/
437 // String describing name and region location of passed region 359 // String describing name and region location of passed region
438 private String RegionString(RegionData reg) 360 private String RegionString(RegionData reg)
439 { 361 {