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/Scene.cs | |
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 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 60 |
1 files changed, 31 insertions, 29 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> |