mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 14:16:07 +08:00
llListSort SL compatibility: When sorting strided list and the list
length is not a multiple of the stride, return the original list. Also, enforce that sort is ascending only when the ascending parameter is 1, and not when it is != 0
This commit is contained in:
@@ -858,7 +858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r));
|
||||
}
|
||||
|
||||
if (ascending == 0)
|
||||
if (ascending != 1)
|
||||
{
|
||||
ret = 0 - ret;
|
||||
}
|
||||
@@ -891,6 +891,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
stride = 1;
|
||||
}
|
||||
|
||||
if ((Data.Length % stride) != 0)
|
||||
return new list(ret);
|
||||
|
||||
// we can optimize here in the case where stride == 1 and the list
|
||||
// consists of homogeneous types
|
||||
|
||||
@@ -910,7 +913,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
if (homogeneous)
|
||||
{
|
||||
Array.Sort(ret, new HomogeneousComparer());
|
||||
if (ascending == 0)
|
||||
if (ascending != 1)
|
||||
{
|
||||
Array.Reverse(ret);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user