fix compiler warning

This commit is contained in:
yinkaile 2013-11-11 15:29:24 +08:00
parent 50ab5783d5
commit 677cf00355
4 changed files with 21 additions and 16 deletions

View File

@ -289,7 +289,7 @@ void Armature::removeBone(Bone *bone, bool recursion)
CCASSERT(bone != nullptr, "bone must be added to the bone dictionary!");
bone->setArmature(nullptr);
bone->removeFromParent();
bone->removeFromParent(recursion);
if (_topBoneList->containsObject(bone))
{

View File

@ -322,16 +322,19 @@ void Bone::addChildBone(Bone *child)
}
}
void Bone::removeChildBone(Bone *bone)
void Bone::removeChildBone(Bone *bone, bool recursion)
{
if (_children && _children->getIndexOfObject(bone) != UINT_MAX )
{
Array *ccbones = bone->_children;
for(auto object : *ccbones)
if(recursion)
{
Bone *ccBone = (Bone *)object;
bone->removeChildBone(ccBone);
Array *ccbones = bone->_children;
for(auto object : *ccbones)
{
Bone *ccBone = (Bone *)object;
bone->removeChildBone(ccBone, recursion);
}
}
bone->setParentBone(nullptr);
@ -342,11 +345,11 @@ void Bone::removeChildBone(Bone *bone)
}
}
void Bone::removeFromParent()
void Bone::removeFromParent(bool recursion)
{
if (nullptr != _parentBone)
{
_parentBone->removeChildBone(this);
_parentBone->removeChildBone(this, recursion);
}
}

View File

@ -112,16 +112,18 @@ public:
*/
Bone *getParentBone();
using Node::removeFromParent;
/**
* Remove itself from its parent.
* @param recursion whether or not to remove childBone's display
*/
void removeFromParent();
void removeFromParent(bool recursion);
/**
* Removes a child Bone
* @param bone the bone you want to remove
*/
void removeChildBone(Bone *bone);
void removeChildBone(Bone *bone, bool recursion);
void update(float delta) override;

View File

@ -146,13 +146,13 @@ void DisplayManager::addDisplay(Node *display, int index)
for (int i = _decoDisplayList->count()-2; i>=0; i--)
{
DecorativeDisplay *dd = static_cast<DecorativeDisplay*>(_decoDisplayList->objectAtIndex(i));
SpriteDisplayData *spriteDisplayData = static_cast<SpriteDisplayData*>(dd->getDisplayData());
if (spriteDisplayData)
DecorativeDisplay *dd = static_cast<DecorativeDisplay*>(_decoDisplayList->getObjectAtIndex(i));
SpriteDisplayData *sdd = static_cast<SpriteDisplayData*>(dd->getDisplayData());
if (sdd)
{
find = true;
skin->setSkinData(spriteDisplayData->skinData);
static_cast<SpriteDisplayData*>(displayData)->skinData = spriteDisplayData->skinData;
skin->setSkinData(sdd->skinData);
static_cast<SpriteDisplayData*>(displayData)->skinData = sdd->skinData;
break;
}
}