mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Build type information on first use (load-time), instead of using a hardcoded list
--HG-- branch : dynamiccore2
This commit is contained in:
@@ -30,7 +30,7 @@ namespace box2d
|
||||
|
||||
Fixture *luax_checkfixture(lua_State *L, int idx)
|
||||
{
|
||||
Fixture *f = luax_checktype<Fixture>(L, idx, PHYSICS_FIXTURE_ID);
|
||||
Fixture *f = luax_checktype<Fixture>(L, idx, Fixture::type);
|
||||
if (!f->isValid())
|
||||
luaL_error(L, "Attempt to use destroyed fixture.");
|
||||
return f;
|
||||
@@ -111,7 +111,7 @@ int w_Fixture_getBody(lua_State *L)
|
||||
Body *body = t->getBody();
|
||||
if (body == 0)
|
||||
return 0;
|
||||
luax_pushtype(L, PHYSICS_BODY_ID, body);
|
||||
luax_pushtype(L, Body::type, body);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -124,19 +124,19 @@ int w_Fixture_getShape(lua_State *L)
|
||||
switch (shape->getType())
|
||||
{
|
||||
case Shape::SHAPE_EDGE:
|
||||
luax_pushtype(L, PHYSICS_EDGE_SHAPE_ID, shape);
|
||||
luax_pushtype(L, EdgeShape::type, shape);
|
||||
break;
|
||||
case Shape::SHAPE_CHAIN:
|
||||
luax_pushtype(L, PHYSICS_CHAIN_SHAPE_ID, shape);
|
||||
luax_pushtype(L, ChainShape::type, shape);
|
||||
break;
|
||||
case Shape::SHAPE_CIRCLE:
|
||||
luax_pushtype(L, PHYSICS_CIRCLE_SHAPE_ID, shape);
|
||||
luax_pushtype(L, CircleShape::type, shape);
|
||||
break;
|
||||
case Shape::SHAPE_POLYGON:
|
||||
luax_pushtype(L, PHYSICS_POLYGON_SHAPE_ID, shape);
|
||||
luax_pushtype(L, PolygonShape::type, shape);
|
||||
break;
|
||||
default:
|
||||
luax_pushtype(L, PHYSICS_SHAPE_ID, shape);
|
||||
luax_pushtype(L, Shape::type, shape);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
@@ -263,7 +263,7 @@ int w_Fixture_destroy(lua_State *L)
|
||||
|
||||
int w_Fixture_isDestroyed(lua_State *L)
|
||||
{
|
||||
Fixture *f = luax_checktype<Fixture>(L, 1, PHYSICS_FIXTURE_ID);
|
||||
Fixture *f = luax_checktype<Fixture>(L, 1, Fixture::type);
|
||||
luax_pushboolean(L, !f->isValid());
|
||||
return 1;
|
||||
}
|
||||
@@ -302,7 +302,7 @@ static const luaL_Reg w_Fixture_functions[] =
|
||||
|
||||
extern "C" int luaopen_fixture(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, PHYSICS_FIXTURE_ID, "Fixture", w_Fixture_functions, nullptr);
|
||||
return luax_register_type(L, Fixture::type, "Fixture", w_Fixture_functions, nullptr);
|
||||
}
|
||||
|
||||
} // box2d
|
||||
|
||||
Reference in New Issue
Block a user