bounds check ChainShape:getPoint, and make functions that take indices 1-indexed on the Lua end of things

This commit is contained in:
Bill Meltsner
2012-02-04 19:38:11 -05:00
parent 83f7002f67
commit ddb1492c1f
4 changed files with 11 additions and 7 deletions
+2
View File
@@ -99,6 +99,8 @@ namespace box2d
b2Vec2 ChainShape::getPoint(int index) const
{
b2ChainShape * c = (b2ChainShape *)shape;
if (index < 0 || index >= c->m_count)
throw love::Exception("Physics error: index out of bounds");
const b2Vec2 & v = c->m_vertices[index];
return Physics::scaleUp(v);
}