mirror of https://github.com/axmolengine/axmol.git
issue #879: replase assert with CCAssert
This commit is contained in:
parent
77cf6f3cbc
commit
f0d22ae504
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
#include "CCGL.h"
|
||||
|
||||
#include "CCDrawingPrimitives.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
using namespace std;
|
||||
namespace cocos2d {
|
||||
|
|
|
@ -156,7 +156,7 @@ CCDirector::~CCDirector(void)
|
|||
void CCDirector::setGLDefaultValues(void)
|
||||
{
|
||||
// This method SHOULD be called only after openGLView_ was initialized
|
||||
assert(m_pobOpenGLView);
|
||||
CCAssert(m_pobOpenGLView, "opengl view should not be null");
|
||||
|
||||
setAlphaBlending(true);
|
||||
setDepthTest(true);
|
||||
|
@ -275,7 +275,7 @@ void CCDirector::calculateDeltaTime(void)
|
|||
|
||||
void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
|
||||
{
|
||||
assert(pobOpenGLView);
|
||||
CCAssert(pobOpenGLView, "opengl view should not be null");
|
||||
|
||||
if (m_pobOpenGLView != pobOpenGLView)
|
||||
{
|
||||
|
@ -494,8 +494,8 @@ void CCDirector::reshapeProjection(const CCSize& newWindowSize)
|
|||
|
||||
void CCDirector::runWithScene(CCScene *pScene)
|
||||
{
|
||||
assert(pScene != NULL);
|
||||
assert(m_pRunningScene == NULL);
|
||||
CCAssert(pScene != NULL, "running scene should not be null");
|
||||
CCAssert(m_pRunningScene == NULL, "m_pRunningScene should be null");
|
||||
|
||||
pushScene(pScene);
|
||||
startAnimation();
|
||||
|
@ -503,7 +503,7 @@ void CCDirector::runWithScene(CCScene *pScene)
|
|||
|
||||
void CCDirector::replaceScene(CCScene *pScene)
|
||||
{
|
||||
assert(pScene != NULL);
|
||||
CCAssert(pScene != NULL, "the scene should not be null");
|
||||
|
||||
unsigned int index = m_pobScenesStack->count();
|
||||
|
||||
|
@ -515,7 +515,7 @@ void CCDirector::replaceScene(CCScene *pScene)
|
|||
|
||||
void CCDirector::pushScene(CCScene *pScene)
|
||||
{
|
||||
assert(pScene);
|
||||
CCAssert(pScene, "the scene should not null");
|
||||
|
||||
m_bSendCleanupToScene = false;
|
||||
|
||||
|
@ -525,7 +525,7 @@ void CCDirector::pushScene(CCScene *pScene)
|
|||
|
||||
void CCDirector::popScene(void)
|
||||
{
|
||||
assert(m_pRunningScene != NULL);
|
||||
CCAssert(m_pRunningScene != NULL, "running scene should not null");
|
||||
|
||||
m_pobScenesStack->removeLastObject();
|
||||
unsigned int c = m_pobScenesStack->count();
|
||||
|
|
|
@ -28,10 +28,10 @@ THE SOFTWARE.
|
|||
#include "ccTypes.h"
|
||||
#include "ccMacros.h"
|
||||
#include "CCGL.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include "CCGL.h"
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
|
|
|
@ -31,8 +31,6 @@ THE SOFTWARE.
|
|||
#include "CCMutableArray.h"
|
||||
#include "CCScriptSupport.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace cocos2d {
|
||||
|
@ -189,7 +187,7 @@ CCScheduler::CCScheduler(void)
|
|||
, m_bCurrentTargetSalvaged(false)
|
||||
, m_pHashForScriptFunctions(NULL)
|
||||
{
|
||||
assert(pSharedScheduler == NULL);
|
||||
CCAssert(pSharedScheduler == NULL, "");
|
||||
}
|
||||
|
||||
CCScheduler::~CCScheduler(void)
|
||||
|
@ -245,8 +243,8 @@ void CCScheduler::removeHashElement(_hashSelectorEntry *pElement)
|
|||
|
||||
void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *pTarget, float fInterval, bool bPaused)
|
||||
{
|
||||
assert(pfnSelector);
|
||||
assert(pTarget);
|
||||
CCAssert(pfnSelector, "");
|
||||
CCAssert(pTarget, "");
|
||||
|
||||
tHashSelectorEntry *pElement = NULL;
|
||||
HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement);
|
||||
|
@ -266,7 +264,7 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(pElement->paused == bPaused);
|
||||
CCAssert(pElement->paused == bPaused, "");
|
||||
}
|
||||
|
||||
if (pElement->timers == NULL)
|
||||
|
@ -297,8 +295,8 @@ void CCScheduler::scheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol *p
|
|||
|
||||
void CCScheduler::scheduleScriptFunc(const char *pszFuncName, ccTime fInterval, bool bPaused)
|
||||
{
|
||||
//assert(pfnSelector);
|
||||
assert(pszFuncName);
|
||||
//CCAssert(pfnSelector);
|
||||
CCAssert(pszFuncName, "");
|
||||
|
||||
tHashScriptFuncEntry *pElement = NULL;
|
||||
HASH_FIND_INT(m_pHashForScriptFunctions, &pszFuncName, pElement);
|
||||
|
@ -315,7 +313,7 @@ void CCScheduler::scheduleScriptFunc(const char *pszFuncName, ccTime fInterval,
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(pElement->paused == bPaused);
|
||||
CCAssert(pElement->paused == bPaused, "");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -327,8 +325,8 @@ void CCScheduler::unscheduleSelector(SEL_SCHEDULE pfnSelector, SelectorProtocol
|
|||
return;
|
||||
}
|
||||
|
||||
//assert(pTarget);
|
||||
//assert(pfnSelector);
|
||||
//CCAssert(pTarget);
|
||||
//CCAssert(pfnSelector);
|
||||
|
||||
tHashSelectorEntry *pElement = NULL;
|
||||
HASH_FIND_INT(m_pHashForSelectors, &pTarget, pElement);
|
||||
|
@ -477,7 +475,7 @@ void CCScheduler::scheduleUpdateForTarget(SelectorProtocol *pTarget, int nPriori
|
|||
if (pHashElement)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
assert(pHashElement->entry->markedForDeletion);
|
||||
CCAssert(pHashElement->entry->markedForDeletion);
|
||||
#endif
|
||||
// TODO: check if priority has changed!
|
||||
|
||||
|
@ -620,7 +618,7 @@ void CCScheduler::unscheduleAllSelectorsForTarget(SelectorProtocol *pTarget)
|
|||
|
||||
void CCScheduler::resumeTarget(SelectorProtocol *pTarget)
|
||||
{
|
||||
assert(pTarget != NULL);
|
||||
CCAssert(pTarget != NULL, "");
|
||||
|
||||
// custom selectors
|
||||
tHashSelectorEntry *pElement = NULL;
|
||||
|
@ -635,14 +633,14 @@ void CCScheduler::resumeTarget(SelectorProtocol *pTarget)
|
|||
HASH_FIND_INT(m_pHashForUpdates, &pTarget, pElementUpdate);
|
||||
if (pElementUpdate)
|
||||
{
|
||||
assert(pElementUpdate->entry != NULL);
|
||||
CCAssert(pElementUpdate->entry != NULL, "");
|
||||
pElementUpdate->entry->paused = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CCScheduler::pauseTarget(SelectorProtocol *pTarget)
|
||||
{
|
||||
assert(pTarget != NULL);
|
||||
CCAssert(pTarget != NULL, "");
|
||||
|
||||
// custom selectors
|
||||
tHashSelectorEntry *pElement = NULL;
|
||||
|
@ -657,7 +655,7 @@ void CCScheduler::pauseTarget(SelectorProtocol *pTarget)
|
|||
HASH_FIND_INT(m_pHashForUpdates, &pTarget, pElementUpdate);
|
||||
if (pElementUpdate)
|
||||
{
|
||||
assert(pElementUpdate->entry != NULL);
|
||||
CCAssert(pElementUpdate->entry != NULL, "");
|
||||
pElementUpdate->entry->paused = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ CCSpeed * CCSpeed::actionWithAction(CCActionInterval *pAction, float fRate)
|
|||
|
||||
bool CCSpeed::initWithAction(CCActionInterval *pAction, float fRate)
|
||||
{
|
||||
assert(pAction != NULL);
|
||||
CCAssert(pAction != NULL, "");
|
||||
pAction->retain();
|
||||
m_pInnerAction = pAction;
|
||||
m_fSpeed = fRate;
|
||||
|
@ -235,7 +235,7 @@ CCFollow *CCFollow::actionWithTarget(CCNode *pFollowedNode, const CCRect& rect)
|
|||
|
||||
bool CCFollow::initWithTarget(CCNode *pFollowedNode)
|
||||
{
|
||||
assert(pFollowedNode != NULL);
|
||||
CCAssert(pFollowedNode != NULL, "");
|
||||
pFollowedNode->retain();
|
||||
m_pobFollowedNode = pFollowedNode;
|
||||
m_bBoundarySet = false;
|
||||
|
@ -249,7 +249,7 @@ bool CCFollow::initWithTarget(CCNode *pFollowedNode)
|
|||
|
||||
bool CCFollow::initWithTarget(CCNode *pFollowedNode, const CCRect& rect)
|
||||
{
|
||||
assert(pFollowedNode != NULL);
|
||||
CCAssert(pFollowedNode != NULL, "");
|
||||
pFollowedNode->retain();
|
||||
m_pobFollowedNode = pFollowedNode;
|
||||
m_bBoundarySet = true;
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace cocos2d {
|
|||
|
||||
bool CCActionEase::initWithAction(CCActionInterval *pAction)
|
||||
{
|
||||
assert(pAction != NULL);
|
||||
CCAssert(pAction != NULL, "");
|
||||
|
||||
if (CCActionInterval::initWithDuration(pAction->getDuration()))
|
||||
{
|
||||
|
@ -740,7 +740,7 @@ namespace cocos2d {
|
|||
|
||||
CCActionInterval* CCEaseElastic::reverse(void)
|
||||
{
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ namespace cocos2d
|
|||
}
|
||||
else
|
||||
{
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -96,7 +96,7 @@ namespace cocos2d
|
|||
CCGridBase* CCGridAction::getGrid(void)
|
||||
{
|
||||
// Abstract class needs implementation
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
#include "CCActionGrid3D.h"
|
||||
#include "CCPointExtension.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@ -134,7 +135,7 @@ namespace cocos2d
|
|||
if (gridSize.x != 1 || gridSize.y != 1)
|
||||
{
|
||||
// Grid size must be (1,1)
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ CCObject* CCActionInterval::copyWithZone(CCZone *pZone)
|
|||
else
|
||||
{
|
||||
// action's base class , must be called using __super::copyWithZone(), after overriding from derived class
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
|
||||
pCopy = new CCActionInterval();
|
||||
pZone = pNewZone = new CCZone(pCopy);
|
||||
|
@ -117,13 +117,13 @@ void CCActionInterval::setAmplitudeRate(CGFloat amp)
|
|||
{
|
||||
CC_UNUSED_PARAM(amp);
|
||||
// Abstract class needs implementation
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
}
|
||||
|
||||
CGFloat CCActionInterval::getAmplitudeRate(void)
|
||||
{
|
||||
// Abstract class needs implementation
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -198,8 +198,8 @@ CCFiniteTimeAction* CCSequence::actionsWithArray(CCArray *actions)
|
|||
|
||||
bool CCSequence::initOneTwo(CCFiniteTimeAction *pActionOne, CCFiniteTimeAction *pActionTwo)
|
||||
{
|
||||
assert(pActionOne != NULL);
|
||||
assert(pActionTwo != NULL);
|
||||
CCAssert(pActionOne != NULL, "");
|
||||
CCAssert(pActionTwo != NULL, "");
|
||||
|
||||
ccTime d = pActionOne->getDuration() + pActionTwo->getDuration();
|
||||
CCActionInterval::initWithDuration(d);
|
||||
|
@ -459,7 +459,7 @@ CCRepeatForever *CCRepeatForever::actionWithAction(CCActionInterval *pAction)
|
|||
|
||||
bool CCRepeatForever::initWithAction(CCActionInterval *pAction)
|
||||
{
|
||||
assert(pAction != NULL);
|
||||
CCAssert(pAction != NULL, "");
|
||||
pAction->retain();
|
||||
m_pInnerAction = pAction;
|
||||
return true;
|
||||
|
@ -563,8 +563,8 @@ CCSpawn* CCSpawn::actionOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction
|
|||
|
||||
bool CCSpawn:: initOneTwo(CCFiniteTimeAction *pAction1, CCFiniteTimeAction *pAction2)
|
||||
{
|
||||
assert(pAction1 != NULL);
|
||||
assert(pAction2 != NULL);
|
||||
CCAssert(pAction1 != NULL, "");
|
||||
CCAssert(pAction2 != NULL, "");
|
||||
|
||||
bool bRet = false;
|
||||
|
||||
|
@ -1941,8 +1941,8 @@ CCReverseTime* CCReverseTime::actionWithAction(CCFiniteTimeAction *pAction)
|
|||
|
||||
bool CCReverseTime::initWithAction(CCFiniteTimeAction *pAction)
|
||||
{
|
||||
assert(pAction != NULL);
|
||||
assert(pAction != m_pOther);
|
||||
CCAssert(pAction != NULL, "");
|
||||
CCAssert(pAction != m_pOther, "");
|
||||
|
||||
if (CCActionInterval::initWithDuration(pAction->getDuration()))
|
||||
{
|
||||
|
@ -2030,7 +2030,7 @@ CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation)
|
|||
|
||||
bool CCAnimate::initWithAnimation(CCAnimation *pAnimation)
|
||||
{
|
||||
assert(pAnimation != NULL);
|
||||
CCAssert(pAnimation != NULL, "");
|
||||
|
||||
return initWithAnimation(pAnimation, true);
|
||||
}
|
||||
|
@ -2046,7 +2046,7 @@ CCAnimate* CCAnimate::actionWithAnimation(CCAnimation *pAnimation, bool bRestore
|
|||
|
||||
bool CCAnimate::initWithAnimation(CCAnimation *pAnimation, bool bRestoreOriginalFrame)
|
||||
{
|
||||
assert(pAnimation);
|
||||
CCAssert(pAnimation, "");
|
||||
|
||||
if (CCActionInterval::initWithDuration(pAnimation->getFrames()->count() * pAnimation->getDelay()))
|
||||
{
|
||||
|
@ -2072,7 +2072,7 @@ CCAnimate* CCAnimate::actionWithDuration(ccTime duration, CCAnimation *pAnimatio
|
|||
|
||||
bool CCAnimate::initWithDuration(ccTime duration, CCAnimation *pAnimation, bool bRestoreOriginalFrame)
|
||||
{
|
||||
assert(pAnimation != NULL);
|
||||
CCAssert(pAnimation != NULL, "");
|
||||
|
||||
if (CCActionInterval::initWithDuration(duration))
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ CCActionManager::CCActionManager(void)
|
|||
m_pCurrentTarget(NULL),
|
||||
m_bCurrentTargetSalvaged(false)
|
||||
{
|
||||
assert(gSharedManager == NULL);
|
||||
CCAssert(gSharedManager == NULL, "");
|
||||
}
|
||||
|
||||
CCActionManager::~CCActionManager(void)
|
||||
|
@ -191,8 +191,8 @@ void CCActionManager::resumeTarget(CCObject *pTarget)
|
|||
|
||||
void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused)
|
||||
{
|
||||
assert(pAction != NULL);
|
||||
assert(pTarget != NULL);
|
||||
CCAssert(pAction != NULL, "");
|
||||
CCAssert(pTarget != NULL, "");
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
// we should convert it to CCObject*, because we save it as CCObject*
|
||||
|
@ -209,7 +209,7 @@ void CCActionManager::addAction(CCAction *pAction, CCNode *pTarget, bool paused)
|
|||
|
||||
actionAllocWithHashElement(pElement);
|
||||
|
||||
assert(! ccArrayContainsObject(pElement->actions, pAction));
|
||||
CCAssert(! ccArrayContainsObject(pElement->actions, pAction), "");
|
||||
ccArrayAppendObject(pElement->actions, pAction);
|
||||
|
||||
pAction->startWithTarget(pTarget);
|
||||
|
@ -288,8 +288,8 @@ void CCActionManager::removeAction(CCAction *pAction)
|
|||
|
||||
void CCActionManager::removeActionByTag(unsigned int tag, CCObject *pTarget)
|
||||
{
|
||||
assert((int)tag != kCCActionTagInvalid);
|
||||
assert(pTarget != NULL);
|
||||
CCAssert((int)tag != kCCActionTagInvalid, "");
|
||||
CCAssert(pTarget != NULL, "");
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(m_pTargets, &pTarget, pElement);
|
||||
|
@ -314,7 +314,7 @@ void CCActionManager::removeActionByTag(unsigned int tag, CCObject *pTarget)
|
|||
|
||||
CCAction* CCActionManager::getActionByTag(unsigned int tag, CCObject *pTarget)
|
||||
{
|
||||
assert((int)tag != kCCActionTagInvalid);
|
||||
CCAssert((int)tag != kCCActionTagInvalid, "");
|
||||
|
||||
tHashElement *pElement = NULL;
|
||||
HASH_FIND_INT(m_pTargets, &pTarget, pElement);
|
||||
|
|
|
@ -26,6 +26,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCAtlasNode.h"
|
||||
#include "CCTextureAtlas.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
@ -66,7 +67,7 @@ CCAtlasNode * CCAtlasNode::atlasWithTileFile(const char *tile, unsigned int tile
|
|||
bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, unsigned int tileHeight,
|
||||
unsigned int itemsToRender)
|
||||
{
|
||||
assert(tile != NULL);
|
||||
CCAssert(tile != NULL, "title should not be null");
|
||||
m_uItemWidth = (int) (tileWidth * CC_CONTENT_SCALE_FACTOR());
|
||||
m_uItemHeight = (int) (tileHeight * CC_CONTENT_SCALE_FACTOR());
|
||||
|
||||
|
|
|
@ -718,7 +718,7 @@ void CCNode::reorderChild(CCNode *child, int zOrder)
|
|||
|
||||
void CCNode::draw()
|
||||
{
|
||||
//assert(0);
|
||||
//CCAssert(0);
|
||||
// override me
|
||||
// Only use- this function to draw your staff.
|
||||
// DON'T draw your stuff outside this method
|
||||
|
|
|
@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCAutoreleasePool.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
namespace cocos2d
|
||||
{
|
||||
|
@ -42,7 +43,7 @@ void CCAutoreleasePool::addObject(CCObject* pObject)
|
|||
{
|
||||
m_pManagedObjectArray->addObject(pObject);
|
||||
|
||||
assert(pObject->m_uReference > 1);
|
||||
CCAssert(pObject->m_uReference > 1, "reference count should greager than 1");
|
||||
|
||||
pObject->release(); // no ref count, in this case autorelease pool added.
|
||||
}
|
||||
|
@ -162,7 +163,7 @@ void CCPoolManager::pop()
|
|||
|
||||
void CCPoolManager::removeObject(CCObject* pObject)
|
||||
{
|
||||
assert(m_pCurReleasePool);
|
||||
CCAssert(m_pCurReleasePool, "current auto release pool should not be null");
|
||||
|
||||
m_pCurReleasePool->removeObject(pObject);
|
||||
}
|
||||
|
@ -176,9 +177,11 @@ void CCPoolManager::addObject(CCObject* pObject)
|
|||
CCAutoreleasePool* CCPoolManager::getCurReleasePool()
|
||||
{
|
||||
if(!m_pCurReleasePool)
|
||||
{
|
||||
push();
|
||||
}
|
||||
|
||||
assert(m_pCurReleasePool);
|
||||
CCAssert(m_pCurReleasePool, "current auto release pool should not be null");
|
||||
|
||||
return m_pCurReleasePool;
|
||||
}
|
||||
|
|
|
@ -25,14 +25,14 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCObject.h"
|
||||
#include "CCAutoreleasePool.h"
|
||||
#include <assert.h>
|
||||
#include "ccMacros.h"
|
||||
namespace cocos2d {
|
||||
|
||||
CCObject* CCCopying::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CC_UNUSED_PARAM(pZone);
|
||||
assert(0);
|
||||
return 0;
|
||||
CCAssert(0, "not implement");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +64,7 @@ CCObject* CCObject::copy()
|
|||
|
||||
void CCObject::release(void)
|
||||
{
|
||||
assert(m_uReference > 0);
|
||||
CCAssert(m_uReference > 0, "reference count should greater than 0");
|
||||
--m_uReference;
|
||||
|
||||
if (m_uReference == 0)
|
||||
|
@ -75,7 +75,7 @@ void CCObject::release(void)
|
|||
|
||||
void CCObject::retain(void)
|
||||
{
|
||||
assert(m_uReference > 0);
|
||||
CCAssert(m_uReference > 0, "reference count should greater than 0");
|
||||
|
||||
++m_uReference;
|
||||
}
|
||||
|
|
|
@ -274,17 +274,17 @@ namespace cocos2d
|
|||
|
||||
void CCGridBase::blit(void)
|
||||
{
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
}
|
||||
|
||||
void CCGridBase::reuse(void)
|
||||
{
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
}
|
||||
|
||||
void CCGridBase::calculateVertexPoints(void)
|
||||
{
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
}
|
||||
|
||||
// implementation of CCGrid3D
|
||||
|
|
|
@ -32,6 +32,7 @@ THE SOFTWARE.
|
|||
#include "CCTouchDelegateProtocol.h"
|
||||
#include "CCAccelerometerDelegate.h"
|
||||
#include "CCKeypadDelegate.h"
|
||||
#include "CCMutableArray.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@ THE SOFTWARE.
|
|||
#include "CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "selector_protocol.h"
|
||||
#include "CCMutableArray.h"
|
||||
|
||||
namespace cocos2d{
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ THE SOFTWARE.
|
|||
#define __COCOA_CC_MUTABLE_ARRAY_H__
|
||||
|
||||
#include "CCObject.h"
|
||||
#include "ccMacros.h"
|
||||
#include <vector>
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
namespace cocos2d {
|
||||
|
@ -113,7 +113,7 @@ public:
|
|||
|
||||
T getObjectAtIndex(unsigned int uIndex)
|
||||
{
|
||||
assert(uIndex < count());
|
||||
CCAssert(uIndex < count(), "");
|
||||
|
||||
if (uIndex >= count())
|
||||
{
|
||||
|
@ -155,7 +155,7 @@ public:
|
|||
|
||||
void insertObjectAtIndex(T pObject, unsigned int uIndex)
|
||||
{
|
||||
assert(uIndex <= count());
|
||||
CCAssert(uIndex <= count(), "");
|
||||
// make sure the object is not null
|
||||
if (pObject == 0)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
/*#include <GLES/egl.h>*/
|
||||
#include "CCNode.h"
|
||||
#include "CCProtocols.h"
|
||||
#include "CCMutableArray.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
|
|
@ -135,7 +135,6 @@ default gl blend src function. Compatible with premultiplied alpha images.
|
|||
On Mac it returns 1;
|
||||
On iPhone it returns 2 if RetinaDisplay is On. Otherwise it returns 1
|
||||
*/
|
||||
#include "CCDirector.h"
|
||||
#define CC_CONTENT_SCALE_FACTOR() CCDirector::sharedDirector()->getContentScaleFactor()
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace cocos2d{
|
|||
|
||||
bool CCLabelAtlas::initWithString(const char *label, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned char startCharMap)
|
||||
{
|
||||
assert(label != NULL);
|
||||
CCAssert(label != NULL, "");
|
||||
if (CCAtlasNode::initWithTileFile(charMapFile, itemWidth, itemHeight, strlen(label)))
|
||||
{
|
||||
m_cMapStartChar = startCharMap;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace cocos2d{
|
|||
}
|
||||
bool CCBMFontConfiguration::initWithFNTfile(const char *FNTfile)
|
||||
{
|
||||
assert(FNTfile != NULL && strlen(FNTfile)!=0);
|
||||
CCAssert(FNTfile != NULL && strlen(FNTfile)!=0, "");
|
||||
m_pKerningDictionary = NULL;
|
||||
this->parseConfigFile(FNTfile);
|
||||
return true;
|
||||
|
@ -395,7 +395,7 @@ namespace cocos2d{
|
|||
|
||||
bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile)
|
||||
{
|
||||
assert(theString != NULL);
|
||||
CCAssert(theString != NULL, "");
|
||||
CC_SAFE_RELEASE(m_pConfiguration);// allow re-init
|
||||
m_pConfiguration = FNTConfigLoadFile(fntFile);
|
||||
m_pConfiguration->retain();
|
||||
|
|
|
@ -23,6 +23,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#include "CCLabelTTF.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
namespace cocos2d{
|
||||
//
|
||||
|
@ -67,7 +68,7 @@ namespace cocos2d{
|
|||
|
||||
bool CCLabelTTF::initWithString(const char *label, const CCSize& dimensions, CCTextAlignment alignment, const char *fontName, float fontSize)
|
||||
{
|
||||
assert(label != NULL);
|
||||
CCAssert(label != NULL, "");
|
||||
if (CCSprite::init())
|
||||
{
|
||||
m_tDimensions = CCSizeMake( dimensions.width * CC_CONTENT_SCALE_FACTOR(), dimensions.height * CC_CONTENT_SCALE_FACTOR() );
|
||||
|
@ -88,7 +89,7 @@ namespace cocos2d{
|
|||
}
|
||||
bool CCLabelTTF::initWithString(const char *label, const char *fontName, float fontSize)
|
||||
{
|
||||
assert(label != NULL);
|
||||
CCAssert(label != NULL, "");
|
||||
if (CCSprite::init())
|
||||
{
|
||||
m_tDimensions = CCSizeZero;
|
||||
|
|
|
@ -665,7 +665,7 @@ CCLayerMultiplex * CCLayerMultiplex::layerWithLayer(CCLayer* layer)
|
|||
}
|
||||
void CCLayerMultiplex::addLayer(CCLayer* layer)
|
||||
{
|
||||
assert(m_pLayers);
|
||||
CCAssert(m_pLayers, "");
|
||||
m_pLayers->addObject(layer);
|
||||
}
|
||||
|
||||
|
|
|
@ -357,11 +357,11 @@ namespace cocos2d{
|
|||
CCNode* pChild = (CCNode*) pObject;
|
||||
if (pChild)
|
||||
{
|
||||
assert(row < rows.size());
|
||||
CCAssert(row < rows.size(), "");
|
||||
|
||||
rowColumns = rows[row];
|
||||
// can not have zero columns on a row
|
||||
assert(rowColumns);
|
||||
CCAssert(rowColumns, "");
|
||||
|
||||
float tmp = pChild->getContentSize().height;
|
||||
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
|
||||
|
@ -380,7 +380,7 @@ namespace cocos2d{
|
|||
}
|
||||
|
||||
// check if too many rows/columns for available menu items
|
||||
assert(! columnsOccupied);
|
||||
CCAssert(! columnsOccupied, "");
|
||||
|
||||
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
|
@ -467,11 +467,11 @@ namespace cocos2d{
|
|||
if (pChild)
|
||||
{
|
||||
// check if too many menu items for the amount of rows/columns
|
||||
assert(column < columns.size());
|
||||
CCAssert(column < columns.size(), "");
|
||||
|
||||
columnRows = columns[column];
|
||||
// can't have zero rows on a column
|
||||
assert(columnRows);
|
||||
CCAssert(columnRows, "");
|
||||
|
||||
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
||||
float tmp = pChild->getContentSize().width;
|
||||
|
@ -496,7 +496,7 @@ namespace cocos2d{
|
|||
}
|
||||
|
||||
// check if too many rows/columns for available menu items.
|
||||
assert(! rowsOccupied);
|
||||
CCAssert(! rowsOccupied, "");
|
||||
|
||||
CCSize winSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
|
|
|
@ -498,7 +498,7 @@ namespace cocos2d{
|
|||
}
|
||||
bool CCMenuItemSprite::initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector)
|
||||
{
|
||||
assert(normalSprite != NULL);
|
||||
CCAssert(normalSprite != NULL, "");
|
||||
CCMenuItem::initWithTarget(target, selector);
|
||||
setNormalImage(normalSprite);
|
||||
setSelectedImage(selectedSprite);
|
||||
|
|
|
@ -343,7 +343,7 @@ void CCProgressTimer::updateRadial(void)
|
|||
{
|
||||
m_nVertexDataCount = index + 3;
|
||||
m_pVertexData = new ccV2F_C4B_T2F[m_nVertexDataCount];
|
||||
assert(m_pVertexData);
|
||||
CCAssert(m_pVertexData, "");
|
||||
|
||||
updateColor();
|
||||
}
|
||||
|
@ -432,7 +432,7 @@ void CCProgressTimer::updateBar(void)
|
|||
{
|
||||
m_nVertexDataCount = kProgressTextureCoordsCount;
|
||||
m_pVertexData = new ccV2F_C4B_T2F[m_nVertexDataCount];
|
||||
assert(m_pVertexData);
|
||||
CCAssert(m_pVertexData, "");
|
||||
|
||||
if (m_eType == kCCProgressTimerTypeHorizontalBarLR)
|
||||
{
|
||||
|
|
|
@ -26,6 +26,7 @@ THE SOFTWARE.
|
|||
#include "CCRibbon.h"
|
||||
#include "CCTextureCache.h"
|
||||
#include "CCPointExtension.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ THE SOFTWARE.
|
|||
#include "CCImage.h"
|
||||
#include "platform/platform.h"
|
||||
#include "support/zip_support/ZipUtils.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
// opengl
|
||||
#include "platform/CCGL.h"
|
||||
|
@ -291,7 +292,7 @@ bool CCParticleSystem::initWithDictionary(CCDictionary<std::string, CCObject*> *
|
|||
else
|
||||
{
|
||||
char *textureData = (char*)valueForKey("textureImageData", dictionary);
|
||||
assert(textureData);
|
||||
CCAssert(textureData, "");
|
||||
|
||||
int dataLen = strlen(textureData);
|
||||
if(dataLen != 0)
|
||||
|
|
|
@ -29,6 +29,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCParticleSystemQuad.h"
|
||||
#include "CCSpriteFrame.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCFileUtils.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS) && (CC_TARGET_PLATFORM != CC_PLATFORM_AIRPLAY)
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "windows.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ THE SOFTWARE.
|
|||
#include "CCGeometry.h"
|
||||
#include "CCTexture2D.h"
|
||||
#include "CCAffineTransform.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -123,7 +124,7 @@ CCSprite* CCSprite::spriteWithTexture(CCTexture2D *pTexture, const CCRect& rect,
|
|||
CC_UNUSED_PARAM(rect);
|
||||
CC_UNUSED_PARAM(offset);
|
||||
// not implement
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,7 @@ bool CCSprite::init(void)
|
|||
|
||||
bool CCSprite::initWithTexture(CCTexture2D *pTexture, const CCRect& rect)
|
||||
{
|
||||
assert(pTexture != NULL);
|
||||
CCAssert(pTexture != NULL, "");
|
||||
// IMPORTANT: [self init] and not [super init];
|
||||
init();
|
||||
setTexture(pTexture);
|
||||
|
@ -235,7 +236,7 @@ bool CCSprite::initWithTexture(CCTexture2D *pTexture, const CCRect& rect)
|
|||
|
||||
bool CCSprite::initWithTexture(CCTexture2D *pTexture)
|
||||
{
|
||||
assert(pTexture != NULL);
|
||||
CCAssert(pTexture != NULL, "");
|
||||
|
||||
CCRect rect = CCRectZero;
|
||||
rect.size = pTexture->getContentSize();
|
||||
|
@ -245,7 +246,7 @@ bool CCSprite::initWithTexture(CCTexture2D *pTexture)
|
|||
|
||||
bool CCSprite::initWithFile(const char *pszFilename)
|
||||
{
|
||||
assert(pszFilename != NULL);
|
||||
CCAssert(pszFilename != NULL, "");
|
||||
|
||||
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage(pszFilename);
|
||||
if (pTexture)
|
||||
|
@ -263,7 +264,7 @@ bool CCSprite::initWithFile(const char *pszFilename)
|
|||
|
||||
bool CCSprite::initWithFile(const char *pszFilename, const CCRect& rect)
|
||||
{
|
||||
assert(pszFilename != NULL);
|
||||
CCAssert(pszFilename != NULL, "");
|
||||
|
||||
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addImage(pszFilename);
|
||||
if (pTexture)
|
||||
|
@ -279,7 +280,7 @@ bool CCSprite::initWithFile(const char *pszFilename, const CCRect& rect)
|
|||
|
||||
bool CCSprite::initWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
|
||||
{
|
||||
assert(pSpriteFrame != NULL);
|
||||
CCAssert(pSpriteFrame != NULL, "");
|
||||
|
||||
bool bRet = initWithTexture(pSpriteFrame->getTexture(), pSpriteFrame->getRect());
|
||||
setDisplayFrame(pSpriteFrame);
|
||||
|
@ -289,7 +290,7 @@ bool CCSprite::initWithSpriteFrame(CCSpriteFrame *pSpriteFrame)
|
|||
|
||||
bool CCSprite::initWithSpriteFrameName(const char *pszSpriteFrameName)
|
||||
{
|
||||
assert(pszSpriteFrameName != NULL);
|
||||
CCAssert(pszSpriteFrameName != NULL, "");
|
||||
|
||||
CCSpriteFrame *pFrame = CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(pszSpriteFrameName);
|
||||
return initWithSpriteFrame(pFrame);
|
||||
|
@ -309,7 +310,7 @@ CCSprite* CCSprite::initWithCGImage(CGImageRef pImage)
|
|||
/*
|
||||
CCSprite* CCSprite::initWithCGImage(CGImageRef pImage, const char *pszKey)
|
||||
{
|
||||
assert(pImage != NULL);
|
||||
CCAssert(pImage != NULL);
|
||||
|
||||
// XXX: possible bug. See issue #349. New API should be added
|
||||
CCTexture2D *pTexture = CCTextureCache::sharedTextureCache()->addCGImage(pImage, pszKey);
|
||||
|
@ -495,7 +496,7 @@ void CCSprite::updateTextureCoords(const CCRect& rect)
|
|||
|
||||
void CCSprite::updateTransform(void)
|
||||
{
|
||||
assert(m_bUsesBatchNode);
|
||||
CCAssert(m_bUsesBatchNode, "");
|
||||
|
||||
// optimization. Quick return if not dirty
|
||||
if (! m_bDirty)
|
||||
|
@ -650,7 +651,7 @@ void CCSprite::draw(void)
|
|||
{
|
||||
CCNode::draw();
|
||||
|
||||
assert(! m_bUsesBatchNode);
|
||||
CCAssert(! m_bUsesBatchNode, "");
|
||||
|
||||
// Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
|
||||
// Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
|
||||
|
@ -726,12 +727,12 @@ void CCSprite::addChild(CCNode *pChild, int zOrder)
|
|||
|
||||
void CCSprite::addChild(CCNode *pChild, int zOrder, int tag)
|
||||
{
|
||||
assert(pChild != NULL);
|
||||
CCAssert(pChild != NULL, "");
|
||||
CCNode::addChild(pChild, zOrder, tag);
|
||||
|
||||
if (m_bUsesBatchNode)
|
||||
{
|
||||
assert(((CCSprite*)pChild)->getTexture()->getName() == m_pobTextureAtlas->getTexture()->getName());
|
||||
CCAssert(((CCSprite*)pChild)->getTexture()->getName() == m_pobTextureAtlas->getTexture()->getName(), "");
|
||||
unsigned int index = m_pobBatchNode->atlasIndexForChild((CCSprite*)(pChild), zOrder);
|
||||
m_pobBatchNode->insertChild((CCSprite*)(pChild), index);
|
||||
}
|
||||
|
@ -741,8 +742,8 @@ void CCSprite::addChild(CCNode *pChild, int zOrder, int tag)
|
|||
|
||||
void CCSprite::reorderChild(CCNode *pChild, int zOrder)
|
||||
{
|
||||
assert(pChild != NULL);
|
||||
assert(m_pChildren->containsObject(pChild));
|
||||
CCAssert(pChild != NULL, "");
|
||||
CCAssert(m_pChildren->containsObject(pChild), "");
|
||||
|
||||
if (zOrder == pChild->getZOrder())
|
||||
{
|
||||
|
@ -888,7 +889,7 @@ void CCSprite::setAnchorPoint(const CCPoint& anchor)
|
|||
|
||||
void CCSprite::setIsRelativeAnchorPoint(bool bRelative)
|
||||
{
|
||||
assert(! m_bUsesBatchNode);
|
||||
CCAssert(! m_bUsesBatchNode, "");
|
||||
CCNode::setIsRelativeAnchorPoint(bRelative);
|
||||
}
|
||||
|
||||
|
@ -1032,15 +1033,15 @@ void CCSprite::setDisplayFrame(CCSpriteFrame *pNewFrame)
|
|||
|
||||
void CCSprite::setDisplayFrameWithAnimationName(const char *animationName, int frameIndex)
|
||||
{
|
||||
assert(animationName);
|
||||
CCAssert(animationName, "");
|
||||
|
||||
CCAnimation *a = CCAnimationCache::sharedAnimationCache()->animationByName(animationName);
|
||||
|
||||
assert(a);
|
||||
CCAssert(a, "");
|
||||
|
||||
CCSpriteFrame *frame = a->getFrames()->getObjectAtIndex(frameIndex);
|
||||
|
||||
assert(frame);
|
||||
CCAssert(frame, "");
|
||||
|
||||
setDisplayFrame(frame);
|
||||
}
|
||||
|
@ -1066,8 +1067,7 @@ CCSpriteFrame* CCSprite::displayedFrame(void)
|
|||
|
||||
void CCSprite::updateBlendFunc(void)
|
||||
{
|
||||
// CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a CCSpriteSheet
|
||||
assert (! m_bUsesBatchNode);
|
||||
CCAssert (! m_bUsesBatchNode, "CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a CCSpriteSheet");
|
||||
|
||||
// it's possible to have an untextured sprite
|
||||
if (! m_pobTexture || ! m_pobTexture->getHasPremultipliedAlpha())
|
||||
|
@ -1087,11 +1087,11 @@ void CCSprite::updateBlendFunc(void)
|
|||
void CCSprite::setTexture(CCTexture2D *texture)
|
||||
{
|
||||
// CCSprite: setTexture doesn't work when the sprite is rendered using a CCSpriteSheet
|
||||
assert(! m_bUsesBatchNode);
|
||||
CCAssert(! m_bUsesBatchNode, "setTexture doesn't work when the sprite is rendered using a CCSpriteSheet");
|
||||
|
||||
// we can not use RTTI, so we do not known the type of object
|
||||
// accept texture==nil as argument
|
||||
/*assert((! texture) || dynamic_cast<CCTexture2D*>(texture));*/
|
||||
/*CCAssert((! texture) || dynamic_cast<CCTexture2D*>(texture));*/
|
||||
|
||||
CC_SAFE_RELEASE(m_pobTexture);
|
||||
|
||||
|
|
|
@ -152,11 +152,11 @@ namespace cocos2d
|
|||
|
||||
void CCSpriteBatchNode::addChild(CCNode *child, int zOrder, int tag)
|
||||
{
|
||||
assert(child != NULL);
|
||||
CCAssert(child != NULL, "child should not be null");
|
||||
|
||||
CCSprite *pSprite = (CCSprite*)(child);
|
||||
// check CCSprite is using the same texture id
|
||||
assert(pSprite->getTexture()->getName() == m_pobTextureAtlas->getTexture()->getName());
|
||||
CCAssert(pSprite->getTexture()->getName() == m_pobTextureAtlas->getTexture()->getName(), "");
|
||||
|
||||
CCNode::addChild(child, zOrder, tag);
|
||||
|
||||
|
@ -177,8 +177,8 @@ namespace cocos2d
|
|||
// override reorderChild
|
||||
void CCSpriteBatchNode::reorderChild(CCNode *child, int zOrder)
|
||||
{
|
||||
assert(child != NULL);
|
||||
assert(m_pChildren->containsObject(child));
|
||||
CCAssert(child != NULL, "the child should not be null");
|
||||
CCAssert(m_pChildren->containsObject(child), "sprite batch node should contain the child");
|
||||
|
||||
if (zOrder == child->getZOrder())
|
||||
{
|
||||
|
@ -203,7 +203,7 @@ namespace cocos2d
|
|||
return;
|
||||
}
|
||||
|
||||
assert(m_pChildren->containsObject(pSprite));
|
||||
CCAssert(m_pChildren->containsObject(pSprite), "sprite batch node should contain the child");
|
||||
|
||||
// cleanup before removing
|
||||
removeSpriteFromAtlas(pSprite);
|
||||
|
@ -307,7 +307,7 @@ namespace cocos2d
|
|||
{
|
||||
// serious problems
|
||||
CCLOG("cocos2d: WARNING: Not enough memory to resize the atlas");
|
||||
assert(false);
|
||||
CCAssert(false, "Not enough memory to resize the atla");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -435,7 +435,7 @@ namespace cocos2d
|
|||
}
|
||||
|
||||
// Should not happen. Error calculating Z on SpriteSheet
|
||||
assert(0);
|
||||
CCAssert(0, "should not run here");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ THE SOFTWARE.
|
|||
****************************************************************************/
|
||||
|
||||
#include "CCSpriteFrame.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
namespace cocos2d {
|
||||
// implementation of CCSpriteFrame
|
||||
|
|
|
@ -91,7 +91,7 @@ void CCSpriteFrameCache::addSpriteFramesWithDictionary(CCDictionary<std::string,
|
|||
}
|
||||
|
||||
// check the format
|
||||
assert(format >=0 && format <= 3);
|
||||
CCAssert(format >=0 && format <= 3, "");
|
||||
|
||||
framesDict->begin();
|
||||
std::string key = "";
|
||||
|
@ -206,7 +206,7 @@ void CCSpriteFrameCache::addSpriteFramesWithFile(const char *pszPlist, CCTexture
|
|||
|
||||
void CCSpriteFrameCache::addSpriteFramesWithFile(const char* plist, const char* textureFileName)
|
||||
{
|
||||
assert(textureFileName);
|
||||
CCAssert(textureFileName, "texture name should not be null");
|
||||
CCTexture2D *texture = CCTextureCache::sharedTextureCache()->addImage(textureFileName);
|
||||
|
||||
if (texture)
|
||||
|
|
|
@ -41,7 +41,7 @@ THE SOFTWARE.
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "ccMacros.h"
|
||||
#include "CCObject.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
|
|
|
@ -143,8 +143,8 @@ namespace cocos2d
|
|||
int len;
|
||||
unsigned int offset = 0;
|
||||
|
||||
assert( out );
|
||||
assert( &*out );
|
||||
CCAssert(out, "");
|
||||
CCAssert(&*out, "");
|
||||
|
||||
gzFile inFile = gzopen(path, "rb");
|
||||
if( inFile == NULL ) {
|
||||
|
@ -210,8 +210,8 @@ namespace cocos2d
|
|||
|
||||
int ZipUtils::ccInflateCCZFile(const char *path, unsigned char **out)
|
||||
{
|
||||
assert( out );
|
||||
assert( &*out );
|
||||
CCAssert(out, "");
|
||||
CCAssert(&*out, "");
|
||||
|
||||
// load file into memory
|
||||
unsigned char *compressed = NULL;
|
||||
|
|
|
@ -41,6 +41,7 @@ THE SOFTWARE.
|
|||
#include "support/ccUtils.h"
|
||||
#include "platform/CCPlatformMacros.h"
|
||||
#include "CCTexturePVR.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||
#include "CCTextureCache.h"
|
||||
|
@ -672,7 +673,7 @@ unsigned int CCTexture2D::bitsPerPixelForFormat()
|
|||
break;
|
||||
default:
|
||||
ret = -1;
|
||||
assert(false);
|
||||
CCAssert(false, "illegal pixel format");
|
||||
CCLOG("bitsPerPixelForFormat: %d, cannot give useful result", m_ePixelFormat);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -141,7 +141,7 @@ bool CCTextureAtlas::initWithFile(const char * file, unsigned int capacity)
|
|||
|
||||
bool CCTextureAtlas::initWithTexture(CCTexture2D *texture, unsigned int capacity)
|
||||
{
|
||||
assert(texture != NULL);
|
||||
CCAssert(texture != NULL, "texture should not be null");
|
||||
m_uCapacity = capacity;
|
||||
m_uTotalQuads = 0;
|
||||
|
||||
|
@ -150,7 +150,7 @@ bool CCTextureAtlas::initWithTexture(CCTexture2D *texture, unsigned int capacity
|
|||
CC_SAFE_RETAIN(m_pTexture);
|
||||
|
||||
// Re-initialization is not allowed
|
||||
assert(m_pQuads == NULL && m_pIndices == NULL);
|
||||
CCAssert(m_pQuads == NULL && m_pIndices == NULL, "");
|
||||
|
||||
m_pQuads = (ccV3F_C4B_T2F_Quad*)calloc( sizeof(ccV3F_C4B_T2F_Quad) * m_uCapacity, 1 );
|
||||
m_pIndices = (GLushort *)calloc( sizeof(GLushort) * m_uCapacity * 6, 1 );
|
||||
|
|
|
@ -30,6 +30,7 @@ THE SOFTWARE.
|
|||
#include "CCTextureCache.h"
|
||||
#include "CCPointExtension.h"
|
||||
#include "support/data_support/ccCArray.h"
|
||||
#include "CCDirector.h"
|
||||
|
||||
namespace cocos2d {
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace cocos2d{
|
|||
if( gid != 0 )
|
||||
{
|
||||
// Optimization: quick return
|
||||
// if the layer is invalid (more than 1 tileset per layer) an assert will be thrown later
|
||||
// if the layer is invalid (more than 1 tileset per layer) an CCAssert will be thrown later
|
||||
if( gid >= tileset->m_uFirstGid )
|
||||
return tileset;
|
||||
}
|
||||
|
|
|
@ -555,7 +555,7 @@ namespace cocos2d {
|
|||
int sizeHint = (int)(s.width * s.height * sizeof(unsigned int));
|
||||
|
||||
int inflatedLen = ZipUtils::ccInflateMemoryWithHint(buffer, len, &deflated, sizeHint);
|
||||
assert(inflatedLen == sizeHint);
|
||||
CCAssert(inflatedLen == sizeHint, "");
|
||||
|
||||
inflatedLen = (size_t)&inflatedLen; // XXX: to avoid warings in compiler
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ THE SOFTWARE.
|
|||
#include "CCTexture2D.h"
|
||||
#include "support/data_support/ccCArray.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
/**
|
||||
|
@ -131,7 +130,7 @@ void CCTouchDispatcher::forceAddHandler(CCTouchHandler *pHandler, CCMutableArray
|
|||
|
||||
if (h->getDelegate() == pHandler->getDelegate())
|
||||
{
|
||||
assert(0);
|
||||
CCAssert(0, "");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -269,13 +268,13 @@ void CCTouchDispatcher::rearrangeHandlers(CCMutableArray<CCTouchHandler*> *pArra
|
|||
|
||||
void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)
|
||||
{
|
||||
assert(pDelegate != NULL);
|
||||
CCAssert(pDelegate != NULL, "");
|
||||
|
||||
CCTouchHandler *handler = NULL;
|
||||
|
||||
handler = this->findHandler(pDelegate);
|
||||
|
||||
assert(handler != NULL);
|
||||
CCAssert(handler != NULL, "");
|
||||
|
||||
handler->setPriority(nPriority);
|
||||
|
||||
|
@ -288,7 +287,7 @@ void CCTouchDispatcher::setPriority(int nPriority, CCTouchDelegate *pDelegate)
|
|||
//
|
||||
void CCTouchDispatcher::touches(CCSet *pTouches, CCEvent *pEvent, unsigned int uIndex)
|
||||
{
|
||||
assert(uIndex >= 0 && uIndex < 4);
|
||||
CCAssert(uIndex >= 0 && uIndex < 4, "");
|
||||
|
||||
CCSet *pMutableTouches;
|
||||
m_bLocked = true;
|
||||
|
|
|
@ -88,7 +88,7 @@ CCTouchHandler* CCTouchHandler::handlerWithDelegate(CCTouchDelegate *pDelegate,
|
|||
|
||||
bool CCTouchHandler::initWithDelegate(CCTouchDelegate *pDelegate, int nPriority)
|
||||
{
|
||||
assert(pDelegate != NULL);
|
||||
CCAssert(pDelegate != NULL, "touch delegate should not be null");
|
||||
|
||||
m_pDelegate = pDelegate; pDelegate->keep();
|
||||
m_nPriority = nPriority;
|
||||
|
|
Loading…
Reference in New Issue