aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMike Mazur2008-08-19 05:30:10 +0000
committerMike Mazur2008-08-19 05:30:10 +0000
commit225067d8b6f8faae47257858b4bf49ecb196b29f (patch)
treecd8cb81fd1adc4edc98636cecf709688d64f8abe /OpenSim/Region
parentApply Godfrey's patch (originally in r5872) to Shared/LSL_Types.cs as well. (diff)
downloadopensim-SC-225067d8b6f8faae47257858b4bf49ecb196b29f.zip
opensim-SC-225067d8b6f8faae47257858b4bf49ecb196b29f.tar.gz
opensim-SC-225067d8b6f8faae47257858b4bf49ecb196b29f.tar.bz2
opensim-SC-225067d8b6f8faae47257858b4bf49ecb196b29f.tar.xz
Sync OpenSim/Region/ScriptEngine/{Common,Shared}/LSL_Types.cs.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs10
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs187
2 files changed, 106 insertions, 91 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 3b317ac..581b820 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -1351,6 +1351,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1351 value = (int)d; 1351 value = (int)d;
1352 } 1352 }
1353 1353
1354 public LSLInteger(string s)
1355 {
1356 value = (int)double.Parse(s);
1357 }
1358
1354 #endregion 1359 #endregion
1355 1360
1356 #region Operators 1361 #region Operators
@@ -1548,6 +1553,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1548 this.value = d; 1553 this.value = d;
1549 } 1554 }
1550 1555
1556 public LSLFloat(string s)
1557 {
1558 this.value = double.Parse(s);
1559 }
1560
1551 #endregion 1561 #endregion
1552 1562
1553 #region Operators 1563 #region Operators
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
index 903c19c..64334f1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs
@@ -126,6 +126,11 @@ namespace OpenSim.Region.ScriptEngine.Shared
126 return (x == vector.x && x == vector.x && z == vector.z); 126 return (x == vector.x && x == vector.x && z == vector.z);
127 } 127 }
128 128
129 public static Vector3 operator -(Vector3 vector)
130 {
131 return new Vector3(-vector.x, -vector.y, -vector.z);
132 }
133
129 #endregion 134 #endregion
130 135
131 #region Vector & Vector Math 136 #region Vector & Vector Math
@@ -629,97 +634,97 @@ namespace OpenSim.Region.ScriptEngine.Shared
629 } 634 }
630 } 635 }
631 636
632 private class AlphanumComparatorFast : IComparer 637 private class AlphanumComparatorFast : IComparer
633 { 638 {
634 public int Compare(object x, object y) 639 public int Compare(object x, object y)
635 { 640 {
636 string s1 = x as string; 641 string s1 = x as string;
637 if (s1 == null) 642 if (s1 == null)
638 { 643 {
639 return 0; 644 return 0;
640 } 645 }
641 string s2 = y as string; 646 string s2 = y as string;
642 if (s2 == null) 647 if (s2 == null)
643 { 648 {
644 return 0; 649 return 0;
645 } 650 }
646 651
647 int len1 = s1.Length; 652 int len1 = s1.Length;
648 int len2 = s2.Length; 653 int len2 = s2.Length;
649 int marker1 = 0; 654 int marker1 = 0;
650 int marker2 = 0; 655 int marker2 = 0;
651 656
652 // Walk through two the strings with two markers. 657 // Walk through two the strings with two markers.
653 while (marker1 < len1 && marker2 < len2) 658 while (marker1 < len1 && marker2 < len2)
654 { 659 {
655 char ch1 = s1[marker1]; 660 char ch1 = s1[marker1];
656 char ch2 = s2[marker2]; 661 char ch2 = s2[marker2];
657 662
658 // Some buffers we can build up characters in for each chunk. 663 // Some buffers we can build up characters in for each chunk.
659 char[] space1 = new char[len1]; 664 char[] space1 = new char[len1];
660 int loc1 = 0; 665 int loc1 = 0;
661 char[] space2 = new char[len2]; 666 char[] space2 = new char[len2];
662 int loc2 = 0; 667 int loc2 = 0;
663 668
664 // Walk through all following characters that are digits or 669 // Walk through all following characters that are digits or
665 // characters in BOTH strings starting at the appropriate marker. 670 // characters in BOTH strings starting at the appropriate marker.
666 // Collect char arrays. 671 // Collect char arrays.
667 do 672 do
668 { 673 {
669 space1[loc1++] = ch1; 674 space1[loc1++] = ch1;
670 marker1++; 675 marker1++;
671 676
672 if (marker1 < len1) 677 if (marker1 < len1)
673 { 678 {
674 ch1 = s1[marker1]; 679 ch1 = s1[marker1];
675 } 680 }
676 else 681 else
677 { 682 {
678 break; 683 break;
679 } 684 }
680 } while (char.IsDigit(ch1) == char.IsDigit(space1[0])); 685 } while (char.IsDigit(ch1) == char.IsDigit(space1[0]));
681 686
682 do 687 do
683 { 688 {
684 space2[loc2++] = ch2; 689 space2[loc2++] = ch2;
685 marker2++; 690 marker2++;
686 691
687 if (marker2 < len2) 692 if (marker2 < len2)
688 { 693 {
689 ch2 = s2[marker2]; 694 ch2 = s2[marker2];
690 } 695 }
691 else 696 else
692 { 697 {
693 break; 698 break;
694 } 699 }
695 } while (char.IsDigit(ch2) == char.IsDigit(space2[0])); 700 } while (char.IsDigit(ch2) == char.IsDigit(space2[0]));
696 701
697 // If we have collected numbers, compare them numerically. 702 // If we have collected numbers, compare them numerically.
698 // Otherwise, if we have strings, compare them alphabetically. 703 // Otherwise, if we have strings, compare them alphabetically.
699 string str1 = new string(space1); 704 string str1 = new string(space1);
700 string str2 = new string(space2); 705 string str2 = new string(space2);
701 706
702 int result; 707 int result;
703 708
704 if (char.IsDigit(space1[0]) && char.IsDigit(space2[0])) 709 if (char.IsDigit(space1[0]) && char.IsDigit(space2[0]))
705 { 710 {
706 int thisNumericChunk = int.Parse(str1); 711 int thisNumericChunk = int.Parse(str1);
707 int thatNumericChunk = int.Parse(str2); 712 int thatNumericChunk = int.Parse(str2);
708 result = thisNumericChunk.CompareTo(thatNumericChunk); 713 result = thisNumericChunk.CompareTo(thatNumericChunk);
709 } 714 }
710 else 715 else
711 { 716 {
712 result = str1.CompareTo(str2); 717 result = str1.CompareTo(str2);
713 } 718 }
714 719
715 if (result != 0) 720 if (result != 0)
716 { 721 {
717 return result; 722 return result;
718 } 723 }
719 } 724 }
720 return len1 - len2; 725 return len1 - len2;
721 } 726 }
722 } 727 }
723 728
724 public list Sort(int stride, int ascending) 729 public list Sort(int stride, int ascending)
725 { 730 {