Sync OpenSim/Region/ScriptEngine/{Common,Shared}/LSL_Types.cs.
parent
a513cba60b
commit
225067d8b6
|
@ -1351,6 +1351,11 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
value = (int)d;
|
value = (int)d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSLInteger(string s)
|
||||||
|
{
|
||||||
|
value = (int)double.Parse(s);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
@ -1548,6 +1553,11 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
this.value = d;
|
this.value = d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LSLFloat(string s)
|
||||||
|
{
|
||||||
|
this.value = double.Parse(s);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Operators
|
#region Operators
|
||||||
|
|
|
@ -126,6 +126,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
return (x == vector.x && x == vector.x && z == vector.z);
|
return (x == vector.x && x == vector.x && z == vector.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Vector3 operator -(Vector3 vector)
|
||||||
|
{
|
||||||
|
return new Vector3(-vector.x, -vector.y, -vector.z);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Vector & Vector Math
|
#region Vector & Vector Math
|
||||||
|
@ -629,97 +634,97 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AlphanumComparatorFast : IComparer
|
private class AlphanumComparatorFast : IComparer
|
||||||
{
|
{
|
||||||
public int Compare(object x, object y)
|
public int Compare(object x, object y)
|
||||||
{
|
{
|
||||||
string s1 = x as string;
|
string s1 = x as string;
|
||||||
if (s1 == null)
|
if (s1 == null)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
string s2 = y as string;
|
string s2 = y as string;
|
||||||
if (s2 == null)
|
if (s2 == null)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int len1 = s1.Length;
|
int len1 = s1.Length;
|
||||||
int len2 = s2.Length;
|
int len2 = s2.Length;
|
||||||
int marker1 = 0;
|
int marker1 = 0;
|
||||||
int marker2 = 0;
|
int marker2 = 0;
|
||||||
|
|
||||||
// Walk through two the strings with two markers.
|
// Walk through two the strings with two markers.
|
||||||
while (marker1 < len1 && marker2 < len2)
|
while (marker1 < len1 && marker2 < len2)
|
||||||
{
|
{
|
||||||
char ch1 = s1[marker1];
|
char ch1 = s1[marker1];
|
||||||
char ch2 = s2[marker2];
|
char ch2 = s2[marker2];
|
||||||
|
|
||||||
// Some buffers we can build up characters in for each chunk.
|
// Some buffers we can build up characters in for each chunk.
|
||||||
char[] space1 = new char[len1];
|
char[] space1 = new char[len1];
|
||||||
int loc1 = 0;
|
int loc1 = 0;
|
||||||
char[] space2 = new char[len2];
|
char[] space2 = new char[len2];
|
||||||
int loc2 = 0;
|
int loc2 = 0;
|
||||||
|
|
||||||
// Walk through all following characters that are digits or
|
// Walk through all following characters that are digits or
|
||||||
// characters in BOTH strings starting at the appropriate marker.
|
// characters in BOTH strings starting at the appropriate marker.
|
||||||
// Collect char arrays.
|
// Collect char arrays.
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
space1[loc1++] = ch1;
|
space1[loc1++] = ch1;
|
||||||
marker1++;
|
marker1++;
|
||||||
|
|
||||||
if (marker1 < len1)
|
if (marker1 < len1)
|
||||||
{
|
{
|
||||||
ch1 = s1[marker1];
|
ch1 = s1[marker1];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (char.IsDigit(ch1) == char.IsDigit(space1[0]));
|
} while (char.IsDigit(ch1) == char.IsDigit(space1[0]));
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
space2[loc2++] = ch2;
|
space2[loc2++] = ch2;
|
||||||
marker2++;
|
marker2++;
|
||||||
|
|
||||||
if (marker2 < len2)
|
if (marker2 < len2)
|
||||||
{
|
{
|
||||||
ch2 = s2[marker2];
|
ch2 = s2[marker2];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (char.IsDigit(ch2) == char.IsDigit(space2[0]));
|
} while (char.IsDigit(ch2) == char.IsDigit(space2[0]));
|
||||||
|
|
||||||
// If we have collected numbers, compare them numerically.
|
// If we have collected numbers, compare them numerically.
|
||||||
// Otherwise, if we have strings, compare them alphabetically.
|
// Otherwise, if we have strings, compare them alphabetically.
|
||||||
string str1 = new string(space1);
|
string str1 = new string(space1);
|
||||||
string str2 = new string(space2);
|
string str2 = new string(space2);
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (char.IsDigit(space1[0]) && char.IsDigit(space2[0]))
|
if (char.IsDigit(space1[0]) && char.IsDigit(space2[0]))
|
||||||
{
|
{
|
||||||
int thisNumericChunk = int.Parse(str1);
|
int thisNumericChunk = int.Parse(str1);
|
||||||
int thatNumericChunk = int.Parse(str2);
|
int thatNumericChunk = int.Parse(str2);
|
||||||
result = thisNumericChunk.CompareTo(thatNumericChunk);
|
result = thisNumericChunk.CompareTo(thatNumericChunk);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result = str1.CompareTo(str2);
|
result = str1.CompareTo(str2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != 0)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return len1 - len2;
|
return len1 - len2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public list Sort(int stride, int ascending)
|
public list Sort(int stride, int ascending)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue