aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
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/Scenes/Scene.cs
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/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs76
1 files changed, 34 insertions, 42 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);