aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-28 23:16:46 +0100
committerJustin Clark-Casey (justincc)2011-10-28 23:16:46 +0100
commit0fe756e42c23dabf3b754f3675597aaf6fb627c4 (patch)
treeaa9ebe244f7efe03b8e8cbf80a70b6fb34a6dade /OpenSim/Region/Framework
parentfetch SOP.RotationOffset once in UpdateRotation() and compare rather than fet... (diff)
parentRemoved use of 'is' operator and casting to find the root ScenePresence in Me... (diff)
downloadopensim-SC_OLD-0fe756e42c23dabf3b754f3675597aaf6fb627c4.zip
opensim-SC_OLD-0fe756e42c23dabf3b754f3675597aaf6fb627c4.tar.gz
opensim-SC_OLD-0fe756e42c23dabf3b754f3675597aaf6fb627c4.tar.bz2
opensim-SC_OLD-0fe756e42c23dabf3b754f3675597aaf6fb627c4.tar.xz
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs16
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs53
5 files changed, 76 insertions, 71 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 );
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 2ff3fb7..b68cc9f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1454,10 +1454,9 @@ namespace OpenSim.Region.Framework.Scenes
1454 if (volume < 0) 1454 if (volume < 0)
1455 volume = 0; 1455 volume = 0;
1456 1456
1457 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 1457 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
1458 { 1458 {
1459 if (!sp.IsChildAgent) 1459 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
1460 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
1461 }); 1460 });
1462 } 1461 }
1463 1462
@@ -2690,10 +2689,8 @@ namespace OpenSim.Region.Framework.Scenes
2690 } 2689 }
2691 } 2690 }
2692 2691
2693 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2692 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
2694 { 2693 {
2695 if (sp.IsChildAgent)
2696 return;
2697 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) 2694 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2698 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); 2695 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2699 }); 2696 });
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 38cdd77..0880e21 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2598,19 +2598,15 @@ namespace OpenSim.Region.Framework.Scenes
2598 public void SendOtherAgentsAvatarDataToMe() 2598 public void SendOtherAgentsAvatarDataToMe()
2599 { 2599 {
2600 int count = 0; 2600 int count = 0;
2601 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2601 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
2602 { 2602 {
2603 // only send information about root agents 2603 // only send information about other root agents
2604 if (scenePresence.IsChildAgent) 2604 if (scenePresence.UUID == UUID)
2605 return; 2605 return;
2606
2607 // only send information about other root agents
2608 if (scenePresence.UUID == UUID)
2609 return;
2610 2606
2611 scenePresence.SendAvatarDataToAgent(this); 2607 scenePresence.SendAvatarDataToAgent(this);
2612 count++; 2608 count++;
2613 }); 2609 });
2614 2610
2615 m_scene.StatsReporter.AddAgentUpdates(count); 2611 m_scene.StatsReporter.AddAgentUpdates(count);
2616 } 2612 }
@@ -2644,13 +2640,14 @@ namespace OpenSim.Region.Framework.Scenes
2644 2640
2645 int count = 0; 2641 int count = 0;
2646 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2642 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2647 { 2643 {
2648 if (scenePresence.UUID == UUID) 2644 // only send information to other root agents
2649 return; 2645 if (scenePresence.UUID == UUID)
2646 return;
2650 2647
2651 SendAppearanceToAgent(scenePresence); 2648 SendAppearanceToAgent(scenePresence);
2652 count++; 2649 count++;
2653 }); 2650 });
2654 2651
2655 m_scene.StatsReporter.AddAgentUpdates(count); 2652 m_scene.StatsReporter.AddAgentUpdates(count);
2656 } 2653 }
@@ -2664,19 +2661,15 @@ namespace OpenSim.Region.Framework.Scenes
2664 //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); 2661 //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
2665 2662
2666 int count = 0; 2663 int count = 0;
2667 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2664 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
2668 { 2665 {
2669 // only send information about root agents 2666 // only send information about other root agents
2670 if (scenePresence.IsChildAgent) 2667 if (scenePresence.UUID == UUID)
2671 return; 2668 return;
2672
2673 // only send information about other root agents
2674 if (scenePresence.UUID == UUID)
2675 return;
2676 2669
2677 scenePresence.SendAppearanceToAgent(this); 2670 scenePresence.SendAppearanceToAgent(this);
2678 count++; 2671 count++;
2679 }); 2672 });
2680 2673
2681 m_scene.StatsReporter.AddAgentUpdates(count); 2674 m_scene.StatsReporter.AddAgentUpdates(count);
2682 } 2675 }