From 7335e5710bd0c22c9e5bd9fa0b576d0985d2fba9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 20 Sep 2007 13:04:51 +0000 Subject: Rev 1971 : The Lbsa71 vintage commit * Refactored to prepare for some serious restructuring --- OpenSim/Region/Environment/Scenes/Scene.cs | 45 +++++++++++++++--------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a542ab0..bdb8957 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -346,15 +346,12 @@ namespace OpenSim.Region.Environment.Scenes m_timeUpdateCount++; if (m_timeUpdateCount > 600) { - List Avatars = RequestAvatarList(); - foreach (ScenePresence avatar in Avatars) + List avatars = GetAvatars(); + foreach (ScenePresence avatar in avatars) { - if (!avatar.childAgent) - { - //Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname); - avatar.ControllingClient.SendViewerTime(m_timePhase); - } + avatar.ControllingClient.SendViewerTime(m_timePhase); } + m_timeUpdateCount = 0; m_timePhase++; if (m_timePhase > 94) @@ -831,7 +828,7 @@ namespace OpenSim.Region.Environment.Scenes { m_eventManager.TriggerOnRemovePresence(agentID); - ScenePresence avatar = RequestAvatar(agentID); + ScenePresence avatar = GetScenePresence(agentID); ForEachScenePresence( delegate(ScenePresence presence) @@ -877,14 +874,19 @@ namespace OpenSim.Region.Environment.Scenes /// Request a List of all Avatars in this World /// /// - public List RequestAvatarList() + public List GetScenePresences() { - List result = new List(); + List result = new List(Avatars.Values); - foreach (ScenePresence avatar in Avatars.Values) - { - result.Add(avatar); - } + return result; + } + + public List GetAvatars() + { + List result = GetScenePresences(delegate(ScenePresence scenePresence) + { + return !scenePresence.childAgent; + }); return result; } @@ -893,7 +895,7 @@ namespace OpenSim.Region.Environment.Scenes /// Request a filtered list of Avatars in this World /// /// - public List RequestAvatarList(FilterAvatarList filter) + public List GetScenePresences(FilterAvatarList filter) { List result = new List(); @@ -913,7 +915,7 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public ScenePresence RequestAvatar(LLUUID avatarID) + public ScenePresence GetScenePresence(LLUUID avatarID) { if (Avatars.ContainsKey(avatarID)) { @@ -954,11 +956,10 @@ namespace OpenSim.Region.Environment.Scenes public void SendKillObject(uint localID) { - List avatars = RequestAvatarList(); - for (int i = 0; i < avatars.Count; i++) - { - avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID); - } + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.ControllingClient.SendKillObject(m_regionHandle, localID); + }); } public void SendAllSceneObjectsToClient(ScenePresence presence) @@ -1419,7 +1420,7 @@ namespace OpenSim.Region.Environment.Scenes public override void Close() { - m_heartbeatTimer.Close(); + m_heartbeatTimer.Close(); base.Close(); } -- cgit v1.1