Build type information on first use (load-time), instead of using a hardcoded list

--HG--
branch : dynamiccore2
This commit is contained in:
Bart van Strien
2016-11-13 16:38:57 +01:00
parent 452a8a877e
commit c761202486
192 changed files with 734 additions and 614 deletions
+5 -5
View File
@@ -30,7 +30,7 @@ namespace box2d
Contact *luax_checkcontact(lua_State *L, int idx)
{
Contact *c = luax_checktype<Contact>(L, idx, PHYSICS_CONTACT_ID);
Contact *c = luax_checktype<Contact>(L, idx, Contact::type);
if (!c->isValid())
luaL_error(L, "Attempt to use destroyed contact.");
return c;
@@ -146,14 +146,14 @@ int w_Contact_getFixtures(lua_State *L)
Fixture *b = nullptr;
luax_catchexcept(L, [&](){ t->getFixtures(a, b); });
luax_pushtype(L, PHYSICS_FIXTURE_ID, a);
luax_pushtype(L, PHYSICS_FIXTURE_ID, b);
luax_pushtype(L, Fixture::type, a);
luax_pushtype(L, Fixture::type, b);
return 2;
}
int w_Contact_isDestroyed(lua_State *L)
{
Contact *c = luax_checktype<Contact>(L, 1, PHYSICS_CONTACT_ID);
Contact *c = luax_checktype<Contact>(L, 1, Contact::type);
luax_pushboolean(L, !c->isValid());
return 1;
}
@@ -181,7 +181,7 @@ static const luaL_Reg w_Contact_functions[] =
extern "C" int luaopen_contact(lua_State *L)
{
return luax_register_type(L, PHYSICS_CONTACT_ID, "Contact", w_Contact_functions, nullptr);
return luax_register_type(L, Contact::type, "Contact", w_Contact_functions, nullptr);
}
} // box2d