mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
* Removed some of the redundant broadcast functions in Scene and SceneGraph so it is clear who/what the broadcast is going to each time
* Removed two redundant parameters from SceneObjectPart * Changed some code in terse update sending that was meant to work with references to work with value types (since Vector3 and Quaternion are structs) * Committing a preview of a new method for sending object updates efficiently (all commented out for now)
This commit is contained in:
@@ -1193,15 +1193,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_eventManager.TriggerOnFrame();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Perform delegate action on all clients subscribing to updates from this region.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void Broadcast(Action<IClientAPI> whatToDo)
|
||||
{
|
||||
ForEachScenePresence(delegate(ScenePresence presence) { whatToDo(presence.ControllingClient); });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Backup the scene. This acts as the main method of the backup thread.
|
||||
/// </summary>
|
||||
@@ -3048,17 +3039,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
}
|
||||
|
||||
m_eventManager.TriggerOnRemovePresence(agentID);
|
||||
Broadcast(delegate(IClientAPI client)
|
||||
{
|
||||
try
|
||||
{
|
||||
client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
//We can safely ignore null reference exceptions. It means the avatar are dead and cleaned up anyway.
|
||||
}
|
||||
});
|
||||
ForEachClient(
|
||||
delegate(IClientAPI client)
|
||||
{
|
||||
//We can safely ignore null reference exceptions. It means the avatar is dead and cleaned up anyway
|
||||
try { client.SendKillObject(avatar.RegionHandle, avatar.LocalId); }
|
||||
catch (NullReferenceException) { }
|
||||
});
|
||||
|
||||
ForEachScenePresence(
|
||||
delegate(ScenePresence presence) { presence.CoarseLocationChange(); });
|
||||
@@ -3143,7 +3130,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return;
|
||||
}
|
||||
}
|
||||
Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
|
||||
ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); });
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -4211,7 +4198,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
public void ForEachClient(Action<IClientAPI> action)
|
||||
{
|
||||
m_sceneGraph.ForEachClient(action);
|
||||
ClientManager.ForEach(action);
|
||||
}
|
||||
|
||||
public void ForEachSOG(Action<SceneObjectGroup> action)
|
||||
|
||||
@@ -1107,23 +1107,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
protected internal void ForEachClient(Action<IClientAPI> action)
|
||||
{
|
||||
List<ScenePresence> splist = GetScenePresences();
|
||||
foreach (ScenePresence presence in splist)
|
||||
{
|
||||
try
|
||||
{
|
||||
action(presence.ControllingClient);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// Catch it and move on. This includes situations where splist has inconsistent info
|
||||
m_log.WarnFormat("[SCENE]: Problem processing action in ForEachClient: ", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected internal void ForEachSOG(Action<SceneObjectGroup> action)
|
||||
{
|
||||
List<SceneObjectGroup> objlist = new List<SceneObjectGroup>(SceneObjectGroupsByFullID.Values);
|
||||
|
||||
@@ -853,16 +853,6 @@ if (m_shape != null) {
|
||||
return m_offsetPosition + m_groupPosition; }
|
||||
}
|
||||
|
||||
public UUID ObjectCreator
|
||||
{
|
||||
get { return _creatorID; }
|
||||
}
|
||||
|
||||
public UUID ObjectOwner
|
||||
{
|
||||
get { return _ownerID; }
|
||||
}
|
||||
|
||||
public SceneObjectGroup ParentGroup
|
||||
{
|
||||
get { return m_parentGroup; }
|
||||
@@ -1440,7 +1430,7 @@ if (m_shape != null) {
|
||||
// Move afterwards ResetIDs as it clears the localID
|
||||
dupe.LocalId = localID;
|
||||
// This may be wrong... it might have to be applied in SceneObjectGroup to the object that's being duplicated.
|
||||
dupe._lastOwnerID = ObjectOwner;
|
||||
dupe._lastOwnerID = OwnerID;
|
||||
|
||||
byte[] extraP = new byte[Shape.ExtraParams.Length];
|
||||
Array.Copy(Shape.ExtraParams, extraP, extraP.Length);
|
||||
|
||||
@@ -2455,11 +2455,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
|
||||
Vector3 pos = m_pos;
|
||||
Vector3 vel = Velocity;
|
||||
Quaternion rot = m_bodyRot;
|
||||
pos.Z -= m_appearance.HipOffset;
|
||||
remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z),
|
||||
new Vector3(vel.X, vel.Y, vel.Z), rot, m_uuid);
|
||||
|
||||
remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue),
|
||||
LocalId, pos, Velocity, m_bodyRot, m_uuid);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||
@@ -2473,7 +2472,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
m_perfMonMS = Environment.TickCount;
|
||||
|
||||
m_scene.Broadcast(SendTerseUpdateToClient);
|
||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||
|
||||
m_lastVelocity = m_velocity;
|
||||
lastPhysPos = AbsolutePosition;
|
||||
@@ -2774,7 +2773,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
if (m_isChildAgent)
|
||||
return;
|
||||
|
||||
m_scene.Broadcast(
|
||||
m_scene.ForEachClient(
|
||||
delegate(IClientAPI client) { client.SendAnimations(animations, seqs, m_controllingClient.AgentId, objectIDs); });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user