aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorDan Lake2011-11-03 17:06:08 -0700
committerDan Lake2011-11-03 17:06:08 -0700
commit94dc7d07ebc22ce0e0d9b77e91538ddc90799bee (patch)
tree0d2ffc74fa937af0ca5d9e6fb2fafeac2c37dd61 /OpenSim/Region/Framework
parentremove the pointless check of the face texture struct against null in Bot.Obj... (diff)
downloadopensim-SC_OLD-94dc7d07ebc22ce0e0d9b77e91538ddc90799bee.zip
opensim-SC_OLD-94dc7d07ebc22ce0e0d9b77e91538ddc90799bee.tar.gz
opensim-SC_OLD-94dc7d07ebc22ce0e0d9b77e91538ddc90799bee.tar.bz2
opensim-SC_OLD-94dc7d07ebc22ce0e0d9b77e91538ddc90799bee.tar.xz
Renamed ForEachRootScenePresence to ForEachAvatar. Cleaned up calls to
the 3 iteration functions so more of them are using the correct iteration for the action they are performing. The 3 iterators that seem to fit all actions within OpenSim at this time are: ForEachAvatar: Perform an action on all avatars (root presences) ForEachClient: Perform an action on all clients (root or child clients) ForEachRootClient: Perform an action on all clients that have an avatar There are still a dozen places or so calling the old ForEachScenePresence that will take a little more refactoring to eliminate.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs76
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs20
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
6 files changed, 55 insertions, 63 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index dff43fd..b996e86 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -872,7 +872,7 @@ namespace OpenSim.Region.Framework.Scenes
872 872
873 try 873 try
874 { 874 {
875 ForEachRootScenePresence(delegate(ScenePresence agent) 875 ForEachAvatar(delegate(ScenePresence agent)
876 { 876 {
877 //agent.ControllingClient.new 877 //agent.ControllingClient.new
878 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 878 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
@@ -1017,7 +1017,7 @@ namespace OpenSim.Region.Framework.Scenes
1017 GridRegion r = new GridRegion(region); 1017 GridRegion r = new GridRegion(region);
1018 try 1018 try
1019 { 1019 {
1020 ForEachRootScenePresence(delegate(ScenePresence agent) 1020 ForEachAvatar(delegate(ScenePresence agent)
1021 { 1021 {
1022 if (m_teleportModule != null) 1022 if (m_teleportModule != null)
1023 m_teleportModule.EnableChildAgent(agent, r); 1023 m_teleportModule.EnableChildAgent(agent, r);
@@ -1423,12 +1423,10 @@ namespace OpenSim.Region.Framework.Scenes
1423 /// <param name="stats">Stats on the Simulator's performance</param> 1423 /// <param name="stats">Stats on the Simulator's performance</param>
1424 private void SendSimStatsPackets(SimStats stats) 1424 private void SendSimStatsPackets(SimStats stats)
1425 { 1425 {
1426 ForEachRootScenePresence( 1426 ForEachRootClient(delegate(IClientAPI client)
1427 delegate(ScenePresence agent) 1427 {
1428 { 1428 client.SendSimStats(stats);
1429 agent.ControllingClient.SendSimStats(stats); 1429 });
1430 }
1431 );
1432 } 1430 }
1433 1431
1434 /// <summary> 1432 /// <summary>
@@ -4214,35 +4212,32 @@ namespace OpenSim.Region.Framework.Scenes
4214 return m_sceneGraph.GetScenePresence(localID); 4212 return m_sceneGraph.GetScenePresence(localID);
4215 } 4213 }
4216 4214
4215 /// <summary>
4216 /// Returns true if scene presence is a child (no avatar in this scene)
4217 /// </summary>
4218 /// <param name="avatarID"></param>
4219 /// <returns></returns>
4217 public override bool PresenceChildStatus(UUID avatarID) 4220 public override bool PresenceChildStatus(UUID avatarID)
4218 { 4221 {
4219 ScenePresence cp = GetScenePresence(avatarID); 4222 ScenePresence sp;
4220 4223 return TryGetScenePresence(avatarID, out sp) && sp.IsChildAgent;
4221 // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing
4222 // This needs to be fixed properly by cleaning up the logout code.
4223 //if (cp != null)
4224 // return cp.IsChildAgent;
4225
4226 //return false;
4227
4228 return cp.IsChildAgent;
4229 } 4224 }
4230 4225
4231 /// <summary> 4226 /// <summary>
4232 /// Performs action on all ROOT (not child) scene presences. 4227 /// Performs action on all avatars in the scene (root scene presences)
4233 /// This is just a shortcut function since frequently actions only appy to root SPs 4228 /// Avatars may be an NPC or a 'real' client.
4234 /// </summary> 4229 /// </summary>
4235 /// <param name="action"></param> 4230 /// <param name="action"></param>
4236 public void ForEachRootScenePresence(Action<ScenePresence> action) 4231 public void ForEachAvatar(Action<ScenePresence> action)
4237 { 4232 {
4238 if(m_sceneGraph != null) 4233 if(m_sceneGraph != null)
4239 { 4234 {
4240 m_sceneGraph.ForEachRootScenePresence(action); 4235 m_sceneGraph.ForEachAvatar(action);
4241 } 4236 }
4242 } 4237 }
4243 4238
4244 /// <summary> 4239 /// <summary>
4245 /// Performs action on all scene presences. 4240 /// Performs action on all scene presences (root and child)
4246 /// </summary> 4241 /// </summary>
4247 /// <param name="action"></param> 4242 /// <param name="action"></param>
4248 public void ForEachScenePresence(Action<ScenePresence> action) 4243 public void ForEachScenePresence(Action<ScenePresence> action)
@@ -4254,25 +4249,6 @@ namespace OpenSim.Region.Framework.Scenes
4254 } 4249 }
4255 4250
4256 /// <summary> 4251 /// <summary>
4257 /// Perform the given action for each object
4258 /// </summary>
4259 /// <param name="action"></param>
4260 // public void ForEachObject(Action<SceneObjectGroup> action)
4261 // {
4262 // List<SceneObjectGroup> presenceList;
4263 //
4264 // lock (m_sceneObjects)
4265 // {
4266 // presenceList = new List<SceneObjectGroup>(m_sceneObjects.Values);
4267 // }
4268 //
4269 // foreach (SceneObjectGroup presence in presenceList)
4270 // {
4271 // action(presence);
4272 // }
4273 // }
4274
4275 /// <summary>
4276 /// Get a group via its UUID 4252 /// Get a group via its UUID
4277 /// </summary> 4253 /// </summary>
4278 /// <param name="fullID"></param> 4254 /// <param name="fullID"></param>
@@ -4344,6 +4320,22 @@ namespace OpenSim.Region.Framework.Scenes
4344 return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar); 4320 return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar);
4345 } 4321 }
4346 4322
4323 /// <summary>
4324 /// Perform an action on all clients with an avatar in this scene (root only)
4325 /// </summary>
4326 /// <param name="action"></param>
4327 public void ForEachRootClient(Action<IClientAPI> action)
4328 {
4329 ForEachAvatar(delegate(ScenePresence presence)
4330 {
4331 action(presence.ControllingClient);
4332 });
4333 }
4334
4335 /// <summary>
4336 /// Perform an action on all clients connected to the region (root and child)
4337 /// </summary>
4338 /// <param name="action"></param>
4347 public void ForEachClient(Action<IClientAPI> action) 4339 public void ForEachClient(Action<IClientAPI> action)
4348 { 4340 {
4349 m_clientManager.ForEachSync(action); 4341 m_clientManager.ForEachSync(action);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 82ded28..a137bca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1190,7 +1190,7 @@ namespace OpenSim.Region.Framework.Scenes
1190 /// This is just a shortcut function since frequently actions only appy to root SPs 1190 /// This is just a shortcut function since frequently actions only appy to root SPs
1191 /// </summary> 1191 /// </summary>
1192 /// <param name="action"></param> 1192 /// <param name="action"></param>
1193 public void ForEachRootScenePresence(Action<ScenePresence> action) 1193 public void ForEachAvatar(Action<ScenePresence> action)
1194 { 1194 {
1195 ForEachScenePresence(delegate(ScenePresence sp) 1195 ForEachScenePresence(delegate(ScenePresence sp)
1196 { 1196 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 3bfd866..9b72bee 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -458,16 +458,16 @@ namespace OpenSim.Region.Framework.Scenes
458 ForEachCurrentScene( 458 ForEachCurrentScene(
459 delegate(Scene scene) 459 delegate(Scene scene)
460 { 460 {
461 scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) 461 scene.ForEachRootClient(delegate(IClientAPI client)
462 { 462 {
463 if (name == null || scenePresence.Name == name) 463 if (name == null || client.Name == name)
464 { 464 {
465 m_log.DebugFormat("Packet debug for {0} {1} set to {2}", 465 m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
466 scenePresence.Firstname, 466 client.FirstName,
467 scenePresence.Lastname, 467 client.LastName,
468 newDebug); 468 newDebug);
469 469
470 scenePresence.ControllingClient.DebugPacketLevel = newDebug; 470 client.DebugPacketLevel = newDebug;
471 } 471 }
472 }); 472 });
473 } 473 }
@@ -481,7 +481,7 @@ namespace OpenSim.Region.Framework.Scenes
481 ForEachCurrentScene( 481 ForEachCurrentScene(
482 delegate(Scene scene) 482 delegate(Scene scene)
483 { 483 {
484 scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) 484 scene.ForEachAvatar(delegate(ScenePresence scenePresence)
485 { 485 {
486 avatars.Add(scenePresence); 486 avatars.Add(scenePresence);
487 }); 487 });
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index a0a7344..3c80eb5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1150,7 +1150,7 @@ namespace OpenSim.Region.Framework.Scenes
1150 { 1150 {
1151 SceneObjectPart part = parts[i]; 1151 SceneObjectPart part = parts[i];
1152 1152
1153 Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1153 Scene.ForEachAvatar(delegate(ScenePresence avatar)
1154 { 1154 {
1155 if (avatar.ParentID == LocalId) 1155 if (avatar.ParentID == LocalId)
1156 avatar.StandUp(); 1156 avatar.StandUp();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 44f822c..1a709e9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -992,7 +992,7 @@ namespace OpenSim.Region.Framework.Scenes
992 public PrimitiveBaseShape Shape 992 public PrimitiveBaseShape Shape
993 { 993 {
994 get { return m_shape; } 994 get { return m_shape; }
995 set { m_shape = value; } 995 set { m_shape = value;}
996 } 996 }
997 997
998 /// <summary> 998 /// <summary>
@@ -1336,12 +1336,12 @@ namespace OpenSim.Region.Framework.Scenes
1336 /// <param name="AgentID"></param> 1336 /// <param name="AgentID"></param>
1337 private void SendRootPartPropertiesToClient(UUID AgentID) 1337 private void SendRootPartPropertiesToClient(UUID AgentID)
1338 { 1338 {
1339 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1339 m_parentGroup.Scene.ForEachClient(delegate(IClientAPI client)
1340 { 1340 {
1341 // Ugly reference :( 1341 // Ugly reference :(
1342 if (avatar.UUID == AgentID) 1342 if (client.AgentId == AgentID)
1343 { 1343 {
1344 m_parentGroup.SendPropertiesToClient(avatar.ControllingClient); 1344 m_parentGroup.SendPropertiesToClient(client);
1345 } 1345 }
1346 }); 1346 });
1347 } 1347 }
@@ -1461,9 +1461,9 @@ namespace OpenSim.Region.Framework.Scenes
1461 if (volume < 0) 1461 if (volume < 0)
1462 volume = 0; 1462 volume = 0;
1463 1463
1464 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) 1464 m_parentGroup.Scene.ForEachRootClient(delegate(IClientAPI client)
1465 { 1465 {
1466 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); 1466 client.SendAttachedSoundGainChange(UUID, (float)volume);
1467 }); 1467 });
1468 } 1468 }
1469 1469
@@ -2216,7 +2216,7 @@ namespace OpenSim.Region.Framework.Scenes
2216 } 2216 }
2217 else 2217 else
2218 { 2218 {
2219 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) 2219 m_parentGroup.Scene.ForEachAvatar(delegate(ScenePresence av)
2220 { 2220 {
2221 if (av.LocalId == localId) 2221 if (av.LocalId == localId)
2222 { 2222 {
@@ -2347,7 +2347,7 @@ namespace OpenSim.Region.Framework.Scenes
2347 } 2347 }
2348 else 2348 else
2349 { 2349 {
2350 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) 2350 m_parentGroup.Scene.ForEachAvatar(delegate(ScenePresence av)
2351 { 2351 {
2352 if (av.LocalId == localId) 2352 if (av.LocalId == localId)
2353 { 2353 {
@@ -2470,7 +2470,7 @@ namespace OpenSim.Region.Framework.Scenes
2470 } 2470 }
2471 else 2471 else
2472 { 2472 {
2473 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) 2473 m_parentGroup.Scene.ForEachAvatar(delegate(ScenePresence av)
2474 { 2474 {
2475 if (av.LocalId == localId) 2475 if (av.LocalId == localId)
2476 { 2476 {
@@ -2696,7 +2696,7 @@ namespace OpenSim.Region.Framework.Scenes
2696 } 2696 }
2697 } 2697 }
2698 2698
2699 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) 2699 m_parentGroup.Scene.ForEachAvatar(delegate(ScenePresence sp)
2700 { 2700 {
2701 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) 2701 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2702 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); 2702 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1d77b06..5fc597c 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -956,7 +956,7 @@ namespace OpenSim.Region.Framework.Scenes
956 } 956 }
957 957
958 // send the animations of the other presences to me 958 // send the animations of the other presences to me
959 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 959 m_scene.ForEachAvatar(delegate(ScenePresence presence)
960 { 960 {
961 if (presence != this) 961 if (presence != this)
962 presence.Animator.SendAnimPackToClient(ControllingClient); 962 presence.Animator.SendAnimPackToClient(ControllingClient);
@@ -2596,7 +2596,7 @@ namespace OpenSim.Region.Framework.Scenes
2596 public void SendOtherAgentsAvatarDataToMe() 2596 public void SendOtherAgentsAvatarDataToMe()
2597 { 2597 {
2598 int count = 0; 2598 int count = 0;
2599 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) 2599 m_scene.ForEachAvatar(delegate(ScenePresence scenePresence)
2600 { 2600 {
2601 // only send information about other root agents 2601 // only send information about other root agents
2602 if (scenePresence.UUID == UUID) 2602 if (scenePresence.UUID == UUID)
@@ -2660,7 +2660,7 @@ namespace OpenSim.Region.Framework.Scenes
2660// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID); 2660// m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} {1}", Name, UUID);
2661 2661
2662 int count = 0; 2662 int count = 0;
2663 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) 2663 m_scene.ForEachAvatar(delegate(ScenePresence scenePresence)
2664 { 2664 {
2665 // only send information about other root agents 2665 // only send information about other root agents
2666 if (scenePresence.UUID == UUID) 2666 if (scenePresence.UUID == UUID)