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 != 0avinationmerge
parent
c2a73a26b5
commit
97f0cff388
|
@ -858,7 +858,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r));
|
ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ascending == 0)
|
if (ascending != 1)
|
||||||
{
|
{
|
||||||
ret = 0 - ret;
|
ret = 0 - ret;
|
||||||
}
|
}
|
||||||
|
@ -891,6 +891,9 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
stride = 1;
|
stride = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((Data.Length % stride) != 0)
|
||||||
|
return new list(ret);
|
||||||
|
|
||||||
// we can optimize here in the case where stride == 1 and the list
|
// we can optimize here in the case where stride == 1 and the list
|
||||||
// consists of homogeneous types
|
// consists of homogeneous types
|
||||||
|
|
||||||
|
@ -910,7 +913,7 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
if (homogeneous)
|
if (homogeneous)
|
||||||
{
|
{
|
||||||
Array.Sort(ret, new HomogeneousComparer());
|
Array.Sort(ret, new HomogeneousComparer());
|
||||||
if (ascending == 0)
|
if (ascending != 1)
|
||||||
{
|
{
|
||||||
Array.Reverse(ret);
|
Array.Reverse(ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue