aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
authorlbsa712007-09-20 23:28:08 +0000
committerlbsa712007-09-20 23:28:08 +0000
commit101369e25ad4e72233e4855be4b82d1647233a6c (patch)
tree58b2a7dfcf83d474cba77f8d16f6c0de4d2f4ec2 /OpenSim/Region/Environment/Scenes/Scene.cs
parentRev 1971 : The Lbsa71 vintage commit (diff)
downloadopensim-SC-101369e25ad4e72233e4855be4b82d1647233a6c.zip
opensim-SC-101369e25ad4e72233e4855be4b82d1647233a6c.tar.gz
opensim-SC-101369e25ad4e72233e4855be4b82d1647233a6c.tar.bz2
opensim-SC-101369e25ad4e72233e4855be4b82d1647233a6c.tar.xz
* Some more presence refactoring
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs99
1 files changed, 47 insertions, 52 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index bdb8957..e683bce 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -52,23 +52,20 @@ using Timer = System.Timers.Timer;
52 52
53namespace OpenSim.Region.Environment.Scenes 53namespace OpenSim.Region.Environment.Scenes
54{ 54{
55 public delegate bool FilterAvatarList(ScenePresence avatar);
56
57 public delegate void ForEachScenePresenceDelegate(ScenePresence presence);
58
59 public partial class Scene : SceneBase 55 public partial class Scene : SceneBase
60 { 56 {
57 public delegate bool FilterAvatarList(ScenePresence avatar);
58
61 protected Timer m_heartbeatTimer = new Timer(); 59 protected Timer m_heartbeatTimer = new Timer();
62 protected Dictionary<LLUUID, ScenePresence> Avatars; 60 protected Dictionary<LLUUID, ScenePresence> m_scenePresences;
63 protected Dictionary<LLUUID, SceneObjectGroup> Prims; 61 protected Dictionary<LLUUID, SceneObjectGroup> m_sceneObjects;
64 public PhysicsScene phyScene;
65 62
66 /// publicized so it can be accessed from SceneObjectGroup. 63 /// publicized so it can be accessed from SceneObjectGroup.
67 protected float timeStep = 0.1f; 64 protected float timeStep = 0.1f;
68 65
69 private Random Rand = new Random(); 66 private Random Rand = new Random();
70 private uint _primCount = 702000; 67 private uint _primCount = 702000;
71 private Mutex _primAllocateMutex = new Mutex(false); 68 private readonly Mutex _primAllocateMutex = new Mutex(false);
72 private int storageCount; 69 private int storageCount;
73 private int terrainCheckCount; 70 private int terrainCheckCount;
74 private int landPrimCheckCount; 71 private int landPrimCheckCount;
@@ -78,7 +75,7 @@ namespace OpenSim.Region.Environment.Scenes
78 75
79 public BasicQuadTreeNode QuadTree; 76 public BasicQuadTreeNode QuadTree;
80 77
81 private Mutex updateLock; 78 private readonly Mutex updateLock;
82 79
83 protected ModuleLoader m_moduleLoader; 80 protected ModuleLoader m_moduleLoader;
84 protected StorageManager storageManager; 81 protected StorageManager storageManager;
@@ -108,30 +105,28 @@ namespace OpenSim.Region.Environment.Scenes
108 get { return authenticateHandler; } 105 get { return authenticateHandler; }
109 } 106 }
110 107
111 /// <summary> 108 private readonly LandManager m_LandManager;
112 ///
113 /// </summary>
114 public PhysicsScene PhysScene
115 {
116 set { phyScene = value; }
117 get { return (phyScene); }
118 }
119
120 private LandManager m_LandManager;
121 109
122 public LandManager LandManager 110 public LandManager LandManager
123 { 111 {
124 get { return m_LandManager; } 112 get { return m_LandManager; }
125 } 113 }
126 114
127 private EstateManager m_estateManager; 115 private readonly EstateManager m_estateManager;
116
117 private PhysicsScene phyScene;
118 public PhysicsScene PhysScene
119 {
120 set { phyScene = value; }
121 get { return (phyScene); }
122 }
128 123
129 public EstateManager EstateManager 124 public EstateManager EstateManager
130 { 125 {
131 get { return m_estateManager; } 126 get { return m_estateManager; }
132 } 127 }
133 128
134 private PermissionManager m_permissionManager; 129 private readonly PermissionManager m_permissionManager;
135 130
136 public PermissionManager PermissionsMngr 131 public PermissionManager PermissionsMngr
137 { 132 {
@@ -140,7 +135,7 @@ namespace OpenSim.Region.Environment.Scenes
140 135
141 public Dictionary<LLUUID, SceneObjectGroup> Objects 136 public Dictionary<LLUUID, SceneObjectGroup> Objects
142 { 137 {
143 get { return Prims; } 138 get { return m_sceneObjects; }
144 } 139 }
145 140
146 public int TimePhase 141 public int TimePhase
@@ -191,8 +186,8 @@ namespace OpenSim.Region.Environment.Scenes
191 186
192 MainLog.Instance.Verbose("Creating new entitities instance"); 187 MainLog.Instance.Verbose("Creating new entitities instance");
193 Entities = new Dictionary<LLUUID, EntityBase>(); 188 Entities = new Dictionary<LLUUID, EntityBase>();
194 Avatars = new Dictionary<LLUUID, ScenePresence>(); 189 m_scenePresences = new Dictionary<LLUUID, ScenePresence>();
195 Prims = new Dictionary<LLUUID, SceneObjectGroup>(); 190 m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
196 191
197 MainLog.Instance.Verbose("Creating LandMap"); 192 MainLog.Instance.Verbose("Creating LandMap");
198 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY); 193 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
@@ -804,15 +799,15 @@ namespace OpenSim.Region.Environment.Scenes
804 Entities[client.AgentId] = newAvatar; 799 Entities[client.AgentId] = newAvatar;
805 } 800 }
806 } 801 }
807 lock (Avatars) 802 lock (m_scenePresences)
808 { 803 {
809 if (Avatars.ContainsKey(client.AgentId)) 804 if (m_scenePresences.ContainsKey(client.AgentId))
810 { 805 {
811 Avatars[client.AgentId] = newAvatar; 806 m_scenePresences[client.AgentId] = newAvatar;
812 } 807 }
813 else 808 else
814 { 809 {
815 Avatars.Add(client.AgentId, newAvatar); 810 m_scenePresences.Add(client.AgentId, newAvatar);
816 } 811 }
817 } 812 }
818 813
@@ -841,11 +836,11 @@ namespace OpenSim.Region.Environment.Scenes
841 } 836 }
842 }); 837 });
843 838
844 lock (Avatars) 839 lock (m_scenePresences)
845 { 840 {
846 if (Avatars.ContainsKey(agentID)) 841 if (m_scenePresences.ContainsKey(agentID))
847 { 842 {
848 Avatars.Remove(agentID); 843 m_scenePresences.Remove(agentID);
849 } 844 }
850 } 845 }
851 lock (Entities) 846 lock (Entities)
@@ -865,18 +860,18 @@ namespace OpenSim.Region.Environment.Scenes
865 860
866 #endregion 861 #endregion
867 862
868 #region Request Avatars List Methods 863 #region Request m_scenePresences List Methods
869 864
870 //The idea is to have a group of method that return a list of avatars meeting some requirement 865 //The idea is to have a group of method that return a list of avatars meeting some requirement
871 // ie it could be all Avatars within a certain range of the calling prim/avatar. 866 // ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
872 867
873 /// <summary> 868 /// <summary>
874 /// Request a List of all Avatars in this World 869 /// Request a List of all m_scenePresences in this World
875 /// </summary> 870 /// </summary>
876 /// <returns></returns> 871 /// <returns></returns>
877 public List<ScenePresence> GetScenePresences() 872 public List<ScenePresence> GetScenePresences()
878 { 873 {
879 List<ScenePresence> result = new List<ScenePresence>(Avatars.Values); 874 List<ScenePresence> result = new List<ScenePresence>(m_scenePresences.Values);
880 875
881 return result; 876 return result;
882 } 877 }
@@ -892,14 +887,14 @@ namespace OpenSim.Region.Environment.Scenes
892 } 887 }
893 888
894 /// <summary> 889 /// <summary>
895 /// Request a filtered list of Avatars in this World 890 /// Request a filtered list of m_scenePresences in this World
896 /// </summary> 891 /// </summary>
897 /// <returns></returns> 892 /// <returns></returns>
898 public List<ScenePresence> GetScenePresences(FilterAvatarList filter) 893 public List<ScenePresence> GetScenePresences(FilterAvatarList filter)
899 { 894 {
900 List<ScenePresence> result = new List<ScenePresence>(); 895 List<ScenePresence> result = new List<ScenePresence>();
901 896
902 foreach (ScenePresence avatar in Avatars.Values) 897 foreach (ScenePresence avatar in m_scenePresences.Values)
903 { 898 {
904 if (filter(avatar)) 899 if (filter(avatar))
905 { 900 {
@@ -917,9 +912,9 @@ namespace OpenSim.Region.Environment.Scenes
917 /// <returns></returns> 912 /// <returns></returns>
918 public ScenePresence GetScenePresence(LLUUID avatarID) 913 public ScenePresence GetScenePresence(LLUUID avatarID)
919 { 914 {
920 if (Avatars.ContainsKey(avatarID)) 915 if (m_scenePresences.ContainsKey(avatarID))
921 { 916 {
922 return Avatars[avatarID]; 917 return m_scenePresences[avatarID];
923 } 918 }
924 return null; 919 return null;
925 } 920 }
@@ -928,9 +923,9 @@ namespace OpenSim.Region.Environment.Scenes
928 /// 923 ///
929 /// </summary> 924 /// </summary>
930 /// <param name="whatToDo"></param> 925 /// <param name="whatToDo"></param>
931 public void ForEachScenePresence(ForEachScenePresenceDelegate whatToDo) 926 public void ForEachScenePresence(Action<ScenePresence> whatToDo)
932 { 927 {
933 foreach (ScenePresence presence in Avatars.Values) 928 foreach (ScenePresence presence in m_scenePresences.Values)
934 { 929 {
935 whatToDo(presence); 930 whatToDo(presence);
936 } 931 }
@@ -1031,9 +1026,9 @@ namespace OpenSim.Region.Environment.Scenes
1031 { 1026 {
1032 if (regionHandle == m_regInfo.RegionHandle) 1027 if (regionHandle == m_regInfo.RegionHandle)
1033 { 1028 {
1034 if (Avatars.ContainsKey(agentID)) 1029 if (m_scenePresences.ContainsKey(agentID))
1035 { 1030 {
1036 Avatars[agentID].MakeAvatar(position, isFlying); 1031 m_scenePresences[agentID].MakeAvatar(position, isFlying);
1037 } 1032 }
1038 } 1033 }
1039 } 1034 }
@@ -1098,11 +1093,11 @@ namespace OpenSim.Region.Environment.Scenes
1098 { 1093 {
1099 if (regionHandle == m_regionHandle) 1094 if (regionHandle == m_regionHandle)
1100 { 1095 {
1101 if (Avatars.ContainsKey(remoteClient.AgentId)) 1096 if (m_scenePresences.ContainsKey(remoteClient.AgentId))
1102 { 1097 {
1103 remoteClient.SendTeleportLocationStart(); 1098 remoteClient.SendTeleportLocationStart();
1104 remoteClient.SendLocalTeleport(position, lookAt, flags); 1099 remoteClient.SendLocalTeleport(position, lookAt, flags);
1105 Avatars[remoteClient.AgentId].Teleport(position); 1100 m_scenePresences[remoteClient.AgentId].Teleport(position);
1106 } 1101 }
1107 } 1102 }
1108 else 1103 else
@@ -1184,9 +1179,9 @@ namespace OpenSim.Region.Environment.Scenes
1184 public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned, 1179 public void SendUrlToUser(LLUUID avatarID, string objectname, LLUUID objectID, LLUUID ownerID, bool groupOwned,
1185 string message, string url) 1180 string message, string url)
1186 { 1181 {
1187 if (Avatars.ContainsKey(avatarID)) 1182 if (m_scenePresences.ContainsKey(avatarID))
1188 { 1183 {
1189 Avatars[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url); 1184 m_scenePresences[avatarID].ControllingClient.SendLoadURL(objectname, objectID, ownerID, groupOwned, message, url);
1190 } 1185 }
1191 } 1186 }
1192 1187
@@ -1200,7 +1195,7 @@ namespace OpenSim.Region.Environment.Scenes
1200 1195
1201 public void SendGeneralAlert(string message) 1196 public void SendGeneralAlert(string message)
1202 { 1197 {
1203 foreach (ScenePresence presence in Avatars.Values) 1198 foreach (ScenePresence presence in m_scenePresences.Values)
1204 { 1199 {
1205 presence.ControllingClient.SendAlertMessage(message); 1200 presence.ControllingClient.SendAlertMessage(message);
1206 } 1201 }
@@ -1208,15 +1203,15 @@ namespace OpenSim.Region.Environment.Scenes
1208 1203
1209 public void SendAlertToUser(LLUUID agentID, string message, bool modal) 1204 public void SendAlertToUser(LLUUID agentID, string message, bool modal)
1210 { 1205 {
1211 if (Avatars.ContainsKey(agentID)) 1206 if (m_scenePresences.ContainsKey(agentID))
1212 { 1207 {
1213 Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal); 1208 m_scenePresences[agentID].ControllingClient.SendAgentAlertMessage(message, modal);
1214 } 1209 }
1215 } 1210 }
1216 1211
1217 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 1212 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
1218 { 1213 {
1219 foreach (ScenePresence presence in Avatars.Values) 1214 foreach (ScenePresence presence in m_scenePresences.Values)
1220 { 1215 {
1221 if ((presence.Firstname == firstName) && (presence.Lastname == lastName)) 1216 if ((presence.Firstname == firstName) && (presence.Lastname == lastName))
1222 { 1217 {
@@ -1405,7 +1400,7 @@ namespace OpenSim.Region.Environment.Scenes
1405 internal bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar) 1400 internal bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar)
1406 { 1401 {
1407 ScenePresence presence; 1402 ScenePresence presence;
1408 if (Avatars.TryGetValue(avatarId, out presence)) 1403 if (m_scenePresences.TryGetValue(avatarId, out presence))
1409 { 1404 {
1410 if (!presence.childAgent) 1405 if (!presence.childAgent)
1411 { 1406 {