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
|
#ifndef CCAssert
|
||||||
#if COCOS2D_DEBUG > 0
|
#if COCOS2D_DEBUG > 0
|
||||||
extern void CC_DLL cc_assert_script_compatible(bool cond, const char *msg);
|
extern void CC_DLL cc_assert_script_compatible(bool cond, const char *msg);
|
||||||
#define CCAssert(cond, msg) \
|
#define CCAssert(cond, msg) do { \
|
||||||
{ \
|
cc_assert_script_compatible(!!(cond), (msg)); \
|
||||||
cc_assert_script_compatible(!!(cond), (msg)); \
|
if (!(cond)) { \
|
||||||
CC_ASSERT(cond); \
|
if (strlen(msg)) \
|
||||||
}
|
cocos2d::CCLog("Assert failed: %s", msg); \
|
||||||
|
CC_ASSERT(cond); \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
#else
|
#else
|
||||||
#define CCAssert(cond, msg)
|
#define CCAssert(cond, msg)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue