diff options
author | John Hurliman | 2009-10-23 01:02:36 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-23 01:02:36 -0700 |
commit | 588361e2a2398b963871762c2b5485c6a086cf47 (patch) | |
tree | 5be2c6705096817c599075da4e12a0e9b0a4c841 /OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |
parent | Added VS2010 support to Prebuild and created runprebuild2010.bat (diff) | |
download | opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.zip opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.tar.gz opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.tar.bz2 opensim-SC_OLD-588361e2a2398b963871762c2b5485c6a086cf47.tar.xz |
Experimental change to use an immutable array for iterating ScenePresences, avoiding locking and copying the list each time it is accessed
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 121 |
1 files changed, 60 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 32171a0..7193002 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -1077,8 +1077,8 @@ if (m_shape != null) { | |||
1077 | 1077 | ||
1078 | private void SendObjectPropertiesToClient(UUID AgentID) | 1078 | private void SendObjectPropertiesToClient(UUID AgentID) |
1079 | { | 1079 | { |
1080 | List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); | 1080 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
1081 | for (int i = 0; i < avatars.Count; i++) | 1081 | for (int i = 0; i < avatars.Length; i++) |
1082 | { | 1082 | { |
1083 | // Ugly reference :( | 1083 | // Ugly reference :( |
1084 | if (avatars[i].UUID == AgentID) | 1084 | if (avatars[i].UUID == AgentID) |
@@ -1140,8 +1140,8 @@ if (m_shape != null) { | |||
1140 | /// </summary> | 1140 | /// </summary> |
1141 | public void AddFullUpdateToAllAvatars() | 1141 | public void AddFullUpdateToAllAvatars() |
1142 | { | 1142 | { |
1143 | List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); | 1143 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
1144 | for (int i = 0; i < avatars.Count; i++) | 1144 | for (int i = 0; i < avatars.Length; i++) |
1145 | { | 1145 | { |
1146 | avatars[i].SceneViewer.QueuePartForUpdate(this); | 1146 | avatars[i].SceneViewer.QueuePartForUpdate(this); |
1147 | } | 1147 | } |
@@ -1165,8 +1165,8 @@ if (m_shape != null) { | |||
1165 | /// Terse updates | 1165 | /// Terse updates |
1166 | public void AddTerseUpdateToAllAvatars() | 1166 | public void AddTerseUpdateToAllAvatars() |
1167 | { | 1167 | { |
1168 | List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); | 1168 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
1169 | for (int i = 0; i < avatars.Count; i++) | 1169 | for (int i = 0; i < avatars.Length; i++) |
1170 | { | 1170 | { |
1171 | avatars[i].SceneViewer.QueuePartForUpdate(this); | 1171 | avatars[i].SceneViewer.QueuePartForUpdate(this); |
1172 | } | 1172 | } |
@@ -1894,24 +1894,24 @@ if (m_shape != null) { | |||
1894 | } | 1894 | } |
1895 | else | 1895 | else |
1896 | { | 1896 | { |
1897 | List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences(); | 1897 | ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); |
1898 | if (avlist != null) | 1898 | |
1899 | for (int i = 0; i < avlist.Length; i++) | ||
1899 | { | 1900 | { |
1900 | foreach (ScenePresence av in avlist) | 1901 | ScenePresence av = avlist[i]; |
1902 | |||
1903 | if (av.LocalId == localId) | ||
1901 | { | 1904 | { |
1902 | if (av.LocalId == localId) | 1905 | DetectedObject detobj = new DetectedObject(); |
1903 | { | 1906 | detobj.keyUUID = av.UUID; |
1904 | DetectedObject detobj = new DetectedObject(); | 1907 | detobj.nameStr = av.ControllingClient.Name; |
1905 | detobj.keyUUID = av.UUID; | 1908 | detobj.ownerUUID = av.UUID; |
1906 | detobj.nameStr = av.ControllingClient.Name; | 1909 | detobj.posVector = av.AbsolutePosition; |
1907 | detobj.ownerUUID = av.UUID; | 1910 | detobj.rotQuat = av.Rotation; |
1908 | detobj.posVector = av.AbsolutePosition; | 1911 | detobj.velVector = av.Velocity; |
1909 | detobj.rotQuat = av.Rotation; | 1912 | detobj.colliderType = 0; |
1910 | detobj.velVector = av.Velocity; | 1913 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; |
1911 | detobj.colliderType = 0; | 1914 | colliding.Add(detobj); |
1912 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
1913 | colliding.Add(detobj); | ||
1914 | } | ||
1915 | } | 1915 | } |
1916 | } | 1916 | } |
1917 | } | 1917 | } |
@@ -1965,26 +1965,25 @@ if (m_shape != null) { | |||
1965 | } | 1965 | } |
1966 | else | 1966 | else |
1967 | { | 1967 | { |
1968 | List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences(); | 1968 | ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); |
1969 | if (avlist != null) | 1969 | |
1970 | for (int i = 0; i < avlist.Length; i++) | ||
1970 | { | 1971 | { |
1971 | foreach (ScenePresence av in avlist) | 1972 | ScenePresence av = avlist[i]; |
1973 | |||
1974 | if (av.LocalId == localId) | ||
1972 | { | 1975 | { |
1973 | if (av.LocalId == localId) | 1976 | DetectedObject detobj = new DetectedObject(); |
1974 | { | 1977 | detobj.keyUUID = av.UUID; |
1975 | DetectedObject detobj = new DetectedObject(); | 1978 | detobj.nameStr = av.Name; |
1976 | detobj.keyUUID = av.UUID; | 1979 | detobj.ownerUUID = av.UUID; |
1977 | detobj.nameStr = av.Name; | 1980 | detobj.posVector = av.AbsolutePosition; |
1978 | detobj.ownerUUID = av.UUID; | 1981 | detobj.rotQuat = av.Rotation; |
1979 | detobj.posVector = av.AbsolutePosition; | 1982 | detobj.velVector = av.Velocity; |
1980 | detobj.rotQuat = av.Rotation; | 1983 | detobj.colliderType = 0; |
1981 | detobj.velVector = av.Velocity; | 1984 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; |
1982 | detobj.colliderType = 0; | 1985 | colliding.Add(detobj); |
1983 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
1984 | colliding.Add(detobj); | ||
1985 | } | ||
1986 | } | 1986 | } |
1987 | |||
1988 | } | 1987 | } |
1989 | } | 1988 | } |
1990 | } | 1989 | } |
@@ -2035,24 +2034,24 @@ if (m_shape != null) { | |||
2035 | } | 2034 | } |
2036 | else | 2035 | else |
2037 | { | 2036 | { |
2038 | List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences(); | 2037 | ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences(); |
2039 | if (avlist != null) | 2038 | |
2039 | for (int i = 0; i < avlist.Length; i++) | ||
2040 | { | 2040 | { |
2041 | foreach (ScenePresence av in avlist) | 2041 | ScenePresence av = avlist[i]; |
2042 | |||
2043 | if (av.LocalId == localId) | ||
2042 | { | 2044 | { |
2043 | if (av.LocalId == localId) | 2045 | DetectedObject detobj = new DetectedObject(); |
2044 | { | 2046 | detobj.keyUUID = av.UUID; |
2045 | DetectedObject detobj = new DetectedObject(); | 2047 | detobj.nameStr = av.Name; |
2046 | detobj.keyUUID = av.UUID; | 2048 | detobj.ownerUUID = av.UUID; |
2047 | detobj.nameStr = av.Name; | 2049 | detobj.posVector = av.AbsolutePosition; |
2048 | detobj.ownerUUID = av.UUID; | 2050 | detobj.rotQuat = av.Rotation; |
2049 | detobj.posVector = av.AbsolutePosition; | 2051 | detobj.velVector = av.Velocity; |
2050 | detobj.rotQuat = av.Rotation; | 2052 | detobj.colliderType = 0; |
2051 | detobj.velVector = av.Velocity; | 2053 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; |
2052 | detobj.colliderType = 0; | 2054 | colliding.Add(detobj); |
2053 | detobj.groupUUID = av.ControllingClient.ActiveGroupId; | ||
2054 | colliding.Add(detobj); | ||
2055 | } | ||
2056 | } | 2055 | } |
2057 | } | 2056 | } |
2058 | } | 2057 | } |
@@ -2312,8 +2311,8 @@ if (m_shape != null) { | |||
2312 | /// </summary> | 2311 | /// </summary> |
2313 | public void SendFullUpdateToAllClients() | 2312 | public void SendFullUpdateToAllClients() |
2314 | { | 2313 | { |
2315 | List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); | 2314 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
2316 | for (int i = 0; i < avatars.Count; i++) | 2315 | for (int i = 0; i < avatars.Length; i++) |
2317 | { | 2316 | { |
2318 | // Ugly reference :( | 2317 | // Ugly reference :( |
2319 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, | 2318 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this, |
@@ -2323,8 +2322,8 @@ if (m_shape != null) { | |||
2323 | 2322 | ||
2324 | public void SendFullUpdateToAllClientsExcept(UUID agentID) | 2323 | public void SendFullUpdateToAllClientsExcept(UUID agentID) |
2325 | { | 2324 | { |
2326 | List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); | 2325 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
2327 | for (int i = 0; i < avatars.Count; i++) | 2326 | for (int i = 0; i < avatars.Length; i++) |
2328 | { | 2327 | { |
2329 | // Ugly reference :( | 2328 | // Ugly reference :( |
2330 | if (avatars[i].UUID != agentID) | 2329 | if (avatars[i].UUID != agentID) |
@@ -2467,8 +2466,8 @@ if (m_shape != null) { | |||
2467 | /// </summary> | 2466 | /// </summary> |
2468 | public void SendTerseUpdateToAllClients() | 2467 | public void SendTerseUpdateToAllClients() |
2469 | { | 2468 | { |
2470 | List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences(); | 2469 | ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences(); |
2471 | for (int i = 0; i < avatars.Count; i++) | 2470 | for (int i = 0; i < avatars.Length; i++) |
2472 | { | 2471 | { |
2473 | SendTerseUpdateToClient(avatars[i].ControllingClient); | 2472 | SendTerseUpdateToClient(avatars[i].ControllingClient); |
2474 | } | 2473 | } |