Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
root
2011-06-30 00:26:03 +01:00
27 changed files with 558 additions and 172 deletions

View File

@@ -63,7 +63,7 @@ namespace OpenSim.Services.GridService
protected GatekeeperServiceConnector m_GatekeeperConnector;
protected UUID m_ScopeID = UUID.Zero;
protected bool m_Check4096 = true;
// protected bool m_Check4096 = true;
protected string m_MapTileDirectory = string.Empty;
protected string m_ThisGatekeeper = string.Empty;
protected Uri m_ThisGatekeeperURI = null;
@@ -121,7 +121,7 @@ namespace OpenSim.Services.GridService
if (scope != string.Empty)
UUID.TryParse(scope, out m_ScopeID);
m_Check4096 = gridConfig.GetBoolean("Check4096", true);
// m_Check4096 = gridConfig.GetBoolean("Check4096", true);
m_MapTileDirectory = gridConfig.GetString("MapTileDirectory", "maptiles");
@@ -311,14 +311,18 @@ namespace OpenSim.Services.GridService
return true;
}
uint x, y;
if (m_Check4096 && !Check4096(handle, out x, out y))
{
RemoveHyperlinkRegion(regInfo.RegionID);
reason = "Region is too far (" + x + ", " + y + ")";
m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
return false;
}
// We are now performing this check for each individual teleport in the EntityTransferModule instead. This
// allows us to give better feedback when teleports fail because of the distance reason (which can't be
// done here) and it also hypergrid teleports that are within range (possibly because the source grid
// itself has regions that are very far apart).
// uint x, y;
// if (m_Check4096 && !Check4096(handle, out x, out y))
// {
// //RemoveHyperlinkRegion(regInfo.RegionID);
// reason = "Region is too far (" + x + ", " + y + ")";
// m_log.Info("[HYPERGRID LINKER]: Unable to link, region is too far (" + x + ", " + y + ")");
// //return false;
// }
regInfo.RegionID = regionID;
@@ -369,60 +373,59 @@ namespace OpenSim.Services.GridService
}
}
/// <summary>
/// Cope with this viewer limitation.
/// </summary>
/// <param name="regInfo"></param>
/// <returns></returns>
public bool Check4096(ulong realHandle, out uint x, out uint y)
{
uint ux = 0, uy = 0;
Utils.LongToUInts(realHandle, out ux, out uy);
x = ux / Constants.RegionSize;
y = uy / Constants.RegionSize;
const uint limit = (4096 - 1) * Constants.RegionSize;
uint xmin = ux - limit;
uint xmax = ux + limit;
uint ymin = uy - limit;
uint ymax = uy + limit;
// World map boundary checks
if (xmin < 0 || xmin > ux)
xmin = 0;
if (xmax > int.MaxValue || xmax < ux)
xmax = int.MaxValue;
if (ymin < 0 || ymin > uy)
ymin = 0;
if (ymax > int.MaxValue || ymax < uy)
ymax = int.MaxValue;
// Check for any regions that are within the possible teleport range to the linked region
List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
if (regions.Count == 0)
{
return false;
}
else
{
// Check for regions which are not linked regions
List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
if (availableRegions.Count() == 0)
return false;
}
return true;
}
// Not currently used
// /// <summary>
// /// Cope with this viewer limitation.
// /// </summary>
// /// <param name="regInfo"></param>
// /// <returns></returns>
// public bool Check4096(ulong realHandle, out uint x, out uint y)
// {
// uint ux = 0, uy = 0;
// Utils.LongToUInts(realHandle, out ux, out uy);
// x = ux / Constants.RegionSize;
// y = uy / Constants.RegionSize;
//
// const uint limit = (4096 - 1) * Constants.RegionSize;
// uint xmin = ux - limit;
// uint xmax = ux + limit;
// uint ymin = uy - limit;
// uint ymax = uy + limit;
// // World map boundary checks
// if (xmin < 0 || xmin > ux)
// xmin = 0;
// if (xmax > int.MaxValue || xmax < ux)
// xmax = int.MaxValue;
// if (ymin < 0 || ymin > uy)
// ymin = 0;
// if (ymax > int.MaxValue || ymax < uy)
// ymax = int.MaxValue;
//
// // Check for any regions that are within the possible teleport range to the linked region
// List<GridRegion> regions = m_GridService.GetRegionRange(m_ScopeID, (int)xmin, (int)xmax, (int)ymin, (int)ymax);
// if (regions.Count == 0)
// {
// return false;
// }
// else
// {
// // Check for regions which are not linked regions
// List<GridRegion> hyperlinks = m_GridService.GetHyperlinks(m_ScopeID);
// IEnumerable<GridRegion> availableRegions = regions.Except(hyperlinks);
// if (availableRegions.Count() == 0)
// return false;
// }
//
// return true;
// }
private void AddHyperlinkRegion(GridRegion regionInfo, ulong regionHandle)
{
RegionData rdata = m_GridService.RegionInfo2RegionData(regionInfo);
int flags = (int)OpenSim.Data.RegionFlags.Hyperlink + (int)OpenSim.Data.RegionFlags.NoDirectLogin + (int)OpenSim.Data.RegionFlags.RegionOnline;
rdata.Data["flags"] = flags.ToString();
m_Database.Store(rdata);
}
private void RemoveHyperlinkRegion(UUID regionID)