diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 62 |
2 files changed, 65 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 3273023..35f8ee0 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2269,7 +2269,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2269 | int count = 0; | 2269 | int count = 0; |
2270 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 2270 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
2271 | { | 2271 | { |
2272 | if (inv.Value.InvType == type) | 2272 | if (inv.Value.Type == type || type == -1) |
2273 | { | 2273 | { |
2274 | count = count + 1; | 2274 | count = count + 1; |
2275 | } | 2275 | } |
@@ -2283,7 +2283,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2283 | ArrayList keys = new ArrayList(); | 2283 | ArrayList keys = new ArrayList(); |
2284 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) | 2284 | foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) |
2285 | { | 2285 | { |
2286 | if (inv.Value.InvType == type) | 2286 | if (inv.Value.Type == type || type == -1) |
2287 | { | 2287 | { |
2288 | keys.Add(inv.Value.Name); | 2288 | keys.Add(inv.Value.Name); |
2289 | } | 2289 | } |
@@ -2972,12 +2972,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2972 | 2972 | ||
2973 | public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end) | 2973 | public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end) |
2974 | { | 2974 | { |
2975 | //LSL_Types.list ret = new LSL_Types.list(src); | 2975 | return src.DeleteSublist(end, start); |
2976 | //ret.RemoveRange(start, end - start); | ||
2977 | //return ret; | ||
2978 | |||
2979 | // Just a hunch - needs testing | ||
2980 | return src.GetSublist(end, start); | ||
2981 | } | 2976 | } |
2982 | 2977 | ||
2983 | public int llGetListEntryType(LSL_Types.list src, int index) | 2978 | public int llGetListEntryType(LSL_Types.list src, int index) |
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 | ||