Finally make attachments stay put. Randomize local ID generation to

prevent adjacent sims from using identical Local IDs for the attachment
Thanks to Mana Janus (Hippo Viewer) for providing the crucial bit of
information, namely that, due to a bug in the viewer, adjacent sims can't
use the same local ids.
0.6.1-post-fixes
Melanie Thielker 2008-11-29 13:17:21 +00:00
parent a00d346aab
commit 1b3a3ffc77
5 changed files with 13 additions and 13 deletions

View File

@ -57,7 +57,6 @@ namespace OpenSim.Framework
public interface IScene public interface IScene
{ {
RegionInfo RegionInfo { get; } RegionInfo RegionInfo { get; }
uint NextAvatarLocalId { get; }
RegionStatus Region_Status { get; set; } RegionStatus Region_Status { get; set; }
ClientManager ClientManager { get; } ClientManager ClientManager { get; }

View File

@ -556,7 +556,12 @@ namespace OpenSim.Region.Environment.Modules.World.Land
} }
lock (m_landList) lock (m_landList)
{ {
return m_landList[m_landIDList[x, y]]; // Corner case. If an autoreturn happens during sim startup
// we will come here with the list uninitialized
//
if (m_landList.ContainsKey(m_landIDList[x, y]))
return m_landList[m_landIDList[x, y]];
return null;
} }
} }

View File

@ -269,6 +269,8 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_config = config; m_config = config;
Random random = new Random();
m_lastAllocatedLocalId = (uint)(random.NextDouble() * (double)(uint.MaxValue/2))+(uint)(uint.MaxValue/4);
m_moduleLoader = moduleLoader; m_moduleLoader = moduleLoader;
m_authenticateHandler = authen; m_authenticateHandler = authen;
CommsManager = commsMan; CommsManager = commsMan;
@ -2182,12 +2184,12 @@ namespace OpenSim.Region.Environment.Scenes
// //
SceneObjectPart RootPrim = GetSceneObjectPart(primID); SceneObjectPart RootPrim = GetSceneObjectPart(primID);
RootPrim.SetParentLocalId(parentLocalID);
if (RootPrim != null) if (RootPrim != null)
{ {
SceneObjectGroup grp = RootPrim.ParentGroup; SceneObjectGroup grp = RootPrim.ParentGroup;
RootPrim.SetParentLocalId(parentLocalID);
if (grp != null) if (grp != null)
{ {
m_log.DebugFormat("[ATTACHMENT]: Received "+ m_log.DebugFormat("[ATTACHMENT]: Received "+
@ -2205,6 +2207,7 @@ namespace OpenSim.Region.Environment.Scenes
grp.LocalId, (uint)0, grp.LocalId, (uint)0,
grp.GroupRotation, grp.GroupRotation,
grp.AbsolutePosition, false); grp.AbsolutePosition, false);
grp.SendGroupFullUpdate();
} }
else else
{ {

View File

@ -53,7 +53,7 @@ namespace OpenSim.Region.Environment.Scenes
/// The last allocated local prim id. When a new local id is requested, the next number in the sequence is /// The last allocated local prim id. When a new local id is requested, the next number in the sequence is
/// dispensed. /// dispensed.
/// </summary> /// </summary>
private uint m_lastAllocatedLocalId = 720000; protected uint m_lastAllocatedLocalId = 720000;
private readonly Mutex _primAllocateMutex = new Mutex(false); private readonly Mutex _primAllocateMutex = new Mutex(false);
@ -92,8 +92,6 @@ namespace OpenSim.Region.Environment.Scenes
protected string m_datastore; protected string m_datastore;
private uint m_nextAvatarLocalId = 8880000;
private AssetCache m_assetCache; private AssetCache m_assetCache;
public AssetCache AssetCache public AssetCache AssetCache
@ -167,11 +165,6 @@ namespace OpenSim.Region.Environment.Scenes
get { return m_regInfo; } get { return m_regInfo; }
} }
public uint NextAvatarLocalId
{
get { return m_nextAvatarLocalId++; }
}
#region admin stuff #region admin stuff
/// <summary> /// <summary>

View File

@ -508,7 +508,7 @@ namespace OpenSim.Region.Environment.Scenes
m_scene = world; m_scene = world;
m_uuid = client.AgentId; m_uuid = client.AgentId;
m_regionInfo = reginfo; m_regionInfo = reginfo;
m_localId = m_scene.NextAvatarLocalId; m_localId = m_scene.AllocateLocalId();
IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>(); IGroupsModule gm = m_scene.RequestModuleInterface<IGroupsModule>();
if (gm != null) if (gm != null)