1
0

Added manual bindings for moved functions

This commit is contained in:
Tycho 2014-01-22 10:35:36 -08:00
parent 1c320fa18c
commit 571200019d
3 changed files with 71 additions and 2 deletions

View File

@ -70,6 +70,7 @@ $cfile "../Generating/ChunkDesc.h"
$cfile "../CraftingRecipes.h" $cfile "../CraftingRecipes.h"
$cfile "../UI/Window.h" $cfile "../UI/Window.h"
$cfile "../Mobs/Monster.h" $cfile "../Mobs/Monster.h"
$cfile "../WorldStorage/SchematicFileSerilizer.h"

View File

@ -13,6 +13,7 @@
#include "../Entities/Player.h" #include "../Entities/Player.h"
#include "../WebAdmin.h" #include "../WebAdmin.h"
#include "../ClientHandle.h" #include "../ClientHandle.h"
#include "../BlockArea.h"
#include "../BlockEntities/ChestEntity.h" #include "../BlockEntities/ChestEntity.h"
#include "../BlockEntities/CommandBlockEntity.h" #include "../BlockEntities/CommandBlockEntity.h"
#include "../BlockEntities/DispenserEntity.h" #include "../BlockEntities/DispenserEntity.h"
@ -22,6 +23,7 @@
#include "../BlockEntities/NoteEntity.h" #include "../BlockEntities/NoteEntity.h"
#include "md5/md5.h" #include "md5/md5.h"
#include "../LineBlockTracer.h" #include "../LineBlockTracer.h"
#include "../WorldStorage/SchematicFileSerilizer.h"
@ -2234,6 +2236,65 @@ static int tolua_cHopperEntity_GetOutputBlockPos(lua_State * tolua_S)
static int tolua_cBlockArea_LoadFromSchematicFile(lua_State * tolua_S)
{
// function cBlockArea::LoadFromSchematicFile
// Exported manually because function has been moved to SchematicFileSerilizer.cpp
cLuaState L(tolua_S);
if (
!L.CheckParamUserType(1, "cBlockArea") ||
!L.CheckParamString (2) ||
!L.CheckParamEnd (3)
)
{
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, 0);
if (self == NULL)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::LoadFromSchematicFile'", NULL);
return 0;
}
AString Filename = tolua_tostring(tolua_S, 2, 0);
LOGWARNING("cBlockArea::LoadFromSchematic file is depreciated. Please use cSchematicFileSerilizer::LoadFromSchematicFile.");
bool res = cSchematicFileSerializer::LoadFromSchematicFile(*self,Filename);
tolua_pushboolean(tolua_S, res);
return 1;
}
static int tolua_cBlockArea_SaveToSchematicFile(lua_State * tolua_S)
{
// function cBlockArea::SaveToSchematicFile
// Exported manually because function has been moved to SchematicFileSerilizer.cpp
cLuaState L(tolua_S);
if (
!L.CheckParamUserType(1, "cBlockArea") ||
!L.CheckParamString (2) ||
!L.CheckParamEnd (3)
)
{
return 0;
}
cBlockArea * self = (cBlockArea *)tolua_tousertype(tolua_S, 1, 0);
if (self == NULL)
{
tolua_error(tolua_S, "invalid 'self' in function 'cBlockArea::SaveToSchematicFile'", NULL);
return 0;
}
AString Filename = tolua_tostring(tolua_S, 2, 0);
LOGWARNING("cBlockArea::SaveToSchematic file is depreciated. Please use cSchematicFileSerializer::SaveToSchematicFile.");
bool res = cSchematicFileSerializer::SaveToSchematicFile(*self,Filename);
tolua_pushboolean(tolua_S, res);
return 1;
}
void ManualBindings::Bind(lua_State * tolua_S) void ManualBindings::Bind(lua_State * tolua_S)
{ {
tolua_beginmodule(tolua_S, NULL); tolua_beginmodule(tolua_S, NULL);
@ -2250,6 +2311,11 @@ void ManualBindings::Bind(lua_State * tolua_S)
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cHopperEntity"); tolua_beginmodule(tolua_S, "cHopperEntity");
tolua_function(tolua_S, "LoadFromSchematicFile", tolua_cBlockArea_LoadFromSchematicFile);
tolua_function(tolua_S, "SaveToSchematicFile", tolua_cBlockArea_SaveToSchematicFile);
tolua_endmodule(tolua_S);
tolua_beginmodule(tolua_S, "cBlockArea");
tolua_function(tolua_S, "GetOutputBlockPos", tolua_cHopperEntity_GetOutputBlockPos); tolua_function(tolua_S, "GetOutputBlockPos", tolua_cHopperEntity_GetOutputBlockPos);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);

View File

@ -13,7 +13,7 @@ class cParsedNBT;
// tolua_begin
class cSchematicFileSerializer class cSchematicFileSerializer
{ {
public: public:
@ -24,7 +24,9 @@ public:
/// Saves the area into a .schematic file. Returns true if successful /// Saves the area into a .schematic file. Returns true if successful
static bool SaveToSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName); static bool SaveToSchematicFile(cBlockArea & a_BlockArea, const AString & a_FileName);
// tolua_end
private: private:
/// Loads the area from a schematic file uncompressed and parsed into a NBT tree. Returns true if successful. /// Loads the area from a schematic file uncompressed and parsed into a NBT tree. Returns true if successful.
static bool LoadFromSchematicNBT(cBlockArea & a_BlockArea, cParsedNBT & a_NBT); static bool LoadFromSchematicNBT(cBlockArea & a_BlockArea, cParsedNBT & a_NBT);
}; }; // tolua_export