mirror of https://github.com/axmolengine/axmol.git
issue #2771: fix bugs
This commit is contained in:
parent
9eac5c4a41
commit
0cb45e50f1
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue