diff options
author | Justin Clark-Casey (justincc) | 2012-03-31 01:45:37 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-31 01:45:37 +0100 |
commit | f0406f9fe2f7a1d4d135934280735a3fdc41935f (patch) | |
tree | e6193662a8b1a8ea4cda9477f64ec5793941e3d1 /OpenSim | |
parent | Allow llRegionSayTo() to work on the PUBLIC_CHANNEL, as per http://wiki.secon... (diff) | |
download | opensim-SC-f0406f9fe2f7a1d4d135934280735a3fdc41935f.zip opensim-SC-f0406f9fe2f7a1d4d135934280735a3fdc41935f.tar.gz opensim-SC-f0406f9fe2f7a1d4d135934280735a3fdc41935f.tar.bz2 opensim-SC-f0406f9fe2f7a1d4d135934280735a3fdc41935f.tar.xz |
Rename SOG.HasChildPrim(uint) to SOG.ContainsPart(uint) to match existing ContainsPart method and remove method duplication.
HasChildPrim is also misleading since the 'root' prim can also be returned.
Diffstat (limited to 'OpenSim')
4 files changed, 28 insertions, 39 deletions
diff --git a/OpenSim/Data/Tests/RegionTests.cs b/OpenSim/Data/Tests/RegionTests.cs index 1d806fc..1f03ec5 100644 --- a/OpenSim/Data/Tests/RegionTests.cs +++ b/OpenSim/Data/Tests/RegionTests.cs | |||
@@ -244,10 +244,10 @@ namespace OpenSim.Data.Tests | |||
244 | SceneObjectPart[] newparts = newsog.Parts; | 244 | SceneObjectPart[] newparts = newsog.Parts; |
245 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); | 245 | Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))"); |
246 | 246 | ||
247 | Assert.That(newsog.HasChildPrim(tmp0), "Assert.That(newsog.HasChildPrim(tmp0))"); | 247 | Assert.That(newsog.ContainsPart(tmp0), "Assert.That(newsog.ContainsPart(tmp0))"); |
248 | Assert.That(newsog.HasChildPrim(tmp1), "Assert.That(newsog.HasChildPrim(tmp1))"); | 248 | Assert.That(newsog.ContainsPart(tmp1), "Assert.That(newsog.ContainsPart(tmp1))"); |
249 | Assert.That(newsog.HasChildPrim(tmp2), "Assert.That(newsog.HasChildPrim(tmp2))"); | 249 | Assert.That(newsog.ContainsPart(tmp2), "Assert.That(newsog.ContainsPart(tmp2))"); |
250 | Assert.That(newsog.HasChildPrim(tmp3), "Assert.That(newsog.HasChildPrim(tmp3))"); | 250 | Assert.That(newsog.ContainsPart(tmp3), "Assert.That(newsog.ContainsPart(tmp3))"); |
251 | } | 251 | } |
252 | 252 | ||
253 | [Test] | 253 | [Test] |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 5c542d6..cd1366c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -860,7 +860,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
860 | 860 | ||
861 | if (sog != null) | 861 | if (sog != null) |
862 | { | 862 | { |
863 | if (sog.HasChildPrim(localID)) | 863 | if (sog.ContainsPart(localID)) |
864 | { | 864 | { |
865 | // m_log.DebugFormat( | 865 | // m_log.DebugFormat( |
866 | // "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.", | 866 | // "[SCENE GRAPH]: Found scene object {0} {1} {2} containing part with local id {3} in {4}. Returning.", |
@@ -888,7 +888,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
888 | if (ent is SceneObjectGroup) | 888 | if (ent is SceneObjectGroup) |
889 | { | 889 | { |
890 | sog = (SceneObjectGroup)ent; | 890 | sog = (SceneObjectGroup)ent; |
891 | if (sog.HasChildPrim(localID)) | 891 | if (sog.ContainsPart(localID)) |
892 | { | 892 | { |
893 | lock (SceneObjectGroupsByLocalPartID) | 893 | lock (SceneObjectGroupsByLocalPartID) |
894 | SceneObjectGroupsByLocalPartID[localID] = sog; | 894 | SceneObjectGroupsByLocalPartID[localID] = sog; |
@@ -926,7 +926,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
926 | if (ent is SceneObjectGroup) | 926 | if (ent is SceneObjectGroup) |
927 | { | 927 | { |
928 | sog = (SceneObjectGroup)ent; | 928 | sog = (SceneObjectGroup)ent; |
929 | if (sog.HasChildPrim(fullID)) | 929 | if (sog.ContainsPart(fullID)) |
930 | { | 930 | { |
931 | lock (SceneObjectGroupsByFullPartID) | 931 | lock (SceneObjectGroupsByFullPartID) |
932 | SceneObjectGroupsByFullPartID[fullID] = sog; | 932 | SceneObjectGroupsByFullPartID[fullID] = sog; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index afb5ccf..9d16beb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -338,6 +338,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
338 | return m_parts.ContainsKey(partID); | 338 | return m_parts.ContainsKey(partID); |
339 | } | 339 | } |
340 | 340 | ||
341 | /// <summary> | ||
342 | /// Does this group contain the given part? | ||
343 | /// should be able to remove these methods once we have a entity index in scene | ||
344 | /// </summary> | ||
345 | /// <param name="localID"></param> | ||
346 | /// <returns></returns> | ||
347 | public bool ContainsPart(uint localID) | ||
348 | { | ||
349 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
350 | for (int i = 0; i < parts.Length; i++) | ||
351 | { | ||
352 | if (parts[i].LocalId == localID) | ||
353 | return true; | ||
354 | } | ||
355 | |||
356 | return false; | ||
357 | } | ||
358 | |||
341 | /// <value> | 359 | /// <value> |
342 | /// The root part of this scene object | 360 | /// The root part of this scene object |
343 | /// </value> | 361 | /// </value> |
@@ -1911,35 +1929,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1911 | return null; | 1929 | return null; |
1912 | } | 1930 | } |
1913 | 1931 | ||
1914 | /// <summary> | ||
1915 | /// Does this group contain the child prim | ||
1916 | /// should be able to remove these methods once we have a entity index in scene | ||
1917 | /// </summary> | ||
1918 | /// <param name="primID"></param> | ||
1919 | /// <returns></returns> | ||
1920 | public bool HasChildPrim(UUID primID) | ||
1921 | { | ||
1922 | return m_parts.ContainsKey(primID); | ||
1923 | } | ||
1924 | |||
1925 | /// <summary> | ||
1926 | /// Does this group contain the child prim | ||
1927 | /// should be able to remove these methods once we have a entity index in scene | ||
1928 | /// </summary> | ||
1929 | /// <param name="localID"></param> | ||
1930 | /// <returns></returns> | ||
1931 | public bool HasChildPrim(uint localID) | ||
1932 | { | ||
1933 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
1934 | for (int i = 0; i < parts.Length; i++) | ||
1935 | { | ||
1936 | if (parts[i].LocalId == localID) | ||
1937 | return true; | ||
1938 | } | ||
1939 | |||
1940 | return false; | ||
1941 | } | ||
1942 | |||
1943 | #endregion | 1932 | #endregion |
1944 | 1933 | ||
1945 | #region Packet Handlers | 1934 | #region Packet Handlers |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7455929..b502ab8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3763,7 +3763,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3763 | // parse for sitting avatare-uuids | 3763 | // parse for sitting avatare-uuids |
3764 | World.ForEachRootScenePresence(delegate(ScenePresence presence) | 3764 | World.ForEachRootScenePresence(delegate(ScenePresence presence) |
3765 | { | 3765 | { |
3766 | if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) | 3766 | if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID)) |
3767 | keytable.Add(presence.UUID); | 3767 | keytable.Add(presence.UUID); |
3768 | }); | 3768 | }); |
3769 | 3769 | ||
@@ -3826,7 +3826,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3826 | World.ForEachRootScenePresence(delegate(ScenePresence presence) | 3826 | World.ForEachRootScenePresence(delegate(ScenePresence presence) |
3827 | { | 3827 | { |
3828 | SceneObjectPart sitPart = presence.ParentPart; | 3828 | SceneObjectPart sitPart = presence.ParentPart; |
3829 | if (sitPart != null && m_host.ParentGroup.HasChildPrim(sitPart.LocalId)) | 3829 | if (sitPart != null && m_host.ParentGroup.ContainsPart(sitPart.LocalId)) |
3830 | nametable.Add(presence.ControllingClient.Name); | 3830 | nametable.Add(presence.ControllingClient.Name); |
3831 | }); | 3831 | }); |
3832 | 3832 | ||
@@ -7684,7 +7684,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7684 | int avatarCount = 0; | 7684 | int avatarCount = 0; |
7685 | World.ForEachRootScenePresence(delegate(ScenePresence presence) | 7685 | World.ForEachRootScenePresence(delegate(ScenePresence presence) |
7686 | { | 7686 | { |
7687 | if (presence.ParentID != 0 && m_host.ParentGroup.HasChildPrim(presence.ParentID)) | 7687 | if (presence.ParentID != 0 && m_host.ParentGroup.ContainsPart(presence.ParentID)) |
7688 | avatarCount++; | 7688 | avatarCount++; |
7689 | }); | 7689 | }); |
7690 | 7690 | ||