* More refactoring to prepare for draw distance based agent sim notification.

afrisby
Teravus Ovares 2007-12-10 19:16:50 +00:00
parent baea4b793d
commit eac9bc6889
3 changed files with 48 additions and 11 deletions

View File

@ -64,6 +64,16 @@ namespace OpenSim.Framework
m_internalEndPoint = new IPEndPoint(IPAddress.Parse("0.0.0.0"), (int) port);
}
public SimpleRegionInfo(RegionInfo ConvertFrom)
{
m_regionLocX = ConvertFrom.RegionLocX;
m_regionLocY = ConvertFrom.RegionLocY;
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_remotingPort = ConvertFrom.RemotingPort;
RemotingAddress = ConvertFrom.RemotingAddress;
RegionID = LLUUID.Zero;
}
public LLUUID RegionID = LLUUID.Zero;
@ -238,6 +248,16 @@ namespace OpenSim.Framework
RemotingAddress = ConvertFrom.RemotingAddress;
RegionID = LLUUID.Zero;
}
public RegionInfo(SimpleRegionInfo ConvertFrom)
{
m_regionLocX = ConvertFrom.RegionLocX;
m_regionLocY = ConvertFrom.RegionLocY;
m_internalEndPoint = ConvertFrom.InternalEndPoint;
m_externalHostName = ConvertFrom.ExternalHostName;
m_remotingPort = ConvertFrom.RemotingPort;
RemotingAddress = ConvertFrom.RemotingAddress;
RegionID = LLUUID.Zero;
}
//not in use, should swap to nini though.
public void LoadFromNiniSource(IConfigSource source)
{

View File

@ -271,6 +271,11 @@ namespace OpenSim.Region.Environment.Scenes
// We have to tell all our ScenePresences about it..
// and add it to the neighbor list.
// We only add it to the neighbor list if it's within 1 region from here.
// Agents may have draw distance values that cross two regions though, so
// we add it to the notify list regardless of distance.
// We'll check the agent's draw distance before notifying them though.
if (RegionInfo.RegionHandle != otherRegion.RegionHandle)
{
@ -297,7 +302,6 @@ namespace OpenSim.Region.Environment.Scenes
{
m_neighbours.Add(otherRegion);
}
if (!(m_regionRestartNotifyList.Contains(otherRegion)))
{
m_regionRestartNotifyList.Add(otherRegion);
@ -313,6 +317,9 @@ namespace OpenSim.Region.Environment.Scenes
MainLog.Instance.Verbose("INTERGRID", "Got notice about Region at X:" + otherRegion.RegionLocX.ToString() + " Y:" + otherRegion.RegionLocY.ToString() + " but it was too far away to send to the client");
}
}
return true;
}
@ -1250,7 +1257,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="presence"></param>
public void InformClientOfNeighbours(ScenePresence presence)
{
m_sceneGridService.EnableNeighbourChildAgents(presence);
m_sceneGridService.EnableNeighbourChildAgents(presence, m_neighbours);
}
/// <summary>
@ -1260,7 +1267,7 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="region"></param>
public void InformClientOfNeighbor(ScenePresence presence, RegionInfo region)
{
m_sceneGridService.InformNeighborChildAgent(presence, region);
m_sceneGridService.InformNeighborChildAgent(presence, region, m_neighbours);
}
/// <summary>

View File

@ -191,14 +191,24 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
///
/// </summary>
public void EnableNeighbourChildAgents(ScenePresence avatar)
public void EnableNeighbourChildAgents(ScenePresence avatar, List<RegionInfo> lstneighbours)
{
List<SimpleRegionInfo> neighbours =
m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
//m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
for (int i = 0; i < lstneighbours.Count; i++)
{
// We don't want to keep sending to regions that consistently fail on comms.
if (!(lstneighbours[i].commFailTF))
{
neighbours.Add(new SimpleRegionInfo(lstneighbours[i]));
}
}
if (neighbours != null)
{
for (int i = 0; i < neighbours.Count; i++)
{
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
agent.InventoryFolder = LLUUID.Zero;
@ -212,7 +222,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
}
public void InformNeighborChildAgent(ScenePresence avatar, RegionInfo region)
public void InformNeighborChildAgent(ScenePresence avatar, RegionInfo region, List<RegionInfo> neighbours)
{
AgentCircuitData agent = avatar.ControllingClient.RequestClientInfo();
agent.BaseFolder = LLUUID.Zero;
@ -257,7 +267,7 @@ namespace OpenSim.Region.Environment.Scenes
List<SimpleRegionInfo> neighbours = new List<SimpleRegionInfo>();
// This stays uncached because we don't already know about our neighbors at this point.
neighbours = m_commsProvider.GridService.RequestNeighbours(m_regionInfo.RegionLocX, m_regionInfo.RegionLocY);
if (neighbours != null)
{