diff --git a/cocos2dx/base_nodes/CCAtlasNode.cpp b/cocos2dx/base_nodes/CCAtlasNode.cpp index 91aa4489c7..1acb5276b3 100644 --- a/cocos2dx/base_nodes/CCAtlasNode.cpp +++ b/cocos2dx/base_nodes/CCAtlasNode.cpp @@ -130,7 +130,7 @@ void CCAtlasNode::updateAtlasValues() } // CCAtlasNode - draw -void CCAtlasNode::draw() +void CCAtlasNode::draw(void) { CC_NODE_DRAW_SETUP(); diff --git a/cocos2dx/include/CCArray.h b/cocos2dx/include/CCArray.h index 11cb12b9be..01d2c0977f 100755 --- a/cocos2dx/include/CCArray.h +++ b/cocos2dx/include/CCArray.h @@ -144,7 +144,7 @@ public: void replaceObjectAtIndex(unsigned int uIndex, CCObject* pObject, bool bReleaseObject = true); /** TODO: deep copy array. */ - virtual CCObject* copyWithZone(CCZone* pZone) {CCAssert(false, "");return NULL;} + virtual CCObject* copyWithZone(CCZone* pZone); public: ccArray* data; CCArray() : data(NULL) {}; diff --git a/cocos2dx/include/CCAtlasNode.h b/cocos2dx/include/CCAtlasNode.h index 369e5843f9..939ed73364 100755 --- a/cocos2dx/include/CCAtlasNode.h +++ b/cocos2dx/include/CCAtlasNode.h @@ -87,7 +87,7 @@ public: */ virtual void updateAtlasValues(); - virtual void draw(); + virtual void draw(void); // CC Texture protocol diff --git a/cocos2dx/include/CCDictionary.h b/cocos2dx/include/CCDictionary.h index ae067b223a..bf1598ae65 100644 --- a/cocos2dx/include/CCDictionary.h +++ b/cocos2dx/include/CCDictionary.h @@ -52,11 +52,13 @@ public: inline const char* getStrKey() const { + CCAssert(m_szKey[0] != '\0', "Should not call this function for integer dictionary"); return m_szKey; } inline int getIntKey() const { + CCAssert(m_szKey[0] == '\0', "Should not call this function for string dictionary"); return m_iKey; } @@ -75,9 +77,9 @@ private: } private: - char m_szKey[256]; /* hash key of string type*/ - int m_iKey; /* hash key of integer type */ - CCObject* m_pObject;/* hash value */ + char m_szKey[256]; /** hash key of string type*/ + int m_iKey; /** hash key of integer type */ + CCObject* m_pObject;/** hash value */ public: UT_hash_handle hh; /* makes this class hashable */ friend class CCDictionary; diff --git a/cocos2dx/support/CCArray.cpp b/cocos2dx/support/CCArray.cpp index 525037714b..ccc5929a20 100644 --- a/cocos2dx/support/CCArray.cpp +++ b/cocos2dx/support/CCArray.cpp @@ -61,17 +61,8 @@ CCArray* CCArray::arrayWithCapacity(unsigned int capacity) CCArray* CCArray::arrayWithArray(CCArray* otherArray) { - CCArray* pArray = new CCArray(); - - if (pArray && pArray->initWithArray(otherArray)) - { - pArray->autorelease(); - } - else - { - CC_SAFE_DELETE(pArray); - } - + CCArray* pArray = (CCArray*)otherArray->copyWithZone(NULL); + pArray->autorelease(); return pArray; } @@ -257,4 +248,15 @@ void CCArray::replaceObjectAtIndex(unsigned int uIndex, CCObject* pObject, bool } } +CCObject* CCArray::copyWithZone(CCZone* pZone) +{ + CCArray* pArray = new CCArray(); + + if (!(pArray && pArray->initWithArray(this))) + { + CC_SAFE_DELETE(pArray); + } + return pArray; +} + NS_CC_END diff --git a/cocos2dx/textures/CCTextureAtlas.cpp b/cocos2dx/textures/CCTextureAtlas.cpp index 4d5e2e4030..a6667c4a4e 100644 --- a/cocos2dx/textures/CCTextureAtlas.cpp +++ b/cocos2dx/textures/CCTextureAtlas.cpp @@ -523,6 +523,7 @@ void CCTextureAtlas::drawNumberOfQuads(unsigned int n) void CCTextureAtlas::drawNumberOfQuads(unsigned int n, unsigned int start) { + if (0 == n) return; ccGLBindTexture2D( m_pTexture->getName() ); // XXX: update is done in draw... perhaps it should be done in a timer