fix warnings caused by deprecating some functions of Array

This commit is contained in:
minggo 2013-08-22 10:45:47 +08:00
parent 3476a843e2
commit 2de8963a0a
29 changed files with 154 additions and 166 deletions

View File

@ -622,7 +622,7 @@ void Director::popScene(void)
else else
{ {
_sendCleanupToScene = true; _sendCleanupToScene = true;
_nextScene = (Scene*)_scenesStack->objectAtIndex(c - 1); _nextScene = (Scene*)_scenesStack->getObjectAtIndex(c - 1);
} }
} }
@ -650,7 +650,7 @@ void Director::popToSceneStackLevel(int level)
// pop stack until reaching desired level // pop stack until reaching desired level
while (c > level) while (c > level)
{ {
Scene *current = (Scene*)_scenesStack->lastObject(); Scene *current = (Scene*)_scenesStack->getLastObject();
if (current->isRunning()) if (current->isRunning())
{ {
@ -663,7 +663,7 @@ void Director::popToSceneStackLevel(int level)
--c; --c;
} }
_nextScene = (Scene*)_scenesStack->lastObject(); _nextScene = (Scene*)_scenesStack->getLastObject();
_sendCleanupToScene = false; _sendCleanupToScene = false;
} }

View File

@ -687,7 +687,7 @@ void Scheduler::unscheduleScriptEntry(unsigned int uScheduleScriptEntryID)
{ {
for (int i = _scriptHandlerEntries->count() - 1; i >= 0; i--) for (int i = _scriptHandlerEntries->count() - 1; i >= 0; i--)
{ {
SchedulerScriptHandlerEntry* pEntry = static_cast<SchedulerScriptHandlerEntry*>(_scriptHandlerEntries->objectAtIndex(i)); SchedulerScriptHandlerEntry* pEntry = static_cast<SchedulerScriptHandlerEntry*>(_scriptHandlerEntries->getObjectAtIndex(i));
if (pEntry->getEntryId() == (int)uScheduleScriptEntryID) if (pEntry->getEntryId() == (int)uScheduleScriptEntryID)
{ {
pEntry->markedForDeletion(); pEntry->markedForDeletion();
@ -909,7 +909,7 @@ void Scheduler::update(float dt)
{ {
for (int i = _scriptHandlerEntries->count() - 1; i >= 0; i--) for (int i = _scriptHandlerEntries->count() - 1; i >= 0; i--)
{ {
SchedulerScriptHandlerEntry* pEntry = static_cast<SchedulerScriptHandlerEntry*>(_scriptHandlerEntries->objectAtIndex(i)); SchedulerScriptHandlerEntry* pEntry = static_cast<SchedulerScriptHandlerEntry*>(_scriptHandlerEntries->getObjectAtIndex(i));
if (pEntry->isMarkedForDeletion()) if (pEntry->isMarkedForDeletion())
{ {
_scriptHandlerEntries->removeObjectAtIndex(i); _scriptHandlerEntries->removeObjectAtIndex(i);

View File

@ -206,13 +206,13 @@ Sequence* Sequence::create(Array* arrayOfActions)
unsigned int count = arrayOfActions->count(); unsigned int count = arrayOfActions->count();
CC_BREAK_IF(count == 0); CC_BREAK_IF(count == 0);
FiniteTimeAction* prev = static_cast<FiniteTimeAction*>( arrayOfActions->objectAtIndex(0) ); FiniteTimeAction* prev = static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(0));
if (count > 1) if (count > 1)
{ {
for (unsigned int i = 1; i < count; ++i) for (unsigned int i = 1; i < count; ++i)
{ {
prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>( arrayOfActions->objectAtIndex(i)) ); prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(i)));
} }
} }
else else
@ -578,12 +578,12 @@ Spawn* Spawn::create(Array *arrayOfActions)
{ {
unsigned int count = arrayOfActions->count(); unsigned int count = arrayOfActions->count();
CC_BREAK_IF(count == 0); CC_BREAK_IF(count == 0);
FiniteTimeAction* prev = static_cast<FiniteTimeAction*>( arrayOfActions->objectAtIndex(0) ); FiniteTimeAction* prev = static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(0));
if (count > 1) if (count > 1)
{ {
for (unsigned int i = 1; i < arrayOfActions->count(); ++i) for (unsigned int i = 1; i < arrayOfActions->count(); ++i)
{ {
prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>( arrayOfActions->objectAtIndex(i)) ); prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(i)));
} }
} }
else else
@ -2107,7 +2107,7 @@ void Animate::update(float t)
float splitTime = _splitTimes->at(i); float splitTime = _splitTimes->at(i);
if( splitTime <= t ) { if( splitTime <= t ) {
AnimationFrame* frame = static_cast<AnimationFrame*>(frames->objectAtIndex(i)); AnimationFrame* frame = static_cast<AnimationFrame*>(frames->getObjectAtIndex(i));
frameToDisplay = frame->getSpriteFrame(); frameToDisplay = frame->getSpriteFrame();
static_cast<Sprite*>(_target)->setDisplayFrame(frameToDisplay); static_cast<Sprite*>(_target)->setDisplayFrame(frameToDisplay);

View File

@ -90,7 +90,7 @@ Array* Array::create(Object* object, ...)
{ {
array->addObject(object); array->addObject(object);
Object *i = va_arg(args, Object*); Object *i = va_arg(args, Object*);
while(i) while (i)
{ {
array->addObject(i); array->addObject(i);
i = va_arg(args, Object*); i = va_arg(args, Object*);
@ -129,12 +129,12 @@ Array* Array::createWithCapacity(unsigned int capacity)
Array* Array::createWithContentsOfFile(const char* fileName) Array* Array::createWithContentsOfFile(const char* fileName)
{ {
Array* pRet = Array::createWithContentsOfFileThreadSafe(fileName); Array* ret = Array::createWithContentsOfFileThreadSafe(fileName);
if (pRet != NULL) if (ret != nullptr)
{ {
pRet->autorelease(); pRet->autorelease();
} }
return pRet; return ret;
} }
Array* Array::createWithContentsOfFileThreadSafe(const char* fileName) Array* Array::createWithContentsOfFileThreadSafe(const char* fileName)
@ -163,7 +163,7 @@ bool Array::initWithObjects(Object* object, ...)
bool ret = false; bool ret = false;
do do
{ {
CC_BREAK_IF(object == NULL); CC_BREAK_IF(object == nullptr);
va_list args; va_list args;
va_start(args, object); va_start(args, object);
@ -172,7 +172,7 @@ bool Array::initWithObjects(Object* object, ...)
{ {
this->addObject(object); this->addObject(object);
Object* i = va_arg(args, Object*); Object* i = va_arg(args, Object*);
while(i) while (i)
{ {
this->addObject(i); this->addObject(i);
i = va_arg(args, Object*); i = va_arg(args, Object*);
@ -200,10 +200,6 @@ bool Array::initWithArray(Array* otherArray)
int Array::getIndexOfObject(Object* object) const int Array::getIndexOfObject(Object* object) const
{ {
// auto it = std::find(data.begin(), data.end(), object );
// if( it == data.end() )
// return -1;
// return it - std::begin(data);
auto it = data.begin(); auto it = data.begin();
for (int i = 0; it != data.end(); ++it, ++i) for (int i = 0; it != data.end(); ++it, ++i)
@ -239,7 +235,7 @@ Object* Array::getRandomObject()
bool Array::containsObject(Object* object) const bool Array::containsObject(Object* object) const
{ {
int i = this->getIndexOfObject(object); int i = this->getIndexOfObject(object);
return (i >=0 ); return (i >=0);
} }
bool Array::isEqualToArray(Array* otherArray) bool Array::isEqualToArray(Array* otherArray)
@ -282,14 +278,6 @@ void Array::removeLastObject(bool releaseObj)
void Array::removeObject(Object* object, bool releaseObj /* ignored */) void Array::removeObject(Object* object, bool releaseObj /* ignored */)
{ {
// auto begin = data.begin();
// auto end = data.end();
//
// auto it = std::find( begin, end, object);
// if( it != end ) {
// data.erase(it);
// }
auto it = data.begin(); auto it = data.begin();
for (; it != data.end(); ++it) for (; it != data.end(); ++it)
{ {
@ -344,7 +332,6 @@ void Array::exchangeObjectAtIndex(unsigned int index1, unsigned int index2)
void Array::replaceObjectAtIndex(unsigned int index, Object* object, bool releaseObject /* ignored */) void Array::replaceObjectAtIndex(unsigned int index, Object* object, bool releaseObject /* ignored */)
{ {
// auto obj = data[index];
data[index] = object; data[index] = object;
} }
@ -368,9 +355,9 @@ Array* Array::clone() const
ret->autorelease(); ret->autorelease();
ret->initWithCapacity(this->data.size() > 0 ? this->data.size() : 1); ret->initWithCapacity(this->data.size() > 0 ? this->data.size() : 1);
Object* obj = NULL; Object* obj = nullptr;
Object* tmpObj = NULL; Object* tmpObj = nullptr;
Clonable* clonable = NULL; Clonable* clonable = nullptr;
CCARRAY_FOREACH(this, obj) CCARRAY_FOREACH(this, obj)
{ {
clonable = dynamic_cast<Clonable*>(obj); clonable = dynamic_cast<Clonable*>(obj);
@ -402,13 +389,13 @@ void Array::acceptVisitor(DataVisitor &visitor)
#else #else
Array::Array() Array::Array()
: data(NULL) : data(nullptr)
{ {
// init(); // init();
} }
Array::Array(unsigned int capacity) Array::Array(unsigned int capacity)
: data(NULL) : data(nullptr)
{ {
initWithCapacity(capacity); initWithCapacity(capacity);
} }
@ -455,7 +442,7 @@ Array* Array::create(Object* object, ...)
{ {
array->addObject(object); array->addObject(object);
Object *i = va_arg(args, Object*); Object *i = va_arg(args, Object*);
while(i) while (i)
{ {
array->addObject(i); array->addObject(i);
i = va_arg(args, Object*); i = va_arg(args, Object*);
@ -494,12 +481,12 @@ Array* Array::createWithCapacity(unsigned int capacity)
Array* Array::createWithContentsOfFile(const char* fileName) Array* Array::createWithContentsOfFile(const char* fileName)
{ {
Array* pRet = Array::createWithContentsOfFileThreadSafe(fileName); Array* ret = Array::createWithContentsOfFileThreadSafe(fileName);
if (pRet != NULL) if (ret != nullptr)
{ {
pRet->autorelease(); ret->autorelease();
} }
return pRet; return ret;
} }
Array* Array::createWithContentsOfFileThreadSafe(const char* fileName) Array* Array::createWithContentsOfFileThreadSafe(const char* fileName)
@ -534,7 +521,7 @@ bool Array::initWithObjects(Object* object, ...)
bool ret = false; bool ret = false;
do do
{ {
CC_BREAK_IF(object == NULL); CC_BREAK_IF(object == nullptr);
va_list args; va_list args;
va_start(args, object); va_start(args, object);
@ -543,7 +530,7 @@ bool Array::initWithObjects(Object* object, ...)
{ {
this->addObject(object); this->addObject(object);
Object* i = va_arg(args, Object*); Object* i = va_arg(args, Object*);
while(i) while (i)
{ {
this->addObject(i); this->addObject(i);
i = va_arg(args, Object*); i = va_arg(args, Object*);
@ -588,9 +575,9 @@ int Array::getIndexOfObject(Object* object) const
Object* Array::getRandomObject() Object* Array::getRandomObject()
{ {
if (data->num==0) if (data->num == 0)
{ {
return NULL; return nullptr;
} }
float r = CCRANDOM_0_1(); float r = CCRANDOM_0_1();
@ -639,7 +626,8 @@ void Array::setObject(Object* object, int index)
{ {
CCASSERT(index>=0 && index < count(), "Invalid index"); CCASSERT(index>=0 && index < count(), "Invalid index");
if( object != data->arr[index] ) { if (object != data->arr[index])
{
data->arr[index]->release(); data->arr[index]->release();
data->arr[index] = object; data->arr[index] = object;
object->retain(); object->retain();
@ -685,13 +673,13 @@ void Array::fastRemoveObject(Object* object)
void Array::exchangeObject(Object* object1, Object* object2) void Array::exchangeObject(Object* object1, Object* object2)
{ {
unsigned int index1 = ccArrayGetIndexOfObject(data, object1); unsigned int index1 = ccArrayGetIndexOfObject(data, object1);
if(index1 == UINT_MAX) if (index1 == UINT_MAX)
{ {
return; return;
} }
unsigned int index2 = ccArrayGetIndexOfObject(data, object2); unsigned int index2 = ccArrayGetIndexOfObject(data, object2);
if(index2 == UINT_MAX) if (index2 == UINT_MAX)
{ {
return; return;
} }
@ -721,7 +709,7 @@ void Array::reverseObjects()
for (int i = 0; i < count ; i++) for (int i = 0; i < count ; i++)
{ {
ccArraySwapObjectsAtIndexes(data, i, maxIndex); ccArraySwapObjectsAtIndexes(data, i, maxIndex);
maxIndex--; --maxIndex;
} }
} }
} }
@ -742,9 +730,9 @@ Array* Array::clone() const
ret->autorelease(); ret->autorelease();
ret->initWithCapacity(this->data->num > 0 ? this->data->num : 1); ret->initWithCapacity(this->data->num > 0 ? this->data->num : 1);
Object* obj = NULL; Object* obj = nullptr;
Object* tmpObj = NULL; Object* tmpObj = nullptr;
Clonable* clonable = NULL; Clonable* clonable = nullptr;
CCARRAY_FOREACH(this, obj) CCARRAY_FOREACH(this, obj)
{ {
clonable = dynamic_cast<Clonable*>(obj); clonable = dynamic_cast<Clonable*>(obj);

View File

@ -297,7 +297,7 @@ public:
/** Returns an element with a certain index */ /** Returns an element with a certain index */
Object* getObjectAtIndex(int index) Object* getObjectAtIndex(int index)
{ {
CCASSERT(index>=0 && index < count(), "index out of range in objectAtIndex()"); CCASSERT(index>=0 && index < count(), "index out of range in getObjectAtIndex()");
#if CC_USE_ARRAY_VECTOR #if CC_USE_ARRAY_VECTOR
return data[index].get(); return data[index].get();
#else #else

View File

@ -165,10 +165,10 @@ void PoolManager::pop()
// if(nCount > 1) // if(nCount > 1)
// { // {
// _curReleasePool = _releasePoolStack->objectAtIndex(nCount - 2); // _curReleasePool = _releasePoolStack->getObjectAtIndex(nCount - 2);
// return; // return;
// } // }
_curReleasePool = (AutoreleasePool*)_releasePoolStack->objectAtIndex(nCount - 2); _curReleasePool = (AutoreleasePool*)_releasePoolStack->getObjectAtIndex(nCount - 2);
} }
/*_curReleasePool = NULL;*/ /*_curReleasePool = NULL;*/

View File

@ -340,7 +340,7 @@ Object* Dictionary::randomObject()
return NULL; return NULL;
} }
Object* key = allKeys()->randomObject(); Object* key = allKeys()->getRandomObject();
if (_dictType == kDictInt) if (_dictType == kDictInt)
{ {

View File

@ -444,7 +444,7 @@ Sprite * Label::getSprite()
{ {
if (_spriteArrayCache.count()) if (_spriteArrayCache.count())
{ {
Sprite *retSprite = (Sprite *) _spriteArrayCache.lastObject(); Sprite *retSprite = (Sprite *) _spriteArrayCache.getLastObject();
_spriteArrayCache.removeLastObject(); _spriteArrayCache.removeLastObject();
return retSprite; return retSprite;
} }

View File

@ -1088,7 +1088,7 @@ bool LayerMultiplex::initWithLayers(Layer *layer, va_list params)
} }
_enabledLayer = 0; _enabledLayer = 0;
this->addChild((Node*)_layers->objectAtIndex(_enabledLayer)); this->addChild((Node*)_layers->getObjectAtIndex(_enabledLayer));
return true; return true;
} }
@ -1104,7 +1104,7 @@ bool LayerMultiplex::initWithArray(Array* arrayOfLayers)
_layers->retain(); _layers->retain();
_enabledLayer = 0; _enabledLayer = 0;
this->addChild((Node*)_layers->objectAtIndex(_enabledLayer)); this->addChild((Node*)_layers->getObjectAtIndex(_enabledLayer));
return true; return true;
} }
return false; return false;
@ -1114,25 +1114,25 @@ void LayerMultiplex::switchTo(unsigned int n)
{ {
CCASSERT( n < _layers->count(), "Invalid index in MultiplexLayer switchTo message" ); CCASSERT( n < _layers->count(), "Invalid index in MultiplexLayer switchTo message" );
this->removeChild((Node*)_layers->objectAtIndex(_enabledLayer), true); this->removeChild((Node*)_layers->getObjectAtIndex(_enabledLayer), true);
_enabledLayer = n; _enabledLayer = n;
this->addChild((Node*)_layers->objectAtIndex(n)); this->addChild((Node*)_layers->getObjectAtIndex(n));
} }
void LayerMultiplex::switchToAndReleaseMe(unsigned int n) void LayerMultiplex::switchToAndReleaseMe(unsigned int n)
{ {
CCASSERT( n < _layers->count(), "Invalid index in MultiplexLayer switchTo message" ); CCASSERT( n < _layers->count(), "Invalid index in MultiplexLayer switchTo message" );
this->removeChild((Node*)_layers->objectAtIndex(_enabledLayer), true); this->removeChild((Node*)_layers->getObjectAtIndex(_enabledLayer), true);
//[layers replaceObjectAtIndex:enabledLayer withObject:[NSNull null]]; //[layers replaceObjectAtIndex:enabledLayer withObject:[NSNull null]];
_layers->replaceObjectAtIndex(_enabledLayer, NULL); _layers->replaceObjectAtIndex(_enabledLayer, NULL);
_enabledLayer = n; _enabledLayer = n;
this->addChild((Node*)_layers->objectAtIndex(n)); this->addChild((Node*)_layers->getObjectAtIndex(n));
} }
NS_CC_END NS_CC_END

View File

@ -808,7 +808,7 @@ MenuItemToggle * MenuItemToggle::createWithTarget(Object* target, SEL_MenuHandle
for (unsigned int z=0; z < menuItems->count(); z++) for (unsigned int z=0; z < menuItems->count(); z++)
{ {
MenuItem* menuItem = (MenuItem*)menuItems->objectAtIndex(z); MenuItem* menuItem = (MenuItem*)menuItems->getObjectAtIndex(z);
pRet->_subItems->addObject(menuItem); pRet->_subItems->addObject(menuItem);
} }
@ -826,7 +826,7 @@ MenuItemToggle * MenuItemToggle::createWithCallback(const ccMenuCallback &callba
for (unsigned int z=0; z < menuItems->count(); z++) for (unsigned int z=0; z < menuItems->count(); z++)
{ {
MenuItem* menuItem = (MenuItem*)menuItems->objectAtIndex(z); MenuItem* menuItem = (MenuItem*)menuItems->getObjectAtIndex(z);
pRet->_subItems->addObject(menuItem); pRet->_subItems->addObject(menuItem);
} }
@ -939,7 +939,7 @@ void MenuItemToggle::setSelectedIndex(unsigned int index)
currentItem->removeFromParentAndCleanup(false); currentItem->removeFromParentAndCleanup(false);
} }
MenuItem* item = (MenuItem*)_subItems->objectAtIndex(_selectedIndex); MenuItem* item = (MenuItem*)_subItems->getObjectAtIndex(_selectedIndex);
this->addChild(item, 0, kCurrentItem); this->addChild(item, 0, kCurrentItem);
Size s = item->getContentSize(); Size s = item->getContentSize();
this->setContentSize(s); this->setContentSize(s);
@ -950,13 +950,13 @@ void MenuItemToggle::setSelectedIndex(unsigned int index)
void MenuItemToggle::selected() void MenuItemToggle::selected()
{ {
MenuItem::selected(); MenuItem::selected();
static_cast<MenuItem*>(_subItems->objectAtIndex(_selectedIndex))->selected(); static_cast<MenuItem*>(_subItems->getObjectAtIndex(_selectedIndex))->selected();
} }
void MenuItemToggle::unselected() void MenuItemToggle::unselected()
{ {
MenuItem::unselected(); MenuItem::unselected();
static_cast<MenuItem*>(_subItems->objectAtIndex(_selectedIndex))->unselected(); static_cast<MenuItem*>(_subItems->getObjectAtIndex(_selectedIndex))->unselected();
} }
void MenuItemToggle::activate() void MenuItemToggle::activate()
@ -989,7 +989,7 @@ void MenuItemToggle::setEnabled(bool enabled)
MenuItem* MenuItemToggle::getSelectedItem() MenuItem* MenuItemToggle::getSelectedItem()
{ {
return static_cast<MenuItem*>(_subItems->objectAtIndex(_selectedIndex)); return static_cast<MenuItem*>(_subItems->getObjectAtIndex(_selectedIndex));
} }
NS_CC_END NS_CC_END

View File

@ -186,7 +186,7 @@ void ParticleBatchNode::addChild(Node * aChild, int zOrder, int tag)
if (pos != 0) if (pos != 0)
{ {
ParticleSystem* p = (ParticleSystem*)_children->objectAtIndex(pos-1); ParticleSystem* p = (ParticleSystem*)_children->getObjectAtIndex(pos-1);
atlasIndex = p->getAtlasIndex() + p->getTotalParticles(); atlasIndex = p->getAtlasIndex() + p->getTotalParticles();
} }
@ -274,7 +274,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder)
int newAtlasIndex = 0; int newAtlasIndex = 0;
for( unsigned int i=0;i < _children->count();i++) for( unsigned int i=0;i < _children->count();i++)
{ {
ParticleSystem* pNode = (ParticleSystem*)_children->objectAtIndex(i); ParticleSystem* pNode = (ParticleSystem*)_children->getObjectAtIndex(i);
if( pNode == child ) if( pNode == child )
{ {
newAtlasIndex = child->getAtlasIndex(); newAtlasIndex = child->getAtlasIndex();
@ -302,7 +302,7 @@ void ParticleBatchNode::getCurrentIndex(unsigned int* oldIndex, unsigned int* ne
for( unsigned int i=0; i < count; i++ ) for( unsigned int i=0; i < count; i++ )
{ {
Node* pNode = (Node *)_children->objectAtIndex(i); Node* pNode = (Node *)_children->getObjectAtIndex(i);
// new index // new index
if( pNode->getZOrder() > z && ! foundNewIdx ) if( pNode->getZOrder() > z && ! foundNewIdx )
@ -349,7 +349,7 @@ unsigned int ParticleBatchNode::searchNewPositionInChildrenForZ(int z)
for( unsigned int i=0; i < count; i++ ) for( unsigned int i=0; i < count; i++ )
{ {
Node *child = (Node *)_children->objectAtIndex(i); Node *child = (Node *)_children->getObjectAtIndex(i);
if (child->getZOrder() > z) if (child->getZOrder() > z)
{ {
return i; return i;
@ -385,7 +385,7 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup)
void ParticleBatchNode::removeChildAtIndex(unsigned int index, bool doCleanup) void ParticleBatchNode::removeChildAtIndex(unsigned int index, bool doCleanup)
{ {
removeChild((ParticleSystem *)_children->objectAtIndex(index),doCleanup); removeChild((ParticleSystem *)_children->getObjectAtIndex(index),doCleanup);
} }
void ParticleBatchNode::removeAllChildrenWithCleanup(bool doCleanup) void ParticleBatchNode::removeAllChildrenWithCleanup(bool doCleanup)

View File

@ -989,7 +989,7 @@ void Sprite::setDisplayFrameWithAnimationName(const char *animationName, int fra
CCASSERT(a, "CCSprite#setDisplayFrameWithAnimationName: Frame not found"); CCASSERT(a, "CCSprite#setDisplayFrameWithAnimationName: Frame not found");
AnimationFrame* frame = static_cast<AnimationFrame*>( a->getFrames()->objectAtIndex(frameIndex) ); AnimationFrame* frame = static_cast<AnimationFrame*>( a->getFrames()->getObjectAtIndex(frameIndex) );
CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame"); CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");

View File

@ -226,7 +226,7 @@ void SpriteBatchNode::removeChild(Node *child, bool cleanup)
void SpriteBatchNode::removeChildAtIndex(unsigned int uIndex, bool bDoCleanup) void SpriteBatchNode::removeChildAtIndex(unsigned int uIndex, bool bDoCleanup)
{ {
removeChild((Sprite*)(_children->objectAtIndex(uIndex)), bDoCleanup); removeChild((Sprite*)(_children->getObjectAtIndex(uIndex)), bDoCleanup);
} }
void SpriteBatchNode::removeAllChildrenWithCleanup(bool bCleanup) void SpriteBatchNode::removeAllChildrenWithCleanup(bool bCleanup)
@ -470,7 +470,7 @@ unsigned int SpriteBatchNode::highestAtlasIndexInChild(Sprite *pSprite)
} }
else else
{ {
return highestAtlasIndexInChild((Sprite*)(children->lastObject())); return highestAtlasIndexInChild((Sprite*)(children->getLastObject()));
} }
} }
@ -484,14 +484,14 @@ unsigned int SpriteBatchNode::lowestAtlasIndexInChild(Sprite *pSprite)
} }
else else
{ {
return lowestAtlasIndexInChild((Sprite*)(children->objectAtIndex(0))); return lowestAtlasIndexInChild((Sprite*)(children->getObjectAtIndex(0)));
} }
} }
unsigned int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ) unsigned int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ)
{ {
Array *pBrothers = sprite->getParent()->getChildren(); Array *pBrothers = sprite->getParent()->getChildren();
unsigned int uChildIndex = pBrothers->indexOfObject(sprite); unsigned int uChildIndex = pBrothers->getIndexOfObject(sprite);
// ignore parent Z if parent is spriteSheet // ignore parent Z if parent is spriteSheet
bool bIgnoreParent = (SpriteBatchNode*)(sprite->getParent()) == this; bool bIgnoreParent = (SpriteBatchNode*)(sprite->getParent()) == this;
@ -499,7 +499,7 @@ unsigned int SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ)
if (uChildIndex > 0 && if (uChildIndex > 0 &&
uChildIndex < UINT_MAX) uChildIndex < UINT_MAX)
{ {
pPrevious = (Sprite*)(pBrothers->objectAtIndex(uChildIndex - 1)); pPrevious = (Sprite*)(pBrothers->getObjectAtIndex(uChildIndex - 1));
} }
// first child of the sprite sheet // first child of the sprite sheet
@ -622,7 +622,7 @@ void SpriteBatchNode::removeSpriteFromAtlas(Sprite *sprite)
// Cleanup sprite. It might be reused (issue #569) // Cleanup sprite. It might be reused (issue #569)
sprite->setBatchNode(NULL); sprite->setBatchNode(NULL);
unsigned int uIndex = _descendants->indexOfObject(sprite); unsigned int uIndex = _descendants->getIndexOfObject(sprite);
if (uIndex != UINT_MAX) if (uIndex != UINT_MAX)
{ {
_descendants->removeObjectAtIndex(uIndex); _descendants->removeObjectAtIndex(uIndex);
@ -632,7 +632,7 @@ void SpriteBatchNode::removeSpriteFromAtlas(Sprite *sprite)
for(; uIndex < count; ++uIndex) for(; uIndex < count; ++uIndex)
{ {
Sprite* s = (Sprite*)(_descendants->objectAtIndex(uIndex)); Sprite* s = (Sprite*)(_descendants->getObjectAtIndex(uIndex));
s->setAtlasIndex( s->getAtlasIndex() - 1 ); s->setAtlasIndex( s->getAtlasIndex() - 1 );
} }
} }

View File

@ -332,7 +332,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
{ {
if (pTMXMapInfo->getParentElement() == TMXPropertyLayer) if (pTMXMapInfo->getParentElement() == TMXPropertyLayer)
{ {
TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->lastObject(); TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->getLastObject();
Size layerSize = layer->_layerSize; Size layerSize = layer->_layerSize;
unsigned int gid = (unsigned int)atoi(valueForKey("gid", attributeDict)); unsigned int gid = (unsigned int)atoi(valueForKey("gid", attributeDict));
int tilesAmount = layerSize.width*layerSize.height; int tilesAmount = layerSize.width*layerSize.height;
@ -366,7 +366,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
} }
else else
{ {
TMXTilesetInfo* info = (TMXTilesetInfo*)pTMXMapInfo->getTilesets()->lastObject(); TMXTilesetInfo* info = (TMXTilesetInfo*)pTMXMapInfo->getTilesets()->getLastObject();
Dictionary *dict = new Dictionary(); Dictionary *dict = new Dictionary();
pTMXMapInfo->setParentGID(info->_firstGid + atoi(valueForKey("id", attributeDict))); pTMXMapInfo->setParentGID(info->_firstGid + atoi(valueForKey("id", attributeDict)));
pTMXMapInfo->getTileProperties()->setObject(dict, pTMXMapInfo->getParentGID()); pTMXMapInfo->getTileProperties()->setObject(dict, pTMXMapInfo->getParentGID());
@ -427,7 +427,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
} }
else if (elementName == "image") else if (elementName == "image")
{ {
TMXTilesetInfo* tileset = (TMXTilesetInfo*)pTMXMapInfo->getTilesets()->lastObject(); TMXTilesetInfo* tileset = (TMXTilesetInfo*)pTMXMapInfo->getTilesets()->getLastObject();
// build full path // build full path
std::string imagename = valueForKey("source", attributeDict); std::string imagename = valueForKey("source", attributeDict);
@ -451,7 +451,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
{ {
pTMXMapInfo->setLayerAttribs(pTMXMapInfo->getLayerAttribs() | TMXLayerAttribNone); pTMXMapInfo->setLayerAttribs(pTMXMapInfo->getLayerAttribs() | TMXLayerAttribNone);
TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->lastObject(); TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->getLastObject();
Size layerSize = layer->_layerSize; Size layerSize = layer->_layerSize;
int tilesAmount = layerSize.width*layerSize.height; int tilesAmount = layerSize.width*layerSize.height;
@ -497,7 +497,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
else if (elementName == "object") else if (elementName == "object")
{ {
char buffer[32] = {0}; char buffer[32] = {0};
TMXObjectGroup* objectGroup = (TMXObjectGroup*)pTMXMapInfo->getObjectGroups()->lastObject(); TMXObjectGroup* objectGroup = (TMXObjectGroup*)pTMXMapInfo->getObjectGroups()->getLastObject();
// The value for "type" was blank or not a valid class name // The value for "type" was blank or not a valid class name
// Create an instance of TMXObjectInfo to store the object and its properties // Create an instance of TMXObjectInfo to store the object and its properties
@ -569,7 +569,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
else if ( pTMXMapInfo->getParentElement() == TMXPropertyLayer ) else if ( pTMXMapInfo->getParentElement() == TMXPropertyLayer )
{ {
// The parent element is the last layer // The parent element is the last layer
TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->lastObject(); TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->getLastObject();
String *value = new String(valueForKey("value", attributeDict)); String *value = new String(valueForKey("value", attributeDict));
std::string key = valueForKey("name", attributeDict); std::string key = valueForKey("name", attributeDict);
// Add the property to the layer // Add the property to the layer
@ -580,7 +580,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
else if ( pTMXMapInfo->getParentElement() == TMXPropertyObjectGroup ) else if ( pTMXMapInfo->getParentElement() == TMXPropertyObjectGroup )
{ {
// The parent element is the last object group // The parent element is the last object group
TMXObjectGroup* objectGroup = (TMXObjectGroup*)pTMXMapInfo->getObjectGroups()->lastObject(); TMXObjectGroup* objectGroup = (TMXObjectGroup*)pTMXMapInfo->getObjectGroups()->getLastObject();
String *value = new String(valueForKey("value", attributeDict)); String *value = new String(valueForKey("value", attributeDict));
const char* key = valueForKey("name", attributeDict); const char* key = valueForKey("name", attributeDict);
objectGroup->getProperties()->setObject(value, key); objectGroup->getProperties()->setObject(value, key);
@ -590,8 +590,8 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
else if ( pTMXMapInfo->getParentElement() == TMXPropertyObject ) else if ( pTMXMapInfo->getParentElement() == TMXPropertyObject )
{ {
// The parent element is the last object // The parent element is the last object
TMXObjectGroup* objectGroup = (TMXObjectGroup*)pTMXMapInfo->getObjectGroups()->lastObject(); TMXObjectGroup* objectGroup = (TMXObjectGroup*)pTMXMapInfo->getObjectGroups()->getLastObject();
Dictionary* dict = (Dictionary*)objectGroup->getObjects()->lastObject(); Dictionary* dict = (Dictionary*)objectGroup->getObjects()->getLastObject();
const char* propertyName = valueForKey("name", attributeDict); const char* propertyName = valueForKey("name", attributeDict);
String *propertyValue = new String(valueForKey("value", attributeDict)); String *propertyValue = new String(valueForKey("value", attributeDict));
@ -611,8 +611,8 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
else if (elementName == "polygon") else if (elementName == "polygon")
{ {
// find parent object's dict and add polygon-points to it // find parent object's dict and add polygon-points to it
TMXObjectGroup* objectGroup = (TMXObjectGroup*)_objectGroups->lastObject(); TMXObjectGroup* objectGroup = (TMXObjectGroup*)_objectGroups->getLastObject();
Dictionary* dict = (Dictionary*)objectGroup->getObjects()->lastObject(); Dictionary* dict = (Dictionary*)objectGroup->getObjects()->getLastObject();
// get points value string // get points value string
const char* value = valueForKey("points", attributeDict); const char* value = valueForKey("points", attributeDict);
@ -690,7 +690,7 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
{ {
pTMXMapInfo->setStoringCharacters(false); pTMXMapInfo->setStoringCharacters(false);
TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->lastObject(); TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->getLastObject();
std::string currentString = pTMXMapInfo->getCurrentString(); std::string currentString = pTMXMapInfo->getCurrentString();
unsigned char *buffer; unsigned char *buffer;
@ -733,7 +733,7 @@ void TMXMapInfo::endElement(void *ctx, const char *name)
} }
else if (pTMXMapInfo->getLayerAttribs() & TMXLayerAttribNone) else if (pTMXMapInfo->getLayerAttribs() & TMXLayerAttribNone)
{ {
TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->lastObject(); TMXLayerInfo* layer = (TMXLayerInfo*)pTMXMapInfo->getLayers()->getLastObject();
Size layerSize = layer->_layerSize; Size layerSize = layer->_layerSize;
int tilesAmount = layerSize.width * layerSize.height; int tilesAmount = layerSize.width * layerSize.height;

View File

@ -230,7 +230,7 @@ void Bone::addChildBone(Bone *child)
childrenAlloc(); childrenAlloc();
} }
if (_children->indexOfObject(child) == UINT_MAX) if (_children->getIndexOfObject(child) == UINT_MAX)
{ {
_children->addObject(child); _children->addObject(child);
child->setParentBone(this); child->setParentBone(this);
@ -239,7 +239,7 @@ void Bone::addChildBone(Bone *child)
void Bone::removeChildBone(Bone *bone, bool recursion) void Bone::removeChildBone(Bone *bone, bool recursion)
{ {
if ( _children->indexOfObject(bone) != UINT_MAX ) if ( _children->getIndexOfObject(bone) != UINT_MAX )
{ {
if(recursion) if(recursion)
{ {

View File

@ -224,7 +224,7 @@ void BoneData::addDisplayData(DisplayData *displayData)
DisplayData *BoneData::getDisplayData(int index) DisplayData *BoneData::getDisplayData(int index)
{ {
return (DisplayData *)displayDataList.objectAtIndex(index); return (DisplayData *)displayDataList.getObjectAtIndex(index);
} }
ArmatureData::ArmatureData() ArmatureData::ArmatureData()
@ -301,7 +301,7 @@ void MovementBoneData::addFrameData(FrameData *frameData)
FrameData *MovementBoneData::getFrameData(int index) FrameData *MovementBoneData::getFrameData(int index)
{ {
return (FrameData *)frameList.objectAtIndex(index); return (FrameData *)frameList.getObjectAtIndex(index);
} }
@ -406,7 +406,7 @@ void TextureData::addContourData(ContourData *contourData)
ContourData *TextureData::getContourData(int index) ContourData *TextureData::getContourData(int index)
{ {
return (ContourData *)contourDataList.objectAtIndex(index); return (ContourData *)contourDataList.getObjectAtIndex(index);
} }

View File

@ -92,7 +92,7 @@ void DisplayManager::addDisplay(DisplayData *displayData, int index)
if(index >= 0 && (unsigned int)index < _decoDisplayList->count()) if(index >= 0 && (unsigned int)index < _decoDisplayList->count())
{ {
decoDisplay = (DecorativeDisplay *)_decoDisplayList->objectAtIndex(index); decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
} }
else else
{ {
@ -145,7 +145,7 @@ void DisplayManager::changeDisplayByIndex(int index, bool force)
} }
DecorativeDisplay *decoDisplay = (DecorativeDisplay *)_decoDisplayList->objectAtIndex(_displayIndex); DecorativeDisplay *decoDisplay = (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(_displayIndex);
setCurrentDecorativeDisplay(decoDisplay); setCurrentDecorativeDisplay(decoDisplay);
} }
@ -210,7 +210,7 @@ DecorativeDisplay *DisplayManager::getCurrentDecorativeDisplay()
DecorativeDisplay *DisplayManager::getDecorativeDisplayByIndex( int index) DecorativeDisplay *DisplayManager::getDecorativeDisplayByIndex( int index)
{ {
return (DecorativeDisplay *)_decoDisplayList->objectAtIndex(index); return (DecorativeDisplay *)_decoDisplayList->getObjectAtIndex(index);
} }
void DisplayManager::initDisplayList(BoneData *boneData) void DisplayManager::initDisplayList(BoneData *boneData)

View File

@ -359,12 +359,12 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
{ {
// Get position type // Get position type
Array *array = static_cast<Array*>(getBaseValue(pNode, propName)); Array *array = static_cast<Array*>(getBaseValue(pNode, propName));
CCBReader::PositionType type = (CCBReader::PositionType)((CCBValue*)array->objectAtIndex(2))->getIntValue(); CCBReader::PositionType type = (CCBReader::PositionType)((CCBValue*)array->getObjectAtIndex(2))->getIntValue();
// Get relative position // Get relative position
Array *value = static_cast<Array*>(pKeyframe1->getValue()); Array *value = static_cast<Array*>(pKeyframe1->getValue());
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue(); float x = ((CCBValue*)value->getObjectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue(); float y = ((CCBValue*)value->getObjectAtIndex(1))->getFloatValue();
Size containerSize = getContainerSize(pNode->getParent()); Size containerSize = getContainerSize(pNode->getParent());
@ -376,12 +376,12 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
{ {
// Get position type // Get position type
Array *array = (Array*)getBaseValue(pNode, propName); Array *array = (Array*)getBaseValue(pNode, propName);
CCBReader::ScaleType type = (CCBReader::ScaleType)((CCBValue*)array->objectAtIndex(2))->getIntValue(); CCBReader::ScaleType type = (CCBReader::ScaleType)((CCBValue*)array->getObjectAtIndex(2))->getIntValue();
// Get relative scale // Get relative scale
Array *value = (Array*)pKeyframe1->getValue(); Array *value = (Array*)pKeyframe1->getValue();
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue(); float x = ((CCBValue*)value->getObjectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue(); float y = ((CCBValue*)value->getObjectAtIndex(1))->getFloatValue();
if (type == CCBReader::ScaleType::MULTIPLY_RESOLUTION) if (type == CCBReader::ScaleType::MULTIPLY_RESOLUTION)
{ {
@ -396,8 +396,8 @@ ActionInterval* CCBAnimationManager::getAction(CCBKeyframe *pKeyframe0, CCBKeyfr
{ {
// Get relative skew // Get relative skew
Array *value = (Array*)pKeyframe1->getValue(); Array *value = (Array*)pKeyframe1->getValue();
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue(); float x = ((CCBValue*)value->getObjectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue(); float y = ((CCBValue*)value->getObjectAtIndex(1))->getFloatValue();
return SkewTo::create(duration, x, y); return SkewTo::create(duration, x, y);
} }
@ -432,12 +432,12 @@ void CCBAnimationManager::setAnimatedProperty(const char *propName, Node *pNode,
{ {
// Get position type // Get position type
Array *array = (Array*)getBaseValue(pNode, propName); Array *array = (Array*)getBaseValue(pNode, propName);
CCBReader::PositionType type = (CCBReader::PositionType)((CCBValue*)array->objectAtIndex(2))->getIntValue(); CCBReader::PositionType type = (CCBReader::PositionType)((CCBValue*)array->getObjectAtIndex(2))->getIntValue();
// Get relative position // Get relative position
Array *value = (Array*)pValue; Array *value = (Array*)pValue;
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue(); float x = ((CCBValue*)value->getObjectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue(); float y = ((CCBValue*)value->getObjectAtIndex(1))->getFloatValue();
pNode->setPosition(getAbsolutePosition(Point(x,y), type, getContainerSize(pNode->getParent()), propName)); pNode->setPosition(getAbsolutePosition(Point(x,y), type, getContainerSize(pNode->getParent()), propName));
} }
@ -445,12 +445,12 @@ void CCBAnimationManager::setAnimatedProperty(const char *propName, Node *pNode,
{ {
// Get scale type // Get scale type
Array *array = (Array*)getBaseValue(pNode, propName); Array *array = (Array*)getBaseValue(pNode, propName);
CCBReader::ScaleType type = (CCBReader::ScaleType)((CCBValue*)array->objectAtIndex(2))->getIntValue(); CCBReader::ScaleType type = (CCBReader::ScaleType)((CCBValue*)array->getObjectAtIndex(2))->getIntValue();
// Get relative scale // Get relative scale
Array *value = (Array*)pValue; Array *value = (Array*)pValue;
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue(); float x = ((CCBValue*)value->getObjectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue(); float y = ((CCBValue*)value->getObjectAtIndex(1))->getFloatValue();
setRelativeScale(pNode, x, y, type, propName); setRelativeScale(pNode, x, y, type, propName);
} }
@ -458,8 +458,8 @@ void CCBAnimationManager::setAnimatedProperty(const char *propName, Node *pNode,
{ {
// Get relative scale // Get relative scale
Array *value = (Array*)pValue; Array *value = (Array*)pValue;
float x = ((CCBValue*)value->objectAtIndex(0))->getFloatValue(); float x = ((CCBValue*)value->getObjectAtIndex(0))->getFloatValue();
float y = ((CCBValue*)value->objectAtIndex(1))->getFloatValue(); float y = ((CCBValue*)value->getObjectAtIndex(1))->getFloatValue();
pNode->setSkewX(x); pNode->setSkewX(x);
pNode->setSkewY(y); pNode->setSkewY(y);
@ -524,7 +524,7 @@ void CCBAnimationManager::setFirstFrame(Node *pNode, CCBSequenceProperty *pSeqPr
else else
{ {
// Use first keyframe // Use first keyframe
CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->objectAtIndex(0); CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->getObjectAtIndex(0);
setAnimatedProperty(pSeqProp->getName(), pNode, keyframe->getValue(), fTweenDuration); setAnimatedProperty(pSeqProp->getName(), pNode, keyframe->getValue(), fTweenDuration);
} }
} }
@ -610,7 +610,7 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
for (int i = 0; i < numKeyframes; ++i) for (int i = 0; i < numKeyframes; ++i)
{ {
CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->objectAtIndex(i); CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->getObjectAtIndex(i);
float timeSinceLastKeyframe = keyframe->getTime() - lastKeyframeTime; float timeSinceLastKeyframe = keyframe->getTime() - lastKeyframeTime;
lastKeyframeTime = keyframe->getTime(); lastKeyframeTime = keyframe->getTime();
if(timeSinceLastKeyframe > 0) { if(timeSinceLastKeyframe > 0) {
@ -618,8 +618,8 @@ Object* CCBAnimationManager::actionForCallbackChannel(CCBSequenceProperty* chann
} }
Array* keyVal = static_cast<Array *>(keyframe->getValue()); Array* keyVal = static_cast<Array *>(keyframe->getValue());
std::string selectorName = static_cast<String *>(keyVal->objectAtIndex(0))->getCString(); std::string selectorName = static_cast<String *>(keyVal->getObjectAtIndex(0))->getCString();
CCBReader::TargetType selectorTarget = (CCBReader::TargetType)atoi(static_cast<String *>(keyVal->objectAtIndex(1))->getCString()); CCBReader::TargetType selectorTarget = (CCBReader::TargetType)atoi(static_cast<String *>(keyVal->getObjectAtIndex(1))->getCString());
if(_jsControlled) { if(_jsControlled) {
String* callbackName = String::createWithFormat("%d:%s", selectorTarget, selectorName.c_str()); String* callbackName = String::createWithFormat("%d:%s", selectorTarget, selectorName.c_str());
@ -683,7 +683,7 @@ Object* CCBAnimationManager::actionForSoundChannel(CCBSequenceProperty* channel)
for (int i = 0; i < numKeyframes; ++i) { for (int i = 0; i < numKeyframes; ++i) {
CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->objectAtIndex(i); CCBKeyframe *keyframe = (CCBKeyframe*)keyframes->getObjectAtIndex(i);
float timeSinceLastKeyframe = keyframe->getTime() - lastKeyframeTime; float timeSinceLastKeyframe = keyframe->getTime() - lastKeyframeTime;
lastKeyframeTime = keyframe->getTime(); lastKeyframeTime = keyframe->getTime();
if(timeSinceLastKeyframe > 0) { if(timeSinceLastKeyframe > 0) {
@ -692,18 +692,18 @@ Object* CCBAnimationManager::actionForSoundChannel(CCBSequenceProperty* channel)
stringstream ss (stringstream::in | stringstream::out); stringstream ss (stringstream::in | stringstream::out);
Array* keyVal = (Array*)keyframe->getValue(); Array* keyVal = (Array*)keyframe->getValue();
std::string soundFile = ((String *)keyVal->objectAtIndex(0))->getCString(); std::string soundFile = ((String *)keyVal->getObjectAtIndex(0))->getCString();
float pitch, pan, gain; float pitch, pan, gain;
ss << ((String *)keyVal->objectAtIndex(1))->getCString(); ss << ((String *)keyVal->getObjectAtIndex(1))->getCString();
ss >> pitch; ss >> pitch;
ss.flush(); ss.flush();
ss << ((String *)keyVal->objectAtIndex(2))->getCString(); ss << ((String *)keyVal->getObjectAtIndex(2))->getCString();
ss >> pan; ss >> pan;
ss.flush(); ss.flush();
ss << ((String *)keyVal->objectAtIndex(3))->getCString(); ss << ((String *)keyVal->getObjectAtIndex(3))->getCString();
ss >> gain; ss >> gain;
ss.flush(); ss.flush();
@ -727,7 +727,7 @@ void CCBAnimationManager::runAction(Node *pNode, CCBSequenceProperty *pSeqProp,
// Make an animation! // Make an animation!
Array *actions = Array::create(); Array *actions = Array::create();
CCBKeyframe *keyframeFirst = (CCBKeyframe*)keyframes->objectAtIndex(0); CCBKeyframe *keyframeFirst = (CCBKeyframe*)keyframes->getObjectAtIndex(0);
float timeFirst = keyframeFirst->getTime() + fTweenDuration; float timeFirst = keyframeFirst->getTime() + fTweenDuration;
if (timeFirst > 0) if (timeFirst > 0)
@ -737,8 +737,8 @@ void CCBAnimationManager::runAction(Node *pNode, CCBSequenceProperty *pSeqProp,
for (int i = 0; i < numKeyframes - 1; ++i) for (int i = 0; i < numKeyframes - 1; ++i)
{ {
CCBKeyframe *kf0 = (CCBKeyframe*)keyframes->objectAtIndex(i); CCBKeyframe *kf0 = (CCBKeyframe*)keyframes->getObjectAtIndex(i);
CCBKeyframe *kf1 = (CCBKeyframe*)keyframes->objectAtIndex(i+1); CCBKeyframe *kf1 = (CCBKeyframe*)keyframes->getObjectAtIndex(i+1);
ActionInterval *action = getAction(kf0, kf1, pSeqProp->getName(), pNode); ActionInterval *action = getAction(kf0, kf1, pSeqProp->getName(), pNode);
if (action) if (action)

View File

@ -967,8 +967,8 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
for (int i = 0 ; i < nCount; i++) for (int i = 0 ; i < nCount; i++)
{ {
pCCBReader->addOwnerCallbackName((dynamic_cast<String*>(ownerCallbackNames->objectAtIndex(i)))->getCString()); pCCBReader->addOwnerCallbackName((dynamic_cast<String*>(ownerCallbackNames->getObjectAtIndex(i)))->getCString());
pCCBReader->addOwnerCallbackNode(dynamic_cast<Node*>(ownerCallbackNodes->objectAtIndex(i)) ); pCCBReader->addOwnerCallbackNode(dynamic_cast<Node*>(ownerCallbackNodes->getObjectAtIndex(i)) );
} }
} }
//set variables //set variables
@ -982,8 +982,8 @@ Node * NodeLoader::parsePropTypeCCBFile(Node * pNode, Node * pParent, CCBReader
for (int i = 0 ; i < nCount; i++) for (int i = 0 ; i < nCount; i++)
{ {
pCCBReader->addOwnerOutletName((static_cast<String*>(ownerOutletNames->objectAtIndex(i)))->getCString()); pCCBReader->addOwnerOutletName((static_cast<String*>(ownerOutletNames->getObjectAtIndex(i)))->getCString());
pCCBReader->addOwnerOutletNode(static_cast<Node*>(ownerOutletNodes->objectAtIndex(i))); pCCBReader->addOwnerOutletNode(static_cast<Node*>(ownerOutletNodes->getObjectAtIndex(i)));
} }
} }
} }

View File

@ -626,11 +626,11 @@ bool ScrollView::ccTouchBegan(Touch* touch, Event* event)
} }
else if (_touches->count() == 2) else if (_touches->count() == 2)
{ {
_touchPoint = (this->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(0)).getMidpoint( _touchPoint = (this->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(0)).getMidpoint(
this->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(1)))); this->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(1))));
_touchLength = _container->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(0)).getDistance( _touchLength = _container->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(0)).getDistance(
_container->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(1))); _container->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(1)));
_dragging = false; _dragging = false;
} }
@ -654,7 +654,7 @@ void ScrollView::ccTouchMoved(Touch* touch, Event* event)
frame = getViewRect(); frame = getViewRect();
newPoint = this->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(0)); newPoint = this->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(0));
moveDistance = newPoint - _touchPoint; moveDistance = newPoint - _touchPoint;
float dis = 0.0f; float dis = 0.0f;
@ -711,8 +711,8 @@ void ScrollView::ccTouchMoved(Touch* touch, Event* event)
} }
else if (_touches->count() == 2 && !_dragging) else if (_touches->count() == 2 && !_dragging)
{ {
const float len = _container->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(0)).getDistance( const float len = _container->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(0)).getDistance(
_container->convertTouchToNodeSpace((Touch*)_touches->objectAtIndex(1))); _container->convertTouchToNodeSpace((Touch*)_touches->getObjectAtIndex(1)));
this->setZoomScale(this->getZoomScale()*len/_touchLength); this->setZoomScale(this->getZoomScale()*len/_touchLength);
} }
} }

View File

@ -80,7 +80,7 @@ void ArrayForObjectSorting::removeSortedObject(SortableObject* object)
idx = this->indexOfSortedObject(object); idx = this->indexOfSortedObject(object);
if (idx < this->count() && idx != CC_INVALID_INDEX) { if (idx < this->count() && idx != CC_INVALID_INDEX) {
foundObj = dynamic_cast<SortableObject*>(this->objectAtIndex(idx)); foundObj = dynamic_cast<SortableObject*>(this->getObjectAtIndex(idx));
if(foundObj->getObjectID() == object->getObjectID()) { if(foundObj->getObjectID() == object->getObjectID()) {
this->removeObjectAtIndex(idx); this->removeObjectAtIndex(idx);
@ -96,7 +96,7 @@ void ArrayForObjectSorting::setObjectID_ofSortedObject(unsigned int tag, Sortabl
idx = this->indexOfSortedObject(object); idx = this->indexOfSortedObject(object);
if (idx < this->count() && idx != CC_INVALID_INDEX) if (idx < this->count() && idx != CC_INVALID_INDEX)
{ {
foundObj = dynamic_cast<SortableObject*>(this->objectAtIndex(idx)); foundObj = dynamic_cast<SortableObject*>(this->getObjectAtIndex(idx));
Object* pObj = dynamic_cast<Object*>(foundObj); Object* pObj = dynamic_cast<Object*>(foundObj);
pObj->retain(); pObj->retain();
@ -130,7 +130,7 @@ SortableObject* ArrayForObjectSorting::objectWithObjectID(unsigned int tag)
if (idx < this->count() && idx != CC_INVALID_INDEX) if (idx < this->count() && idx != CC_INVALID_INDEX)
{ {
foundObj = dynamic_cast<SortableObject*>(this->objectAtIndex(idx)); foundObj = dynamic_cast<SortableObject*>(this->getObjectAtIndex(idx));
if (foundObj->getObjectID() != tag) { if (foundObj->getObjectID() != tag) {
foundObj = NULL; foundObj = NULL;
} }

View File

@ -187,7 +187,7 @@ void TableView::insertCellAtIndex(unsigned int idx)
newIdx = _cellsUsed->indexOfSortedObject(cell); newIdx = _cellsUsed->indexOfSortedObject(cell);
for (unsigned int i=newIdx; i<_cellsUsed->count(); i++) for (unsigned int i=newIdx; i<_cellsUsed->count(); i++)
{ {
cell = (TableViewCell*)_cellsUsed->objectAtIndex(i); cell = (TableViewCell*)_cellsUsed->getObjectAtIndex(i);
this->_setIndexForCell(cell->getIdx()+1, cell); this->_setIndexForCell(cell->getIdx()+1, cell);
} }
} }
@ -234,7 +234,7 @@ void TableView::removeCellAtIndex(unsigned int idx)
// [_indices shiftIndexesStartingAtIndex:idx+1 by:-1]; // [_indices shiftIndexesStartingAtIndex:idx+1 by:-1];
for (unsigned int i=_cellsUsed->count()-1; i > newIdx; i--) for (unsigned int i=_cellsUsed->count()-1; i > newIdx; i--)
{ {
cell = (TableViewCell*)_cellsUsed->objectAtIndex(i); cell = (TableViewCell*)_cellsUsed->getObjectAtIndex(i);
this->_setIndexForCell(cell->getIdx()-1, cell); this->_setIndexForCell(cell->getIdx()-1, cell);
} }
} }
@ -246,7 +246,7 @@ TableViewCell *TableView::dequeueCell()
if (_cellsFreed->count() == 0) { if (_cellsFreed->count() == 0) {
cell = NULL; cell = NULL;
} else { } else {
cell = (TableViewCell*)_cellsFreed->objectAtIndex(0); cell = (TableViewCell*)_cellsFreed->getObjectAtIndex(0);
cell->retain(); cell->retain();
_cellsFreed->removeObjectAtIndex(0); _cellsFreed->removeObjectAtIndex(0);
cell->autorelease(); cell->autorelease();
@ -510,7 +510,7 @@ void TableView::scrollViewDidScroll(ScrollView* view)
if (_cellsUsed->count() > 0) if (_cellsUsed->count() > 0)
{ {
TableViewCell* cell = (TableViewCell*)_cellsUsed->objectAtIndex(0); TableViewCell* cell = (TableViewCell*)_cellsUsed->getObjectAtIndex(0);
idx = cell->getIdx(); idx = cell->getIdx();
while(idx <startIdx) while(idx <startIdx)
@ -518,7 +518,7 @@ void TableView::scrollViewDidScroll(ScrollView* view)
this->_moveCellOutOfSight(cell); this->_moveCellOutOfSight(cell);
if (_cellsUsed->count() > 0) if (_cellsUsed->count() > 0)
{ {
cell = (TableViewCell*)_cellsUsed->objectAtIndex(0); cell = (TableViewCell*)_cellsUsed->getObjectAtIndex(0);
idx = cell->getIdx(); idx = cell->getIdx();
} }
else else
@ -529,7 +529,7 @@ void TableView::scrollViewDidScroll(ScrollView* view)
} }
if (_cellsUsed->count() > 0) if (_cellsUsed->count() > 0)
{ {
TableViewCell *cell = (TableViewCell*)_cellsUsed->lastObject(); TableViewCell *cell = (TableViewCell*)_cellsUsed->getLastObject();
idx = cell->getIdx(); idx = cell->getIdx();
while(idx <= maxIdx && idx > endIdx) while(idx <= maxIdx && idx > endIdx)
@ -537,7 +537,7 @@ void TableView::scrollViewDidScroll(ScrollView* view)
this->_moveCellOutOfSight(cell); this->_moveCellOutOfSight(cell);
if (_cellsUsed->count() > 0) if (_cellsUsed->count() > 0)
{ {
cell = (TableViewCell*)_cellsUsed->lastObject(); cell = (TableViewCell*)_cellsUsed->getLastObject();
idx = cell->getIdx(); idx = cell->getIdx();
} }

View File

@ -114,7 +114,7 @@ static void networkThread(void)
if (0 != s_requestQueue->count()) if (0 != s_requestQueue->count())
{ {
request = dynamic_cast<HttpRequest*>(s_requestQueue->objectAtIndex(0)); request = dynamic_cast<HttpRequest*>(s_requestQueue->getObjectAtIndex(0));
s_requestQueue->removeObjectAtIndex(0); s_requestQueue->removeObjectAtIndex(0);
} }
@ -485,7 +485,7 @@ void HttpClient::dispatchResponseCallbacks(float delta)
if (s_responseQueue->count()) if (s_responseQueue->count())
{ {
response = dynamic_cast<HttpResponse*>(s_responseQueue->objectAtIndex(0)); response = dynamic_cast<HttpResponse*>(s_responseQueue->getObjectAtIndex(0));
s_responseQueue->removeObjectAtIndex(0); s_responseQueue->removeObjectAtIndex(0);
} }

View File

@ -1649,7 +1649,7 @@ void AddAndDeleteParticleSystems::removeSystem(float dt)
{ {
CCLOG("remove random system"); CCLOG("remove random system");
unsigned int uRand = rand() % (nChildrenCount - 1); unsigned int uRand = rand() % (nChildrenCount - 1);
_batchNode->removeChild((Node*)_batchNode->getChildren()->objectAtIndex(uRand), true); _batchNode->removeChild((Node*)_batchNode->getChildren()->getObjectAtIndex(uRand), true);
auto particleSystem = ParticleSystemQuad::create("Particles/Spiral.plist"); auto particleSystem = ParticleSystemQuad::create("Particles/Spiral.plist");
//add new //add new
@ -1796,7 +1796,7 @@ void ReorderParticleSystems::onEnter()
void ReorderParticleSystems::reorderSystem(float time) void ReorderParticleSystems::reorderSystem(float time)
{ {
auto system = (ParticleSystem*)_batchNode->getChildren()->objectAtIndex(1); auto system = (ParticleSystem*)_batchNode->getChildren()->getObjectAtIndex(1);
_batchNode->reorderChild(system, system->getZOrder() - 1); _batchNode->reorderChild(system, system->getZOrder() - 1);
} }

View File

@ -445,7 +445,7 @@ void AddSpriteSheet::update(float dt)
for( int i=0; i < totalToAdd;i++ ) for( int i=0; i < totalToAdd;i++ )
{ {
batchNode->addChild((Node*) (sprites->objectAtIndex(i)), zs[i], kTagBase+i); batchNode->addChild((Node*) (sprites->getObjectAtIndex(i)), zs[i], kTagBase+i);
} }
batchNode->sortAllChildren(); batchNode->sortAllChildren();
@ -503,7 +503,7 @@ void RemoveSpriteSheet::update(float dt)
// add them with random Z (very important!) // add them with random Z (very important!)
for( int i=0; i < totalToAdd;i++ ) for( int i=0; i < totalToAdd;i++ )
{ {
batchNode->addChild((Node*) (sprites->objectAtIndex(i)), CCRANDOM_MINUS1_1() * 50, kTagBase+i); batchNode->addChild((Node*) (sprites->getObjectAtIndex(i)), CCRANDOM_MINUS1_1() * 50, kTagBase+i);
} }
// remove them // remove them
@ -559,7 +559,7 @@ void ReorderSpriteSheet::update(float dt)
// add them with random Z (very important!) // add them with random Z (very important!)
for( int i=0; i < totalToAdd;i++ ) for( int i=0; i < totalToAdd;i++ )
{ {
batchNode->addChild((Node*) (sprites->objectAtIndex(i)), CCRANDOM_MINUS1_1() * 50, kTagBase+i); batchNode->addChild((Node*) (sprites->getObjectAtIndex(i)), CCRANDOM_MINUS1_1() * 50, kTagBase+i);
} }
batchNode->sortAllChildren(); batchNode->sortAllChildren();
@ -569,7 +569,7 @@ void ReorderSpriteSheet::update(float dt)
for( int i=0;i < totalToAdd;i++) for( int i=0;i < totalToAdd;i++)
{ {
auto node = (Node*) (batchNode->getChildren()->objectAtIndex(i)); auto node = (Node*) (batchNode->getChildren()->getObjectAtIndex(i));
batchNode->reorderChild(node, CCRANDOM_MINUS1_1() * 50); batchNode->reorderChild(node, CCRANDOM_MINUS1_1() * 50);
} }

View File

@ -1 +1 @@
6b5ddb2c8e2b4b8dea01e8ff068ff9a15795db69 7b8ff30c1fc482c4d7485032c73c1145a60168b4

View File

@ -166,7 +166,7 @@ void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& in
Point pos; Point pos;
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
{ {
node = (Node*)children->objectAtIndex(i); node = (Node*)children->getObjectAtIndex(i);
pos = node->getPosition(); pos = node->getPosition();
pos.y += adjustVert; pos.y += adjustVert;
node->setPosition(pos); node->setPosition(pos);

View File

@ -722,8 +722,8 @@ void ScriptingCore::pauseSchedulesAndActions(js_proxy_t* p)
Node* node = (Node*)p->ptr; Node* node = (Node*)p->ptr;
for(unsigned int i = 0; i < arr->count(); ++i) { for(unsigned int i = 0; i < arr->count(); ++i) {
if (arr->objectAtIndex(i)) { if (arr->getObjectAtIndex(i)) {
node->getScheduler()->pauseTarget(arr->objectAtIndex(i)); node->getScheduler()->pauseTarget(arr->getObjectAtIndex(i));
} }
} }
} }
@ -736,8 +736,8 @@ void ScriptingCore::resumeSchedulesAndActions(js_proxy_t* p)
Node* node = (Node*)p->ptr; Node* node = (Node*)p->ptr;
for(unsigned int i = 0; i < arr->count(); ++i) { for(unsigned int i = 0; i < arr->count(); ++i) {
if (!arr->objectAtIndex(i)) continue; if (!arr->getObjectAtIndex(i)) continue;
node->getScheduler()->resumeTarget(arr->objectAtIndex(i)); node->getScheduler()->resumeTarget(arr->getObjectAtIndex(i));
} }
} }

View File

@ -1 +1 @@
d17c1939227c62cebcc30a071cf81b12bfa08db3 c89d590602b0d7e1d6a9f556da352dd33af7ea72