mirror of https://github.com/axmolengine/axmol.git
issue #1056: Added CCArray::copyWithZone implementation. CCDictElement bound check.
This commit is contained in:
parent
15e03f8b14
commit
7c0af610ff
|
@ -130,7 +130,7 @@ void CCAtlasNode::updateAtlasValues()
|
|||
}
|
||||
|
||||
// CCAtlasNode - draw
|
||||
void CCAtlasNode::draw()
|
||||
void CCAtlasNode::draw(void)
|
||||
{
|
||||
CC_NODE_DRAW_SETUP();
|
||||
|
||||
|
|
|
@ -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) {};
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
*/
|
||||
virtual void updateAtlasValues();
|
||||
|
||||
virtual void draw();
|
||||
virtual void draw(void);
|
||||
|
||||
// CC Texture protocol
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -61,17 +61,8 @@ CCArray* CCArray::arrayWithCapacity(unsigned int capacity)
|
|||
|
||||
CCArray* CCArray::arrayWithArray(CCArray* otherArray)
|
||||
{
|
||||
CCArray* pArray = new CCArray();
|
||||
|
||||
if (pArray && pArray->initWithArray(otherArray))
|
||||
{
|
||||
CCArray* pArray = (CCArray*)otherArray->copyWithZone(NULL);
|
||||
pArray->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_SAFE_DELETE(pArray);
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue