1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-01-18 19:47:15 +01:00

Reduce duplicate debugging information from entities by moving it to member functions in base entity.

This commit is contained in:
Sandu Liviu Catalin 2015-11-11 08:56:38 +02:00
parent 73b93d707c
commit 5855f7b46a

View File

@ -2473,7 +2473,7 @@ public:
*/ */
const SQChar * ToString() const const SQChar * ToString() const
{ {
return ToStringF("%d", m_ID); return ToStrF("%d", m_ID);
} }
/* -------------------------------------------------------------------------------------------- /* --------------------------------------------------------------------------------------------
@ -2524,7 +2524,7 @@ public:
} }
else else
{ {
LogWrn(_SC("Attempting to <get global tag> using an invalid reference: %d"), m_ID); BadRef("gtag", "get global tag");
} }
return _SC(""); return _SC("");
@ -2541,7 +2541,7 @@ public:
} }
else else
{ {
LogWrn(_SC("Attempting to <set global tag> using an invalid reference: %d"), m_ID); BadRef("gtag", "set global tag");
} }
} }
@ -2556,7 +2556,7 @@ public:
} }
else else
{ {
LogWrn(_SC("Attempting to <get global data> using an invalid reference: %d"), m_ID); BadRef("gdata", "get global data");
} }
return NullData(); return NullData();
@ -2573,7 +2573,7 @@ public:
} }
else else
{ {
LogWrn(_SC("Attempting to <set global tag> using an invalid reference: %d"), m_ID); BadRef("gdata", "set global data");
} }
} }
@ -2699,12 +2699,37 @@ public:
} }
else else
{ {
LogWrn(_SC("Attempting to <destroy %d entity> using an invalid reference: %d"), Ent< T >::Name, m_ID); BadRef("destroy", "destroy entity instance");
} }
return false; return false;
} }
protected:
/* --------------------------------------------------------------------------------------------
* Throw a bad reference error.
*/
void BadRef(const char * loc, const char * act) const
{
DbgWrn(Ent< T >::CName, loc, "Attempting to <%s> using an invalid reference: %d", act, m_ID);
}
/* --------------------------------------------------------------------------------------------
* Throw a bad argument error.
*/
void BadArg(const char * loc, const char * act, SQInt32 arg) const
{
DbgWrn(Ent< T >::CName, loc, "Attempting to <%s> using an invalid argument: %d", act, arg);
}
/* --------------------------------------------------------------------------------------------
* Throw a bad argument error.
*/
void BadArg(const char * loc, const char * act, const char * msg, SQInt32 arg) const
{
DbgWrn(Ent< T >::CName, loc, "Attempting to <%s> %s: %d", act, msg, arg);
}
}; };
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------