diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index baa8759..a86a33c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3599,9 +3599,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3599 | public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) | 3599 | public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) |
3600 | { | 3600 | { |
3601 | ScenePresence presence; | 3601 | ScenePresence presence; |
3602 | m_sceneGraph.TryGetAvatar(agentID, out presence); | 3602 | if(m_sceneGraph.TryGetAvatar(agentID, out presence)) |
3603 | |||
3604 | if (presence != null) | ||
3605 | { | 3603 | { |
3606 | try | 3604 | try |
3607 | { | 3605 | { |
@@ -3776,9 +3774,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3776 | Vector3 lookAt, uint teleportFlags) | 3774 | Vector3 lookAt, uint teleportFlags) |
3777 | { | 3775 | { |
3778 | ScenePresence sp; | 3776 | ScenePresence sp; |
3779 | m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp); | 3777 | if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp)) |
3780 | |||
3781 | if (sp != null) | ||
3782 | { | 3778 | { |
3783 | uint regionX = m_regInfo.RegionLocX; | 3779 | uint regionX = m_regInfo.RegionLocX; |
3784 | uint regionY = m_regInfo.RegionLocY; | 3780 | uint regionY = m_regInfo.RegionLocY; |
@@ -4134,6 +4130,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
4134 | 4130 | ||
4135 | //The idea is to have a group of method that return a list of avatars meeting some requirement | 4131 | //The idea is to have a group of method that return a list of avatars meeting some requirement |
4136 | // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. | 4132 | // ie it could be all m_scenePresences within a certain range of the calling prim/avatar. |
4133 | // | ||
4134 | // GetAvatars returns a new list of all root agent presences in the scene | ||
4135 | // GetScenePresences returns a new list of all presences in the scene or a filter may be passed. | ||
4136 | // GetScenePresence returns the presence with matching UUID or first/last name. | ||
4137 | // ForEachScenePresence requests the Scene to run a delegate function against all presences. | ||
4137 | 4138 | ||
4138 | /// <summary> | 4139 | /// <summary> |
4139 | /// Return a list of all avatars in this region. | 4140 | /// Return a list of all avatars in this region. |
@@ -4150,7 +4151,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4150 | /// This list is a new object, so it can be iterated over without locking. | 4151 | /// This list is a new object, so it can be iterated over without locking. |
4151 | /// </summary> | 4152 | /// </summary> |
4152 | /// <returns></returns> | 4153 | /// <returns></returns> |
4153 | public ScenePresence[] GetScenePresences() | 4154 | public List<ScenePresence> GetScenePresences() |
4154 | { | 4155 | { |
4155 | return m_sceneGraph.GetScenePresences(); | 4156 | return m_sceneGraph.GetScenePresences(); |
4156 | } | 4157 | } |
@@ -4176,6 +4177,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
4176 | return m_sceneGraph.GetScenePresence(avatarID); | 4177 | return m_sceneGraph.GetScenePresence(avatarID); |
4177 | } | 4178 | } |
4178 | 4179 | ||
4180 | /// <summary> | ||
4181 | /// Request the ScenePresence in this region by first/last name. | ||
4182 | /// Should normally only be a single match, but first is always returned | ||
4183 | /// </summary> | ||
4184 | /// <param name="firstName"></param> | ||
4185 | /// <param name="lastName"></param> | ||
4186 | /// <returns></returns> | ||
4187 | public ScenePresence GetScenePresence(string firstName, string lastName) | ||
4188 | { | ||
4189 | return m_sceneGraph.GetScenePresence(firstName, lastName); | ||
4190 | } | ||
4191 | |||
4192 | /// <summary> | ||
4193 | /// Request the ScenePresence in this region by localID. | ||
4194 | /// </summary> | ||
4195 | /// <param name="localID"></param> | ||
4196 | /// <returns></returns> | ||
4197 | public ScenePresence GetScenePresence(uint localID) | ||
4198 | { | ||
4199 | return m_sceneGraph.GetScenePresence(localID); | ||
4200 | } | ||
4201 | |||
4179 | public override bool PresenceChildStatus(UUID avatarID) | 4202 | public override bool PresenceChildStatus(UUID avatarID) |
4180 | { | 4203 | { |
4181 | ScenePresence cp = GetScenePresence(avatarID); | 4204 | ScenePresence cp = GetScenePresence(avatarID); |
@@ -4191,25 +4214,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
4191 | } | 4214 | } |
4192 | 4215 | ||
4193 | /// <summary> | 4216 | /// <summary> |
4194 | /// | 4217 | /// Performs action on all scene presences. |
4195 | /// </summary> | 4218 | /// </summary> |
4196 | /// <param name="action"></param> | 4219 | /// <param name="action"></param> |
4197 | public void ForEachScenePresence(Action<ScenePresence> action) | 4220 | public void ForEachScenePresence(Action<ScenePresence> action) |
4198 | { | 4221 | { |
4199 | // We don't want to try to send messages if there are no avatars. | ||
4200 | if (m_sceneGraph != null) | 4222 | if (m_sceneGraph != null) |
4201 | { | 4223 | { |
4202 | try | 4224 | m_sceneGraph.ForEachScenePresence(action); |
4203 | { | ||
4204 | ScenePresence[] presences = GetScenePresences(); | ||
4205 | for (int i = 0; i < presences.Length; i++) | ||
4206 | action(presences[i]); | ||
4207 | } | ||
4208 | catch (Exception e) | ||
4209 | { | ||
4210 | m_log.Info("[BUG] in " + RegionInfo.RegionName + ": " + e.ToString()); | ||
4211 | m_log.Info("[BUG] Stack Trace: " + e.StackTrace); | ||
4212 | } | ||
4213 | } | 4225 | } |
4214 | } | 4226 | } |
4215 | 4227 | ||