mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Fix Fixture:getShape() causing crashes with ChainShapes (resolves issue #1392), removed dead code that's no longer valid
This commit is contained in:
@@ -36,8 +36,8 @@ namespace box2d
|
|||||||
|
|
||||||
love::Type ChainShape::type("ChainShape", &Shape::type);
|
love::Type ChainShape::type("ChainShape", &Shape::type);
|
||||||
|
|
||||||
ChainShape::ChainShape(b2ChainShape *c, bool loop, bool own)
|
ChainShape::ChainShape(b2ChainShape *c, bool own)
|
||||||
: Shape(c, own), loop(loop)
|
: Shape(c, own)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,11 +47,6 @@ ChainShape::~ChainShape()
|
|||||||
|
|
||||||
void ChainShape::setNextVertex(float x, float y)
|
void ChainShape::setNextVertex(float x, float y)
|
||||||
{
|
{
|
||||||
if (loop)
|
|
||||||
{
|
|
||||||
throw love::Exception("Physics error: Can't call setNextVertex on a loop ChainShape");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
b2Vec2 v(x, y);
|
b2Vec2 v(x, y);
|
||||||
b2ChainShape *c = (b2ChainShape *)shape;
|
b2ChainShape *c = (b2ChainShape *)shape;
|
||||||
c->SetNextVertex(Physics::scaleDown(v));
|
c->SetNextVertex(Physics::scaleDown(v));
|
||||||
@@ -65,11 +60,6 @@ void ChainShape::setNextVertex()
|
|||||||
|
|
||||||
void ChainShape::setPreviousVertex(float x, float y)
|
void ChainShape::setPreviousVertex(float x, float y)
|
||||||
{
|
{
|
||||||
if (loop)
|
|
||||||
{
|
|
||||||
throw love::Exception("Physics error: Can't call setPreviousVertex on a loop ChainShape");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
b2Vec2 v(x, y);
|
b2Vec2 v(x, y);
|
||||||
b2ChainShape *c = (b2ChainShape *)shape;
|
b2ChainShape *c = (b2ChainShape *)shape;
|
||||||
c->SetPrevVertex(Physics::scaleDown(v));
|
c->SetPrevVertex(Physics::scaleDown(v));
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public:
|
|||||||
* Create a new ChainShape from a Box2D chain shape.
|
* Create a new ChainShape from a Box2D chain shape.
|
||||||
* @param c The chain shape.
|
* @param c The chain shape.
|
||||||
**/
|
**/
|
||||||
ChainShape(b2ChainShape *c, bool loop = false, bool own = true);
|
ChainShape(b2ChainShape *c, bool own = true);
|
||||||
|
|
||||||
virtual ~ChainShape();
|
virtual ~ChainShape();
|
||||||
|
|
||||||
@@ -103,9 +103,6 @@ public:
|
|||||||
**/
|
**/
|
||||||
const b2Vec2 *getPoints() const;
|
const b2Vec2 *getPoints() const;
|
||||||
|
|
||||||
private:
|
|
||||||
// True if this ChainShape is a loop.
|
|
||||||
bool loop;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // box2d
|
} // box2d
|
||||||
|
|||||||
Reference in New Issue
Block a user