diff --git a/cocos2dx/cocoa/NSMutableArray.cpp b/cocos2dx/cocoa/NSMutableArray.cpp index 4703d422e4..6342d0d71c 100644 --- a/cocos2dx/cocoa/NSMutableArray.cpp +++ b/cocos2dx/cocoa/NSMutableArray.cpp @@ -25,6 +25,7 @@ THE SOFTWARE. #include "NSMutableArray.h" #include #include +#include using namespace std; @@ -252,3 +253,16 @@ NSMutableArray* arrayWithArray(NSMutableArray *pArray) return pNewArray; } + +NSObject* NSMutableArray::getObjectAtIndex(UINT32 uIndex) +{ + assert(uIndex < count()); + assert(uIndex >= 0); + + if (uIndex <= 0 || uIndex >= count()) + { + return NULL; + } + + return m_array[uIndex]; +} diff --git a/cocos2dx/cocoa/NSMutableArray.h b/cocos2dx/cocoa/NSMutableArray.h index 7951482c63..d9dcb4570a 100644 --- a/cocos2dx/cocoa/NSMutableArray.h +++ b/cocos2dx/cocoa/NSMutableArray.h @@ -41,6 +41,7 @@ public: UINT32 getIndexOfObject(NSObject *pObject); bool containsObject(NSObject *pObject); NSObject* getLastObject(void); + NSObject* getObjectAtIndex(UINT32 uIndex); // Adding objects void addObject(NSObject *pObject);