diff options
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.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 30 |
1 files changed, 19 insertions, 11 deletions
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; | |||
48 | namespace OpenSim.Region.Environment.Scenes | 48 | namespace OpenSim.Region.Environment.Scenes |
49 | { | 49 | { |
50 | public delegate bool FilterAvatarList(ScenePresence avatar); | 50 | public delegate bool FilterAvatarList(ScenePresence avatar); |
51 | public delegate void ForEachScenePresenceDelegate(ScenePresence presence); | ||
51 | 52 | ||
52 | public partial class Scene : SceneBase, ILocalStorageReceiver | 53 | public partial class Scene : SceneBase, ILocalStorageReceiver |
53 | { | 54 | { |
@@ -120,14 +121,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
120 | /// <param name="clientThreads">Dictionary to contain client threads</param> | 121 | /// <param name="clientThreads">Dictionary to contain client threads</param> |
121 | /// <param name="regionHandle">Region Handle for this region</param> | 122 | /// <param name="regionHandle">Region Handle for this region</param> |
122 | /// <param name="regionName">Region Name for this region</param> | 123 | /// <param name="regionName">Region Name for this region</param> |
123 | public Scene(ClientManager clientManager, RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) | 124 | public Scene(RegionInfo regInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeManager, BaseHttpServer httpServer) |
124 | { | 125 | { |
125 | updateLock = new Mutex(false); | 126 | updateLock = new Mutex(false); |
126 | this.authenticateHandler = authen; | 127 | this.authenticateHandler = authen; |
127 | this.commsManager = commsMan; | 128 | this.commsManager = commsMan; |
128 | this.storageManager = storeManager; | 129 | this.storageManager = storeManager; |
129 | this.assetCache = assetCach; | 130 | this.assetCache = assetCach; |
130 | m_clientManager = clientManager; | ||
131 | m_regInfo = regInfo; | 131 | m_regInfo = regInfo; |
132 | m_regionHandle = m_regInfo.RegionHandle; | 132 | m_regionHandle = m_regInfo.RegionHandle; |
133 | m_regionName = m_regInfo.RegionName; | 133 | m_regionName = m_regInfo.RegionName; |
@@ -268,9 +268,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
268 | 268 | ||
269 | this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); | 269 | this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); |
270 | 270 | ||
271 | m_clientManager.ForEachClient(delegate(IClientAPI client) | 271 | this.ForEachScenePresence(delegate(ScenePresence presence) |
272 | { | 272 | { |
273 | this.SendLayerData(client); | 273 | this.SendLayerData(presence.ControllingClient); |
274 | }); | 274 | }); |
275 | 275 | ||
276 | foreach (LLUUID UUID in Entities.Keys) | 276 | foreach (LLUUID UUID in Entities.Keys) |
@@ -299,9 +299,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
299 | } | 299 | } |
300 | this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); | 300 | this.storageManager.DataStore.StoreTerrain(Terrain.getHeights2DD()); |
301 | 301 | ||
302 | m_clientManager.ForEachClient(delegate(IClientAPI client) | 302 | this.ForEachScenePresence(delegate(ScenePresence presence) |
303 | { | 303 | { |
304 | this.SendLayerData(client); | 304 | this.SendLayerData(presence.ControllingClient); |
305 | }); | 305 | }); |
306 | 306 | ||
307 | foreach (LLUUID UUID in Entities.Keys) | 307 | foreach (LLUUID UUID in Entities.Keys) |
@@ -329,9 +329,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
329 | { | 329 | { |
330 | /* Dont save here, rely on tainting system instead */ | 330 | /* Dont save here, rely on tainting system instead */ |
331 | 331 | ||
332 | m_clientManager.ForEachClient(delegate(IClientAPI client) | 332 | this.ForEachScenePresence(delegate(ScenePresence presence) |
333 | { | 333 | { |
334 | this.SendLayerData(pointx, pointy, client); | 334 | this.SendLayerData(pointx, pointy, presence.ControllingClient); |
335 | }); | 335 | }); |
336 | } | 336 | } |
337 | } | 337 | } |
@@ -581,10 +581,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
581 | 581 | ||
582 | ScenePresence avatar = this.RequestAvatar(agentID); | 582 | ScenePresence avatar = this.RequestAvatar(agentID); |
583 | 583 | ||
584 | m_clientManager.ForEachClient( | 584 | this.ForEachScenePresence( |
585 | delegate(IClientAPI client) | 585 | delegate(ScenePresence presence) |
586 | { | 586 | { |
587 | client.SendKillObject(avatar.RegionHandle, avatar.LocalId); | 587 | presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); |
588 | }); | 588 | }); |
589 | 589 | ||
590 | lock (Avatars) | 590 | lock (Avatars) |
@@ -661,6 +661,14 @@ namespace OpenSim.Region.Environment.Scenes | |||
661 | } | 661 | } |
662 | return null; | 662 | return null; |
663 | } | 663 | } |
664 | |||
665 | public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo) | ||
666 | { | ||
667 | foreach (ScenePresence presence in this.Avatars.Values) | ||
668 | { | ||
669 | whatToDo(presence); | ||
670 | } | ||
671 | } | ||
664 | #endregion | 672 | #endregion |
665 | 673 | ||
666 | 674 | ||