mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
committed by
UbitUmarov
parent
d12418ed8f
commit
587b19c76b
@@ -6544,6 +6544,66 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
return -1;
|
||||
}
|
||||
|
||||
public LSL_Integer llListFindListNext(LSL_List src, LSL_List test, LSL_Integer instance)
|
||||
{
|
||||
if (src.Length == 0 && test.Length == 0)
|
||||
return 0;
|
||||
if (test.Length == 0)
|
||||
return instance;
|
||||
if (test.Length > src.Length)
|
||||
return -1;
|
||||
|
||||
int count = Math.Abs(instance);
|
||||
|
||||
if (instance >= 0)
|
||||
{
|
||||
int match = 0;
|
||||
count++;
|
||||
for (int i = 0; i < src.Length; i++)
|
||||
{
|
||||
if (LSL_List.ListFind_areEqual(src[i], test[match]))
|
||||
{
|
||||
match++;
|
||||
if (match == test.Length)
|
||||
{
|
||||
count--;
|
||||
if (count == 0)
|
||||
return i - test.Length + 1;
|
||||
match = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
match = LSL_List.ListFind_areEqual(src[i], test[0]) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (instance < 0)
|
||||
{
|
||||
int match = test.Length - 1;
|
||||
for (int i = src.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (LSL_List.ListFind_areEqual(src[i], test[match]))
|
||||
{
|
||||
match--;
|
||||
if (match < 0)
|
||||
{
|
||||
count--;
|
||||
if (count == 0)
|
||||
return i;
|
||||
match = test.Length - 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
match = test.Length - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public LSL_Integer llListFindStrided(LSL_List src, LSL_List test, LSL_Integer lstart, LSL_Integer lend, LSL_Integer lstride)
|
||||
{
|
||||
if (src.Length == 0)
|
||||
|
||||
@@ -264,6 +264,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||
void llListenControl(int number, int active);
|
||||
void llListenRemove(int number);
|
||||
LSL_Integer llListFindList(LSL_List src, LSL_List test);
|
||||
LSL_Integer llListFindListNext(LSL_List src, LSL_List test, LSL_Integer instance);
|
||||
LSL_Integer llListFindStrided(LSL_List src, LSL_List test, LSL_Integer lstart, LSL_Integer lend, LSL_Integer lstride);
|
||||
LSL_List llListInsertList(LSL_List dest, LSL_List src, int start);
|
||||
LSL_List llListRandomize(LSL_List src, int stride);
|
||||
|
||||
@@ -1286,6 +1286,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||
return m_LSL_Functions.llListFindList(src, test);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public LSL_Integer llListFindListNext(LSL_List src, LSL_List test, LSL_Integer instance)
|
||||
{
|
||||
return m_LSL_Functions.llListFindListNext(src, test, instance);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public LSL_Integer llListFindStrided(LSL_List src, LSL_List test, LSL_Integer lstart, LSL_Integer lend, LSL_Integer lstride)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user