From 3c326aae997c2250f1a9704f993b6a988a8efe89 Mon Sep 17 00:00:00 2001 From: MW Date: Sun, 15 Jul 2007 18:05:41 +0000 Subject: Removed the reference to ClientManager from scene, as scene really shouldn't have a direct reference to the UDP/Packet server's clientmanager, instead it should send all data through the ScenePresences. For those functions that was using the clientManager's foreachClient(delegate) method, there is now a ForEachScenePresence(delegate) in scene. This change helps with the decoupling of client packet functions from the scene functions. --- OpenSim/Region/Environment/Scenes/Scene.cs | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 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 ad46322..d9b630e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -48,6 +48,7 @@ using Timer = System.Timers.Timer; namespace OpenSim.Region.Environment.Scenes { public delegate bool FilterAvatarList(ScenePresence avatar); + public delegate void ForEachScenePresenceDelegate(ScenePresence presence); public partial class Scene : SceneBase, ILocalStorageReceiver { @@ -120,14 +121,13 @@ namespace OpenSim.Region.Environment.Scenes /// Dictionary to contain client threads /// Region Handle for this region /// Region Name for this region - public Scene(ClientManager clientManager, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) + public Scene(RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) { updateLock = new Mutex(false); this.authenticateHandler = authen; this.commsManager = commsMan; this.storageManager = storeManager; this.assetCache = assetCach; - m_clientManager = clientManager; m_regInfo = regInfo; m_regionHandle = m_regInfo.RegionHandle; m_regionName = m_regInfo.RegionName; @@ -268,9 +268,9 @@ namespace OpenSim.Region.Environment.Scenes this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); - m_clientManager.ForEachClient(delegate(IClientAPI client) + this.ForEachScenePresence(delegate(ScenePresence presence) { - this.SendLayerData(client); + this.SendLayerData(presence.ControllingClient); }); foreach (LLUUID UUID in Entities.Keys) @@ -299,9 +299,9 @@ namespace OpenSim.Region.Environment.Scenes } this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); - m_clientManager.ForEachClient(delegate(IClientAPI client) + this.ForEachScenePresence(delegate(ScenePresence presence) { - this.SendLayerData(client); + this.SendLayerData(presence.ControllingClient); }); foreach (LLUUID UUID in Entities.Keys) @@ -329,9 +329,9 @@ namespace OpenSim.Region.Environment.Scenes { /* Dont save here, rely on tainting system instead */ - m_clientManager.ForEachClient(delegate(IClientAPI client) + this.ForEachScenePresence(delegate(ScenePresence presence) { - this.SendLayerData(pointx, pointy, client); + this.SendLayerData(pointx, pointy, presence.ControllingClient); }); } } @@ -581,10 +581,10 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence avatar = this.RequestAvatar(agentID); - m_clientManager.ForEachClient( - delegate(IClientAPI client) + this.ForEachScenePresence( + delegate(ScenePresence presence) { - client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); }); lock (Avatars) @@ -661,6 +661,14 @@ namespace OpenSim.Region.Environment.Scenes } return null; } + + public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo) + { + foreach (ScenePresence presence in this.Avatars.Values) + { + whatToDo(presence); + } + } #endregion -- cgit v1.1