diff options
author | Dan Lake | 2011-10-27 00:42:21 -0700 |
---|---|---|
committer | Dan Lake | 2011-10-27 00:42:21 -0700 |
commit | b98613091cd6dc2f914fb5ab38ca33cdff21fc24 (patch) | |
tree | 42be01a68146870ddcd64e842a13f2fbb46b4738 /OpenSim/Region/Framework/Scenes | |
parent | For now, comment out error message on new script engine console commands. (diff) | |
download | opensim-SC-b98613091cd6dc2f914fb5ab38ca33cdff21fc24.zip opensim-SC-b98613091cd6dc2f914fb5ab38ca33cdff21fc24.tar.gz opensim-SC-b98613091cd6dc2f914fb5ab38ca33cdff21fc24.tar.bz2 opensim-SC-b98613091cd6dc2f914fb5ab38ca33cdff21fc24.tar.xz |
Added new ForEachRootScenePresence to Scene since almost every delegate passed to ForEachScenePresence checks for !IsChildAgent first. It consolidates child and root handling for coming refactors.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 16 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneManager.cs | 9 |
3 files changed, 50 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e43185d..302103a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -893,22 +893,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
893 | 893 | ||
894 | try | 894 | try |
895 | { | 895 | { |
896 | ForEachScenePresence(delegate(ScenePresence agent) | 896 | ForEachRootScenePresence(delegate(ScenePresence agent) |
897 | { | 897 | { |
898 | // If agent is a root agent. | 898 | //agent.ControllingClient.new |
899 | if (!agent.IsChildAgent) | 899 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); |
900 | { | 900 | |
901 | //agent.ControllingClient.new | 901 | List<ulong> old = new List<ulong>(); |
902 | //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); | 902 | old.Add(otherRegion.RegionHandle); |
903 | 903 | agent.DropOldNeighbours(old); | |
904 | List<ulong> old = new List<ulong>(); | 904 | if (m_teleportModule != null) |
905 | old.Add(otherRegion.RegionHandle); | 905 | m_teleportModule.EnableChildAgent(agent, otherRegion); |
906 | agent.DropOldNeighbours(old); | 906 | }); |
907 | if (m_teleportModule != null) | ||
908 | m_teleportModule.EnableChildAgent(agent, otherRegion); | ||
909 | } | ||
910 | } | ||
911 | ); | ||
912 | } | 907 | } |
913 | catch (NullReferenceException) | 908 | catch (NullReferenceException) |
914 | { | 909 | { |
@@ -1043,16 +1038,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1043 | GridRegion r = new GridRegion(region); | 1038 | GridRegion r = new GridRegion(region); |
1044 | try | 1039 | try |
1045 | { | 1040 | { |
1046 | ForEachScenePresence(delegate(ScenePresence agent) | 1041 | ForEachRootScenePresence(delegate(ScenePresence agent) |
1047 | { | 1042 | { |
1048 | // If agent is a root agent. | 1043 | if (m_teleportModule != null) |
1049 | if (!agent.IsChildAgent) | 1044 | m_teleportModule.EnableChildAgent(agent, r); |
1050 | { | 1045 | }); |
1051 | if (m_teleportModule != null) | ||
1052 | m_teleportModule.EnableChildAgent(agent, r); | ||
1053 | } | ||
1054 | } | ||
1055 | ); | ||
1056 | } | 1046 | } |
1057 | catch (NullReferenceException) | 1047 | catch (NullReferenceException) |
1058 | { | 1048 | { |
@@ -1456,11 +1446,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1456 | /// <param name="stats">Stats on the Simulator's performance</param> | 1446 | /// <param name="stats">Stats on the Simulator's performance</param> |
1457 | private void SendSimStatsPackets(SimStats stats) | 1447 | private void SendSimStatsPackets(SimStats stats) |
1458 | { | 1448 | { |
1459 | ForEachScenePresence( | 1449 | ForEachRootScenePresence( |
1460 | delegate(ScenePresence agent) | 1450 | delegate(ScenePresence agent) |
1461 | { | 1451 | { |
1462 | if (!agent.IsChildAgent) | 1452 | agent.ControllingClient.SendSimStats(stats); |
1463 | agent.ControllingClient.SendSimStats(stats); | ||
1464 | } | 1453 | } |
1465 | ); | 1454 | ); |
1466 | } | 1455 | } |
@@ -4290,6 +4279,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
4290 | } | 4279 | } |
4291 | 4280 | ||
4292 | /// <summary> | 4281 | /// <summary> |
4282 | /// Performs action on all ROOT (not child) scene presences. | ||
4283 | /// This is just a shortcut function since frequently actions only appy to root SPs | ||
4284 | /// </summary> | ||
4285 | /// <param name="action"></param> | ||
4286 | public void ForEachRootScenePresence(Action<ScenePresence> action) | ||
4287 | { | ||
4288 | if(m_sceneGraph != null) | ||
4289 | { | ||
4290 | m_sceneGraph.ForEachRootScenePresence(action); | ||
4291 | } | ||
4292 | } | ||
4293 | |||
4294 | /// <summary> | ||
4293 | /// Performs action on all scene presences. | 4295 | /// Performs action on all scene presences. |
4294 | /// </summary> | 4296 | /// </summary> |
4295 | /// <param name="action"></param> | 4297 | /// <param name="action"></param> |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index caec704..542bd51 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1190,7 +1190,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1190 | } | 1190 | } |
1191 | } | 1191 | } |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | /// <summary> | ||
1195 | /// Performs action on all ROOT (not child) scene presences. | ||
1196 | /// This is just a shortcut function since frequently actions only appy to root SPs | ||
1197 | /// </summary> | ||
1198 | /// <param name="action"></param> | ||
1199 | public void ForEachRootScenePresence(Action<ScenePresence> action) | ||
1200 | { | ||
1201 | ForEachScenePresence(delegate(ScenePresence sp) | ||
1202 | { | ||
1203 | if (!sp.IsChildAgent) | ||
1204 | action(sp); | ||
1205 | }); | ||
1206 | } | ||
1207 | |||
1194 | /// <summary> | 1208 | /// <summary> |
1195 | /// Performs action on all scene presences. This can ultimately run the actions in parallel but | 1209 | /// Performs action on all scene presences. This can ultimately run the actions in parallel but |
1196 | /// any delegates passed in will need to implement their own locking on data they reference and | 1210 | /// any delegates passed in will need to implement their own locking on data they reference and |
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index a58b87d..3bfd866 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs | |||
@@ -458,9 +458,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
458 | ForEachCurrentScene( | 458 | ForEachCurrentScene( |
459 | delegate(Scene scene) | 459 | delegate(Scene scene) |
460 | { | 460 | { |
461 | scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 461 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
462 | { | 462 | { |
463 | if (!scenePresence.IsChildAgent && (name == null || scenePresence.Name == name)) | 463 | if (name == null || scenePresence.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 | scenePresence.Firstname, |
@@ -481,10 +481,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
481 | ForEachCurrentScene( | 481 | ForEachCurrentScene( |
482 | delegate(Scene scene) | 482 | delegate(Scene scene) |
483 | { | 483 | { |
484 | scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 484 | scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) |
485 | { | 485 | { |
486 | if (!scenePresence.IsChildAgent) | 486 | avatars.Add(scenePresence); |
487 | avatars.Add(scenePresence); | ||
488 | }); | 487 | }); |
489 | } | 488 | } |
490 | ); | 489 | ); |