diff options
author | Melanie Thielker | 2014-08-10 22:00:01 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-08-10 22:01:39 +0200 |
commit | 0e809ab2658d9aff51d7a12754630ccfec977b79 (patch) | |
tree | d3470826a6625977a79ad0d21cf40959f09f193b /OpenSim/Region | |
parent | add wearables array size checks on unpack (diff) | |
download | opensim-SC-0e809ab2658d9aff51d7a12754630ccfec977b79.zip opensim-SC-0e809ab2658d9aff51d7a12754630ccfec977b79.tar.gz opensim-SC-0e809ab2658d9aff51d7a12754630ccfec977b79.tar.bz2 opensim-SC-0e809ab2658d9aff51d7a12754630ccfec977b79.tar.xz |
LSL llListFindList fix: check types as well as content. Items must be same type
to be found.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3f0af6d..e72b3dd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5950,17 +5950,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5950 | { | 5950 | { |
5951 | for (int i = 0; i < length; i++) | 5951 | for (int i = 0; i < length; i++) |
5952 | { | 5952 | { |
5953 | int needle = llGetListEntryType(test, 0).value; | ||
5954 | int haystack = llGetListEntryType(src, i).value; | ||
5955 | |||
5953 | // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) | 5956 | // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) |
5954 | // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code | 5957 | // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code |
5955 | // and so the comparison fails even if the LSL_Integer conceptually has the same value. | 5958 | // and so the comparison fails even if the LSL_Integer conceptually has the same value. |
5956 | // Therefore, here we test Equals on both the source and destination objects. | 5959 | // Therefore, here we test Equals on both the source and destination objects. |
5957 | // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). | 5960 | // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). |
5958 | if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) | 5961 | if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) |
5959 | { | 5962 | { |
5960 | int j; | 5963 | int j; |
5961 | for (j = 1; j < test.Length; j++) | 5964 | for (j = 1; j < test.Length; j++) |
5962 | if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) | 5965 | { |
5966 | needle = llGetListEntryType(test, j).value; | ||
5967 | haystack = llGetListEntryType(src, i+j).value; | ||
5968 | |||
5969 | if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) | ||
5963 | break; | 5970 | break; |
5971 | } | ||
5964 | 5972 | ||
5965 | if (j == test.Length) | 5973 | if (j == test.Length) |
5966 | { | 5974 | { |