diff --git a/src/modules/physics/box2d/Body.cpp b/src/modules/physics/box2d/Body.cpp index 16df904e0..92aa9e0e5 100644 --- a/src/modules/physics/box2d/Body.cpp +++ b/src/modules/physics/box2d/Body.cpp @@ -427,7 +427,7 @@ World *Body::getWorld() const return world; } -int Body::getFixtureList(lua_State *L) const +int Body::getFixtures(lua_State *L) const { lua_newtable(L); b2Fixture *f = body->GetFixtureList(); @@ -447,7 +447,7 @@ int Body::getFixtureList(lua_State *L) const return 1; } -int Body::getJointList(lua_State *L) const +int Body::getJoints(lua_State *L) const { lua_newtable(L); const b2JointEdge *je = body->GetJointList(); @@ -471,7 +471,7 @@ int Body::getJointList(lua_State *L) const return 1; } -int Body::getContactList(lua_State *L) const +int Body::getContacts(lua_State *L) const { lua_newtable(L); const b2ContactEdge *ce = body->GetContactList(); diff --git a/src/modules/physics/box2d/Body.h b/src/modules/physics/box2d/Body.h index 3c75224c7..992ee0087 100644 --- a/src/modules/physics/box2d/Body.h +++ b/src/modules/physics/box2d/Body.h @@ -391,19 +391,19 @@ public: * Get an array of all the Fixtures attached to this Body. * @return An array of Fixtures. **/ - int getFixtureList(lua_State *L) const; + int getFixtures(lua_State *L) const; /** * Get an array of all Joints attached to this Body. **/ - int getJointList(lua_State *L) const; + int getJoints(lua_State *L) const; /** * Get an array of all active Contacts attached to this Body. * This list changes during World:update and you may miss some collisions * if you don't use the collision callbacks. **/ - int getContactList(lua_State *L) const; + int getContacts(lua_State *L) const; /** * Destroy this body. diff --git a/src/modules/physics/box2d/World.cpp b/src/modules/physics/box2d/World.cpp index 1b39b3868..36876bb09 100644 --- a/src/modules/physics/box2d/World.cpp +++ b/src/modules/physics/box2d/World.cpp @@ -461,7 +461,7 @@ int World::getContactCount() const return world->GetContactCount(); } -int World::getBodyList(lua_State *L) const +int World::getBodies(lua_State *L) const { lua_newtable(L); b2Body *b = world->GetBodyList(); @@ -483,7 +483,7 @@ int World::getBodyList(lua_State *L) const return 1; } -int World::getJointList(lua_State *L) const +int World::getJoints(lua_State *L) const { lua_newtable(L); b2Joint *j = world->GetJointList(); @@ -501,7 +501,7 @@ int World::getJointList(lua_State *L) const return 1; } -int World::getContactList(lua_State *L) const +int World::getContacts(lua_State *L) const { lua_newtable(L); b2Contact *c = world->GetContactList(); diff --git a/src/modules/physics/box2d/World.h b/src/modules/physics/box2d/World.h index 0577c950e..e23c5d2ac 100644 --- a/src/modules/physics/box2d/World.h +++ b/src/modules/physics/box2d/World.h @@ -245,19 +245,19 @@ public: * Get an array of all the Bodies in the World. * @return An array of Bodies. **/ - int getBodyList(lua_State *L) const; + int getBodies(lua_State *L) const; /** * Get an array of all the Joints in the World. * @return An array of Joints. **/ - int getJointList(lua_State *L) const; + int getJoints(lua_State *L) const; /** * Get an array of all the Contacts in the World. * @return An array of Contacts. **/ - int getContactList(lua_State *L) const; + int getContacts(lua_State *L) const; /** * Gets the ground body. diff --git a/src/modules/physics/box2d/wrap_Body.cpp b/src/modules/physics/box2d/wrap_Body.cpp index b68c34085..16c13ccbf 100644 --- a/src/modules/physics/box2d/wrap_Body.cpp +++ b/src/modules/physics/box2d/wrap_Body.cpp @@ -530,30 +530,30 @@ int w_Body_getWorld(lua_State *L) return 1; } -int w_Body_getFixtureList(lua_State *L) +int w_Body_getFixtures(lua_State *L) { Body *t = luax_checkbody(L, 1); lua_remove(L, 1); int n = 0; - luax_catchexcept(L, [&](){ n = t->getFixtureList(L); }); + luax_catchexcept(L, [&](){ n = t->getFixtures(L); }); return n; } -int w_Body_getJointList(lua_State *L) +int w_Body_getJoints(lua_State *L) { Body *t = luax_checkbody(L, 1); lua_remove(L, 1); int n = 0; - luax_catchexcept(L, [&](){ n = t->getJointList(L); }); + luax_catchexcept(L, [&](){ n = t->getJoints(L); }); return n; } -int w_Body_getContactList(lua_State *L) +int w_Body_getContacts(lua_State *L) { Body *t = luax_checkbody(L, 1); lua_remove(L, 1); int n = 0; - luax_catchexcept(L, [&](){ n = t->getContactList(L); }); + luax_catchexcept(L, [&](){ n = t->getContacts(L); }); return n; } @@ -585,6 +585,24 @@ int w_Body_getUserData(lua_State *L) return t->getUserData(L); } +int w_Body_getFixtureList(lua_State *L) +{ + luax_markdeprecated(L, "Body:getFixtureList", API_METHOD, DEPRECATED_RENAMED, "Body:getFixtures"); + return w_Body_getFixtures(L); +} + +int w_Body_getJointList(lua_State *L) +{ + luax_markdeprecated(L, "Body:getJointList", API_METHOD, DEPRECATED_RENAMED, "Body:getJoints"); + return w_Body_getJoints(L); +} + +int w_Body_getContactList(lua_State *L) +{ + luax_markdeprecated(L, "Body:getContactList", API_METHOD, DEPRECATED_RENAMED, "Body:getContacts"); + return w_Body_getContacts(L); +} + static const luaL_Reg w_Body_functions[] = { { "getX", w_Body_getX }, @@ -638,13 +656,19 @@ static const luaL_Reg w_Body_functions[] = { "setFixedRotation", w_Body_setFixedRotation }, { "isFixedRotation", w_Body_isFixedRotation }, { "getWorld", w_Body_getWorld }, - { "getFixtureList", w_Body_getFixtureList }, - { "getJointList", w_Body_getJointList }, - { "getContactList", w_Body_getContactList }, + { "getFixtures", w_Body_getFixtures }, + { "getJoints", w_Body_getJoints }, + { "getContacts", w_Body_getContacts }, { "destroy", w_Body_destroy }, { "isDestroyed", w_Body_isDestroyed }, { "setUserData", w_Body_setUserData }, { "getUserData", w_Body_getUserData }, + + // Deprectaed + { "getFixtureList", w_Body_getFixtureList }, + { "getJointList", w_Body_getJointList }, + { "getContactList", w_Body_getContactList }, + { 0, 0 } }; diff --git a/src/modules/physics/box2d/wrap_World.cpp b/src/modules/physics/box2d/wrap_World.cpp index 6230ad17e..f70c7c932 100644 --- a/src/modules/physics/box2d/wrap_World.cpp +++ b/src/modules/physics/box2d/wrap_World.cpp @@ -151,30 +151,30 @@ int w_World_getContactCount(lua_State *L) return 1; } -int w_World_getBodyList(lua_State *L) +int w_World_getBodies(lua_State *L) { World *t = luax_checkworld(L, 1); lua_remove(L, 1); int ret = 0; - luax_catchexcept(L, [&](){ ret = t->getBodyList(L); }); + luax_catchexcept(L, [&](){ ret = t->getBodies(L); }); return ret; } -int w_World_getJointList(lua_State *L) +int w_World_getJoints(lua_State *L) { World *t = luax_checkworld(L, 1); lua_remove(L, 1); int ret = 0; - luax_catchexcept(L, [&](){ ret = t->getJointList(L); }); + luax_catchexcept(L, [&](){ ret = t->getJoints(L); }); return ret; } -int w_World_getContactList(lua_State *L) +int w_World_getContacts(lua_State *L) { World *t = luax_checkworld(L, 1); lua_remove(L, 1); int ret = 0; - luax_catchexcept(L, [&](){ ret = t->getContactList(L); }); + luax_catchexcept(L, [&](){ ret = t->getContacts(L); }); return ret; } @@ -208,6 +208,23 @@ int w_World_isDestroyed(lua_State *L) return 1; } +int w_World_getBodyList(lua_State *L) +{ + luax_markdeprecated(L, "World:getBodyList", API_METHOD, DEPRECATED_RENAMED, "World:getBodies"); + return w_World_getBodies(L); +} + +int w_World_getJointList(lua_State *L) +{ + luax_markdeprecated(L, "World:getJointList", API_METHOD, DEPRECATED_RENAMED, "World:getJoints"); + return w_World_getJoints(L); +} + +int w_World_getContactList(lua_State *L) +{ + luax_markdeprecated(L, "World:getContactList", API_METHOD, DEPRECATED_RENAMED, "World:getContacts"); + return w_World_getContacts(L); +} static const luaL_Reg w_World_functions[] = { @@ -225,13 +242,19 @@ static const luaL_Reg w_World_functions[] = { "getBodyCount", w_World_getBodyCount }, { "getJointCount", w_World_getJointCount }, { "getContactCount", w_World_getContactCount }, - { "getBodyList", w_World_getBodyList }, - { "getJointList", w_World_getJointList }, - { "getContactList", w_World_getContactList }, + { "getBodies", w_World_getBodies }, + { "getJoints", w_World_getJoints }, + { "getContacts", w_World_getContacts }, { "queryBoundingBox", w_World_queryBoundingBox }, { "rayCast", w_World_rayCast }, { "destroy", w_World_destroy }, { "isDestroyed", w_World_isDestroyed }, + + // Deprecated + { "getBodyList", w_World_getBodyList }, + { "getJointList", w_World_getJointList }, + { "getContactList", w_World_getContactList }, + { 0, 0 } };