From 60acc370fcd98d8553fa19c5c866727d9fac25c7 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Fri, 15 Aug 2008 00:55:16 +0000 Subject: Thanks, krtaylor, for a patch that fixes llListSort() and llListRandomize() failing with stride less than 1. Fix issue 1893. --- OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 9 ++++++++- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 9d05526..e1a4648 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -3541,6 +3541,11 @@ namespace OpenSim.Region.ScriptEngine.Common public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending) { m_host.AddScriptLPS(1); + + if (stride <= 0) + { + stride = 1; + } return src.Sort(stride, ascending); } @@ -3855,8 +3860,10 @@ namespace OpenSim.Region.ScriptEngine.Common m_host.AddScriptLPS(1); - if (stride == 0) + if (stride <= 0) + { stride = 1; + } // Stride MUST be a factor of the list length // If not, then return the src list. This also diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index e0614da..6c4f34a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3454,6 +3454,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending) { m_host.AddScriptLPS(1); + + if (stride <= 0) + { + stride = 1; + } return src.Sort(stride, ascending); } @@ -3766,8 +3771,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); - if (stride == 0) + if (stride <= 0) + { stride = 1; + } // Stride MUST be a factor of the list length // If not, then return the src list. This also -- cgit v1.1