* Only lock the Borders when they're being changed, otherwise one avatar's movement could hinder another avatar's movement.

remotes/origin/0.6.7-post-fixes
Teravus Ovares (Dan Olivares) 2009-08-29 03:36:41 -04:00
parent 9eb8c14e87
commit d45f871d8f
2 changed files with 185 additions and 69 deletions

View File

@ -237,19 +237,30 @@ namespace OpenSim.Region.CoreModules.World.Land
conn.RegionScene.RegionInfo.RegionName, conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
scene.BordersLocked = true;
conn.RegionScene.BordersLocked = true;
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
lock (conn.RegionScene.EastBorders)
conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
lock (conn.RegionScene.NorthBorders)
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock (conn.RegionScene.SouthBorders)
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock (scene.WestBorders)
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
// Reset Terrain.. since terrain normally loads first. // Reset Terrain.. since terrain normally loads first.
// //
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
conn.RegionScene.BordersLocked = false;
scene.BordersLocked = false;
connectedYN = true; connectedYN = true;
break; break;
@ -277,16 +288,23 @@ namespace OpenSim.Region.CoreModules.World.Land
extents.X = conn.XEnd; extents.X = conn.XEnd;
conn.UpdateExtents(extents); conn.UpdateExtents(extents);
scene.BordersLocked = true;
conn.RegionScene.BordersLocked = true;
m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}", m_log.DebugFormat("Scene: {0} to the northeast of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName, conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents); conn.RegionScene.PhysicsScene.Combine(null,Vector3.Zero,extents);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
lock(conn.RegionScene.NorthBorders)
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
lock(conn.RegionScene.EastBorders)
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock(conn.RegionScene.WestBorders)
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock(scene.SouthBorders)
scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
// Reset Terrain.. since terrain normally loads first. // Reset Terrain.. since terrain normally loads first.
@ -294,6 +312,9 @@ namespace OpenSim.Region.CoreModules.World.Land
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
scene.BordersLocked = false;
conn.RegionScene.BordersLocked = false;
connectedYN = true; connectedYN = true;
break; break;
} }
@ -318,35 +339,47 @@ namespace OpenSim.Region.CoreModules.World.Land
extents.X = regionConnections.XEnd + conn.XEnd; extents.X = regionConnections.XEnd + conn.XEnd;
conn.UpdateExtents(extents); conn.UpdateExtents(extents);
scene.BordersLocked = true;
conn.RegionScene.BordersLocked = true;
m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}", m_log.DebugFormat("Scene: {0} to the NorthEast of Scene{1} Offset: {2}. Extents:{3}",
conn.RegionScene.RegionInfo.RegionName, conn.RegionScene.RegionInfo.RegionName,
regionConnections.RegionScene.RegionInfo.RegionName, offset, extents); regionConnections.RegionScene.RegionInfo.RegionName, offset, extents);
conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents); conn.RegionScene.PhysicsScene.Combine(null, Vector3.Zero, extents);
scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero); scene.PhysicsScene.Combine(conn.RegionScene.PhysicsScene, offset, Vector3.Zero);
lock(conn.RegionScene.NorthBorders)
if (conn.RegionScene.NorthBorders.Count == 1)// && 2) if (conn.RegionScene.NorthBorders.Count == 1)// && 2)
{ {
//compound border //compound border
// already locked above
conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize; conn.RegionScene.NorthBorders[0].BorderLine.Z += (int)Constants.RegionSize;
lock(conn.RegionScene.EastBorders)
conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.EastBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock(conn.RegionScene.WestBorders)
conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.WestBorders[0].BorderLine.Y += (int)Constants.RegionSize;
} }
lock(scene.SouthBorders)
scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south scene.SouthBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport south
lock(conn.RegionScene.EastBorders)
if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2) if (conn.RegionScene.EastBorders.Count == 1)// && conn.RegionScene.EastBorders.Count == 2)
{ {
conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize; conn.RegionScene.EastBorders[0].BorderLine.Z += (int)Constants.RegionSize;
lock(conn.RegionScene.NorthBorders)
conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.NorthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
lock(conn.RegionScene.SouthBorders)
conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize; conn.RegionScene.SouthBorders[0].BorderLine.Y += (int)Constants.RegionSize;
} }
lock (scene.WestBorders)
scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West scene.WestBorders[0].BorderLine.Z += (int)Constants.RegionSize; //auto teleport West
/* /*
else else
@ -363,6 +396,8 @@ namespace OpenSim.Region.CoreModules.World.Land
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised());
//conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised()); //conn.RegionScene.PhysicsScene.SetTerrain(conn.RegionScene.Heightmap.GetFloatsSerialised());
scene.BordersLocked = false;
conn.RegionScene.BordersLocked = false;
connectedYN = true; connectedYN = true;

View File

@ -81,6 +81,8 @@ namespace OpenSim.Region.Framework.Scenes
protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
public volatile bool BordersLocked = false;
public List<Border> NorthBorders = new List<Border>(); public List<Border> NorthBorders = new List<Border>();
public List<Border> EastBorders = new List<Border>(); public List<Border> EastBorders = new List<Border>();
public List<Border> SouthBorders = new List<Border>(); public List<Border> SouthBorders = new List<Border>();
@ -332,6 +334,8 @@ namespace OpenSim.Region.Framework.Scenes
Random random = new Random(); Random random = new Random();
BordersLocked = true;
Border northBorder = new Border(); Border northBorder = new Border();
northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
northBorder.CrossDirection = Cardinals.N; northBorder.CrossDirection = Cardinals.N;
@ -352,6 +356,7 @@ namespace OpenSim.Region.Framework.Scenes
westBorder.CrossDirection = Cardinals.W; westBorder.CrossDirection = Cardinals.W;
WestBorders.Add(westBorder); WestBorders.Add(westBorder);
BordersLocked = false;
m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4); m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4);
m_moduleLoader = moduleLoader; m_moduleLoader = moduleLoader;
@ -482,6 +487,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="regInfo"></param> /// <param name="regInfo"></param>
public Scene(RegionInfo regInfo) public Scene(RegionInfo regInfo)
{ {
BordersLocked = true;
Border northBorder = new Border(); Border northBorder = new Border();
northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<--- northBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, (int)Constants.RegionSize); //<---
northBorder.CrossDirection = Cardinals.N; northBorder.CrossDirection = Cardinals.N;
@ -501,6 +507,7 @@ namespace OpenSim.Region.Framework.Scenes
westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //---> westBorder.BorderLine = new Vector3(0, (int)Constants.RegionSize, 0); //--->
westBorder.CrossDirection = Cardinals.W; westBorder.CrossDirection = Cardinals.W;
WestBorders.Add(westBorder); WestBorders.Add(westBorder);
BordersLocked = false;
m_regInfo = regInfo; m_regInfo = regInfo;
m_eventManager = new EventManager(); m_eventManager = new EventManager();
@ -1801,7 +1808,8 @@ namespace OpenSim.Region.Framework.Scenes
public Border GetCrossedBorder(Vector3 position, Cardinals gridline) public Border GetCrossedBorder(Vector3 position, Cardinals gridline)
{ {
if (BordersLocked)
{
switch (gridline) switch (gridline)
{ {
case Cardinals.N: case Cardinals.N:
@ -1815,8 +1823,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
break; break;
case Cardinals.S: case Cardinals.S:
lock (SouthBorders) lock (SouthBorders)
{ {
foreach (Border b in SouthBorders) foreach (Border b in SouthBorders)
@ -1851,18 +1857,59 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
} }
}
else
{
switch (gridline)
{
case Cardinals.N:
foreach (Border b in NorthBorders)
{
if (b.TestCross(position))
return b;
}
break;
case Cardinals.S:
foreach (Border b in SouthBorders)
{
if (b.TestCross(position))
return b;
}
break;
case Cardinals.E:
foreach (Border b in EastBorders)
{
if (b.TestCross(position))
return b;
}
break;
case Cardinals.W:
foreach (Border b in WestBorders)
{
if (b.TestCross(position))
return b;
}
break;
}
}
return null; return null;
} }
public bool TestBorderCross(Vector3 position, Cardinals border) public bool TestBorderCross(Vector3 position, Cardinals border)
{
if (BordersLocked)
{ {
switch (border) switch (border)
{ {
case Cardinals.N: case Cardinals.N:
lock (NorthBorders) lock (NorthBorders)
{ {
foreach(Border b in NorthBorders) foreach (Border b in NorthBorders)
{ {
if (b.TestCross(position)) if (b.TestCross(position))
return true; return true;
@ -1899,7 +1946,41 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
break; break;
}
}
else
{
switch (border)
{
case Cardinals.N:
foreach (Border b in NorthBorders)
{
if (b.TestCross(position))
return true;
}
break;
case Cardinals.E:
foreach (Border b in EastBorders)
{
if (b.TestCross(position))
return true;
}
break;
case Cardinals.S:
foreach (Border b in SouthBorders)
{
if (b.TestCross(position))
return true;
}
break;
case Cardinals.W:
foreach (Border b in WestBorders)
{
if (b.TestCross(position))
return true;
}
break;
}
} }
return false; return false;
} }