diff options
author | Teravus Ovares (Dan Olivares) | 2010-09-17 18:41:29 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2010-09-17 18:41:29 -0400 |
commit | 33fbf0e329843b9f7b209079ca474ae95e81eaee (patch) | |
tree | 7f26ff2a36a8ee90925a0a0d754b7a27e28c0f99 /OpenSim/Region | |
parent | * Fixed and re-enabled CacheTests (diff) | |
parent | Add LandServices to make landmarks work right in grids (diff) | |
download | opensim-SC_OLD-33fbf0e329843b9f7b209079ca474ae95e81eaee.zip opensim-SC_OLD-33fbf0e329843b9f7b209079ca474ae95e81eaee.tar.gz opensim-SC_OLD-33fbf0e329843b9f7b209079ca474ae95e81eaee.tar.bz2 opensim-SC_OLD-33fbf0e329843b9f7b209079ca474ae95e81eaee.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 103 |
1 files changed, 22 insertions, 81 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 621d429..a6ca171 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5601,78 +5601,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5601 | ScriptSleep(5000); | 5601 | ScriptSleep(5000); |
5602 | } | 5602 | } |
5603 | 5603 | ||
5604 | public LSL_List llParseString2List(string str, LSL_List separators, LSL_List in_spacers) | ||
5605 | { | ||
5606 | m_host.AddScriptLPS(1); | ||
5607 | LSL_List ret = new LSL_List(); | ||
5608 | LSL_List spacers = new LSL_List(); | ||
5609 | if (in_spacers.Length > 0 && separators.Length > 0) | ||
5610 | { | ||
5611 | for (int i = 0; i < in_spacers.Length; i++) | ||
5612 | { | ||
5613 | object s = in_spacers.Data[i]; | ||
5614 | for (int j = 0; j < separators.Length; j++) | ||
5615 | { | ||
5616 | if (separators.Data[j].ToString() == s.ToString()) | ||
5617 | { | ||
5618 | s = null; | ||
5619 | break; | ||
5620 | } | ||
5621 | } | ||
5622 | if (s != null) | ||
5623 | { | ||
5624 | spacers.Add(s); | ||
5625 | } | ||
5626 | } | ||
5627 | } | ||
5628 | object[] delimiters = new object[separators.Length + spacers.Length]; | ||
5629 | separators.Data.CopyTo(delimiters, 0); | ||
5630 | spacers.Data.CopyTo(delimiters, separators.Length); | ||
5631 | bool dfound = false; | ||
5632 | do | ||
5633 | { | ||
5634 | dfound = false; | ||
5635 | int cindex = -1; | ||
5636 | string cdeli = ""; | ||
5637 | for (int i = 0; i < delimiters.Length; i++) | ||
5638 | { | ||
5639 | int index = str.IndexOf(delimiters[i].ToString()); | ||
5640 | bool found = index != -1; | ||
5641 | if (found && String.Empty != delimiters[i].ToString()) | ||
5642 | { | ||
5643 | if ((cindex > index) || (cindex == -1)) | ||
5644 | { | ||
5645 | cindex = index; | ||
5646 | cdeli = delimiters[i].ToString(); | ||
5647 | } | ||
5648 | dfound = dfound || found; | ||
5649 | } | ||
5650 | } | ||
5651 | if (cindex != -1) | ||
5652 | { | ||
5653 | if (cindex > 0) | ||
5654 | { | ||
5655 | ret.Add(new LSL_String(str.Substring(0, cindex))); | ||
5656 | } | ||
5657 | // Cannot use spacers.Contains() because spacers may be either type String or LSLString | ||
5658 | for (int j = 0; j < spacers.Length; j++) | ||
5659 | { | ||
5660 | if (spacers.Data[j].ToString() == cdeli) | ||
5661 | { | ||
5662 | ret.Add(new LSL_String(cdeli)); | ||
5663 | break; | ||
5664 | } | ||
5665 | } | ||
5666 | str = str.Substring(cindex + cdeli.Length); | ||
5667 | } | ||
5668 | } while (dfound); | ||
5669 | if (str != "") | ||
5670 | { | ||
5671 | ret.Add(new LSL_String(str)); | ||
5672 | } | ||
5673 | return ret; | ||
5674 | } | ||
5675 | |||
5676 | public LSL_Integer llOverMyLand(string id) | 5604 | public LSL_Integer llOverMyLand(string id) |
5677 | { | 5605 | { |
5678 | m_host.AddScriptLPS(1); | 5606 | m_host.AddScriptLPS(1); |
@@ -8436,7 +8364,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8436 | // of arrays or other objects. | 8364 | // of arrays or other objects. |
8437 | // </remarks> | 8365 | // </remarks> |
8438 | 8366 | ||
8439 | public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) | 8367 | private LSL_List ParseString(string src, LSL_List separators, LSL_List spacers, bool keepNulls) |
8440 | { | 8368 | { |
8441 | int beginning = 0; | 8369 | int beginning = 0; |
8442 | int srclen = src.Length; | 8370 | int srclen = src.Length; |
@@ -8456,8 +8384,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8456 | 8384 | ||
8457 | LSL_List tokens = new LSL_List(); | 8385 | LSL_List tokens = new LSL_List(); |
8458 | 8386 | ||
8459 | m_host.AddScriptLPS(1); | ||
8460 | |||
8461 | // All entries are initially valid | 8387 | // All entries are initially valid |
8462 | 8388 | ||
8463 | for (int i = 0; i < mlen; i++) | 8389 | for (int i = 0; i < mlen; i++) |
@@ -8529,14 +8455,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8529 | { | 8455 | { |
8530 | // no markers were found on this pass | 8456 | // no markers were found on this pass |
8531 | // so we're pretty much done | 8457 | // so we're pretty much done |
8532 | tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning))); | 8458 | if ((keepNulls) || ((!keepNulls) && (srclen - beginning) > 0)) |
8459 | tokens.Add(new LSL_String(src.Substring(beginning, srclen - beginning))); | ||
8533 | break; | 8460 | break; |
8534 | } | 8461 | } |
8535 | 8462 | ||
8536 | // Otherwise we just add the newly delimited token | 8463 | // Otherwise we just add the newly delimited token |
8537 | // and recalculate where the search should continue. | 8464 | // and recalculate where the search should continue. |
8538 | 8465 | if ((keepNulls) || ((!keepNulls) && (offset[best] - beginning) > 0)) | |
8539 | tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning))); | 8466 | tokens.Add(new LSL_String(src.Substring(beginning,offset[best]-beginning))); |
8540 | 8467 | ||
8541 | if (best < seplen) | 8468 | if (best < seplen) |
8542 | { | 8469 | { |
@@ -8545,7 +8472,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8545 | else | 8472 | else |
8546 | { | 8473 | { |
8547 | beginning = offset[best] + (spcarray[best - seplen].ToString()).Length; | 8474 | beginning = offset[best] + (spcarray[best - seplen].ToString()).Length; |
8548 | tokens.Add(new LSL_String(spcarray[best - seplen].ToString())); | 8475 | string str = spcarray[best - seplen].ToString(); |
8476 | if ((keepNulls) || ((!keepNulls) && (str.Length > 0))) | ||
8477 | tokens.Add(new LSL_String(str)); | ||
8549 | } | 8478 | } |
8550 | } | 8479 | } |
8551 | 8480 | ||
@@ -8555,7 +8484,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8555 | // arduous. Alternatively the 'break' could be replced with a return | 8484 | // arduous. Alternatively the 'break' could be replced with a return |
8556 | // but that's shabby programming. | 8485 | // but that's shabby programming. |
8557 | 8486 | ||
8558 | if (beginning == srclen) | 8487 | if ((beginning == srclen) && (keepNulls)) |
8559 | { | 8488 | { |
8560 | if (srclen != 0) | 8489 | if (srclen != 0) |
8561 | tokens.Add(new LSL_String("")); | 8490 | tokens.Add(new LSL_String("")); |
@@ -8563,7 +8492,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8563 | 8492 | ||
8564 | return tokens; | 8493 | return tokens; |
8565 | } | 8494 | } |
8566 | 8495 | ||
8496 | public LSL_List llParseString2List(string src, LSL_List separators, LSL_List spacers) | ||
8497 | { | ||
8498 | m_host.AddScriptLPS(1); | ||
8499 | return this.ParseString(src, separators, spacers, false); | ||
8500 | } | ||
8501 | |||
8502 | public LSL_List llParseStringKeepNulls(string src, LSL_List separators, LSL_List spacers) | ||
8503 | { | ||
8504 | m_host.AddScriptLPS(1); | ||
8505 | return this.ParseString(src, separators, spacers, true); | ||
8506 | } | ||
8507 | |||
8567 | public LSL_Integer llGetObjectPermMask(int mask) | 8508 | public LSL_Integer llGetObjectPermMask(int mask) |
8568 | { | 8509 | { |
8569 | m_host.AddScriptLPS(1); | 8510 | m_host.AddScriptLPS(1); |