From b8a27932286a4626b1b202a7f521d609073c1ea9 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 23 Oct 2013 12:09:11 +0200 Subject: [PATCH] Fixed bindings for cHopperEntity:GetOutputBlockPos(). --- source/Bindings.cpp | 46 +---------------------------- source/Bindings.h | 2 +- source/BlockEntities/HopperEntity.h | 7 ++--- source/ManualBindings.cpp | 44 +++++++++++++++++++++++++++ 4 files changed, 48 insertions(+), 51 deletions(-) diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 87ea32e19..7b689caec 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/23/13 11:13:15. +** Generated automatically by tolua++-1.0.92 on 10/23/13 12:07:27. */ #ifndef __cplusplus @@ -18924,49 +18924,6 @@ static int tolua_AllToLua_cHopperEntity_new00_local(lua_State* tolua_S) } #endif //#ifndef TOLUA_DISABLE -/* method: GetOutputBlockPos of class cHopperEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cHopperEntity_GetOutputBlockPos00 -static int tolua_AllToLua_cHopperEntity_GetOutputBlockPos00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cHopperEntity",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_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cHopperEntity* self = (cHopperEntity*) tolua_tousertype(tolua_S,1,0); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,2,0)); - int a_OutputX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_OutputY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_OutputZ = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOutputBlockPos'", NULL); -#endif - { - bool tolua_ret = (bool) self->GetOutputBlockPos(a_BlockMeta,a_OutputX,a_OutputY,a_OutputZ); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushnumber(tolua_S,(lua_Number)a_OutputX); - tolua_pushnumber(tolua_S,(lua_Number)a_OutputY); - tolua_pushnumber(tolua_S,(lua_Number)a_OutputZ); - } - } - return 4; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetOutputBlockPos'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - /* get function: Name of class HTTPFormData */ #ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Name static int tolua_get_HTTPFormData_Name(lua_State* tolua_S) @@ -31034,7 +30991,6 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) tolua_function(tolua_S,"new",tolua_AllToLua_cHopperEntity_new00); tolua_function(tolua_S,"new_local",tolua_AllToLua_cHopperEntity_new00_local); tolua_function(tolua_S,".call",tolua_AllToLua_cHopperEntity_new00_local); - tolua_function(tolua_S,"GetOutputBlockPos",tolua_AllToLua_cHopperEntity_GetOutputBlockPos00); tolua_endmodule(tolua_S); tolua_cclass(tolua_S,"HTTPFormData","HTTPFormData","",NULL); tolua_beginmodule(tolua_S,"HTTPFormData"); diff --git a/source/Bindings.h b/source/Bindings.h index 3d2114d89..85dec30fb 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /* ** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 10/23/13 11:13:15. +** Generated automatically by tolua++-1.0.92 on 10/23/13 12:07:28. */ /* Exported function */ diff --git a/source/BlockEntities/HopperEntity.h b/source/BlockEntities/HopperEntity.h index 9e69f15c3..1a7650581 100644 --- a/source/BlockEntities/HopperEntity.h +++ b/source/BlockEntities/HopperEntity.h @@ -38,15 +38,12 @@ public: /// Constructor used for normal operation cHopperEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World); - // tolua_begin - /** Returns the block coords of the block receiving the output items, based on the meta - Returns false if unattached + Returns false if unattached. + Exported in ManualBindings.cpp */ bool GetOutputBlockPos(NIBBLETYPE a_BlockMeta, int & a_OutputX, int & a_OutputY, int & a_OutputZ); - // tolua_end - static const char * GetClassStatic(void) { return "cHopperEntity"; } protected: diff --git a/source/ManualBindings.cpp b/source/ManualBindings.cpp index e6605ddb0..466701bf8 100644 --- a/source/ManualBindings.cpp +++ b/source/ManualBindings.cpp @@ -17,6 +17,7 @@ #include "BlockEntities/DispenserEntity.h" #include "BlockEntities/DropperEntity.h" #include "BlockEntities/FurnaceEntity.h" +#include "BlockEntities/HopperEntity.h" #include "md5/md5.h" #include "LuaWindow.h" #include "LineBlockTracer.h" @@ -2059,6 +2060,45 @@ static int tolua_cLineBlockTracer_Trace(lua_State * tolua_S) +static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S) +{ + // function cHopperEntity::GetOutputBlockPos() + // Exported manually because tolua would require meaningless params + + cLuaState L(tolua_S); + if ( + !L.CheckParamUserType(1, "cHopperEntity") || + !L.CheckParamNumber (2) || + !L.CheckParamEnd (3) + ) + { + return 0; + } + cHopperEntity * self = (cHopperEntity *)tolua_tousertype(tolua_S, 1, 0); + if (self == NULL) + { + tolua_error(tolua_S, "invalid 'self' in function 'cHopperEntity::GetOutputBlockPos()'", NULL); + return 0; + } + + NIBBLETYPE a_BlockMeta = ((NIBBLETYPE)tolua_tonumber(tolua_S, 2, 0)); + int a_OutputX, a_OutputY, a_OutputZ; + bool res = self->GetOutputBlockPos(a_BlockMeta, a_OutputX, a_OutputY, a_OutputZ); + tolua_pushboolean(tolua_S, res); + if (res) + { + tolua_pushnumber(tolua_S, (lua_Number)a_OutputX); + tolua_pushnumber(tolua_S, (lua_Number)a_OutputY); + tolua_pushnumber(tolua_S, (lua_Number)a_OutputZ); + return 4; + } + return 1; +} + + + + + void ManualBindings::Bind(lua_State * tolua_S) { tolua_beginmodule(tolua_S, NULL); @@ -2070,6 +2110,10 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_function(tolua_S, "LOGWARNING", tolua_LOGWARN); tolua_function(tolua_S, "LOGERROR", tolua_LOGERROR); + tolua_beginmodule(tolua_S, "cHopperEntity"); + tolua_function(tolua_S, "GetOutputBlockPos", tolua_cHopperEntity_GetOutputBlockPos); + tolua_endmodule(tolua_S); + tolua_beginmodule(tolua_S, "cLineBlockTracer"); tolua_function(tolua_S, "Trace", tolua_cLineBlockTracer_Trace); tolua_endmodule(tolua_S);