mirror of https://github.com/axmolengine/axmol.git
Log assert messages
Now, assert messages as visible in the trace output as well as the line number of condition that failed.
This commit is contained in:
parent
e6afc9a180
commit
e699919bc6
|
@ -37,11 +37,14 @@ THE SOFTWARE.
|
|||
#ifndef CCAssert
|
||||
#if COCOS2D_DEBUG > 0
|
||||
extern void CC_DLL cc_assert_script_compatible(bool cond, const char *msg);
|
||||
#define CCAssert(cond, msg) \
|
||||
{ \
|
||||
cc_assert_script_compatible(!!(cond), (msg)); \
|
||||
CC_ASSERT(cond); \
|
||||
}
|
||||
#define CCAssert(cond, msg) do { \
|
||||
cc_assert_script_compatible(!!(cond), (msg)); \
|
||||
if (!(cond)) { \
|
||||
if (strlen(msg)) \
|
||||
cocos2d::CCLog("Assert failed: %s", msg); \
|
||||
CC_ASSERT(cond); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
#define CCAssert(cond, msg)
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue