Browse Source

Rename PrismaticJoint/RevoluteJoint:hasLimitsEnabled to areLimitsEnabled and deprecate the old methods (resolves issue #1324).

--HG--
branch : minor
Alex Szpakowski 8 years ago
parent
commit
d8eb6e6012

+ 1 - 1
src/modules/physics/box2d/PrismaticJoint.cpp

@@ -117,7 +117,7 @@ void PrismaticJoint::setLimitsEnabled(bool enable)
 	joint->EnableLimit(enable);
 }
 
-bool PrismaticJoint::hasLimitsEnabled() const
+bool PrismaticJoint::areLimitsEnabled() const
 {
 	return joint->IsLimitEnabled();
 }

+ 1 - 1
src/modules/physics/box2d/PrismaticJoint.h

@@ -104,7 +104,7 @@ public:
 	/**
 	 * Checks whether limits are enabled.
 	 **/
-	bool hasLimitsEnabled() const;
+	bool areLimitsEnabled() const;
 
 	/**
 	 * Sets the upper limit, usually in meters.

+ 1 - 1
src/modules/physics/box2d/RevoluteJoint.cpp

@@ -116,7 +116,7 @@ void RevoluteJoint::setLimitsEnabled(bool enable)
 	joint->EnableLimit(enable);
 }
 
-bool RevoluteJoint::hasLimitsEnabled() const
+bool RevoluteJoint::areLimitsEnabled() const
 {
 	return joint->IsLimitEnabled();
 }

+ 1 - 1
src/modules/physics/box2d/RevoluteJoint.h

@@ -104,7 +104,7 @@ public:
 	/**
 	 * Checks whether limits are enabled.
 	 **/
-	bool hasLimitsEnabled() const;
+	bool areLimitsEnabled() const;
 
 	/**
 	 * Sets the upper limit in degrees.

+ 13 - 3
src/modules/physics/box2d/wrap_PrismaticJoint.cpp

@@ -111,10 +111,10 @@ int w_PrismaticJoint_setLimitsEnabled(lua_State *L)
 	return 0;
 }
 
-int w_PrismaticJoint_hasLimitsEnabled(lua_State *L)
+int w_PrismaticJoint_areLimitsEnabled(lua_State *L)
 {
 	PrismaticJoint *t = luax_checkprismaticjoint(L, 1);
-	luax_pushboolean(L, t->hasLimitsEnabled());
+	luax_pushboolean(L, t->areLimitsEnabled());
 	return 1;
 }
 
@@ -178,6 +178,12 @@ int w_PrismaticJoint_getReferenceAngle(lua_State *L)
 	return 1;
 }
 
+int w_PrismaticJoint_hasLimitsEnabled(lua_State *L)
+{
+	luax_markdeprecated(L, "PrismaticJoint:hasLimitsEnabled", DEPRECATED_RENAMED, "PrismaticJoint:areLimitsEnabled");
+	return w_PrismaticJoint_areLimitsEnabled(L);
+}
+
 static const luaL_Reg w_PrismaticJoint_functions[] =
 {
 	{ "getJointTranslation", w_PrismaticJoint_getJointTranslation },
@@ -190,7 +196,7 @@ static const luaL_Reg w_PrismaticJoint_functions[] =
 	{ "getMotorForce", w_PrismaticJoint_getMotorForce },
 	{ "getMaxMotorForce", w_PrismaticJoint_getMaxMotorForce },
 	{ "setLimitsEnabled", w_PrismaticJoint_setLimitsEnabled },
-	{ "hasLimitsEnabled", w_PrismaticJoint_hasLimitsEnabled },
+	{ "areLimitsEnabled", w_PrismaticJoint_areLimitsEnabled },
 	{ "setUpperLimit", w_PrismaticJoint_setUpperLimit },
 	{ "setLowerLimit", w_PrismaticJoint_setLowerLimit },
 	{ "setLimits", w_PrismaticJoint_setLimits },
@@ -199,6 +205,10 @@ static const luaL_Reg w_PrismaticJoint_functions[] =
 	{ "getLimits", w_PrismaticJoint_getLimits },
 	{ "getAxis", w_PrismaticJoint_getAxis },
 	{ "getReferenceAngle", w_PrismaticJoint_getReferenceAngle },
+
+	// Deprecated
+	{ "hasLimitsEnabled", w_PrismaticJoint_hasLimitsEnabled },
+
 	{ 0, 0 }
 };
 

+ 13 - 3
src/modules/physics/box2d/wrap_RevoluteJoint.cpp

@@ -111,10 +111,10 @@ int w_RevoluteJoint_setLimitsEnabled(lua_State *L)
 	return 0;
 }
 
-int w_RevoluteJoint_hasLimitsEnabled(lua_State *L)
+int w_RevoluteJoint_areLimitsEnabled(lua_State *L)
 {
 	RevoluteJoint *t = luax_checkrevolutejoint(L, 1);
-	luax_pushboolean(L, t->hasLimitsEnabled());
+	luax_pushboolean(L, t->areLimitsEnabled());
 	return 1;
 }
 
@@ -171,6 +171,12 @@ int w_RevoluteJoint_getReferenceAngle(lua_State *L)
 	return 1;
 }
 
+int w_RevoluteJoint_hasLimitsEnabled(lua_State *L)
+{
+	luax_markdeprecated(L, "RevoluteJoint:hasLimitsEnabled", DEPRECATED_RENAMED, "RevoluteJoint:areLimitsEnabled");
+	return w_RevoluteJoint_areLimitsEnabled(L);
+}
+
 static const luaL_Reg w_RevoluteJoint_functions[] =
 {
 	{ "getJointAngle", w_RevoluteJoint_getJointAngle },
@@ -183,7 +189,7 @@ static const luaL_Reg w_RevoluteJoint_functions[] =
 	{ "getMotorTorque", w_RevoluteJoint_getMotorTorque },
 	{ "getMaxMotorTorque", w_RevoluteJoint_getMaxMotorTorque },
 	{ "setLimitsEnabled", w_RevoluteJoint_setLimitsEnabled },
-	{ "hasLimitsEnabled", w_RevoluteJoint_hasLimitsEnabled },
+	{ "areLimitsEnabled", w_RevoluteJoint_areLimitsEnabled },
 	{ "setUpperLimit", w_RevoluteJoint_setUpperLimit },
 	{ "setLowerLimit", w_RevoluteJoint_setLowerLimit },
 	{ "setLimits", w_RevoluteJoint_setLimits },
@@ -191,6 +197,10 @@ static const luaL_Reg w_RevoluteJoint_functions[] =
 	{ "getUpperLimit", w_RevoluteJoint_getUpperLimit },
 	{ "getLimits", w_RevoluteJoint_getLimits },
 	{ "getReferenceAngle", w_RevoluteJoint_getReferenceAngle },
+
+	// Deprecated
+	{ "hasLimitsEnabled", w_RevoluteJoint_hasLimitsEnabled },
+
 	{ 0, 0 }
 };
 

+ 1 - 1
src/modules/sound/wrap_Sound.cpp

@@ -53,7 +53,7 @@ int w_newDecoder(lua_State *L)
 
 int w_newSoundData(lua_State *L)
 {
-	SoundData *t = 0;
+	SoundData *t = nullptr;
 
 	if (lua_isnumber(L, 1))
 	{