From 49d6afd501c16a782881e30bce2f908d730ce767 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 15 Nov 2013 10:15:27 +0100 Subject: Removed cBlockEntity:CreateByBlockType() from the Lua API. Plugins cannot be allowed to create block entities, that would result in memory leaks. --- source/Bindings.cpp | 43 +------------------------------------- source/Bindings.h | 2 +- source/BlockEntities/BlockEntity.h | 4 ++-- 3 files changed, 4 insertions(+), 45 deletions(-) (limited to 'source') diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 583bbfeb7..93c66d233 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/15/13 09:35:12. +** Generated automatically by tolua++-1.0.92 on 11/15/13 10:14:19. */ #ifndef __cplusplus @@ -17578,46 +17578,6 @@ tolua_lerror: } #endif //#ifndef TOLUA_DISABLE -/* method: CreateByBlockType of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_CreateByBlockType00 -static int tolua_AllToLua_cBlockEntity_CreateByBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBlockEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isusertype(tolua_S,7,"cWorld",1,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - int a_BlockX = ((int) tolua_tonumber(tolua_S,4,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,6,0)); - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,7,NULL)); - { - cBlockEntity* tolua_ret = (cBlockEntity*) cBlockEntity::CreateByBlockType(a_BlockType,a_BlockMeta,a_BlockX,a_BlockY,a_BlockZ,a_World); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockEntity"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CreateByBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* method: GetPosX of class cBlockEntity */ #ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosX00 static int tolua_AllToLua_cBlockEntity_GetPosX00(lua_State* tolua_S) @@ -30932,7 +30892,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_cclass(tolua_S,"cBlockEntity","cBlockEntity","",NULL); #endif tolua_beginmodule(tolua_S,"cBlockEntity"); - tolua_function(tolua_S,"CreateByBlockType",tolua_AllToLua_cBlockEntity_CreateByBlockType00); tolua_function(tolua_S,"GetPosX",tolua_AllToLua_cBlockEntity_GetPosX00); tolua_function(tolua_S,"GetPosY",tolua_AllToLua_cBlockEntity_GetPosY00); tolua_function(tolua_S,"GetPosZ",tolua_AllToLua_cBlockEntity_GetPosZ00); diff --git a/source/Bindings.h b/source/Bindings.h index a853b3521..13f398a4d 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/15/13 09:35:13. +** Generated automatically by tolua++-1.0.92 on 11/15/13 10:14:20. */ /* Exported function */ diff --git a/source/BlockEntities/BlockEntity.h b/source/BlockEntities/BlockEntity.h index 6a6ffb448..a2de3160a 100644 --- a/source/BlockEntities/BlockEntity.h +++ b/source/BlockEntities/BlockEntity.h @@ -47,13 +47,13 @@ public: m_World = a_World; } - // tolua_begin - /// Creates a new block entity for the specified block type /// If a_World is valid, then the entity is created bound to that world /// Returns NULL for unknown block types static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World = NULL); + // tolua_begin + // Position, in absolute block coordinates: int GetPosX(void) const { return m_PosX; } int GetPosY(void) const { return m_PosY; } -- cgit v1.2.3