diff options
author | Teravus Ovares | 2008-04-24 15:11:19 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-04-24 15:11:19 +0000 |
commit | 5c660ea0c59a15000e40fd7be7421c5f99bbe96c (patch) | |
tree | 2770814087ad60bc162ca58addd3c90db86c4613 /OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |
parent | auto table creation for nhibernate backends (diff) | |
download | opensim-SC_OLD-5c660ea0c59a15000e40fd7be7421c5f99bbe96c.zip opensim-SC_OLD-5c660ea0c59a15000e40fd7be7421c5f99bbe96c.tar.gz opensim-SC_OLD-5c660ea0c59a15000e40fd7be7421c5f99bbe96c.tar.bz2 opensim-SC_OLD-5c660ea0c59a15000e40fd7be7421c5f99bbe96c.tar.xz |
* Patch from Melanie. Mantis: 1040. Thanks Melanie!
* Implements llDeleteSubList in all it's modes. Corrects type selection in inventory functions. Adds support for INVENTORY_ALL selector
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_Types.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index 7a8b4ca..ec10157 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -403,6 +403,68 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
403 | return ret; | 403 | return ret; |
404 | } | 404 | } |
405 | 405 | ||
406 | public list DeleteSublist(int start, int end) | ||
407 | { | ||
408 | // Not an easy one | ||
409 | // If start <= end, remove that part | ||
410 | // if either is negative, count from the end of the array | ||
411 | // if the resulting start > end, remove all BUT that part | ||
412 | |||
413 | Object[] ret; | ||
414 | |||
415 | if(start < 0) | ||
416 | start=m_data.Length-start; | ||
417 | |||
418 | if(start < 0) | ||
419 | start=0; | ||
420 | |||
421 | if(end < 0) | ||
422 | end=m_data.Length-end; | ||
423 | if(end < 0) | ||
424 | end=0; | ||
425 | |||
426 | if(start > end) | ||
427 | { | ||
428 | if(end >= m_data.Length) | ||
429 | return new list(new Object[0]); | ||
430 | |||
431 | if(start >= m_data.Length) | ||
432 | start=m_data.Length-1; | ||
433 | |||
434 | return GetSublist(end, start); | ||
435 | } | ||
436 | |||
437 | // start >= 0 && end >= 0 here | ||
438 | if(start >= m_data.Length) | ||
439 | { | ||
440 | ret=new Object[m_data.Length]; | ||
441 | Array.Copy(m_data, 0, ret, 0, m_data.Length); | ||
442 | |||
443 | return new list(ret); | ||
444 | } | ||
445 | |||
446 | if(end >= m_data.Length) | ||
447 | end=m_data.Length-1; | ||
448 | |||
449 | // now, this makes the math easier | ||
450 | int remove=end+1-start; | ||
451 | |||
452 | ret=new Object[m_data.Length-remove]; | ||
453 | if(ret.Length == 0) | ||
454 | return new list(ret); | ||
455 | |||
456 | int src; | ||
457 | int dest=0; | ||
458 | |||
459 | for(src = 0 ; src < m_data.Length ; src++) | ||
460 | { | ||
461 | if(src < start || src > end) | ||
462 | ret[dest++]=m_data[src]; | ||
463 | } | ||
464 | |||
465 | return new list(ret); | ||
466 | } | ||
467 | |||
406 | public list GetSublist(int start, int end) | 468 | public list GetSublist(int start, int end) |
407 | { | 469 | { |
408 | 470 | ||