Improve on TBG Renfold's fix to llRequestSimulatorData DATA_SIM_POS by only performing HG regionflags service check if the region secret is not empty.

An empty RegionSecret is never HG, whilst a non-empty one may be HG or being genuinely used as a RegionSecret.
connector_plugin
Justin Clark-Casey (justincc) 2012-10-13 01:03:09 +01:00
parent f6e166cd0b
commit 330b976a62
1 changed files with 25 additions and 19 deletions

View File

@ -9314,11 +9314,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
GridRegion info; GridRegion info;
if (m_ScriptEngine.World.RegionInfo.RegionName == simulator) //Det data for this simulator? if (World.RegionInfo.RegionName == simulator)
info = new GridRegion(World.RegionInfo);
info = new GridRegion(m_ScriptEngine.World.RegionInfo);
else else
info = m_ScriptEngine.World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator); info = World.GridService.GetRegionByName(m_ScriptEngine.World.RegionInfo.ScopeID, simulator);
switch (data) switch (data)
{ {
@ -9329,12 +9328,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return UUID.Zero.ToString(); return UUID.Zero.ToString();
} }
RegionFlags regionFlags = (RegionFlags)m_ScriptEngine.World.GridService.GetRegionFlags(info.ScopeID, info.RegionID); bool isHypergridRegion = false;
if ((regionFlags & RegionFlags.Hyperlink) != 0)
if (World.RegionInfo.RegionName != simulator && info.RegionSecret != "")
{
// Hypergrid is currently placing real destination region co-ords into RegionSecret.
// But other code can also use this field for a genuine RegionSecret! Therefore, if
// anything is present we need to disambiguate.
//
// FIXME: Hypergrid should be storing this data in a different field.
RegionFlags regionFlags
= (RegionFlags)m_ScriptEngine.World.GridService.GetRegionFlags(
info.ScopeID, info.RegionID);
isHypergridRegion = (regionFlags & RegionFlags.Hyperlink) != 0;
}
if (isHypergridRegion)
{ {
uint rx = 0, ry = 0; uint rx = 0, ry = 0;
//Hypergrid Region co-ordinates
Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry); Utils.LongToUInts(Convert.ToUInt64(info.RegionSecret), out rx, out ry);
reply = new LSL_Vector( reply = new LSL_Vector(
rx, rx,
ry, ry,
@ -9342,18 +9355,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
else else
{ {
UUID regionSecret = UUID.Zero; // Local grid co-oridnates
if (UUID.TryParse(info.RegionSecret, out regionSecret)) reply = new LSL_Vector(
{ info.RegionLocX,
if (regionSecret != UUID.Zero) info.RegionLocY,
{ 0).ToString();
//Local co-oridnates
reply = new LSL_Vector(
info.RegionLocX,
info.RegionLocY,
0).ToString();
}
}
} }
break; break;
case ScriptBaseClass.DATA_SIM_STATUS: case ScriptBaseClass.DATA_SIM_STATUS: