diff options
author | Melanie | 2012-09-24 20:14:00 +0100 |
---|---|---|
committer | Melanie | 2012-09-24 20:14:00 +0100 |
commit | bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6 (patch) | |
tree | 2ac67907f6333bbbc9e4d821c6607b53d0e22acb /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Merge branch 'master' into careminster (diff) | |
parent | HG Rez object: warn the user if the item or asset cannot be found. (diff) | |
download | opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.zip opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.gz opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.bz2 opensim-SC-bbaf2c5a80441fdbd2f55e02ec9f46c3b66869c6.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 9570669..8d06d83 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5871,27 +5871,36 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5871 | /// Returns the index of the first occurrence of test | 5871 | /// Returns the index of the first occurrence of test |
5872 | /// in src. | 5872 | /// in src. |
5873 | /// </summary> | 5873 | /// </summary> |
5874 | 5874 | /// <param name="src">Source list</param> | |
5875 | /// <param name="test">List to search for</param> | ||
5876 | /// <returns> | ||
5877 | /// The index number of the point in src where test was found if it was found. | ||
5878 | /// Otherwise returns -1 | ||
5879 | /// </returns> | ||
5875 | public LSL_Integer llListFindList(LSL_List src, LSL_List test) | 5880 | public LSL_Integer llListFindList(LSL_List src, LSL_List test) |
5876 | { | 5881 | { |
5877 | |||
5878 | int index = -1; | 5882 | int index = -1; |
5879 | int length = src.Length - test.Length + 1; | 5883 | int length = src.Length - test.Length + 1; |
5880 | 5884 | ||
5881 | m_host.AddScriptLPS(1); | 5885 | m_host.AddScriptLPS(1); |
5882 | 5886 | ||
5883 | // If either list is empty, do not match | 5887 | // If either list is empty, do not match |
5884 | |||
5885 | if (src.Length != 0 && test.Length != 0) | 5888 | if (src.Length != 0 && test.Length != 0) |
5886 | { | 5889 | { |
5887 | for (int i = 0; i < length; i++) | 5890 | for (int i = 0; i < length; i++) |
5888 | { | 5891 | { |
5889 | if (src.Data[i].Equals(test.Data[0])) | 5892 | // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) |
5893 | // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code | ||
5894 | // and so the comparison fails even if the LSL_Integer conceptually has the same value. | ||
5895 | // Therefore, here we test Equals on both the source and destination objects. | ||
5896 | // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). | ||
5897 | if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) | ||
5890 | { | 5898 | { |
5891 | int j; | 5899 | int j; |
5892 | for (j = 1; j < test.Length; j++) | 5900 | for (j = 1; j < test.Length; j++) |
5893 | if (!src.Data[i+j].Equals(test.Data[j])) | 5901 | if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) |
5894 | break; | 5902 | break; |
5903 | |||
5895 | if (j == test.Length) | 5904 | if (j == test.Length) |
5896 | { | 5905 | { |
5897 | index = i; | 5906 | index = i; |
@@ -5902,19 +5911,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5902 | } | 5911 | } |
5903 | 5912 | ||
5904 | return index; | 5913 | return index; |
5905 | |||
5906 | } | 5914 | } |
5907 | 5915 | ||
5908 | public LSL_String llGetObjectName() | 5916 | public LSL_String llGetObjectName() |
5909 | { | 5917 | { |
5910 | m_host.AddScriptLPS(1); | 5918 | m_host.AddScriptLPS(1); |
5911 | return m_host.Name!=null?m_host.Name:String.Empty; | 5919 | return m_host.Name !=null ? m_host.Name : String.Empty; |
5912 | } | 5920 | } |
5913 | 5921 | ||
5914 | public void llSetObjectName(string name) | 5922 | public void llSetObjectName(string name) |
5915 | { | 5923 | { |
5916 | m_host.AddScriptLPS(1); | 5924 | m_host.AddScriptLPS(1); |
5917 | m_host.Name = name!=null?name:String.Empty; | 5925 | m_host.Name = name != null ? name : String.Empty; |
5918 | } | 5926 | } |
5919 | 5927 | ||
5920 | public LSL_String llGetDate() | 5928 | public LSL_String llGetDate() |