From d147bcf2660f08d53d8f7f50f4167d2858354f9b Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 28 Jun 2012 00:05:45 +0800 Subject: [PATCH] fixed #1369: Invoking CCLabelTTF:setPosition(x,y) in lua script causes crash. --- lua/cocos2dx_support/LuaCocos2d.cpp | 43 +++++------------------------ tools/tolua++/CCNode.pkg | 1 - 2 files changed, 7 insertions(+), 37 deletions(-) diff --git a/lua/cocos2dx_support/LuaCocos2d.cpp b/lua/cocos2dx_support/LuaCocos2d.cpp index 95b4c2c0005c..045538ed12cb 100644 --- a/lua/cocos2dx_support/LuaCocos2d.cpp +++ b/lua/cocos2dx_support/LuaCocos2d.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: Cocos2d -** Generated automatically by tolua++-1.0.92 on 06/27/12 13:55:52. +** Generated automatically by tolua++-1.0.92 on 06/28/12 00:04:38. */ #include @@ -16849,38 +16849,6 @@ static int tolua_Cocos2d_CCNode_getPositionY00(lua_State* tolua_S) static int tolua_Cocos2d_CCNode_setPosition00(lua_State* tolua_S) { #ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"CCNode",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"CCPoint",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - CCNode* self = (CCNode*) tolua_tousertype(tolua_S,1,0); - CCPoint newPosition = *((CCPoint*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'setPosition'", NULL); -#endif - { - self->setPosition(newPosition); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'setPosition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: setPosition of class CCNode */ -#ifndef TOLUA_DISABLE_tolua_Cocos2d_CCNode_setPosition01 -static int tolua_Cocos2d_CCNode_setPosition01(lua_State* tolua_S) -{ tolua_Error tolua_err; if ( !tolua_isusertype(tolua_S,1,"CCNode",0,&tolua_err) || @@ -16890,6 +16858,7 @@ static int tolua_Cocos2d_CCNode_setPosition01(lua_State* tolua_S) ) goto tolua_lerror; else +#endif { CCNode* self = (CCNode*) tolua_tousertype(tolua_S,1,0); float x = ((float) tolua_tonumber(tolua_S,2,0)); @@ -16902,8 +16871,11 @@ static int tolua_Cocos2d_CCNode_setPosition01(lua_State* tolua_S) } } return 0; -tolua_lerror: - return tolua_Cocos2d_CCNode_setPosition00(tolua_S); +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'setPosition'.",&tolua_err); + return 0; +#endif } #endif //#ifndef TOLUA_DISABLE @@ -38237,7 +38209,6 @@ TOLUA_API int tolua_Cocos2d_open (lua_State* tolua_S) tolua_function(tolua_S,"getPositionX",tolua_Cocos2d_CCNode_getPositionX00); tolua_function(tolua_S,"getPositionY",tolua_Cocos2d_CCNode_getPositionY00); tolua_function(tolua_S,"setPosition",tolua_Cocos2d_CCNode_setPosition00); - tolua_function(tolua_S,"setPosition",tolua_Cocos2d_CCNode_setPosition01); tolua_function(tolua_S,"setPositionX",tolua_Cocos2d_CCNode_setPositionX00); tolua_function(tolua_S,"setPositionY",tolua_Cocos2d_CCNode_setPositionY00); tolua_function(tolua_S,"getSkewX",tolua_Cocos2d_CCNode_getSkewX00); diff --git a/tools/tolua++/CCNode.pkg b/tools/tolua++/CCNode.pkg index fa41e72604bf..9fc60990af94 100644 --- a/tools/tolua++/CCNode.pkg +++ b/tools/tolua++/CCNode.pkg @@ -21,7 +21,6 @@ class CCNode : public CCObject void getPosition(float* x = 0, float* y = 0); float getPositionX(); float getPositionY(); - void setPosition(CCPoint newPosition); void setPosition(float x, float y); void setPositionX(float x); void setPositionY(float y);