diff options
author | Justin Clarke Casey | 2008-04-16 16:07:34 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-04-16 16:07:34 +0000 |
commit | e3a6a370fafdb94f16fd97e4e86699839e425f99 (patch) | |
tree | 44ac96fc3bd866bdea274716f0d3061e827f7616 /OpenSim | |
parent | From: Alan M Webb <awebb@vnet.ibm.com> (diff) | |
download | opensim-SC_OLD-e3a6a370fafdb94f16fd97e4e86699839e425f99.zip opensim-SC_OLD-e3a6a370fafdb94f16fd97e4e86699839e425f99.tar.gz opensim-SC_OLD-e3a6a370fafdb94f16fd97e4e86699839e425f99.tar.bz2 opensim-SC_OLD-e3a6a370fafdb94f16fd97e4e86699839e425f99.tar.xz |
* From: Alan M Webb <awebb@vnet.ibm.com>
* Here's an updated ListInsertList implementation, tested to be LL
compliant.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 9de7c0e..39d8473 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2779,10 +2779,55 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2779 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0); | 2779 | return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0); |
2780 | } | 2780 | } |
2781 | 2781 | ||
2782 | public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start) | 2782 | /// <summary> |
2783 | /// Insert the list identified by <src> into the | ||
2784 | /// list designated by <dest> such that the first | ||
2785 | /// new element has the index specified by <index> | ||
2786 | /// </summary> | ||
2787 | |||
2788 | public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int index) | ||
2783 | { | 2789 | { |
2790 | |||
2791 | LSL_Types.list pref = null; | ||
2792 | LSL_Types.list suff = null; | ||
2793 | |||
2784 | m_host.AddScriptLPS(1); | 2794 | m_host.AddScriptLPS(1); |
2785 | return dest.GetSublist(0, start - 1) + src + dest.GetSublist(start, -1); | 2795 | |
2796 | if(index < 0) | ||
2797 | { | ||
2798 | index = index+src.Length; | ||
2799 | if(index < 0) | ||
2800 | { | ||
2801 | index = 0; | ||
2802 | } | ||
2803 | } | ||
2804 | |||
2805 | if(index != 0) | ||
2806 | { | ||
2807 | pref = dest.GetSublist(0,index-1); | ||
2808 | if(index < dest.Length) | ||
2809 | { | ||
2810 | suff = dest.GetSublist(index,-1); | ||
2811 | return pref + src + suff; | ||
2812 | } | ||
2813 | else | ||
2814 | { | ||
2815 | return pref + src; | ||
2816 | } | ||
2817 | } | ||
2818 | else | ||
2819 | { | ||
2820 | if(index < dest.Length) | ||
2821 | { | ||
2822 | suff = dest.GetSublist(index,-1); | ||
2823 | return src + suff; | ||
2824 | } | ||
2825 | else | ||
2826 | { | ||
2827 | return src; | ||
2828 | } | ||
2829 | } | ||
2830 | |||
2786 | } | 2831 | } |
2787 | 2832 | ||
2788 | /// <summary> | 2833 | /// <summary> |