mirror of https://github.com/axmolengine/axmol.git
[Mac] fix CC_ASSERT error
[Mac] add CC_DISABLE_ASSERT check [cocos2d-x] CCSprite::createWithSpriteFrame() check pSpriteFrame
This commit is contained in:
parent
dcc8733a53
commit
39b019b2cb
|
@ -36,13 +36,13 @@ CCApplication* CCApplication::sm_pSharedApplication = 0;
|
|||
|
||||
CCApplication::CCApplication()
|
||||
{
|
||||
CC_ASSERT(! sm_pSharedApplication);
|
||||
CCAssert(! sm_pSharedApplication, "sm_pSharedApplication already exist");
|
||||
sm_pSharedApplication = this;
|
||||
}
|
||||
|
||||
CCApplication::~CCApplication()
|
||||
{
|
||||
CC_ASSERT(this == sm_pSharedApplication);
|
||||
CCAssert(this == sm_pSharedApplication, "sm_pSharedApplication != this");
|
||||
sm_pSharedApplication = 0;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ TargetPlatform CCApplication::getTargetPlatform()
|
|||
|
||||
CCApplication* CCApplication::sharedApplication()
|
||||
{
|
||||
CC_ASSERT(sm_pSharedApplication);
|
||||
CCAssert(sm_pSharedApplication, "sm_pSharedApplication not set");
|
||||
return sm_pSharedApplication;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2011 Zynga Inc.
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include <string>
|
||||
|
|
|
@ -340,8 +340,8 @@ static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAl
|
|||
{
|
||||
bool bRet = false;
|
||||
|
||||
CCAssert( pText, @"Invalid pText");
|
||||
CCAssert( pInfo, @"Invalid pInfo");
|
||||
CCAssert(pText, "Invalid pText");
|
||||
CCAssert(pInfo, "Invalid pInfo");
|
||||
|
||||
do {
|
||||
NSString * string = [NSString stringWithUTF8String:pText];
|
||||
|
|
|
@ -5,8 +5,11 @@
|
|||
|
||||
#define CC_DLL
|
||||
|
||||
#if CC_DISABLE_ASSERT > 0
|
||||
#define CC_ASSERT(cond)
|
||||
#else
|
||||
#define CC_ASSERT(cond) assert(cond)
|
||||
|
||||
#endif
|
||||
|
||||
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ CCSprite* CCSprite::spriteWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
|
|||
CCSprite* CCSprite::createWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
|
||||
{
|
||||
CCSprite *pobSprite = new CCSprite();
|
||||
if (pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame))
|
||||
if (pSpriteFrame && pobSprite && pobSprite->initWithSpriteFrame(pSpriteFrame))
|
||||
{
|
||||
pobSprite->autorelease();
|
||||
return pobSprite;
|
||||
|
@ -153,9 +153,12 @@ CCSprite* CCSprite::createWithSpriteFrameName(const char *pszSpriteFrameName)
|
|||
{
|
||||
CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(pszSpriteFrameName);
|
||||
|
||||
#if COCOS2D_DEBUG > 0
|
||||
char msg[256] = {0};
|
||||
sprintf(msg, "Invalid spriteFrameName: %s", pszSpriteFrameName);
|
||||
CCAssert(pFrame != NULL, msg);
|
||||
#endif
|
||||
|
||||
return createWithSpriteFrame(pFrame);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ int CCLuaEngine::executeString(const char *codes)
|
|||
int CCLuaEngine::executeScriptFile(const char* filename)
|
||||
{
|
||||
int nRet = luaL_dofile(m_state, filename);
|
||||
// lua_gc(m_state, LUA_GCCOLLECT, 0);
|
||||
// lua_gc(m_state, LUA_GCCOLLECT, 0);
|
||||
|
||||
if (nRet != 0)
|
||||
{
|
||||
|
@ -126,7 +126,7 @@ int CCLuaEngine::executeGlobalFunction(const char* functionName)
|
|||
}
|
||||
|
||||
int error = lua_pcall(m_state, 0, 1, 0); /* call function, stack: ret */
|
||||
// lua_gc(m_state, LUA_GCCOLLECT, 0);
|
||||
// lua_gc(m_state, LUA_GCCOLLECT, 0);
|
||||
|
||||
if (error)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue