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.afrisby
parent
a87ebda895
commit
3c326aae99
|
@ -213,7 +213,7 @@ namespace OpenSim
|
|||
|
||||
StorageManager tmpStoreManager = new StorageManager("OpenSim.DataStore.NullStorage.dll", regionDat.DataStore, regionDat.RegionName);
|
||||
|
||||
LocalWorld = new Scene(udpServer.PacketServer.ClientManager, regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer);
|
||||
LocalWorld = new Scene( regionDat, authenBase, commsManager, this.AssetCache, tmpStoreManager, httpServer);
|
||||
this.m_localWorld.Add(LocalWorld);
|
||||
|
||||
udpServer.LocalWorld = LocalWorld;
|
||||
|
|
|
@ -149,15 +149,13 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
avatar = null;
|
||||
}
|
||||
|
||||
m_clientManager.ForEachClient(delegate(IClientAPI client)
|
||||
this.ForEachScenePresence(delegate(ScenePresence presence)
|
||||
{
|
||||
int dis = -1000;
|
||||
if (this.Avatars.ContainsKey(client.AgentId))
|
||||
if (this.Avatars.ContainsKey(presence.ControllingClient.AgentId))
|
||||
{
|
||||
avatar = this.Avatars[client.AgentId];
|
||||
// int dis = Util.fast_distance2d((int)(client.ClientAvatar.Pos.X - simClient.ClientAvatar.Pos.X), (int)(client.ClientAvatar.Pos.Y - simClient.ClientAvatar.Pos.Y));
|
||||
avatar = this.Avatars[presence.ControllingClient.AgentId];
|
||||
dis = (int)avatar.Pos.GetDistanceTo(fromPos);
|
||||
//Console.WriteLine("found avatar at " +dis);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
|
@ -166,7 +164,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
if ((dis < 10) && (dis > -10))
|
||||
{
|
||||
//should change so the message is sent through the avatar rather than direct to the ClientView
|
||||
client.SendChatMessage(message, type, fromPos, fromName,
|
||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
|
@ -174,20 +172,20 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
if ((dis < 30) && (dis > -30))
|
||||
{
|
||||
//Console.WriteLine("sending chat");
|
||||
client.SendChatMessage(message, type, fromPos, fromName,
|
||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
case 2: // Shout
|
||||
if ((dis < 100) && (dis > -100))
|
||||
{
|
||||
client.SendChatMessage(message, type, fromPos, fromName,
|
||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
||||
fromAgentID);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xff: // Broadcast
|
||||
client.SendChatMessage(message, type, fromPos, fromName,
|
||||
presence.ControllingClient.SendChatMessage(message, type, fromPos, fromName,
|
||||
fromAgentID);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -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
|
|||
/// <param name="clientThreads">Dictionary to contain client threads</param>
|
||||
/// <param name="regionHandle">Region Handle for this region</param>
|
||||
/// <param name="regionName">Region Name for this region</param>
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -41,7 +41,6 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public abstract class SceneBase : IWorld
|
||||
{
|
||||
public Dictionary<LLUUID, EntityBase> Entities;
|
||||
protected ClientManager m_clientManager;
|
||||
protected ulong m_regionHandle;
|
||||
protected string m_regionName;
|
||||
protected RegionInfo m_regInfo;
|
||||
|
|
|
@ -18,8 +18,8 @@ namespace SimpleApp
|
|||
{
|
||||
private List<ScenePresence> m_avatars;
|
||||
|
||||
public MyWorld(ClientManager clientManager, RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer)
|
||||
: base(clientManager, regionInfo, authen, commsMan, assetCach, storeMan, httpServer)
|
||||
public MyWorld( RegionInfo regionInfo, AuthenticateSessionsBase authen, CommunicationsManager commsMan, AssetCache assetCach, StorageManager storeMan, BaseHttpServer httpServer)
|
||||
: base( regionInfo, authen, commsMan, assetCach, storeMan, httpServer)
|
||||
{
|
||||
m_avatars = new List<Avatar>();
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace SimpleApp
|
|||
|
||||
OpenSim.Region.Environment.StorageManager storeMan = new OpenSim.Region.Environment.StorageManager("OpenSim.DataStore.NullStorage.dll", "simpleapp.yap", "simpleapp");
|
||||
|
||||
world = new MyWorld(packetServer.ClientManager, regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer);
|
||||
world = new MyWorld( regionInfo, m_circuitManager, communicationsManager, assetCache, storeMan, httpServer);
|
||||
world.PhysScene = physManager.GetPhysicsScene("basicphysics"); //PhysicsScene.Null;
|
||||
|
||||
world.LoadWorldMap();
|
||||
|
|
Loading…
Reference in New Issue