diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 50f9377..4ba0e64 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -102,19 +102,19 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
102 | 102 | ||
103 | public override string ToString() | 103 | public override string ToString() |
104 | { | 104 | { |
105 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z); | 105 | string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z); |
106 | return s; | 106 | return s; |
107 | } | 107 | } |
108 | 108 | ||
109 | public static explicit operator LSLString(Vector3 vec) | 109 | public static explicit operator LSLString(Vector3 vec) |
110 | { | 110 | { |
111 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); | 111 | string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); |
112 | return new LSLString(s); | 112 | return new LSLString(s); |
113 | } | 113 | } |
114 | 114 | ||
115 | public static explicit operator string(Vector3 vec) | 115 | public static explicit operator string(Vector3 vec) |
116 | { | 116 | { |
117 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); | 117 | string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); |
118 | return s; | 118 | return s; |
119 | } | 119 | } |
120 | 120 | ||
@@ -414,19 +414,19 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
414 | 414 | ||
415 | public override string ToString() | 415 | public override string ToString() |
416 | { | 416 | { |
417 | string st=String.Format(Culture.FormatProvider, "<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s); | 417 | string st=String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", x, y, z, s); |
418 | return st; | 418 | return st; |
419 | } | 419 | } |
420 | 420 | ||
421 | public static explicit operator string(Quaternion r) | 421 | public static explicit operator string(Quaternion r) |
422 | { | 422 | { |
423 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s); | 423 | string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", r.x, r.y, r.z, r.s); |
424 | return s; | 424 | return s; |
425 | } | 425 | } |
426 | 426 | ||
427 | public static explicit operator LSLString(Quaternion r) | 427 | public static explicit operator LSLString(Quaternion r) |
428 | { | 428 | { |
429 | string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s); | 429 | string s=String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}, {3:0.000000}>", r.x, r.y, r.z, r.s); |
430 | return new LSLString(s); | 430 | return new LSLString(s); |
431 | } | 431 | } |
432 | 432 | ||
@@ -537,7 +537,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
537 | else if (o is LSL_Types.LSLFloat) | 537 | else if (o is LSL_Types.LSLFloat) |
538 | size += 8; | 538 | size += 8; |
539 | else if (o is LSL_Types.LSLString) | 539 | else if (o is LSL_Types.LSLString) |
540 | size += ((LSL_Types.LSLString)o).m_string.Length; | 540 | size += ((LSL_Types.LSLString)o).m_string == null ? 0 : ((LSL_Types.LSLString)o).m_string.Length; |
541 | else if (o is LSL_Types.key) | 541 | else if (o is LSL_Types.key) |
542 | size += ((LSL_Types.key)o).value.Length; | 542 | size += ((LSL_Types.key)o).value.Length; |
543 | else if (o is LSL_Types.Vector3) | 543 | else if (o is LSL_Types.Vector3) |
@@ -546,6 +546,8 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
546 | size += 64; | 546 | size += 64; |
547 | else if (o is int) | 547 | else if (o is int) |
548 | size += 4; | 548 | size += 4; |
549 | else if (o is uint) | ||
550 | size += 4; | ||
549 | else if (o is string) | 551 | else if (o is string) |
550 | size += ((string)o).Length; | 552 | size += ((string)o).Length; |
551 | else if (o is float) | 553 | else if (o is float) |
@@ -736,24 +738,16 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
736 | 738 | ||
737 | public static bool operator ==(list a, list b) | 739 | public static bool operator ==(list a, list b) |
738 | { | 740 | { |
739 | int la = -1; | 741 | int la = a.Length; |
740 | int lb = -1; | 742 | int lb = b.Length; |
741 | try { la = a.Length; } | ||
742 | catch (NullReferenceException) { } | ||
743 | try { lb = b.Length; } | ||
744 | catch (NullReferenceException) { } | ||
745 | 743 | ||
746 | return la == lb; | 744 | return la == lb; |
747 | } | 745 | } |
748 | 746 | ||
749 | public static bool operator !=(list a, list b) | 747 | public static bool operator !=(list a, list b) |
750 | { | 748 | { |
751 | int la = -1; | 749 | int la = a.Length; |
752 | int lb = -1; | 750 | int lb = b.Length; |
753 | try { la = a.Length; } | ||
754 | catch (NullReferenceException) { } | ||
755 | try {lb = b.Length;} | ||
756 | catch (NullReferenceException) { } | ||
757 | 751 | ||
758 | return la != lb; | 752 | return la != lb; |
759 | } | 753 | } |
@@ -987,7 +981,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
987 | ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r)); | 981 | ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r)); |
988 | } | 982 | } |
989 | 983 | ||
990 | if (ascending == 0) | 984 | if (ascending != 1) |
991 | { | 985 | { |
992 | ret = 0 - ret; | 986 | ret = 0 - ret; |
993 | } | 987 | } |
@@ -1020,6 +1014,9 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1020 | stride = 1; | 1014 | stride = 1; |
1021 | } | 1015 | } |
1022 | 1016 | ||
1017 | if ((Data.Length % stride) != 0) | ||
1018 | return new list(ret); | ||
1019 | |||
1023 | // we can optimize here in the case where stride == 1 and the list | 1020 | // we can optimize here in the case where stride == 1 and the list |
1024 | // consists of homogeneous types | 1021 | // consists of homogeneous types |
1025 | 1022 | ||
@@ -1039,7 +1036,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1039 | if (homogeneous) | 1036 | if (homogeneous) |
1040 | { | 1037 | { |
1041 | Array.Sort(ret, new HomogeneousComparer()); | 1038 | Array.Sort(ret, new HomogeneousComparer()); |
1042 | if (ascending == 0) | 1039 | if (ascending != 1) |
1043 | { | 1040 | { |
1044 | Array.Reverse(ret); | 1041 | Array.Reverse(ret); |
1045 | } | 1042 | } |