diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 0ca5ff3..885559a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -102,19 +102,31 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
102 | 102 | ||
103 | public override string ToString() | 103 | public override string ToString() |
104 | { | 104 | { |
105 | <<<<<<< HEAD | ||
105 | string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z); | 106 | string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z); |
107 | ======= | ||
108 | string s = String.Format(Culture.FormatProvider, "<{0:0.000000}, {1:0.000000}, {2:0.000000}>", x, y, z); | ||
109 | >>>>>>> avn/ubitvar | ||
106 | return s; | 110 | return s; |
107 | } | 111 | } |
108 | 112 | ||
109 | public static explicit operator LSLString(Vector3 vec) | 113 | public static explicit operator LSLString(Vector3 vec) |
110 | { | 114 | { |
115 | <<<<<<< HEAD | ||
111 | string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); | 116 | string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); |
117 | ======= | ||
118 | string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); | ||
119 | >>>>>>> avn/ubitvar | ||
112 | return new LSLString(s); | 120 | return new LSLString(s); |
113 | } | 121 | } |
114 | 122 | ||
115 | public static explicit operator string(Vector3 vec) | 123 | public static explicit operator string(Vector3 vec) |
116 | { | 124 | { |
125 | <<<<<<< HEAD | ||
117 | string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); | 126 | string s=String.Format(Culture.FormatProvider,"<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); |
127 | ======= | ||
128 | string s = String.Format("<{0:0.000000}, {1:0.000000}, {2:0.000000}>", vec.x, vec.y, vec.z); | ||
129 | >>>>>>> avn/ubitvar | ||
118 | return s; | 130 | return s; |
119 | } | 131 | } |
120 | 132 | ||
@@ -414,19 +426,19 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
414 | 426 | ||
415 | public override string ToString() | 427 | public override string ToString() |
416 | { | 428 | { |
417 | string st=String.Format(Culture.FormatProvider, "<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s); | 429 | 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; | 430 | return st; |
419 | } | 431 | } |
420 | 432 | ||
421 | public static explicit operator string(Quaternion r) | 433 | public static explicit operator string(Quaternion r) |
422 | { | 434 | { |
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); | 435 | 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; | 436 | return s; |
425 | } | 437 | } |
426 | 438 | ||
427 | public static explicit operator LSLString(Quaternion r) | 439 | public static explicit operator LSLString(Quaternion r) |
428 | { | 440 | { |
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); | 441 | 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); | 442 | return new LSLString(s); |
431 | } | 443 | } |
432 | 444 | ||
@@ -537,7 +549,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
537 | else if (o is LSL_Types.LSLFloat) | 549 | else if (o is LSL_Types.LSLFloat) |
538 | size += 8; | 550 | size += 8; |
539 | else if (o is LSL_Types.LSLString) | 551 | else if (o is LSL_Types.LSLString) |
540 | size += ((LSL_Types.LSLString)o).m_string.Length; | 552 | size += ((LSL_Types.LSLString)o).m_string == null ? 0 : ((LSL_Types.LSLString)o).m_string.Length; |
541 | else if (o is LSL_Types.key) | 553 | else if (o is LSL_Types.key) |
542 | size += ((LSL_Types.key)o).value.Length; | 554 | size += ((LSL_Types.key)o).value.Length; |
543 | else if (o is LSL_Types.Vector3) | 555 | else if (o is LSL_Types.Vector3) |
@@ -546,6 +558,8 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
546 | size += 64; | 558 | size += 64; |
547 | else if (o is int) | 559 | else if (o is int) |
548 | size += 4; | 560 | size += 4; |
561 | else if (o is uint) | ||
562 | size += 4; | ||
549 | else if (o is string) | 563 | else if (o is string) |
550 | size += ((string)o).Length; | 564 | size += ((string)o).Length; |
551 | else if (o is float) | 565 | else if (o is float) |
@@ -713,10 +727,17 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
713 | private void ExtendAndAdd(object o) | 727 | private void ExtendAndAdd(object o) |
714 | { | 728 | { |
715 | object[] tmp; | 729 | object[] tmp; |
730 | <<<<<<< HEAD | ||
716 | tmp = new object[Data.Length + 1]; | 731 | tmp = new object[Data.Length + 1]; |
717 | Data.CopyTo(tmp, 0); | 732 | Data.CopyTo(tmp, 0); |
718 | tmp.SetValue(o, tmp.Length - 1); | 733 | tmp.SetValue(o, tmp.Length - 1); |
719 | Data = tmp; | 734 | Data = tmp; |
735 | ======= | ||
736 | tmp = new object[m_data.Length + 1]; | ||
737 | m_data.CopyTo(tmp, 0); | ||
738 | tmp.SetValue(o, tmp.Length - 1); | ||
739 | m_data = tmp; | ||
740 | >>>>>>> avn/ubitvar | ||
720 | } | 741 | } |
721 | 742 | ||
722 | public static list operator +(list a, LSLString s) | 743 | public static list operator +(list a, LSLString s) |
@@ -739,24 +760,16 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
739 | 760 | ||
740 | public static bool operator ==(list a, list b) | 761 | public static bool operator ==(list a, list b) |
741 | { | 762 | { |
742 | int la = -1; | 763 | int la = a.Length; |
743 | int lb = -1; | 764 | int lb = b.Length; |
744 | try { la = a.Length; } | ||
745 | catch (NullReferenceException) { } | ||
746 | try { lb = b.Length; } | ||
747 | catch (NullReferenceException) { } | ||
748 | 765 | ||
749 | return la == lb; | 766 | return la == lb; |
750 | } | 767 | } |
751 | 768 | ||
752 | public static bool operator !=(list a, list b) | 769 | public static bool operator !=(list a, list b) |
753 | { | 770 | { |
754 | int la = -1; | 771 | int la = a.Length; |
755 | int lb = -1; | 772 | int lb = b.Length; |
756 | try { la = a.Length; } | ||
757 | catch (NullReferenceException) { } | ||
758 | try {lb = b.Length;} | ||
759 | catch (NullReferenceException) { } | ||
760 | 773 | ||
761 | return la != lb; | 774 | return la != lb; |
762 | } | 775 | } |
@@ -990,7 +1003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
990 | ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r)); | 1003 | ret = Math.Sign(Quaternion.Mag(l) - Quaternion.Mag(r)); |
991 | } | 1004 | } |
992 | 1005 | ||
993 | if (ascending == 0) | 1006 | if (ascending != 1) |
994 | { | 1007 | { |
995 | ret = 0 - ret; | 1008 | ret = 0 - ret; |
996 | } | 1009 | } |
@@ -1023,6 +1036,9 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1023 | stride = 1; | 1036 | stride = 1; |
1024 | } | 1037 | } |
1025 | 1038 | ||
1039 | if ((Data.Length % stride) != 0) | ||
1040 | return new list(ret); | ||
1041 | |||
1026 | // we can optimize here in the case where stride == 1 and the list | 1042 | // we can optimize here in the case where stride == 1 and the list |
1027 | // consists of homogeneous types | 1043 | // consists of homogeneous types |
1028 | 1044 | ||
@@ -1042,7 +1058,7 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
1042 | if (homogeneous) | 1058 | if (homogeneous) |
1043 | { | 1059 | { |
1044 | Array.Sort(ret, new HomogeneousComparer()); | 1060 | Array.Sort(ret, new HomogeneousComparer()); |
1045 | if (ascending == 0) | 1061 | if (ascending != 1) |
1046 | { | 1062 | { |
1047 | Array.Reverse(ret); | 1063 | Array.Reverse(ret); |
1048 | } | 1064 | } |