diff options
author | alondria | 2008-02-02 18:52:07 +0000 |
---|---|---|
committer | alondria | 2008-02-02 18:52:07 +0000 |
commit | 0ea708c1339f1da2b9d189b2920d520e008a6491 (patch) | |
tree | f48256054f567e63b1277be437a8d6bd5e6bf049 /OpenSim/Region/ScriptEngine | |
parent | Turn on fastMode for map block queries to grid server if and only if grid is ... (diff) | |
download | opensim-SC-0ea708c1339f1da2b9d189b2920d520e008a6491.zip opensim-SC-0ea708c1339f1da2b9d189b2920d520e008a6491.tar.gz opensim-SC-0ea708c1339f1da2b9d189b2920d520e008a6491.tar.bz2 opensim-SC-0ea708c1339f1da2b9d189b2920d520e008a6491.tar.xz |
Added llParseString2List (and a few extra methods to LSL_Types.list).
Diffstat (limited to '')
4 files changed, 74 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs index 96a7dae..c985d6f 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BaseClass.cs | |||
@@ -1244,9 +1244,9 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
1244 | m_LSL_Functions.llEjectFromLand(pest); | 1244 | m_LSL_Functions.llEjectFromLand(pest); |
1245 | } | 1245 | } |
1246 | 1246 | ||
1247 | public void llParseString2List() | 1247 | public LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers) |
1248 | { | 1248 | { |
1249 | m_LSL_Functions.llParseString2List(); | 1249 | return m_LSL_Functions.llParseString2List(str,separators,spacers); |
1250 | } | 1250 | } |
1251 | 1251 | ||
1252 | public int llOverMyLand(string id) | 1252 | public int llOverMyLand(string id) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 4054369..8ef33d7 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -2039,9 +2039,55 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2039 | NotImplemented("llEjectFromLand"); | 2039 | NotImplemented("llEjectFromLand"); |
2040 | } | 2040 | } |
2041 | 2041 | ||
2042 | public void llParseString2List() | 2042 | public LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers) |
2043 | { | 2043 | { |
2044 | NotImplemented("llParseString2List"); | 2044 | LSL_Types.list ret = new LSL_Types.list(); |
2045 | object[] delimeters = new object[separators.Length + spacers.Length]; | ||
2046 | separators.Data.CopyTo(delimeters, 0); | ||
2047 | spacers.Data.CopyTo(delimeters, separators.Length); | ||
2048 | bool dfound = false; | ||
2049 | do | ||
2050 | { | ||
2051 | dfound = false; | ||
2052 | int cindex = -1; | ||
2053 | string cdeli = ""; | ||
2054 | for (int i = 0; i < delimeters.Length; i++) | ||
2055 | { | ||
2056 | int index = str.IndexOf(delimeters[i].ToString()); | ||
2057 | bool found = index != -1; | ||
2058 | if (found) | ||
2059 | { | ||
2060 | if ((cindex > index) || (cindex == -1)) | ||
2061 | { | ||
2062 | cindex = index; | ||
2063 | cdeli = (string)delimeters[i]; | ||
2064 | } | ||
2065 | dfound = dfound || found; | ||
2066 | } | ||
2067 | } | ||
2068 | if (cindex != -1) | ||
2069 | { | ||
2070 | if (cindex > 0) | ||
2071 | { | ||
2072 | ret.Add(str.Substring(0, cindex)); | ||
2073 | if (spacers.Contains(cdeli)) | ||
2074 | { | ||
2075 | ret.Add(cdeli); | ||
2076 | } | ||
2077 | } | ||
2078 | if (cindex == 0 && spacers.Contains(cdeli)) | ||
2079 | { | ||
2080 | ret.Add(cdeli); | ||
2081 | } | ||
2082 | str = str.Substring(cindex + 1); | ||
2083 | } | ||
2084 | } | ||
2085 | while (dfound); | ||
2086 | if (str != "") | ||
2087 | { | ||
2088 | ret.Add(str); | ||
2089 | } | ||
2090 | return ret; | ||
2045 | } | 2091 | } |
2046 | 2092 | ||
2047 | public int llOverMyLand(string id) | 2093 | public int llOverMyLand(string id) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index dbeeaf5..f6ccca3 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs | |||
@@ -409,7 +409,7 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
409 | 409 | ||
410 | //wiki: llEjectFromLand(key pest) | 410 | //wiki: llEjectFromLand(key pest) |
411 | void llEjectFromLand(string pest); | 411 | void llEjectFromLand(string pest); |
412 | void llParseString2List(); | 412 | LSL_Types.list llParseString2List(string str, LSL_Types.list separators, LSL_Types.list spacers); |
413 | //wiki: integer llOverMyLand(key id) | 413 | //wiki: integer llOverMyLand(key id) |
414 | int llOverMyLand(string id); | 414 | int llOverMyLand(string id); |
415 | //wiki: key llGetLandOwnerAt(vector pos) | 415 | //wiki: key llGetLandOwnerAt(vector pos) |
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index e48f667..bbdd4ee 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | |||
@@ -354,6 +354,29 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
354 | return new list(tmp); | 354 | return new list(tmp); |
355 | } | 355 | } |
356 | 356 | ||
357 | public void Add(object o) | ||
358 | { | ||
359 | object[] tmp; | ||
360 | tmp = new object[m_data.Length + 1]; | ||
361 | m_data.CopyTo(tmp, 0); | ||
362 | tmp[m_data.Length] = o; | ||
363 | m_data = tmp; | ||
364 | } | ||
365 | |||
366 | public bool Contains(object o) | ||
367 | { | ||
368 | bool ret = false; | ||
369 | foreach (object i in Data) | ||
370 | { | ||
371 | if (i == o) | ||
372 | { | ||
373 | ret = true; | ||
374 | break; | ||
375 | } | ||
376 | } | ||
377 | return ret; | ||
378 | } | ||
379 | |||
357 | public list GetSublist(int start, int end) | 380 | public list GetSublist(int start, int end) |
358 | { | 381 | { |
359 | Console.WriteLine("GetSublist(" + start.ToString() + "," + end.ToString() + ")"); | 382 | Console.WriteLine("GetSublist(" + start.ToString() + "," + end.ToString() + ")"); |