aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs29
-rw-r--r--OpenSim/Tools/Compiler/Program.cs39
2 files changed, 27 insertions, 41 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 1efe798..0b41bc6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -729,7 +729,8 @@ namespace SecondLife
729 public int Compare(KeyValuePair<int, int> a, 729 public int Compare(KeyValuePair<int, int> a,
730 KeyValuePair<int, int> b) 730 KeyValuePair<int, int> b)
731 { 731 {
732 return a.Key.CompareTo(b.Key); 732 int kc = a.Key.CompareTo(b.Key);
733 return (kc != 0) ? kc : a.Value.CompareTo(b.Value);
733 } 734 }
734 } 735 }
735 736
@@ -751,27 +752,19 @@ namespace SecondLife
751 752
752 sorted.Sort(new kvpSorter()); 753 sorted.Sort(new kvpSorter());
753 754
754 int l = 1; 755 int l = sorted[0].Key;
755 int c = 1; 756 int c = sorted[0].Value;
756 757
757 foreach (KeyValuePair<int, int> cspos in sorted) 758 foreach (KeyValuePair<int, int> cspos in sorted)
758 { 759 {
759 if (cspos.Key >= line) 760 if (cspos.Key >= line &&
760 { 761 !(cspos.Key == line && cspos.Value <= col))
761 if (cspos.Key > line) 762 break;
762 return new KeyValuePair<int, int>(l, c); 763 l = cspos.Key;
763 if (cspos.Value > col) 764 c = cspos.Value;
764 return new KeyValuePair<int, int>(l, c);
765 c = cspos.Value;
766 if (c == 0)
767 c++;
768 }
769 else
770 {
771 l = cspos.Key;
772 }
773 } 765 }
774 return new KeyValuePair<int, int>(l, c); 766 positionMap.TryGetValue(new KeyValuePair<int, int>(l, c), out ret);
767 return ret;
775 } 768 }
776 769
777 string ReplaceTypes(string message) 770 string ReplaceTypes(string message)
diff --git a/OpenSim/Tools/Compiler/Program.cs b/OpenSim/Tools/Compiler/Program.cs
index 6c59c31..b9c960b 100644
--- a/OpenSim/Tools/Compiler/Program.cs
+++ b/OpenSim/Tools/Compiler/Program.cs
@@ -255,12 +255,13 @@ namespace OpenSim.Tools.LSL.Compiler
255 return FindErrorPosition(line, col, null); 255 return FindErrorPosition(line, col, null);
256 } 256 }
257 257
258 private class kvpSorter : IComparer<KeyValuePair<int,int>> 258 private class kvpSorter : IComparer<KeyValuePair<int, int>>
259 { 259 {
260 public int Compare(KeyValuePair<int,int> a, 260 public int Compare(KeyValuePair<int, int> a,
261 KeyValuePair<int,int> b) 261 KeyValuePair<int, int> b)
262 { 262 {
263 return a.Key.CompareTo(b.Key); 263 int kc = a.Key.CompareTo(b.Key);
264 return (kc != 0) ? kc : a.Value.CompareTo(b.Value);
264 } 265 }
265 } 266 }
266 267
@@ -277,32 +278,24 @@ namespace OpenSim.Tools.LSL.Compiler
277 out ret)) 278 out ret))
278 return ret; 279 return ret;
279 280
280 List<KeyValuePair<int,int>> sorted = 281 List<KeyValuePair<int, int>> sorted =
281 new List<KeyValuePair<int,int>>(positionMap.Keys); 282 new List<KeyValuePair<int, int>>(positionMap.Keys);
282 283
283 sorted.Sort(new kvpSorter()); 284 sorted.Sort(new kvpSorter());
284 285
285 int l = 1; 286 int l = sorted[0].Key;
286 int c = 1; 287 int c = sorted[0].Value;
287 288
288 foreach (KeyValuePair<int, int> cspos in sorted) 289 foreach (KeyValuePair<int, int> cspos in sorted)
289 { 290 {
290 if (cspos.Key >= line) 291 if (cspos.Key >= line &&
291 { 292 !(cspos.Key == line && cspos.Value <= col))
292 if (cspos.Key > line) 293 break;
293 return new KeyValuePair<int, int>(l, c); 294 l = cspos.Key;
294 if (cspos.Value > col) 295 c = cspos.Value;
295 return new KeyValuePair<int, int>(l, c);
296 c = cspos.Value;
297 if (c == 0)
298 c++;
299 }
300 else
301 {
302 l = cspos.Key;
303 }
304 } 296 }
305 return new KeyValuePair<int, int>(l, c); 297 positionMap.TryGetValue(new KeyValuePair<int, int>(l, c), out ret);
298 return ret;
306 } 299 }
307 } 300 }
308} 301}