diff options
author | Tedd Hansen | 2007-09-15 16:16:57 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-09-15 16:16:57 +0000 |
commit | cff586df68c01282d1ce6ef2875e342280e3bd1b (patch) | |
tree | ed1617ce5bab39d13d335dc0823913e30dcf36ad /OpenSim/Region/ScriptEngine/DotNetEngine | |
parent | llList2Key, llList2Rot, llList2List (diff) | |
download | opensim-SC_OLD-cff586df68c01282d1ce6ef2875e342280e3bd1b.zip opensim-SC_OLD-cff586df68c01282d1ce6ef2875e342280e3bd1b.tar.gz opensim-SC_OLD-cff586df68c01282d1ce6ef2875e342280e3bd1b.tar.bz2 opensim-SC_OLD-cff586df68c01282d1ce6ef2875e342280e3bd1b.tar.xz |
Bugfixed: llListRandomize
Implemented: llListSort, llList2ListStrided, llDeleteSubString, llInsertString
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | 76 |
1 files changed, 69 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs index 80e52c3..f95811e 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs | |||
@@ -13,6 +13,11 @@ using System.Runtime.Remoting.Lifetime; | |||
13 | 13 | ||
14 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | 14 | namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler |
15 | { | 15 | { |
16 | // | ||
17 | // !!!IMPORTANT!!! | ||
18 | // | ||
19 | // REMEMBER TO UPDATE http://opensimulator.org/wiki/LlFunction_implementation_status | ||
20 | // | ||
16 | 21 | ||
17 | /// <summary> | 22 | /// <summary> |
18 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. | 23 | /// Contains all LSL ll-functions. This class will be in Default AppDomain. |
@@ -321,9 +326,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
321 | return src.Substring(start, end); | 326 | return src.Substring(start, end); |
322 | } | 327 | } |
323 | 328 | ||
324 | public string llDeleteSubString(string src, int start, int end) { NotImplemented("llDeleteSubString"); return ""; } | 329 | public string llDeleteSubString(string src, int start, int end) |
325 | public string llInsertString(string dst, int position, string src) { NotImplemented("llInsertString"); return ""; } | 330 | { |
326 | 331 | return src.Remove(start, end - start); | |
332 | } | ||
333 | public string llInsertString(string dst, int position, string src) | ||
334 | { | ||
335 | return dst.Insert(position, src); | ||
336 | } | ||
327 | public string llToUpper(string src) | 337 | public string llToUpper(string src) |
328 | { | 338 | { |
329 | return src.ToUpper(); | 339 | return src.ToUpper(); |
@@ -472,9 +482,40 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
472 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } | 482 | public LSL_Types.Vector3 llGetCenterOfMass() { NotImplemented("llGetCenterOfMass"); return new LSL_Types.Vector3(); } |
473 | 483 | ||
474 | public List<string> llListSort(List<string> src, int stride, int ascending) { | 484 | public List<string> llListSort(List<string> src, int stride, int ascending) { |
475 | //SortedList<string, int> sorted = new SortedList<string, int>(); | 485 | SortedList<string, List<string>> sorted = new SortedList<string, List<string>>(); |
476 | //foreach (string s in src) | 486 | // Add chunks to an array |
477 | NotImplemented("llListSort"); return new List<string>(); ; | 487 | int s = stride; |
488 | if (s < 1) | ||
489 | s = 1; | ||
490 | int c = 0; | ||
491 | List<string> chunk = new List<string>(); | ||
492 | string chunkString = ""; | ||
493 | foreach (string element in src) | ||
494 | { | ||
495 | c++; | ||
496 | if (c > s) | ||
497 | { | ||
498 | sorted.Add(chunkString, chunk); | ||
499 | chunkString = ""; | ||
500 | chunk = new List<string>(); | ||
501 | c = 0; | ||
502 | } | ||
503 | chunk.Add(element); | ||
504 | chunkString += element.ToString(); | ||
505 | } | ||
506 | if (chunk.Count > 0) | ||
507 | sorted.Add(chunkString, chunk); | ||
508 | |||
509 | List<string> ret = new List<string>(); | ||
510 | foreach (List<string> ls in sorted.Values) | ||
511 | { | ||
512 | ret.AddRange(ls); | ||
513 | } | ||
514 | |||
515 | if (ascending == LSL.LSL_BaseClass.TRUE) | ||
516 | return ret; | ||
517 | ret.Reverse(); | ||
518 | return ret; | ||
478 | } | 519 | } |
479 | 520 | ||
480 | public int llGetListLength(List<string> src) | 521 | public int llGetListLength(List<string> src) |
@@ -587,6 +628,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
587 | } | 628 | } |
588 | chunk.Add(element); | 629 | chunk.Add(element); |
589 | } | 630 | } |
631 | if (chunk.Count > 0) | ||
632 | tmp.Add(chunk); | ||
590 | 633 | ||
591 | // Decreate array back into a list | 634 | // Decreate array back into a list |
592 | int rnd; | 635 | int rnd; |
@@ -605,7 +648,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler | |||
605 | 648 | ||
606 | 649 | ||
607 | } | 650 | } |
608 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) { NotImplemented("llList2ListStrided"); return new List<string>(); } | 651 | public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) |
652 | { | ||
653 | List<string> ret = new List<string>(); | ||
654 | int s = stride; | ||
655 | if (s < 1) | ||
656 | s = 1; | ||
657 | |||
658 | int sc = s; | ||
659 | for (int i = start; i < src.Count; i++) { | ||
660 | sc--; | ||
661 | if (sc ==0) { | ||
662 | sc = s; | ||
663 | // Addthis | ||
664 | ret.Add(src[i]); | ||
665 | } | ||
666 | if (i == end) | ||
667 | break; | ||
668 | } | ||
669 | return ret; | ||
670 | } | ||
609 | 671 | ||
610 | public LSL_Types.Vector3 llGetRegionCorner() | 672 | public LSL_Types.Vector3 llGetRegionCorner() |
611 | { | 673 | { |