mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
no idea why this was changed in a previous commit
how the fuck did this get changed!
This commit is contained in:
parent
89843b541c
commit
d7b68a97ee
2 changed files with 323 additions and 297 deletions
|
|
@ -404,6 +404,22 @@ void ArrayObject::uniqueKey()
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ArrayObject::uniquePair()
|
||||||
|
{
|
||||||
|
for (S32 i = 0; i < mArray.size(); i++)
|
||||||
|
{
|
||||||
|
for (S32 j = i + 1; j < mArray.size(); j++)
|
||||||
|
{
|
||||||
|
if (isEqual(mArray[i].key, mArray[j].key) && isEqual(mArray[i].value, mArray[j].value))
|
||||||
|
{
|
||||||
|
erase(j);
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
void ArrayObject::duplicate(ArrayObject* obj)
|
void ArrayObject::duplicate(ArrayObject* obj)
|
||||||
{
|
{
|
||||||
empty();
|
empty();
|
||||||
|
|
@ -740,6 +756,12 @@ DefineEngineMethod( ArrayObject, uniqueKey, void, (),,
|
||||||
object->uniqueKey();
|
object->uniqueKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DefineEngineMethod(ArrayObject, uniquePair, void, (), ,
|
||||||
|
"Removes any elements that have duplicated key and value pairs (leaving the first instance)")
|
||||||
|
{
|
||||||
|
object->uniquePair();
|
||||||
|
}
|
||||||
|
|
||||||
DefineEngineMethod(ArrayObject, duplicate, bool, (ArrayObject* target), ,
|
DefineEngineMethod(ArrayObject, duplicate, bool, (ArrayObject* target), ,
|
||||||
"Alters array into an exact duplicate of the target array.\n"
|
"Alters array into an exact duplicate of the target array.\n"
|
||||||
"@param target ArrayObject to duplicate\n")
|
"@param target ArrayObject to duplicate\n")
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,10 @@ public:
|
||||||
/// (keeps the first instance only)
|
/// (keeps the first instance only)
|
||||||
void uniqueKey();
|
void uniqueKey();
|
||||||
|
|
||||||
|
/// Removes any duplicate keys from the array
|
||||||
|
/// (keeps the first instance only)
|
||||||
|
void uniquePair();
|
||||||
|
|
||||||
/// Makes this array an exact duplicate of another array
|
/// Makes this array an exact duplicate of another array
|
||||||
void duplicate(ArrayObject* obj);
|
void duplicate(ArrayObject* obj);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue