mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Fix algorithms.
This commit is contained in:
parent
9dd016a229
commit
185c51ef8f
@ -65,7 +65,7 @@ private:
|
||||
bool m_CyclicLock; // Prevent the script callback from entering a loop.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Uint32 m_StringTruncate; // The length at which to trincate strings in debug.
|
||||
Uint32 m_StringTruncate; // The length at which to truncate strings in debug.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
std::FILE* m_File; // Handle to the file where the logs should be saved.
|
||||
|
@ -307,11 +307,11 @@ static inline LightObj Player_FirstWhereNameMatches(bool neg, bool cs, CSStr nam
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name matches or not the specified one.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameEquals(bool neg, bool cs, CSStr name, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameEquals(bool neg, bool cs, CSStr name, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemFunc< CPlayer > fwd(env, func);
|
||||
ForwardElemFunc< CPlayer > fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachEqualsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -323,11 +323,11 @@ static inline Uint32 Player_EachWhereNameEquals(bool neg, bool cs, CSStr name, L
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name matches or not the specified one.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameEqualsData(bool neg, bool cs, CSStr name, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameEqualsData(bool neg, bool cs, CSStr name, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, env, func);
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachEqualsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -339,11 +339,11 @@ static inline Uint32 Player_EachWhereNameEqualsData(bool neg, bool cs, CSStr nam
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name begins with the specified string.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameBegins(bool neg, bool cs, CSStr name, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameBegins(bool neg, bool cs, CSStr name, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemFunc< CPlayer > fwd(env, func);
|
||||
ForwardElemFunc< CPlayer > fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachBeginsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -355,11 +355,11 @@ static inline Uint32 Player_EachWhereNameBegins(bool neg, bool cs, CSStr name, L
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name begins with the specified string.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameBeginsData(bool neg, bool cs, CSStr name, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameBeginsData(bool neg, bool cs, CSStr name, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, env, func);
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachBeginsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -371,11 +371,11 @@ static inline Uint32 Player_EachWhereNameBeginsData(bool neg, bool cs, CSStr nam
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name ends or not with the specified string.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameEnds(bool neg, bool cs, CSStr name, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameEnds(bool neg, bool cs, CSStr name, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemFunc< CPlayer > fwd(env, func);
|
||||
ForwardElemFunc< CPlayer > fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachEndsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -387,11 +387,11 @@ static inline Uint32 Player_EachWhereNameEnds(bool neg, bool cs, CSStr name, Lig
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name ends or not with the specified string.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameEndsData(bool neg, bool cs, CSStr name, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameEndsData(bool neg, bool cs, CSStr name, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, env, func);
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachEndsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -403,11 +403,11 @@ static inline Uint32 Player_EachWhereNameEndsData(bool neg, bool cs, CSStr name,
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name contains the specified string.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameContains(bool neg, bool cs, CSStr name, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameContains(bool neg, bool cs, CSStr name, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemFunc< CPlayer > fwd(env, func);
|
||||
ForwardElemFunc< CPlayer > fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachContainsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -419,11 +419,11 @@ static inline Uint32 Player_EachWhereNameContains(bool neg, bool cs, CSStr name,
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name contains the specified string.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameContainsData(bool neg, bool cs, CSStr name, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameContainsData(bool neg, bool cs, CSStr name, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, env, func);
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachContainsWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -435,11 +435,11 @@ static inline Uint32 Player_EachWhereNameContainsData(bool neg, bool cs, CSStr n
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name matches the specified filter.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameMatches(bool neg, bool cs, CSStr name, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameMatches(bool neg, bool cs, CSStr name, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemFunc< CPlayer > fwd(env, func);
|
||||
ForwardElemFunc< CPlayer > fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachMatchesWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
@ -451,11 +451,11 @@ static inline Uint32 Player_EachWhereNameMatches(bool neg, bool cs, CSStr name,
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the name matches the specified filter.
|
||||
*/
|
||||
static inline Uint32 Player_EachWhereNameMatchesData(bool neg, bool cs, CSStr name, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 Player_EachWhereNameMatchesData(bool neg, bool cs, CSStr name, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_NAME_STR(name)
|
||||
// Create a new element forwarder
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, env, func);
|
||||
ForwardElemDataFunc< CPlayer > fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachMatchesWhile(InstSpec< CPlayer >::CBegin(), InstSpec< CPlayer >::CEnd(),
|
||||
ValidInstFunc< CPlayer >(), PlayerName(),
|
||||
|
@ -957,8 +957,8 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Base constructor.
|
||||
*/
|
||||
ForwardElemFunc(LightObj & env, Function & func)
|
||||
: mEnv(env.IsNull() ? func.GetEnv() : env.mObj), mFunc(func.GetFunc()), mCount(0)
|
||||
ForwardElemFunc(Function & func)
|
||||
: mEnv(func.GetEnv()), mFunc(func.GetFunc()), mCount(0)
|
||||
{
|
||||
if (mFunc.IsNull())
|
||||
{
|
||||
@ -1031,8 +1031,8 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Base constructor.
|
||||
*/
|
||||
ForwardElemDataFunc(LightObj & data, LightObj & env, Function & func)
|
||||
: mEnv(env.IsNull() ? func.GetEnv() : env.mObj), mFunc(func.GetFunc()), mData(data), mCount(0)
|
||||
ForwardElemDataFunc(LightObj & data, Function & func)
|
||||
: mEnv(func.GetEnv()), mFunc(func.GetFunc()), mData(data), mCount(0)
|
||||
{
|
||||
if (mFunc.IsNull())
|
||||
{
|
||||
@ -1377,10 +1377,10 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all active entities of this type.
|
||||
*/
|
||||
static inline Uint32 EachActive(LightObj & env, Function & func)
|
||||
static inline Uint32 EachActive(Function & func)
|
||||
{
|
||||
// Create a new element forwarder
|
||||
ForwardElem fwd(env, func);
|
||||
ForwardElem fwd(func);
|
||||
// Process each entity in the pool
|
||||
CollectWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(),
|
||||
std::reference_wrapper< ForwardElem >(fwd));
|
||||
@ -1391,10 +1391,10 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all active entities of this type.
|
||||
*/
|
||||
static inline Uint32 EachActiveData(LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 EachActiveData(LightObj & data, Function & func)
|
||||
{
|
||||
// Create a new element forwarder
|
||||
ForwardElemData fwd(data, env, func);
|
||||
ForwardElemData fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
CollectWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(),
|
||||
std::reference_wrapper< ForwardElemData >(fwd));
|
||||
@ -1405,11 +1405,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag matches or not the specified one.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagEquals(bool neg, bool cs, CSStr tag, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagEquals(bool neg, bool cs, CSStr tag, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElem fwd(env, func);
|
||||
ForwardElem fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachEqualsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElem >(fwd), tag, !neg, cs);
|
||||
@ -1420,11 +1420,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag matches or not the specified one.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagEqualsData(bool neg, bool cs, CSStr tag, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagEqualsData(bool neg, bool cs, CSStr tag, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElemData fwd(data, env, func);
|
||||
ForwardElemData fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachEqualsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElemData >(fwd), tag, !neg, cs);
|
||||
@ -1435,11 +1435,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag begins with the specified string.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagBegins(bool neg, bool cs, CSStr tag, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagBegins(bool neg, bool cs, CSStr tag, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElem fwd(env, func);
|
||||
ForwardElem fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachBeginsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElem >(fwd), tag, strlen(tag), !neg, cs);
|
||||
@ -1450,11 +1450,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag begins with the specified string.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagBeginsData(bool neg, bool cs, CSStr tag, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagBeginsData(bool neg, bool cs, CSStr tag, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElemData fwd(data, env, func);
|
||||
ForwardElemData fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachBeginsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElemData >(fwd), tag, strlen(tag), !neg, cs);
|
||||
@ -1465,11 +1465,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag ends or not with the specified string.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagEnds(bool neg, bool cs, CSStr tag, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagEnds(bool neg, bool cs, CSStr tag, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElem fwd(env, func);
|
||||
ForwardElem fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachEndsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElem >(fwd), tag, strlen(tag), !neg, cs);
|
||||
@ -1480,11 +1480,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag ends or not with the specified string.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagEndsData(bool neg, bool cs, CSStr tag, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagEndsData(bool neg, bool cs, CSStr tag, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElemData fwd(data, env, func);
|
||||
ForwardElemData fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachEndsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElemData >(fwd), tag, strlen(tag), !neg, cs);
|
||||
@ -1495,11 +1495,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag contains the specified string.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagContains(bool neg, bool cs, CSStr tag, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagContains(bool neg, bool cs, CSStr tag, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElem fwd(env, func);
|
||||
ForwardElem fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachContainsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElem >(fwd), tag, !neg, cs);
|
||||
@ -1510,11 +1510,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag contains the specified string.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagContainsData(bool neg, bool cs, CSStr tag, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagContainsData(bool neg, bool cs, CSStr tag, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElemData fwd(data, env, func);
|
||||
ForwardElemData fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachContainsWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElemData >(fwd), tag, !neg, cs);
|
||||
@ -1525,11 +1525,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag match the specified filter.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagMatches(bool neg, bool cs, CSStr tag, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagMatches(bool neg, bool cs, CSStr tag, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElem fwd(env, func);
|
||||
ForwardElem fwd(func);
|
||||
// Process each entity in the pool
|
||||
EachMatchesWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElem >(fwd), tag, !neg, cs);
|
||||
@ -1540,11 +1540,11 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process all entities of this type where the tag match the specified filter.
|
||||
*/
|
||||
static inline Uint32 EachWhereTagMatchesData(bool neg, bool cs, CSStr tag, LightObj & data, LightObj & env, Function & func)
|
||||
static inline Uint32 EachWhereTagMatchesData(bool neg, bool cs, CSStr tag, LightObj & data, Function & func)
|
||||
{
|
||||
SQMOD_VALID_TAG_STR(tag)
|
||||
// Create a new element forwarder
|
||||
ForwardElemData fwd(data, env, func);
|
||||
ForwardElemData fwd(data, func);
|
||||
// Process each entity in the pool
|
||||
EachMatchesWhile(Inst::CBegin(), Inst::CEnd(), ValidInst(), InstTag(),
|
||||
std::reference_wrapper< ForwardElemData >(fwd), tag, !neg, cs);
|
||||
|
Loading…
Reference in New Issue
Block a user