issue #2771: fix bugs

This commit is contained in:
boyu0 2013-11-15 16:27:43 +08:00
parent 9eac5c4a41
commit 0cb45e50f1
2 changed files with 6 additions and 6 deletions

View File

@ -365,7 +365,7 @@ PhysicsShape* PhysicsBody::addShape(PhysicsShape* shape, bool addMassAndMoment/*
if (shape == nullptr) return nullptr;
// add shape to body
if (_shapes->getIndexOfObject(shape) == UINT_MAX)
if (_shapes->getIndexOfObject(shape) == CC_INVALID_INDEX)
{
shape->setBody(this);
@ -633,7 +633,7 @@ void PhysicsBody::removeShape(int tag, bool reduceMassAndMoment/* = true*/)
void PhysicsBody::removeShape(PhysicsShape* shape, bool reduceMassAndMoment/* = true*/)
{
if (_shapes->getIndexOfObject(shape) != UINT_MAX)
if (_shapes->getIndexOfObject(shape) != CC_INVALID_INDEX)
{
// deduce the area, mass and moment
// area must update before mass, because the density changes depend on it.

View File

@ -236,7 +236,7 @@ bool PhysicsWorld::init(Scene& scene)
void PhysicsWorld::addBodyOrDelay(PhysicsBody* body)
{
if (_delayRemoveBodies->getIndexOfObject(body) != UINT_MAX)
if (_delayRemoveBodies->getIndexOfObject(body) != CC_INVALID_INDEX)
{
_delayRemoveBodies->removeObject(body);
return;
@ -244,7 +244,7 @@ void PhysicsWorld::addBodyOrDelay(PhysicsBody* body)
if (_info->getSpace()->locked_private)
{
if (_delayAddBodies->getIndexOfObject(body) == UINT_MAX)
if (_delayAddBodies->getIndexOfObject(body) == CC_INVALID_INDEX)
{
_delayAddBodies->addObject(body);
_delayDirty = true;
@ -257,7 +257,7 @@ void PhysicsWorld::addBodyOrDelay(PhysicsBody* body)
void PhysicsWorld::removeBodyOrDelay(PhysicsBody* body)
{
if (_delayAddBodies->getIndexOfObject(body) != UINT_MAX)
if (_delayAddBodies->getIndexOfObject(body) != CC_INVALID_INDEX)
{
_delayAddBodies->removeObject(body);
return;
@ -265,7 +265,7 @@ void PhysicsWorld::removeBodyOrDelay(PhysicsBody* body)
if (_info->getSpace()->locked_private)
{
if (_delayRemoveBodies->getIndexOfObject(body) == UINT_MAX)
if (_delayRemoveBodies->getIndexOfObject(body) == CC_INVALID_INDEX)
{
_delayRemoveBodies->addObject(body);
_delayDirty = true;