issue #2387: Using static_cast instead of C style cast in iteration of CCArray.

This commit is contained in:
James Chen 2013-07-09 14:29:51 +08:00
parent 52a987b84e
commit 9b9fe67d25
38 changed files with 117 additions and 117 deletions

View File

@ -2006,7 +2006,7 @@ bool Animate::initWithAnimation(Animation *pAnimation)
Object* pObj = NULL;
CCARRAY_FOREACH(pFrames, pObj)
{
AnimationFrame* frame = (AnimationFrame*)pObj;
AnimationFrame* frame = static_cast<AnimationFrame*>(pObj);
float value = (accumUnitsOfTime * newUnitOfTimeValue) / singleDuration;
accumUnitsOfTime += frame->getDelayUnits();
_splitTimes->push_back(value);

View File

@ -128,7 +128,7 @@ Node::~Node(void)
Object* child;
CCARRAY_FOREACH(_children, child)
{
Node* pChild = (Node*) child;
Node* pChild = static_cast<Node*>(child);
if (pChild)
{
pChild->_parent = NULL;
@ -580,7 +580,7 @@ Node* Node::getChildByTag(int aTag)
Object* child;
CCARRAY_FOREACH(_children, child)
{
Node* pNode = (Node*) child;
Node* pNode = static_cast<Node*>(child);
if(pNode && pNode->_tag == aTag)
return pNode;
}
@ -701,7 +701,7 @@ void Node::removeAllChildrenWithCleanup(bool cleanup)
Object* child;
CCARRAY_FOREACH(_children, child)
{
Node* pNode = (Node*) child;
Node* pNode = static_cast<Node*>(child);
if (pNode)
{
// IMPORTANT:

View File

@ -76,10 +76,10 @@ I found that it's not work in C++. So it keep what it's look like in version 1.0
do { \
if(pArray && pArray->count() > 0) \
{ \
Object* child; \
Object* child; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
elementType pNode = static_cast<elementType>(child); \
if(pNode) \
{ \
pNode->func(); \
@ -93,10 +93,10 @@ while(false)
do { \
if(pArray && pArray->count() > 0) \
{ \
Object* child = NULL; \
Object* child; \
CCARRAY_FOREACH(pArray, child) \
{ \
elementType pNode = (elementType) child; \
elementType pNode = static_cast<elementType>(child); \
if(pNode) \
{ \
pNode->func(pObject); \

View File

@ -133,7 +133,7 @@ void PoolManager::finalize()
{
if(!pObj)
break;
AutoreleasePool* pPool = (AutoreleasePool*)pObj;
AutoreleasePool* pPool = static_cast<AutoreleasePool*>(pObj);
pPool->clear();
}
}

View File

@ -109,7 +109,7 @@ void KeypadDispatcher::forceRemoveDelegate(KeypadDelegate* pDelegate)
Object* pObj = NULL;
CCARRAY_FOREACH(_delegates, pObj)
{
pHandler = (KeypadHandler*)pObj;
pHandler = static_cast<KeypadHandler*>(pObj);
if (pHandler && pHandler->getDelegate() == pDelegate)
{
_delegates->removeObject(pHandler);
@ -132,7 +132,7 @@ bool KeypadDispatcher::dispatchKeypadMSG(ccKeypadMSGType nMsgType)
{
CC_BREAK_IF(!pObj);
pHandler = (KeypadHandler*)pObj;
pHandler = static_cast<KeypadHandler*>(pObj);
pDelegate = pHandler->getDelegate();
switch (nMsgType)

View File

@ -44,7 +44,7 @@ static std::vector<unsigned int> ccarray_to_std_vector(Array* pArray)
Object* pObj;
CCARRAY_FOREACH(pArray, pObj)
{
Integer* pInteger = (Integer*)pObj;
Integer* pInteger = static_cast<Integer*>(pObj);
ret.push_back((unsigned int)pInteger->getValue());
}
return ret;
@ -142,7 +142,7 @@ bool Menu::initWithArray(Array* pArrayOfItems)
Object* pObj = NULL;
CCARRAY_FOREACH(pArrayOfItems, pObj)
{
MenuItem* item = (MenuItem*)pObj;
MenuItem* item = static_cast<MenuItem*>(pObj);
this->addChild(item, z);
z++;
}

View File

@ -1036,7 +1036,7 @@ void MenuItemToggle::setEnabled(bool enabled)
Object* pObj = NULL;
CCARRAY_FOREACH(_subItems, pObj)
{
MenuItem* pItem = (MenuItem*)pObj;
MenuItem* pItem = static_cast<MenuItem*>(pObj);
pItem->setEnabled(enabled);
}
}

View File

@ -594,7 +594,7 @@ void RenderTexture::draw()
Object *pElement;
CCARRAY_FOREACH(_children, pElement)
{
Node *pChild = (Node*)pElement;
Node *pChild = static_cast<Node*>(pElement);
if (pChild != _sprite)
{

View File

@ -476,7 +476,7 @@ void ParticleBatchNode::updateAllAtlasIndexes()
CCARRAY_FOREACH(_children,pObj)
{
ParticleSystem* child = (ParticleSystem*)pObj;
ParticleSystem* child = static_cast<ParticleSystem*>(pObj);
child->setAtlasIndex(index);
index += child->getTotalParticles();
}

View File

@ -116,7 +116,7 @@ bool Animation::initWithSpriteFrames(Array *pFrames, float delay/* = 0.0f*/)
Object* pObj = NULL;
CCARRAY_FOREACH(pFrames, pObj)
{
SpriteFrame* frame = (SpriteFrame*)pObj;
SpriteFrame* frame = static_cast<SpriteFrame*>(pObj);
AnimationFrame *animFrame = new AnimationFrame();
animFrame->initWithSpriteFrame(frame, 1, NULL);
_frames->addObject(animFrame);
@ -141,7 +141,7 @@ bool Animation::initWithAnimationFrames(Array* arrayOfAnimationFrames, float del
Object* pObj = NULL;
CCARRAY_FOREACH(_frames, pObj)
{
AnimationFrame* animFrame = (AnimationFrame*)pObj;
AnimationFrame* animFrame = static_cast<AnimationFrame*>(pObj);
_totalDelayUnits += animFrame->getDelayUnits();
}
return true;

View File

@ -114,7 +114,7 @@ void AnimationCache::parseVersion1(Dictionary* animations)
Object* pObj = NULL;
CCARRAY_FOREACH(frameNames, pObj)
{
const char* frameName = ((String*)pObj)->getCString();
const char* frameName = static_cast<String*>(pObj)->getCString();
SpriteFrame* spriteFrame = frameCache->spriteFrameByName(frameName);
if ( ! spriteFrame ) {
@ -170,7 +170,7 @@ void AnimationCache::parseVersion2(Dictionary* animations)
Object* pObj = NULL;
CCARRAY_FOREACH(frameArray, pObj)
{
Dictionary* entry = (Dictionary*)(pObj);
Dictionary* entry = static_cast<Dictionary*>(pObj);
const char* spriteFrameName = entry->valueForKey("spriteframe")->getCString();
SpriteFrame *spriteFrame = frameCache->spriteFrameByName(spriteFrameName);
@ -222,7 +222,7 @@ void AnimationCache::addAnimationsWithDictionary(Dictionary* dictionary)
Object* pObj = NULL;
CCARRAY_FOREACH(spritesheets, pObj)
{
String* name = (String*)(pObj);
String* name = static_cast<String*>(pObj);
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(name->getCString());
}
}

View File

@ -280,7 +280,7 @@ void SpriteBatchNode::sortAllChildren()
// and at the same time reorder descendants and the quads to the right index
CCARRAY_FOREACH(_children, pObj)
{
Sprite* pChild = (Sprite*)pObj;
Sprite* pChild = static_cast<Sprite*>(pObj);
updateAtlasIndex(pChild, &index);
}
}
@ -314,7 +314,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex)
{
bool needNewIndex=true;
if (((Sprite*) (pArray->data->arr[0]))->getZOrder() >= 0)
if (static_cast<Sprite*>(pArray->data->arr[0])->getZOrder() >= 0)
{
//all children are in front of the parent
oldIndex = sprite->getAtlasIndex();
@ -332,7 +332,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, int* curIndex)
Object* pObj = NULL;
CCARRAY_FOREACH(pArray,pObj)
{
Sprite* child = (Sprite*)pObj;
Sprite* child = static_cast<Sprite*>(pObj);
if (needNewIndex && child->getZOrder() >= 0)
{
oldIndex = sprite->getAtlasIndex();
@ -434,7 +434,7 @@ unsigned int SpriteBatchNode::rebuildIndexInOrder(Sprite *pobParent, unsigned in
Object* pObject = NULL;
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pChild = (Sprite*) pObject;
Sprite* pChild = static_cast<Sprite*>(pObject);
if (pChild && (pChild->getZOrder() < 0))
{
uIndex = rebuildIndexInOrder(pChild, uIndex);
@ -454,7 +454,7 @@ unsigned int SpriteBatchNode::rebuildIndexInOrder(Sprite *pobParent, unsigned in
Object* pObject = NULL;
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pChild = (Sprite*) pObject;
Sprite* pChild = static_cast<Sprite*>(pObject);
if (pChild && (pChild->getZOrder() >= 0))
{
uIndex = rebuildIndexInOrder(pChild, uIndex);
@ -576,17 +576,17 @@ void SpriteBatchNode::insertChild(Sprite *pSprite, unsigned int uIndex)
// update indices
unsigned int i = uIndex+1;
Sprite* pChild = NULL;
Sprite* pChild = nullptr;
for(; i<descendantsData->num; i++){
pChild = (Sprite*)descendantsData->arr[i];
pChild = static_cast<Sprite*>(descendantsData->arr[i]);
pChild->setAtlasIndex(pChild->getAtlasIndex() + 1);
}
// add children recursively
Object* pObj = NULL;
Object* pObj = nullptr;
CCARRAY_FOREACH(pSprite->getChildren(), pObj)
{
pChild = (Sprite*)pObj;
pChild = static_cast<Sprite*>(pObj);
unsigned int idx = atlasIndexForChild(pChild, pChild->getZOrder());
insertChild(pChild, idx);
}
@ -616,10 +616,10 @@ void SpriteBatchNode::appendChild(Sprite* sprite)
// add children recursively
Object* pObj = NULL;
Object* pObj = nullptr;
CCARRAY_FOREACH(sprite->getChildren(), pObj)
{
Sprite* child = (Sprite*)pObj;
Sprite* child = static_cast<Sprite*>(pObj);
appendChild(child);
}
}
@ -654,7 +654,7 @@ void SpriteBatchNode::removeSpriteFromAtlas(Sprite *pobSprite)
Object* pObject = NULL;
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pChild = (Sprite*) pObject;
Sprite* pChild = static_cast<Sprite*>(pObject);
if (pChild)
{
removeSpriteFromAtlas(pChild);
@ -760,7 +760,7 @@ SpriteBatchNode * SpriteBatchNode::addSpriteWithoutQuad(Sprite*child, unsigned i
Object* pObject = NULL;
CCARRAY_FOREACH(_descendants, pObject)
{
Sprite* pChild = (Sprite*) pObject;
Sprite* pChild = static_cast<Sprite*>(pObject);
if (pChild && (pChild->getAtlasIndex() >= z))
{
++i;

View File

@ -177,7 +177,7 @@ void SpriteFrameCache::addSpriteFramesWithDictionary(Dictionary* dictionary, Tex
Object* pObj = NULL;
CCARRAY_FOREACH(aliases, pObj)
{
std::string oneAlias = ((String*)pObj)->getCString();
std::string oneAlias = static_cast<String*>(pObj)->getCString();
if (_spriteFramesAliases->objectForKey(oneAlias.c_str()))
{
CCLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());

View File

@ -101,7 +101,7 @@ void NotificationCenter::removeObserver(Object *target,const char *name)
Object* obj = NULL;
CCARRAY_FOREACH(_observers, obj)
{
NotificationObserver* observer = (NotificationObserver*) obj;
NotificationObserver* observer = static_cast<NotificationObserver*>(obj);
if (!observer)
continue;
@ -120,7 +120,7 @@ int NotificationCenter::removeAllObservers(Object *target)
CCARRAY_FOREACH(_observers, obj)
{
NotificationObserver *observer = (NotificationObserver *)obj;
NotificationObserver *observer = static_cast<NotificationObserver *>(obj);
if (!observer)
continue;
@ -154,7 +154,7 @@ void NotificationCenter::unregisterScriptObserver(Object *target,const char* nam
Object* obj = NULL;
CCARRAY_FOREACH(_observers, obj)
{
NotificationObserver* observer = (NotificationObserver*) obj;
NotificationObserver* observer = static_cast<NotificationObserver*>(obj);
if (!observer)
continue;
@ -172,7 +172,7 @@ void NotificationCenter::postNotification(const char *name, Object *object)
Object* obj = NULL;
CCARRAY_FOREACH(ObserversCopy, obj)
{
NotificationObserver* observer = (NotificationObserver*) obj;
NotificationObserver* observer = static_cast<NotificationObserver*>(obj);
if (!observer)
continue;
@ -207,7 +207,7 @@ int NotificationCenter::getObserverHandlerByName(const char* name)
Object* obj = NULL;
CCARRAY_FOREACH(_observers, obj)
{
NotificationObserver* observer = (NotificationObserver*) obj;
NotificationObserver* observer = static_cast<NotificationObserver*>(obj);
if (NULL == observer)
continue;

View File

@ -405,10 +405,10 @@ Sprite * TMXLayer::insertTileForGID(unsigned int gid, const Point& pos)
// update possible children
if (_children && _children->count()>0)
{
Object* pObject = NULL;
Object* pObject = nullptr;
CCARRAY_FOREACH(_children, pObject)
{
Sprite* pChild = (Sprite*) pObject;
Sprite* pChild = static_cast<Sprite*>(pObject);
if (pChild)
{
unsigned int ai = pChild->getAtlasIndex();
@ -608,10 +608,10 @@ void TMXLayer::removeTileAt(const Point& pos)
// update possible children
if (_children && _children->count()>0)
{
Object* pObject = NULL;
Object* pObject = nullptr;
CCARRAY_FOREACH(_children, pObject)
{
Sprite* pChild = (Sprite*) pObject;
Sprite* pChild = static_cast<Sprite*>(pObject);
if (pChild)
{
unsigned int ai = pChild->getAtlasIndex();

View File

@ -49,10 +49,10 @@ Dictionary* TMXObjectGroup::objectNamed(const char *objectName)
{
if (_objects && _objects->count() > 0)
{
Object* pObj = NULL;
Object* pObj = nullptr;
CCARRAY_FOREACH(_objects, pObj)
{
Dictionary* pDict = (Dictionary*)pObj;
Dictionary* pDict = static_cast<Dictionary*>(pObj);
String *name = (String*)pDict->objectForKey("name");
if (name && name->_string == objectName)
{

View File

@ -149,7 +149,7 @@ TMXTilesetInfo * TMXTiledMap::tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInf
Object* pObj = NULL;
CCARRAY_FOREACH_REVERSE(tilesets, pObj)
{
tileset = (TMXTilesetInfo*)pObj;
tileset = static_cast<TMXTilesetInfo*>(pObj);
if (tileset)
{
for( unsigned int y=0; y < size.height; y++ )
@ -211,7 +211,7 @@ void TMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
Object* pObj = NULL;
CCARRAY_FOREACH(layers, pObj)
{
layerInfo = (TMXLayerInfo*)pObj;
layerInfo = static_cast<TMXLayerInfo*>(pObj);
if (layerInfo && layerInfo->_visible)
{
TMXLayer *child = parseLayer(layerInfo, mapInfo);
@ -262,7 +262,7 @@ TMXObjectGroup * TMXTiledMap::objectGroupNamed(const char *groupName)
Object* pObj = NULL;
CCARRAY_FOREACH(_objectGroups, pObj)
{
objectGroup = (TMXObjectGroup*)(pObj);
objectGroup = static_cast<TMXObjectGroup*>(pObj);
if (objectGroup && objectGroup->getGroupName() == sGroupName)
{
return objectGroup;

View File

@ -108,7 +108,7 @@ void TouchDispatcher::forceAddHandler(TouchHandler *pHandler, Array *pArray)
Object* pObj = NULL;
CCARRAY_FOREACH(pArray, pObj)
{
TouchHandler *h = (TouchHandler *)pObj;
TouchHandler *h = static_cast<TouchHandler *>(pObj);
if (h)
{
if (h->getPriority() < pHandler->getPriority())
@ -183,7 +183,7 @@ void TouchDispatcher::forceRemoveDelegate(TouchDelegate *pDelegate)
Object* pObj = NULL;
CCARRAY_FOREACH(_standardHandlers, pObj)
{
pHandler = (TouchHandler*)pObj;
pHandler = static_cast<TouchHandler*>(pObj);
if (pHandler && pHandler->getDelegate() == pDelegate)
{
_standardHandlers->removeObject(pHandler);
@ -194,7 +194,7 @@ void TouchDispatcher::forceRemoveDelegate(TouchDelegate *pDelegate)
// remove handler from _targetedHandlers
CCARRAY_FOREACH(_targetedHandlers, pObj)
{
pHandler = (TouchHandler*)pObj;
pHandler = static_cast<TouchHandler*>(pObj);
if (pHandler && pHandler->getDelegate() == pDelegate)
{
_targetedHandlers->removeObject(pHandler);
@ -254,7 +254,7 @@ TouchHandler* TouchDispatcher::findHandler(TouchDelegate *pDelegate)
Object* pObj = NULL;
CCARRAY_FOREACH(_targetedHandlers, pObj)
{
TouchHandler* pHandler = (TouchHandler*)pObj;
TouchHandler* pHandler = static_cast<TouchHandler*>(pObj);
if (pHandler->getDelegate() == pDelegate)
{
return pHandler;
@ -263,7 +263,7 @@ TouchHandler* TouchDispatcher::findHandler(TouchDelegate *pDelegate)
CCARRAY_FOREACH(_standardHandlers, pObj)
{
TouchHandler* pHandler = (TouchHandler*)pObj;
TouchHandler* pHandler = static_cast<TouchHandler*>(pObj);
if (pHandler->getDelegate() == pDelegate)
{
return pHandler;
@ -280,7 +280,7 @@ TouchHandler* TouchDispatcher::findHandler(Array* pArray, TouchDelegate *pDelega
Object* pObj = NULL;
CCARRAY_FOREACH(pArray, pObj)
{
TouchHandler* pHandle = (TouchHandler*)pObj;
TouchHandler* pHandle = static_cast<TouchHandler*>(pObj);
if (pHandle->getDelegate() == pDelegate)
{
return pHandle;
@ -346,7 +346,7 @@ void TouchDispatcher::touches(Set *pTouches, Event *pEvent, unsigned int uIndex)
Object* pObj = NULL;
CCARRAY_FOREACH(_targetedHandlers, pObj)
{
pHandler = (TargetedTouchHandler *)(pObj);
pHandler = static_cast<TargetedTouchHandler*>(pObj);
if (! pHandler)
{
@ -403,10 +403,10 @@ void TouchDispatcher::touches(Set *pTouches, Event *pEvent, unsigned int uIndex)
if (uStandardHandlersCount > 0 && pMutableTouches->count() > 0)
{
StandardTouchHandler *pHandler = NULL;
Object* pObj = NULL;
Object* pObj = nullptr;
CCARRAY_FOREACH(_standardHandlers, pObj)
{
pHandler = (StandardTouchHandler*)(pObj);
pHandler = static_cast<StandardTouchHandler*>(pObj);
if (! pHandler)
{
@ -455,10 +455,10 @@ void TouchDispatcher::touches(Set *pTouches, Event *pEvent, unsigned int uIndex)
{
_toAdd = false;
TouchHandler* pHandler = NULL;
Object* pObj = NULL;
Object* pObj = nullptr;
CCARRAY_FOREACH(_handlersToAdd, pObj)
{
pHandler = (TouchHandler*)pObj;
pHandler = static_cast<TouchHandler*>(pObj);
if (! pHandler)
{
break;

View File

@ -418,7 +418,7 @@ void Armature::update(float dt)
Object *object = NULL;
CCARRAY_FOREACH(_topBoneList, object)
{
((Bone *)object)->update(dt);
static_cast<Bone*>(object)->update(dt);
}
}
@ -433,7 +433,7 @@ void Armature::draw()
Object *object = NULL;
CCARRAY_FOREACH(_children, object)
{
Bone *bone = (Bone *)object;
Bone *bone = static_cast<Bone *>(object);
DisplayManager *displayManager = bone->getDisplayManager();
Node *node = displayManager->getDisplayRenderNode();
@ -534,7 +534,7 @@ Rect Armature::boundingBox()
Object *object = NULL;
CCARRAY_FOREACH(_children, object)
{
Bone *bone = (Bone *)object;
Bone *bone = static_cast<Bone *>(object);
Rect r = bone->getDisplayManager()->getBoundingBox();
if(first)

View File

@ -188,7 +188,7 @@ void Bone::update(float delta)
Object *object = NULL;
CCARRAY_FOREACH(_children, object)
{
Bone *childBone = (Bone *)object;
Bone *childBone = static_cast<Bone *>(object);
childBone->update(delta);
}
@ -247,7 +247,7 @@ void Bone::removeChildBone(Bone *bone, bool recursion)
Object *_object = NULL;
CCARRAY_FOREACH(_ccbones, _object)
{
Bone *_ccBone = (Bone *)_object;
Bone *_ccBone = static_cast<Bone *>(_object);
bone->removeChildBone(_ccBone, recursion);
}
}

View File

@ -84,7 +84,7 @@ void ArmatureAnimation:: pause()
Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object)
{
((Tween *)object)->pause();
static_cast<Tween *>(object)->pause();
}
ProcessBase::pause();
}
@ -94,7 +94,7 @@ void ArmatureAnimation::resume()
Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object)
{
((Tween *)object)->resume();
static_cast<Tween *>(object)->resume();
}
ProcessBase::resume();
}
@ -104,7 +104,7 @@ void ArmatureAnimation::stop()
Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object)
{
((Tween *)object)->stop();
static_cast<Tween *>(object)->stop();
}
_tweenList->removeAllObjects();
ProcessBase::stop();
@ -237,7 +237,7 @@ void ArmatureAnimation::update(float dt)
Object *object = NULL;
CCARRAY_FOREACH(_tweenList, object)
{
((Tween *)object)->update(dt);
static_cast<Tween *>(object)->update(dt);
}
}

View File

@ -225,7 +225,7 @@ void DisplayManager::initDisplayList(BoneData *boneData)
Array *displayDataList = &boneData->displayDataList;
CCARRAY_FOREACH(displayDataList, object)
{
DisplayData *displayData = (DisplayData *)object;
DisplayData *displayData = static_cast<DisplayData *>(object);
DecorativeDisplay *decoDisplay = DecorativeDisplay::create();
decoDisplay->setDisplayData(displayData);

View File

@ -63,7 +63,7 @@ ColliderDetector::~ColliderDetector()
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
b2Body *body = colliderBody->getB2Body();
PhysicsWorld::sharedPhysicsWorld()->getNoGravityWorld()->DestroyBody(body);
@ -101,7 +101,7 @@ void ColliderDetector::addContourData(ContourData *contourData)
int i = 0;
CCARRAY_FOREACH(array, object)
{
ContourVertex2F *v = (ContourVertex2F *)object;
ContourVertex2F *v = static_cast<ContourVertex2F *>(object);
b2bv[i].Set(v->x / PT_RATIO, v->y / PT_RATIO);
i++;
}
@ -134,7 +134,7 @@ void ColliderDetector::addContourDataList(Array *contourDataList)
Object *object = NULL;
CCARRAY_FOREACH(contourDataList, object)
{
addContourData((ContourData *)object);
addContourData(static_cast<ContourData *>(object));
}
}
@ -153,7 +153,7 @@ void ColliderDetector::setColliderFilter(b2Filter &filter)
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
colliderBody->getB2Body()->GetFixtureList()->SetFilterData(filter);
}
}
@ -163,7 +163,7 @@ void ColliderDetector::setActive(bool active)
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
colliderBody->getB2Body()->SetActive(active);
}
}
@ -175,7 +175,7 @@ void ColliderDetector::updateTransform(AffineTransform &t)
Object *object = NULL;
CCARRAY_FOREACH(_colliderBodyList, object)
{
ColliderBody *colliderBody = (ColliderBody *)object;
ColliderBody *colliderBody = static_cast<ColliderBody *>(object);
ContourData *contourData = colliderBody->getContourData();
b2Body *body = colliderBody->getB2Body();
@ -188,7 +188,7 @@ void ColliderDetector::updateTransform(AffineTransform &t)
int i = 0;
CCARRAY_FOREACH(array, object)
{
ContourVertex2F *cv = (ContourVertex2F *)object;
ContourVertex2F *cv = static_cast<ContourVertex2F *>(object);
b2Vec2 &bv = shape->m_vertices[i];
helpPoint.setPoint(cv->x, cv->y);

View File

@ -238,7 +238,7 @@ int CCBAnimationManager::getSequenceId(const char* pSequenceName)
string seqName(pSequenceName);
CCARRAY_FOREACH(mSequences, pElement)
{
CCBSequence *seq = (CCBSequence*)pElement;
CCBSequence *seq = static_cast<CCBSequence*>(pElement);
if (seqName.compare(seq->getName()) == 0)
{
return seq->getSequenceId();
@ -252,7 +252,7 @@ CCBSequence* CCBAnimationManager::getSequence(int nSequenceId)
Object *pElement = NULL;
CCARRAY_FOREACH(mSequences, pElement)
{
CCBSequence *seq = (CCBSequence*)pElement;
CCBSequence *seq = static_cast<CCBSequence*>(pElement);
if (seq->getSequenceId() == nSequenceId)
{
return seq;

View File

@ -333,7 +333,7 @@ void CCBReader::cleanUpNodeGraph(Node *pNode)
Object *pChild = NULL;
CCARRAY_FOREACH(pNode->getChildren(), pChild)
{
cleanUpNodeGraph((Node*)pChild);
cleanUpNodeGraph(static_cast<Node*>(pChild));
}
}

View File

@ -78,7 +78,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * pCCBR
bool bFound = false;
CCARRAY_FOREACH(extraPropsNames, pObj)
{
String* pStr = (String*)pObj;
String* pStr = static_cast<String*>(pObj);
if (0 == pStr->compare(propertyName.c_str()))
{
bFound = true;
@ -90,7 +90,7 @@ void NodeLoader::parseProperties(Node * pNode, Node * pParent, CCBReader * pCCBR
}
else if (isExtraProp && pNode == pCCBReader->getAnimationManager()->getRootNode())
{
Array *extraPropsNames = (Array*)pNode->getUserObject();
Array *extraPropsNames = static_cast<Array*>(pNode->getUserObject());
if (! extraPropsNames)
{
extraPropsNames = Array::create();

View File

@ -124,7 +124,7 @@ void Control::sendActionsForControlEvents(ControlEvent controlEvents)
Object* pObj = NULL;
CCARRAY_FOREACH(invocationList, pObj)
{
Invocation* invocation = (Invocation*)pObj;
Invocation* invocation = static_cast<Invocation*>(pObj);
invocation->invoke(this);
}
//Call ScriptFunc
@ -212,7 +212,7 @@ void Control::removeTargetWithActionForControlEvent(Object* target, SEL_CCContro
Object* pObj = NULL;
CCARRAY_FOREACH(eventInvocationList, pObj)
{
Invocation *invocation = (Invocation*)pObj;
Invocation *invocation = static_cast<Invocation*>(pObj);
bool shouldBeRemoved=true;
if (target)
{

View File

@ -157,7 +157,7 @@ void ScrollView::pause(Object* sender)
CCARRAY_FOREACH(pChildren, pObj)
{
Node* pChild = (Node*)pObj;
Node* pChild = static_cast<Node*>(pObj);
pChild->pauseSchedulerAndActions();
}
}
@ -169,7 +169,7 @@ void ScrollView::resume(Object* sender)
CCARRAY_FOREACH(pChildren, pObj)
{
Node* pChild = (Node*)pObj;
Node* pChild = static_cast<Node*>(pObj);
pChild->resumeSchedulerAndActions();
}

View File

@ -106,7 +106,7 @@ void TableView::reloadData()
Object* pObj = NULL;
CCARRAY_FOREACH(_cellsUsed, pObj)
{
TableViewCell* cell = (TableViewCell*)pObj;
TableViewCell* cell = static_cast<TableViewCell*>(pObj);
if(_tableViewDelegate != NULL) {
_tableViewDelegate->tableCellWillRecycle(this, cell);
@ -494,7 +494,7 @@ void TableView::scrollViewDidScroll(ScrollView* view)
int i = 0;
CCARRAY_FOREACH(_cellsUsed, pObj)
{
TableViewCell* pCell = (TableViewCell*)pObj;
TableViewCell* pCell = static_cast<TableViewCell*>(pObj);
CCLog("cells Used index %d, value = %d", i, pCell->getIdx());
i++;
}
@ -502,7 +502,7 @@ void TableView::scrollViewDidScroll(ScrollView* view)
i = 0;
CCARRAY_FOREACH(_cellsFreed, pObj)
{
TableViewCell* pCell = (TableViewCell*)pObj;
TableViewCell* pCell = static_cast<TableViewCell*>(pObj);
CCLog("cells freed index %d, value = %d", i, pCell->getIdx());
i++;
}

View File

@ -52,7 +52,7 @@ void Bug422Layer::check(Node* t)
CCARRAY_FOREACH(array, pChild)
{
CC_BREAK_IF(! pChild);
Node* pNode = (Node*) pChild;
Node* pNode = static_cast<Node*>(pChild);
CCLog("%p, rc: %d", pNode, pNode->retainCount());
check(pNode);
}

View File

@ -66,7 +66,7 @@ void ProjectileController::update(float delta)
CCARRAY_FOREACH(targetsToDelete, jt)
{
Sprite *target = dynamic_cast<Sprite*>(jt);
((EnemyController*)(target->getComponent("EnemyController")))->die();
static_cast<EnemyController*>(target->getComponent("EnemyController"))->die();
}
bool isDied = targetsToDelete->count();

View File

@ -49,7 +49,7 @@ bool ControlButtonTest_HelloVariableSize::init()
int i = 0;
CCARRAY_FOREACH(stringArray, pObj)
{
String* title = (String*)pObj;
String* title = static_cast<String*>(pObj);
// Creates a button with this string as title
ControlButton *button = standardButtonWithTitle(title->getCString());
if (i == 0)

View File

@ -129,7 +129,7 @@ static void setEnableRecursiveCascading(Node* node, bool enable)
Array* children = node->getChildren();
CCARRAY_FOREACH(children, obj)
{
Node* child = (Node*)obj;
Node* child = static_cast<Node*>(obj);
setEnableRecursiveCascading(child, enable);
}
}

View File

@ -220,7 +220,7 @@ void IterateSpriteSheetFastEnum::update(float dt)
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pSprite = (Sprite*) pObject;
Sprite* pSprite = static_cast<Sprite*>(pObject);
pSprite->setVisible(false);
}
@ -257,7 +257,7 @@ void IterateSpriteSheetCArray::update(float dt)
CCARRAY_FOREACH(pChildren, pObject)
{
Sprite* pSprite = (Sprite*)pObject;
Sprite* pSprite = static_cast<Sprite*>(pObject);
pSprite->setVisible(false);
}

View File

@ -133,7 +133,7 @@ TMXOrthoTest::TMXOrthoTest()
Object* pObject = NULL;
CCARRAY_FOREACH(pChildrenArray, pObject)
{
child = (SpriteBatchNode*)pObject;
child = static_cast<SpriteBatchNode*>(pObject);
if(!child)
break;
@ -182,7 +182,7 @@ TMXOrthoTest2::TMXOrthoTest2()
Object* pObject = NULL;
CCARRAY_FOREACH(pChildrenArray, pObject)
{
child = (SpriteBatchNode*)pObject;
child = static_cast<SpriteBatchNode*>(pObject);
if(!child)
break;
@ -216,7 +216,7 @@ TMXOrthoTest3::TMXOrthoTest3()
Object* pObject = NULL;
CCARRAY_FOREACH(pChildrenArray, pObject)
{
child = (SpriteBatchNode*)pObject;
child = static_cast<SpriteBatchNode*>(pObject);
if(!child)
break;
@ -251,7 +251,7 @@ TMXOrthoTest4::TMXOrthoTest4()
Object* pObject = NULL;
CCARRAY_FOREACH(pChildrenArray, pObject)
{
child = (SpriteBatchNode*)pObject;
child = static_cast<SpriteBatchNode*>(pObject);
if(!child)
break;
@ -556,7 +556,7 @@ TMXUncompressedTest::TMXUncompressedTest()
Object* pObject = NULL;
CCARRAY_FOREACH(pChildrenArray, pObject)
{
layer= (TMXLayer*)pObject;
layer= static_cast<TMXLayer*>(pObject);
if(!layer)
break;
@ -621,7 +621,7 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest()
Object* pObj = NULL;
CCARRAY_FOREACH(objects, pObj)
{
dict = (Dictionary*)pObj;//dynamic_cast<StringToStringDictionary*>(*it);
dict = static_cast<Dictionary*>(pObj);
if(!dict)
break;
@ -644,7 +644,7 @@ void TMXOrthoObjectsTest::draw()
Object* pObj = NULL;
CCARRAY_FOREACH(objects, pObj)
{
dict = (Dictionary*)pObj;//dynamic_cast<StringToStringDictionary*>(*it);
dict = static_cast<Dictionary*>(pObj);
if(!dict)
break;
@ -702,7 +702,7 @@ TMXIsoObjectsTest::TMXIsoObjectsTest()
Object* pObj = NULL;
CCARRAY_FOREACH(objects, pObj)
{
dict = (Dictionary*)pObj;
dict = static_cast<Dictionary*>(pObj);
if(!dict)
break;
@ -721,18 +721,18 @@ void TMXIsoObjectsTest::draw()
Object* pObj = NULL;
CCARRAY_FOREACH(objects, pObj)
{
dict = (Dictionary*)pObj;//dynamic_cast<StringToStringDictionary*>(*it);
dict = static_cast<Dictionary*>(pObj);
if(!dict)
break;
const char* key = "x";
int x = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("x"))->getNumber();
int x = static_cast<String*>(dict->objectForKey(key))->intValue();
key = "y";
int y = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("y"))->getNumber();
int y = static_cast<String*>(dict->objectForKey(key))->intValue();
key = "width";
int width = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("width"))->getNumber();
int width = static_cast<String*>(dict->objectForKey(key))->intValue();
key = "height";
int height = ((String*)dict->objectForKey(key))->intValue();//dynamic_cast<NSNumber*>(dict->objectForKey("height"))->getNumber();
int height = static_cast<String*>(dict->objectForKey(key))->intValue();
glLineWidth(3);
@ -1157,7 +1157,7 @@ TMXOrthoFlipTest::TMXOrthoFlipTest()
Object* pObj = NULL;
CCARRAY_FOREACH(map->getChildren(), pObj)
{
SpriteBatchNode* child = (SpriteBatchNode*)pObj;
SpriteBatchNode* child = static_cast<SpriteBatchNode*>(pObj);
child->getTexture()->setAntiAliasTexParameters();
}
@ -1187,7 +1187,7 @@ TMXOrthoFlipRunTimeTest::TMXOrthoFlipRunTimeTest()
Object* pObj = NULL;
CCARRAY_FOREACH(map->getChildren(), pObj)
{
SpriteBatchNode* child = (SpriteBatchNode*)pObj;
SpriteBatchNode* child = static_cast<SpriteBatchNode*>(pObj);
child->getTexture()->setAntiAliasTexParameters();
}
@ -1266,7 +1266,7 @@ TMXOrthoFromXMLTest::TMXOrthoFromXMLTest()
Object* pObj = NULL;
CCARRAY_FOREACH(map->getChildren(), pObj)
{
SpriteBatchNode* child = (SpriteBatchNode*)pObj;
SpriteBatchNode* child = static_cast<SpriteBatchNode*>(pObj);
child->getTexture()->setAntiAliasTexParameters();
}
@ -1297,7 +1297,7 @@ TMXBug987::TMXBug987()
Object* pObject = NULL;
CCARRAY_FOREACH(childs, pObject)
{
pNode = (TMXLayer*) pObject;
pNode = static_cast<TMXLayer*>(pObject);
CC_BREAK_IF(!pNode);
pNode->getTexture()->setAntiAliasTexParameters();
}
@ -1523,7 +1523,7 @@ void TMXGIDObjectsTest::draw()
Object* pObj = NULL;
CCARRAY_FOREACH(array, pObj)
{
dict = (Dictionary*)pObj;
dict = static_cast<Dictionary*>(pObj);
if(!dict)
{
break;

View File

@ -71,7 +71,7 @@ PongLayer::PongLayer()
Object* pObj = NULL;
CCARRAY_FOREACH(_paddles, pObj)
{
paddle = (Paddle*)(pObj);
paddle = static_cast<Paddle*>(pObj);
if(!paddle)
break;
@ -105,7 +105,7 @@ void PongLayer::doStep(float delta)
Object* pObj = NULL;
CCARRAY_FOREACH(_paddles, pObj)
{
paddle = (Paddle*)(pObj);
paddle = static_cast<Paddle*>(pObj);
if(!paddle)
break;

View File

@ -1 +1 @@
ef40a853a2bf6590fbd9af75f8b318844caf4b64
283cec6d4443dbb957d240238c35201064da699f

View File

@ -279,7 +279,7 @@ static int tolua_Cocos2d_WebSocket_createByProtocolArray00(lua_State* tolua_S)
Object* pObj = NULL;
CCARRAY_FOREACH(protocolArray, pObj)
{
String* pStr = (String*)pObj;
String* pStr = static_cast<String*>(pObj);
if (NULL != pStr) {
protocols.push_back(pStr->getCString());
}