Added Body/Contact/Fixture/Joint/World:isDestroyed (resolves issue #964.)

This commit is contained in:
Alex Szpakowski
2015-01-05 00:14:41 -04:00
parent be9b5b5d1a
commit 91062a1496
21 changed files with 56 additions and 0 deletions
+8
View File
@@ -564,6 +564,13 @@ int w_Body_destroy(lua_State *L)
return 0;
}
int w_Body_isDestroyed(lua_State *L)
{
Body *b = luax_checktype<Body>(L, 1, "Body", PHYSICS_BODY_T);
luax_pushboolean(L, b->body == nullptr);
return 1;
}
int w_Body_setUserData(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
@@ -635,6 +642,7 @@ static const luaL_Reg functions[] =
{ "getJointList", w_Body_getJointList },
{ "getContactList", w_Body_getContactList },
{ "destroy", w_Body_destroy },
{ "isDestroyed", w_Body_isDestroyed },
{ "setUserData", w_Body_setUserData },
{ "getUserData", w_Body_getUserData },
{ 0, 0 }
+1
View File
@@ -88,6 +88,7 @@ int w_Body_getFixtureList(lua_State *L);
int w_Body_getJointList(lua_State *L);
int w_Body_getContactList(lua_State *L);
int w_Body_destroy(lua_State *L);
int w_Body_isDestroyed(lua_State *L);
int w_Body_setUserData(lua_State *L);
int w_Body_getUserData(lua_State *L);
extern "C" int luaopen_body(lua_State *L);
@@ -151,6 +151,13 @@ int w_Contact_getFixtures(lua_State *L)
return 2;
}
int w_Contact_isDestroyed(lua_State *L)
{
Contact *c = luax_checktype<Contact>(L, 1, "Contact", PHYSICS_CONTACT_T);
luax_pushboolean(L, !c->isValid());
return 1;
}
extern "C" int luaopen_contact(lua_State *L)
{
static const luaL_Reg functions[] =
@@ -170,6 +177,7 @@ extern "C" int luaopen_contact(lua_State *L)
{ "getTangentSpeed", w_Contact_getTangentSpeed },
{ "getChildren", w_Contact_getChildren },
{ "getFixtures", w_Contact_getFixtures },
{ "isDestroyed", w_Contact_isDestroyed },
{ 0, 0 }
};
+1
View File
@@ -48,6 +48,7 @@ int w_Contact_setTangentSpeed(lua_State *L);
int w_Contact_getTangentSpeed(lua_State *L);
int w_Contact_getChildren(lua_State *L);
int w_Contact_getFixtures(lua_State *L);
int w_Contact_isDestroyed(lua_State *L);
extern "C" int luaopen_contact(lua_State *L);
} // box2d
@@ -98,6 +98,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -262,6 +262,13 @@ int w_Fixture_destroy(lua_State *L)
return 0;
}
int w_Fixture_isDestroyed(lua_State *L)
{
Fixture *f = luax_checktype<Fixture>(L, 1, "Fixture", PHYSICS_FIXTURE_T);
luax_pushboolean(L, !f->isValid());
return 1;
}
static const luaL_Reg functions[] =
{
{ "getType", w_Fixture_getType },
@@ -290,6 +297,7 @@ static const luaL_Reg functions[] =
{ "getGroupIndex", w_Fixture_getGroupIndex },
{ "setGroupIndex", w_Fixture_setGroupIndex },
{ "destroy", w_Fixture_destroy },
{ "isDestroyed", w_Fixture_isDestroyed },
{ 0, 0 }
};
+1
View File
@@ -60,6 +60,7 @@ int w_Fixture_getMassData(lua_State *L);
int w_Fixture_getGroupIndex(lua_State *L);
int w_Fixture_setGroupIndex(lua_State *L);
int w_Fixture_destroy(lua_State *L);
int w_Fixture_isDestroyed(lua_State *L);
extern "C" int luaopen_fixture(lua_State *L);
} // box2d
@@ -82,6 +82,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -82,6 +82,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
+8
View File
@@ -147,6 +147,13 @@ int w_Joint_destroy(lua_State *L)
return 0;
}
int w_Joint_isDestroyed(lua_State *L)
{
Joint *t = luax_checktype<Joint>(L, 1, "Joint", PHYSICS_JOINT_T);
luax_pushboolean(L, !t->isValid());
return 1;
}
static const luaL_Reg functions[] =
{
{ "getType", w_Joint_getType },
@@ -158,6 +165,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
+1
View File
@@ -43,6 +43,7 @@ int w_Joint_getCollideConnected(lua_State *L);
int w_Joint_setUserData(lua_State *L);
int w_Joint_getUserData(lua_State *L);
int w_Joint_destroy(lua_State *L);
int w_Joint_isDestroyed(lua_State *L);
extern "C" int luaopen_joint(lua_State *L);
} // box2d
@@ -132,6 +132,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -116,6 +116,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -193,6 +193,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -79,6 +79,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -193,6 +193,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -55,6 +55,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -81,6 +81,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
@@ -157,6 +157,7 @@ static const luaL_Reg functions[] =
{ "setUserData", w_Joint_setUserData },
{ "getUserData", w_Joint_getUserData },
{ "destroy", w_Joint_destroy },
{ "isDestroyed", w_Joint_isDestroyed },
{ 0, 0 }
};
+8
View File
@@ -189,6 +189,13 @@ int w_World_destroy(lua_State *L)
return 0;
}
int w_World_isDestroyed(lua_State *L)
{
World *w = luax_checktype<World>(L, 1, "World", PHYSICS_WORLD_T);
luax_pushboolean(L, !w->isValid());
return 1;
}
static const luaL_Reg functions[] =
{
@@ -212,6 +219,7 @@ static const luaL_Reg functions[] =
{ "queryBoundingBox", w_World_queryBoundingBox },
{ "rayCast", w_World_rayCast },
{ "destroy", w_World_destroy },
{ "isDestroyed", w_World_isDestroyed },
{ 0, 0 }
};
+1
View File
@@ -55,6 +55,7 @@ int w_World_getContactList(lua_State *L);
int w_World_queryBoundingBox(lua_State *L);
int w_World_rayCast(lua_State *L);
int w_World_destroy(lua_State *L);
int w_World_isDestroyed(lua_State *L);
extern "C" int luaopen_world(lua_State *L);
} // box2d