mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 19:36:07 +08:00
increase HG mapsearch spargetti; add more flexibility on input uri formats. To find regions in memory for a grid the http format needs to be used, because aditional compares made by viewers
This commit is contained in:
@@ -579,7 +579,70 @@ namespace OpenSim.Services.GridService
|
||||
int count = 0;
|
||||
List<GridRegion> rinfos = new List<GridRegion>();
|
||||
|
||||
if (rdatas != null)
|
||||
if (count < maxNumber && m_AllowHypergridMapSearch && name.Contains("."))
|
||||
{
|
||||
string regionURI = "";
|
||||
string regionName = "";
|
||||
if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName))
|
||||
return null;
|
||||
|
||||
string mapname = regionURI + regionName;
|
||||
bool haveMatch = false;
|
||||
|
||||
if (rdatas != null && (rdatas.Count > 0))
|
||||
{
|
||||
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
||||
foreach (RegionData rdata in rdatas)
|
||||
{
|
||||
if (count++ < maxNumber)
|
||||
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||
if(rdata.RegionName == mapname)
|
||||
{
|
||||
haveMatch = true;
|
||||
if(count == maxNumber)
|
||||
{
|
||||
rinfos.RemoveAt(count - 1);
|
||||
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(haveMatch)
|
||||
return rinfos;
|
||||
}
|
||||
|
||||
rdatas = m_Database.Get(Util.EscapeForLike(mapname)+ "%", scopeID);
|
||||
if (rdatas != null && (rdatas.Count > 0))
|
||||
{
|
||||
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
||||
foreach (RegionData rdata in rdatas)
|
||||
{
|
||||
if (count++ < maxNumber)
|
||||
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||
if(rdata.RegionName == mapname)
|
||||
{
|
||||
haveMatch = true;
|
||||
if(count == maxNumber)
|
||||
{
|
||||
rinfos.RemoveAt(count - 1);
|
||||
rinfos.Add(RegionData2RegionInfo(rdata));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(haveMatch)
|
||||
return rinfos;
|
||||
}
|
||||
|
||||
string HGname = regionURI +" "+ regionName;
|
||||
GridRegion r = m_HypergridLinker.LinkRegion(scopeID, HGname);
|
||||
if (r != null)
|
||||
{
|
||||
if( count == maxNumber)
|
||||
rinfos.RemoveAt(count - 1);
|
||||
rinfos.Add(r);
|
||||
}
|
||||
}
|
||||
else if (rdatas != null && (rdatas.Count > 0))
|
||||
{
|
||||
// m_log.DebugFormat("[GRID SERVICE]: Found {0} regions", rdatas.Count);
|
||||
foreach (RegionData rdata in rdatas)
|
||||
@@ -589,13 +652,6 @@ namespace OpenSim.Services.GridService
|
||||
}
|
||||
}
|
||||
|
||||
if (m_AllowHypergridMapSearch && (rdatas == null || (rdatas != null && rdatas.Count == 0)))
|
||||
{
|
||||
GridRegion r = GetHypergridRegionByName(scopeID, name);
|
||||
if (r != null)
|
||||
rinfos.Add(r);
|
||||
}
|
||||
|
||||
return rinfos;
|
||||
}
|
||||
|
||||
@@ -608,7 +664,20 @@ namespace OpenSim.Services.GridService
|
||||
protected GridRegion GetHypergridRegionByName(UUID scopeID, string name)
|
||||
{
|
||||
if (name.Contains("."))
|
||||
return m_HypergridLinker.LinkRegion(scopeID, name);
|
||||
{
|
||||
string regionURI = "";
|
||||
string regionName = "";
|
||||
if(!m_HypergridLinker.buildHGRegionURI(name, out regionURI, out regionName))
|
||||
return null;
|
||||
|
||||
string mapname = regionURI + regionName;
|
||||
List<RegionData> rdatas = m_Database.Get(Util.EscapeForLike(mapname), scopeID);
|
||||
if ((rdatas != null) && (rdatas.Count > 0))
|
||||
return RegionData2RegionInfo(rdatas[0]); // get the first
|
||||
|
||||
string HGname = regionURI +" "+ regionName;
|
||||
return m_HypergridLinker.LinkRegion(scopeID, HGname);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user