aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMW2007-07-15 18:05:41 +0000
committerMW2007-07-15 18:05:41 +0000
commit3c326aae997c2250f1a9704f993b6a988a8efe89 (patch)
treef0a034c4820139d3d134e5598479751f0b46863a /OpenSim/Region
parentRemoved reference to Scene EventManager from primitive. In its place, primiti... (diff)
downloadopensim-SC_OLD-3c326aae997c2250f1a9704f993b6a988a8efe89.zip
opensim-SC_OLD-3c326aae997c2250f1a9704f993b6a988a8efe89.tar.gz
opensim-SC_OLD-3c326aae997c2250f1a9704f993b6a988a8efe89.tar.bz2
opensim-SC_OLD-3c326aae997c2250f1a9704f993b6a988a8efe89.tar.xz
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 '')
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs16
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs30
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs1
-rw-r--r--OpenSim/Region/Examples/SimpleApp/MyWorld.cs4
-rw-r--r--OpenSim/Region/Examples/SimpleApp/Program.cs2
6 files changed, 30 insertions, 25 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index 6f64512..ab03ed1 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -213,7 +213,7 @@ namespace OpenSim
213 213
214 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName); 214 StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName);
215 215
216 LocalWorld = new Scene(udpServer.PacketServer.ClientManager, regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer); 216 LocalWorld = new Scene( regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer);
217 this.m_localWorld.Add(LocalWorld); 217 this.m_localWorld.Add(LocalWorld);
218 218
219 udpServer.LocalWorld = LocalWorld; 219 udpServer.LocalWorld = LocalWorld;
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index bf98b0d..1445edf 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -149,15 +149,13 @@ namespace OpenSim.Region.Environment.Scenes
149 avatar = null; 149 avatar = null;
150 } 150 }
151 151
152 m_clientManager.ForEachClient(delegate(IClientAPI client) 152 this.ForEachScenePresence(delegate(ScenePresence presence)
153 { 153 {
154 int dis = -1000; 154 int dis = -1000;
155 if (this.Avatars.ContainsKey(client.AgentId)) 155 if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId))
156 { 156 {
157 avatar = this.Avatars[client.AgentId]; 157 avatar = this.Avatars[presence.ControllingClient.AgentId];
158 // int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
159 dis = (int)avatar.Pos.GetDistanceTo(fromPos); 158 dis = (int)avatar.Pos.GetDistanceTo(fromPos);
160 //Console.WriteLine("found avatar at " +dis);
161 } 159 }
162 160
163 switch (type) 161 switch (type)
@@ -166,7 +164,7 @@ namespace OpenSim.Region.Environment.Scenes
166 if ((dis < 10) && (dis > -10)) 164 if ((dis < 10) && (dis > -10))
167 { 165 {
168 //should change so the message is sent through the avatar rather than direct to the ClientView 166 //should change so the message is sent through the avatar rather than direct to the ClientView
169 client.SendChatMessage(message, type, fromPos, fromName, 167 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
170 fromAgentID); 168 fromAgentID);
171 } 169 }
172 break; 170 break;
@@ -174,20 +172,20 @@ namespace OpenSim.Region.Environment.Scenes
174 if ((dis < 30) && (dis > -30)) 172 if ((dis < 30) && (dis > -30))
175 { 173 {
176 //Console.WriteLine("sending chat"); 174 //Console.WriteLine("sending chat");
177 client.SendChatMessage(message, type, fromPos, fromName, 175 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
178 fromAgentID); 176 fromAgentID);
179 } 177 }
180 break; 178 break;
181 case 2: // Shout 179 case 2: // Shout
182 if ((dis < 100) && (dis > -100)) 180 if ((dis < 100) && (dis > -100))
183 { 181 {
184 client.SendChatMessage(message, type, fromPos, fromName, 182 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
185 fromAgentID); 183 fromAgentID);
186 } 184 }
187 break; 185 break;
188 186
189 case 0xff: // Broadcast 187 case 0xff: // Broadcast
190 client.SendChatMessage(message, type, fromPos, fromName, 188 presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
191 fromAgentID); 189 fromAgentID);
192 break; 190 break;
193 } 191 }
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;
48namespace OpenSim.Region.Environment.Scenes 48namespace 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
diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs
index c852499..161a5cf 100644
--- a/OpenSim/Region/Environment/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs
@@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Scenes
41 public abstract class SceneBase : IWorld 41 public abstract class SceneBase : IWorld
42 { 42 {
43 public Dictionary<LLUUID, EntityBase> Entities; 43 public Dictionary<LLUUID, EntityBase> Entities;
44 protected ClientManager m_clientManager;
45 protected ulong m_regionHandle; 44 protected ulong m_regionHandle;
46 protected string m_regionName; 45 protected string m_regionName;
47 protected RegionInfo m_regInfo; 46 protected RegionInfo m_regInfo;
diff --git a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
index bdf1263..777d4ae 100644
--- a/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
+++ b/OpenSim/Region/Examples/SimpleApp/MyWorld.cs
@@ -18,8 +18,8 @@ namespace SimpleApp
18 { 18 {
19 private List<ScenePresence> m_avatars; 19 private List<ScenePresence> m_avatars;
20 20
21 public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer) 21 public MyWorld( RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer)
22 : base(clientManager, regionInfo, authen, commsMan, assetCach, storeMan, httpServer) 22 : base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer)
23 { 23 {
24 m_avatars = new List<Avatar>(); 24 m_avatars = new List<Avatar>();
25 } 25 }
diff --git a/OpenSim/Region/Examples/SimpleApp/Program.cs b/OpenSim/Region/Examples/SimpleApp/Program.cs
index f8c99aa..82a62a3 100644
--- a/OpenSim/Region/Examples/SimpleApp/Program.cs
+++ b/OpenSim/Region/Examples/SimpleApp/Program.cs
@@ -61,7 +61,7 @@ namespace SimpleApp
61 61
62 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp"); 62 OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
63 63
64 world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer); 64 world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer);
65 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null; 65 world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
66 66
67 world.LoadWorldMap(); 67 world.LoadWorldMap();