aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs56
1 files changed, 40 insertions, 16 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 0b41bc6..5988539 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -724,13 +724,13 @@ namespace SecondLife
724 return assembly; 724 return assembly;
725 } 725 }
726 726
727 private class kvpSorter : IComparer<KeyValuePair<int, int>> 727 private class kvpSorter : IComparer<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>
728 { 728 {
729 public int Compare(KeyValuePair<int, int> a, 729 public int Compare(KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> a,
730 KeyValuePair<int, int> b) 730 KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> b)
731 { 731 {
732 int kc = a.Key.CompareTo(b.Key); 732 int kc = a.Key.Key.CompareTo(b.Key.Key);
733 return (kc != 0) ? kc : a.Value.CompareTo(b.Value); 733 return (kc != 0) ? kc : a.Key.Value.CompareTo(b.Key.Value);
734 } 734 }
735 } 735 }
736 736
@@ -747,24 +747,48 @@ namespace SecondLife
747 out ret)) 747 out ret))
748 return ret; 748 return ret;
749 749
750 List<KeyValuePair<int, int>> sorted = 750 var sorted = new List<KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>>>(positionMap);
751 new List<KeyValuePair<int, int>>(positionMap.Keys);
752 751
753 sorted.Sort(new kvpSorter()); 752 sorted.Sort(new kvpSorter());
754 753
755 int l = sorted[0].Key; 754 int l = 1;
756 int c = sorted[0].Value; 755 int c = 1;
756 int pl = 1;
757 757
758 foreach (KeyValuePair<int, int> cspos in sorted) 758 foreach (KeyValuePair<KeyValuePair<int, int>, KeyValuePair<int, int>> posmap in sorted)
759 { 759 {
760 if (cspos.Key >= line && 760 //m_log.DebugFormat("[Compiler]: Scanning line map {0},{1} --> {2},{3}", posmap.Key.Key, posmap.Key.Value, posmap.Value.Key, posmap.Value.Value);
761 !(cspos.Key == line && cspos.Value <= col)) 761 int nl = posmap.Value.Key + line - posmap.Key.Key; // New, translated LSL line and column.
762 int nc = posmap.Value.Value + col - posmap.Key.Value;
763 // Keep going until we find the first point passed line,col.
764 if (posmap.Key.Key > line)
765 {
766 //m_log.DebugFormat("[Compiler]: Line is larger than requested {0},{1}, returning {2},{3}", line, col, l, c);
767 if (pl < line)
768 {
769 //m_log.DebugFormat("[Compiler]: Previous line ({0}) is less than requested line ({1}), setting column to 1.", pl, line);
770 c = 1;
771 }
762 break; 772 break;
763 l = cspos.Key; 773 }
764 c = cspos.Value; 774 if (posmap.Key.Key == line && posmap.Key.Value > col)
775 {
776 // Never move l,c backwards.
777 if (nl > l || (nl == l && nc > c))
778 {
779 //m_log.DebugFormat("[Compiler]: Using offset relative to this: {0} + {1} - {2}, {3} + {4} - {5} = {6}, {7}",
780 // posmap.Value.Key, line, posmap.Key.Key, posmap.Value.Value, col, posmap.Key.Value, nl, nc);
781 l = nl;
782 c = nc;
783 }
784 //m_log.DebugFormat("[Compiler]: Column is larger than requested {0},{1}, returning {2},{3}", line, col, l, c);
785 break;
786 }
787 pl = posmap.Key.Key;
788 l = posmap.Value.Key;
789 c = posmap.Value.Value;
765 } 790 }
766 positionMap.TryGetValue(new KeyValuePair<int, int>(l, c), out ret); 791 return new KeyValuePair<int, int>(l, c);
767 return ret;
768 } 792 }
769 793
770 string ReplaceTypes(string message) 794 string ReplaceTypes(string message)