Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

bulletsim
Justin Clark-Casey (justincc) 2011-06-10 20:42:15 +01:00
commit 08db3c5a8e
3 changed files with 64 additions and 34 deletions

View File

@ -147,8 +147,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
{ {
base.AgentHasMovedAway(sp, logout); base.AgentHasMovedAway(sp, logout);
if (logout) if (logout)
{
// Reset the map
ResetMap(sp);
// Log them out of this grid // Log them out of this grid
m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId); m_aScene.PresenceService.LogoutAgent(sp.ControllingClient.SessionId);
}
} }
protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout) protected override bool CreateAgent(ScenePresence sp, GridRegion reg, GridRegion finalDestination, AgentCircuitData agentCircuit, uint teleportFlags, out string reason, out bool logout)
@ -280,6 +285,27 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
} }
protected void ResetMap(ScenePresence sp)
{
List<GridRegion> regions = m_Scenes[0].GridService.GetRegionRange(m_Scenes[0].RegionInfo.ScopeID, 0, 17000 * (int)Constants.RegionSize, 0, 17000 * (int)Constants.RegionSize);
m_log.DebugFormat("[HG ENTITY TRANSFER MODULE]: Resetting {0} tiles on the map", regions.Count);
if (regions != null)
{
List<MapBlockData> mapBlocks = new List<MapBlockData>();
foreach (GridRegion r in regions)
{
MapBlockData mblock = new MapBlockData();
mblock.X = (ushort)(r.RegionLocX / Constants.RegionSize);
mblock.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
mblock.Name = "";
mblock.Access = 254; // means 'simulator is offline'. We need this because the viewer ignores 255's
mblock.MapImageId = UUID.Zero;
mapBlocks.Add(mblock);
}
sp.ControllingClient.SendMapBlock(mapBlocks, 0);
}
}
#endregion #endregion

View File

@ -59,44 +59,44 @@ namespace OpenSim.Region.CoreModules.Hypergrid
#endregion #endregion
protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag) //protected override void GetAndSendBlocks(IClientAPI remoteClient, int minX, int minY, int maxX, int maxY, uint flag)
{ //{
List<MapBlockData> mapBlocks = new List<MapBlockData>(); // List<MapBlockData> mapBlocks = new List<MapBlockData>();
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, // List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize, // minX * (int)Constants.RegionSize, maxX * (int)Constants.RegionSize,
minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize); // minY * (int)Constants.RegionSize, maxY * (int)Constants.RegionSize);
foreach (GridRegion r in regions) // foreach (GridRegion r in regions)
{ // {
uint x = 0, y = 0; // uint x = 0, y = 0;
long handle = 0; // long handle = 0;
if (r.RegionSecret != null && r.RegionSecret != string.Empty) // if (r.RegionSecret != null && r.RegionSecret != string.Empty)
{ // {
if (long.TryParse(r.RegionSecret, out handle)) // if (long.TryParse(r.RegionSecret, out handle))
{ // {
Utils.LongToUInts((ulong)handle, out x, out y); // Utils.LongToUInts((ulong)handle, out x, out y);
x = x / Constants.RegionSize; // x = x / Constants.RegionSize;
y = y / Constants.RegionSize; // y = y / Constants.RegionSize;
} // }
} // }
if (handle == 0 || // if (handle == 0 ||
// Check the distance from the current region // // Check the distance from the current region
(handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096)) // (handle != 0 && Math.Abs((int)(x - m_scene.RegionInfo.RegionLocX)) < 4096 && Math.Abs((int)(y - m_scene.RegionInfo.RegionLocY)) < 4096))
{ // {
MapBlockData block = new MapBlockData(); // MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r); // MapBlockFromGridRegion(block, r);
mapBlocks.Add(block); // mapBlocks.Add(block);
} // }
} // }
// Different from super // // Different from super
FillInMap(mapBlocks, minX, minY, maxX, maxY); // //FillInMap(mapBlocks, minX, minY, maxX, maxY);
// // //
remoteClient.SendMapBlock(mapBlocks, 0); // remoteClient.SendMapBlock(mapBlocks, 0);
} //}
private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY) private void FillInMap(List<MapBlockData> mapBlocks, int minX, int minY, int maxX, int maxY)

View File

@ -303,7 +303,11 @@ namespace OpenSim.Region.Physics.Meshing
if (meshOsd is OSDMap) if (meshOsd is OSDMap)
{ {
OSDMap map = (OSDMap)meshOsd; OSDMap map = (OSDMap)meshOsd;
OSDMap physicsParms = (OSDMap)map["physics_shape"]; OSDMap physicsParms = (OSDMap)map["physics_shape"]; // old asset format
if (physicsParms.Count == 0)
physicsParms = (OSDMap)map["physics_mesh"]; // new asset format
int physOffset = physicsParms["offset"].AsInteger() + (int)start; int physOffset = physicsParms["offset"].AsInteger() + (int)start;
int physSize = physicsParms["size"].AsInteger(); int physSize = physicsParms["size"].AsInteger();