From d1a1338d1a63c2992868d1b66ea5e5741e8a3971 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 24 Jul 2019 01:07:48 +1000 Subject: Revert list content type check. https://sledjhamr.org/mantisbt/view.php?id=19 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 84e4546..ce2bfaf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5985,23 +5985,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { for (int i = 0; i < length; i++) { - int needle = llGetListEntryType(test, 0).value; - int haystack = llGetListEntryType(src, i).value; +//// int needle = llGetListEntryType(test, 0).value; +//// int haystack = llGetListEntryType(src, i).value; // Why this piece of insanity? This is because most script constants are C# value types (e.g. int) // rather than wrapped LSL types. Such a script constant does not have int.Equal(LSL_Integer) code // and so the comparison fails even if the LSL_Integer conceptually has the same value. // Therefore, here we test Equals on both the source and destination objects. // However, a future better approach may be use LSL struct script constants (e.g. LSL_Integer(1)). - if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) + + // The commented out bit of insanity was to check the LSL types are the same as well, which we don't really want. + if (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i])) +//// if ((needle == haystack) && (src.Data[i].Equals(test.Data[0]) || test.Data[0].Equals(src.Data[i]))) { int j; for (j = 1; j < test.Length; j++) + if (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j]))) { - needle = llGetListEntryType(test, j).value; - haystack = llGetListEntryType(src, i+j).value; +//// needle = llGetListEntryType(test, j).value; +//// haystack = llGetListEntryType(src, i+j).value; - if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) +//// if ((needle != haystack) || (!(src.Data[i+j].Equals(test.Data[j]) || test.Data[j].Equals(src.Data[i+j])))) break; } -- cgit v1.1