diff options
author | Melanie Thielker | 2014-08-10 22:00:01 +0200 |
---|---|---|
committer | Melanie Thielker | 2014-08-10 22:00:01 +0200 |
commit | 4707c488282732b56bc7121544960d3bcb877e20 (patch) | |
tree | 489c730aad46a2fe769222daa18a667db701567a /OpenSim | |
parent | Give extra info on the call stack when SQL errors happen (diff) | |
download | opensim-SC_OLD-4707c488282732b56bc7121544960d3bcb877e20.zip opensim-SC_OLD-4707c488282732b56bc7121544960d3bcb877e20.tar.gz opensim-SC_OLD-4707c488282732b56bc7121544960d3bcb877e20.tar.bz2 opensim-SC_OLD-4707c488282732b56bc7121544960d3bcb877e20.tar.xz |
LSL llListFindList fix: check types as well as content. Items must be same type
to be found.
Diffstat (limited to 'OpenSim')
-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 c65f933..b569194 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6001,17 +6001,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6001 | { | 6001 | { |
6002 | for (int i = 0; i < length; i++) | 6002 | for (int i = 0; i < length; i++) |
6003 | { | 6003 | { |
6004 | int needle = llGetListEntryType(test, 0).value; | ||
6005 | int haystack = llGetListEntryType(src, i).value; | ||
6006 | |||
6004 | // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) | 6007 | // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) |
6005 | // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code | 6008 | // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code |
6006 | // and so the comparison fails even if the LSL_Integer conceptually has the same value. | 6009 | // and so the comparison fails even if the LSL_Integer conceptually has the same value. |
6007 | // Therefore, here we test Equals on both the source and destination objects. | 6010 | // Therefore, here we test Equals on both the source and destination objects. |
6008 | // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). | 6011 | // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). |
6009 | if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) | 6012 | if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) |
6010 | { | 6013 | { |
6011 | int j; | 6014 | int j; |
6012 | for (j = 1; j < test.Length; j++) | 6015 | for (j = 1; j < test.Length; j++) |
6013 | if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) | 6016 | { |
6017 | needle = llGetListEntryType(test, j).value; | ||
6018 | haystack = llGetListEntryType(src, i+j).value; | ||
6019 | |||
6020 | if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) | ||
6014 | break; | 6021 | break; |
6022 | } | ||
6015 | 6023 | ||
6016 | if (j == test.Length) | 6024 | if (j == test.Length) |
6017 | { | 6025 | { |