aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2011-10-27 18:14:38 +0100
committerMelanie2011-10-27 18:14:38 +0100
commitb975cbcbed71b12898052395fbc83a5880273190 (patch)
treef149288740af5227a865783a51f566bef537721e /OpenSim/Region/Framework
parentMerge branch 'master' into bigmerge (diff)
parentRemoved use of 'is' operator and casting to find the root ScenePresence in Me... (diff)
downloadopensim-SC-b975cbcbed71b12898052395fbc83a5880273190.zip
opensim-SC-b975cbcbed71b12898052395fbc83a5880273190.tar.gz
opensim-SC-b975cbcbed71b12898052395fbc83a5880273190.tar.bz2
opensim-SC-b975cbcbed71b12898052395fbc83a5880273190.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
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.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs53
5 files changed, 78 insertions, 71 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b2f5279..0cb6681 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -920,22 +920,17 @@ namespace OpenSim.Region.Framework.Scenes
920 920
921 try 921 try
922 { 922 {
923 ForEachScenePresence(delegate(ScenePresence agent) 923 ForEachRootScenePresence(delegate(ScenePresence agent)
924 { 924 {
925 // If agent is a root agent. 925 //agent.ControllingClient.new
926 if (!agent.IsChildAgent) 926 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo());
927 { 927
928 //agent.ControllingClient.new 928 List<ulong> old = new List<ulong>();
929 //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); 929 old.Add(otherRegion.RegionHandle);
930 930 agent.DropOldNeighbours(old);
931 List<ulong> old = new List<ulong>(); 931 if (m_teleportModule != null)
932 old.Add(otherRegion.RegionHandle); 932 m_teleportModule.EnableChildAgent(agent, otherRegion);
933 agent.DropOldNeighbours(old); 933 });
934 if (m_teleportModule != null)
935 m_teleportModule.EnableChildAgent(agent, otherRegion);
936 }
937 }
938 );
939 } 934 }
940 catch (NullReferenceException) 935 catch (NullReferenceException)
941 { 936 {
@@ -1070,16 +1065,11 @@ namespace OpenSim.Region.Framework.Scenes
1070 GridRegion r = new GridRegion(region); 1065 GridRegion r = new GridRegion(region);
1071 try 1066 try
1072 { 1067 {
1073 ForEachScenePresence(delegate(ScenePresence agent) 1068 ForEachRootScenePresence(delegate(ScenePresence agent)
1074 { 1069 {
1075 // If agent is a root agent. 1070 if (m_teleportModule != null)
1076 if (!agent.IsChildAgent) 1071 m_teleportModule.EnableChildAgent(agent, r);
1077 { 1072 });
1078 if (m_teleportModule != null)
1079 m_teleportModule.EnableChildAgent(agent, r);
1080 }
1081 }
1082 );
1083 } 1073 }
1084 catch (NullReferenceException) 1074 catch (NullReferenceException)
1085 { 1075 {
@@ -1493,11 +1483,10 @@ namespace OpenSim.Region.Framework.Scenes
1493 /// <param name="stats">Stats on the Simulator's performance</param> 1483 /// <param name="stats">Stats on the Simulator's performance</param>
1494 private void SendSimStatsPackets(SimStats stats) 1484 private void SendSimStatsPackets(SimStats stats)
1495 { 1485 {
1496 ForEachScenePresence( 1486 ForEachRootScenePresence(
1497 delegate(ScenePresence agent) 1487 delegate(ScenePresence agent)
1498 { 1488 {
1499 if (!agent.IsChildAgent) 1489 agent.ControllingClient.SendSimStats(stats);
1500 agent.ControllingClient.SendSimStats(stats);
1501 } 1490 }
1502 ); 1491 );
1503 } 1492 }
@@ -4463,6 +4452,19 @@ namespace OpenSim.Region.Framework.Scenes
4463 } 4452 }
4464 4453
4465 /// <summary> 4454 /// <summary>
4455 /// Performs action on all ROOT (not child) scene presences.
4456 /// This is just a shortcut function since frequently actions only appy to root SPs
4457 /// </summary>
4458 /// <param name="action"></param>
4459 public void ForEachRootScenePresence(Action<ScenePresence> action)
4460 {
4461 if(m_sceneGraph != null)
4462 {
4463 m_sceneGraph.ForEachRootScenePresence(action);
4464 }
4465 }
4466
4467 /// <summary>
4466 /// Performs action on all scene presences. 4468 /// Performs action on all scene presences.
4467 /// </summary> 4469 /// </summary>
4468 /// <param name="action"></param> 4470 /// <param name="action"></param>
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 13668ab..a4080ca 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1265,7 +1265,21 @@ namespace OpenSim.Region.Framework.Scenes
1265 } 1265 }
1266 } 1266 }
1267 } 1267 }
1268 1268
1269 /// <summary>
1270 /// Performs action on all ROOT (not child) scene presences.
1271 /// This is just a shortcut function since frequently actions only appy to root SPs
1272 /// </summary>
1273 /// <param name="action"></param>
1274 public void ForEachRootScenePresence(Action<ScenePresence> action)
1275 {
1276 ForEachScenePresence(delegate(ScenePresence sp)
1277 {
1278 if (!sp.IsChildAgent)
1279 action(sp);
1280 });
1281 }
1282
1269 /// <summary> 1283 /// <summary>
1270 /// Performs action on all scene presences. This can ultimately run the actions in parallel but 1284 /// Performs action on all scene presences. This can ultimately run the actions in parallel but
1271 /// any delegates passed in will need to implement their own locking on data they reference and 1285 /// 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 6e20d14..0a8edf9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1493,10 +1493,9 @@ namespace OpenSim.Region.Framework.Scenes
1493 if (volume < 0) 1493 if (volume < 0)
1494 volume = 0; 1494 volume = 0;
1495 1495
1496 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 1496 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
1497 { 1497 {
1498 if (!sp.IsChildAgent) 1498 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
1499 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume);
1500 }); 1499 });
1501 } 1500 }
1502 1501
@@ -2136,6 +2135,8 @@ namespace OpenSim.Region.Framework.Scenes
2136 2135
2137 public void PhysicsCollision(EventArgs e) 2136 public void PhysicsCollision(EventArgs e)
2138 { 2137 {
2138// m_log.DebugFormat("Invoking PhysicsCollision on {0} {1} {2}", Name, LocalId, UUID);
2139
2139 // single threaded here 2140 // single threaded here
2140 2141
2141 CollisionEventUpdate a = (CollisionEventUpdate)e; 2142 CollisionEventUpdate a = (CollisionEventUpdate)e;
@@ -2729,10 +2730,8 @@ namespace OpenSim.Region.Framework.Scenes
2729 TaskInventory.LockItemsForRead(false); 2730 TaskInventory.LockItemsForRead(false);
2730 } 2731 }
2731 2732
2732 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence sp) 2733 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp)
2733 { 2734 {
2734 if (sp.IsChildAgent)
2735 return;
2736 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100)) 2735 if (!(Util.GetDistanceTo(sp.AbsolutePosition, AbsolutePosition) >= 100))
2737 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID); 2736 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
2738 }); 2737 });
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0f13050..35870c5 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2950,19 +2950,15 @@ namespace OpenSim.Region.Framework.Scenes
2950 public void SendOtherAgentsAvatarDataToMe() 2950 public void SendOtherAgentsAvatarDataToMe()
2951 { 2951 {
2952 int count = 0; 2952 int count = 0;
2953 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2953 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
2954 { 2954 {
2955 // only send information about root agents 2955 // only send information about other root agents
2956 if (scenePresence.IsChildAgent) 2956 if (scenePresence.UUID == UUID)
2957 return; 2957 return;
2958
2959 // only send information about other root agents
2960 if (scenePresence.UUID == UUID)
2961 return;
2962 2958
2963 scenePresence.SendAvatarDataToAgent(this); 2959 scenePresence.SendAvatarDataToAgent(this);
2964 count++; 2960 count++;
2965 }); 2961 });
2966 2962
2967 m_scene.StatsReporter.AddAgentUpdates(count); 2963 m_scene.StatsReporter.AddAgentUpdates(count);
2968 } 2964 }
@@ -2996,13 +2992,14 @@ namespace OpenSim.Region.Framework.Scenes
2996 2992
2997 int count = 0; 2993 int count = 0;
2998 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2994 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2999 { 2995 {
3000 if (scenePresence.UUID == UUID) 2996 // only send information to other root agents
3001 return; 2997 if (scenePresence.UUID == UUID)
2998 return;
3002 2999
3003 SendAppearanceToAgent(scenePresence); 3000 SendAppearanceToAgent(scenePresence);
3004 count++; 3001 count++;
3005 }); 3002 });
3006 3003
3007 m_scene.StatsReporter.AddAgentUpdates(count); 3004 m_scene.StatsReporter.AddAgentUpdates(count);
3008 } 3005 }
@@ -3016,19 +3013,15 @@ namespace OpenSim.Region.Framework.Scenes
3016 //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); 3013 //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
3017 3014
3018 int count = 0; 3015 int count = 0;
3019 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 3016 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence)
3020 { 3017 {
3021 // only send information about root agents 3018 // only send information about other root agents
3022 if (scenePresence.IsChildAgent) 3019 if (scenePresence.UUID == UUID)
3023 return; 3020 return;
3024
3025 // only send information about other root agents
3026 if (scenePresence.UUID == UUID)
3027 return;
3028 3021
3029 scenePresence.SendAppearanceToAgent(this); 3022 scenePresence.SendAppearanceToAgent(this);
3030 count++; 3023 count++;
3031 }); 3024 });
3032 3025
3033 m_scene.StatsReporter.AddAgentUpdates(count); 3026 m_scene.StatsReporter.AddAgentUpdates(count);
3034 } 3027 }