summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--VC2008/GenerateBindings.cmd3
-rw-r--r--VC2008/MCServer.vcproj45
-rw-r--r--source/AllToLua.pkg18
-rw-r--r--source/Bindings.cpp1043
-rw-r--r--source/Bindings.h2
-rw-r--r--source/BlockArea.cpp626
-rw-r--r--source/BlockArea.h138
-rw-r--r--source/ChunkDef.h6
-rw-r--r--source/cChunkMap.cpp29
-rw-r--r--source/cChunkMap.h3
-rw-r--r--source/cWorld.cpp11
-rw-r--r--source/cWorld.h3
12 files changed, 1888 insertions, 39 deletions
diff --git a/VC2008/GenerateBindings.cmd b/VC2008/GenerateBindings.cmd
new file mode 100644
index 000000000..73670d5e8
--- /dev/null
+++ b/VC2008/GenerateBindings.cmd
@@ -0,0 +1,3 @@
+set ALLTOLUA_WAIT=N
+cd ..\source
+AllToLua.bat \ No newline at end of file
diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj
index 058f8be77..8c47ec37e 100644
--- a/VC2008/MCServer.vcproj
+++ b/VC2008/MCServer.vcproj
@@ -266,6 +266,14 @@
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
+ RelativePath="..\source\BlockArea.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\source\BlockArea.h"
+ >
+ </File>
+ <File
RelativePath="..\source\BlockID.cpp"
>
</File>
@@ -1605,6 +1613,43 @@
Name="Bindings"
>
<File
+ RelativePath="..\source\AllToLua.pkg"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="GenerateBindings.cmd"
+ AdditionalDependencies="&quot;cTorch.h&quot;;&quot;cStairs.h&quot;;&quot;cLadder.h&quot;;&quot;../iniFile/iniFile.h&quot;;&quot;BlockID.h&quot;;&quot;PacketID.h&quot;;&quot;Defines.h&quot;;&quot;LuaFunctions.h&quot;;&quot;cStringMap.h&quot;;&quot;cChatColor.h&quot;;&quot;cClientHandle.h&quot;;&quot;cEntity.h&quot;;&quot;cPawn.h&quot;;&quot;cPlayer.h&quot;;&quot;cPluginManager.h&quot;;&quot;cPlugin.h&quot;;&quot;cPlugin_NewLua.h&quot;;&quot;cPlugin_Lua.h&quot;;&quot;cServer.h&quot;;&quot;cWorld.h&quot;;&quot;cInventory.h&quot;;&quot;cItem.h&quot;;&quot;cWebAdmin.h&quot;;&quot;cWebPlugin.h&quot;;&quot;cWebPlugin_Lua.h&quot;;&quot;cPickup.h&quot;;&quot;cRoot.h&quot;;&quot;cTCPLink.h&quot;;&quot;Vector3f.h&quot;;&quot;Vector3d.h&quot;;&quot;Vector3i.h&quot;;&quot;Matrix4f.h&quot;;&quot;cCuboid.h&quot;;&quot;cMCLogger.h&quot;;&quot;cTracer.h&quot;;&quot;cGroup.h&quot;;&quot;BlockArea.h&quot;;&quot;packets/cPacket_Login.h&quot;;&quot;packets/cPacket_BlockDig.h&quot;;&quot;packets/cPacket_BlockPlace.h&quot;"
+ Outputs="Bindings.cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="GenerateBindings.cmd"
+ AdditionalDependencies="&quot;cTorch.h&quot;;&quot;cStairs.h&quot;;&quot;cLadder.h&quot;;&quot;../iniFile/iniFile.h&quot;;&quot;BlockID.h&quot;;&quot;PacketID.h&quot;;&quot;Defines.h&quot;;&quot;LuaFunctions.h&quot;;&quot;cStringMap.h&quot;;&quot;cChatColor.h&quot;;&quot;cClientHandle.h&quot;;&quot;cEntity.h&quot;;&quot;cPawn.h&quot;;&quot;cPlayer.h&quot;;&quot;cPluginManager.h&quot;;&quot;cPlugin.h&quot;;&quot;cPlugin_NewLua.h&quot;;&quot;cPlugin_Lua.h&quot;;&quot;cServer.h&quot;;&quot;cWorld.h&quot;;&quot;cInventory.h&quot;;&quot;cItem.h&quot;;&quot;cWebAdmin.h&quot;;&quot;cWebPlugin.h&quot;;&quot;cWebPlugin_Lua.h&quot;;&quot;cPickup.h&quot;;&quot;cRoot.h&quot;;&quot;cTCPLink.h&quot;;&quot;Vector3f.h&quot;;&quot;Vector3d.h&quot;;&quot;Vector3i.h&quot;;&quot;Matrix4f.h&quot;;&quot;cCuboid.h&quot;;&quot;cMCLogger.h&quot;;&quot;cTracer.h&quot;;&quot;cGroup.h&quot;;&quot;BlockArea.h&quot;;&quot;packets/cPacket_Login.h&quot;;&quot;packets/cPacket_BlockDig.h&quot;;&quot;packets/cPacket_BlockPlace.h&quot;"
+ Outputs="Bindings.cpp"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release profiled|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCustomBuildTool"
+ CommandLine="GenerateBindings.cmd"
+ AdditionalDependencies="&quot;cTorch.h&quot;;&quot;cStairs.h&quot;;&quot;cLadder.h&quot;;&quot;../iniFile/iniFile.h&quot;;&quot;BlockID.h&quot;;&quot;PacketID.h&quot;;&quot;Defines.h&quot;;&quot;LuaFunctions.h&quot;;&quot;cStringMap.h&quot;;&quot;cChatColor.h&quot;;&quot;cClientHandle.h&quot;;&quot;cEntity.h&quot;;&quot;cPawn.h&quot;;&quot;cPlayer.h&quot;;&quot;cPluginManager.h&quot;;&quot;cPlugin.h&quot;;&quot;cPlugin_NewLua.h&quot;;&quot;cPlugin_Lua.h&quot;;&quot;cServer.h&quot;;&quot;cWorld.h&quot;;&quot;cInventory.h&quot;;&quot;cItem.h&quot;;&quot;cWebAdmin.h&quot;;&quot;cWebPlugin.h&quot;;&quot;cWebPlugin_Lua.h&quot;;&quot;cPickup.h&quot;;&quot;cRoot.h&quot;;&quot;cTCPLink.h&quot;;&quot;Vector3f.h&quot;;&quot;Vector3d.h&quot;;&quot;Vector3i.h&quot;;&quot;Matrix4f.h&quot;;&quot;cCuboid.h&quot;;&quot;cMCLogger.h&quot;;&quot;cTracer.h&quot;;&quot;cGroup.h&quot;;&quot;BlockArea.h&quot;;&quot;packets/cPacket_Login.h&quot;;&quot;packets/cPacket_BlockDig.h&quot;;&quot;packets/cPacket_BlockPlace.h&quot;"
+ Outputs="Bindings.cpp"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\source\Bindings.cpp"
>
<FileConfiguration
diff --git a/source/AllToLua.pkg b/source/AllToLua.pkg
index 7a5de8d49..c8d2b6384 100644
--- a/source/AllToLua.pkg
+++ b/source/AllToLua.pkg
@@ -3,6 +3,23 @@ $#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same acr
$#include "tolua_base.h"
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// NOTE: when changing the BLOCKTYPE or NIBBLETYPE types, you need to change them both in this file and in ChunkDef.h
+// (for some reason, just including the ChunkDef.h file doesn't work in ToLua)
+
+typedef char BLOCKTYPE;
+typedef unsigned char NIBBLETYPE;
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+
+
$cfile "cTorch.h"
$cfile "cStairs.h"
$cfile "cStep.h"
@@ -43,6 +60,7 @@ $cfile "cCuboid.h"
$cfile "cMCLogger.h"
$cfile "cTracer.h"
$cfile "cGroup.h"
+$cfile "BlockArea.h"
$cfile "packets/cPacket_Login.h"
$cfile "packets/cPacket_BlockDig.h"
$cfile "packets/cPacket_BlockPlace.h"
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index d2a97f34e..81db4a447 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 07/02/12 10:32:19.
+** Generated automatically by tolua++-1.0.92 on 07/02/12 18:28:58.
*/
#ifndef __cplusplus
@@ -53,6 +53,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
#include "cMCLogger.h"
#include "cTracer.h"
#include "cGroup.h"
+#include "BlockArea.h"
#include "packets/cPacket_Login.h"
#include "packets/cPacket_BlockDig.h"
#include "packets/cPacket_BlockPlace.h"
@@ -70,6 +71,13 @@ static int tolua_collect_cMCLogger (lua_State* tolua_S)
return 0;
}
+static int tolua_collect_cPacket_BlockDig (lua_State* tolua_S)
+{
+ cPacket_BlockDig* self = (cPacket_BlockDig*) tolua_tousertype(tolua_S,1,0);
+ Mtolua_delete(self);
+ return 0;
+}
+
static int tolua_collect_cItem (lua_State* tolua_S)
{
cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0);
@@ -98,9 +106,9 @@ static int tolua_collect_cPickup (lua_State* tolua_S)
return 0;
}
-static int tolua_collect_cPacket_BlockDig (lua_State* tolua_S)
+static int tolua_collect_cBlockArea (lua_State* tolua_S)
{
- cPacket_BlockDig* self = (cPacket_BlockDig*) tolua_tousertype(tolua_S,1,0);
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
Mtolua_delete(self);
return 0;
}
@@ -173,23 +181,22 @@ static int tolua_collect_Vector3d (lua_State* tolua_S)
/* function to register type */
static void tolua_reg_types (lua_State* tolua_S)
{
- tolua_usertype(tolua_S,"BLOCKTYPE");
tolua_usertype(tolua_S,"TakeDamageInfo");
tolua_usertype(tolua_S,"cLuaItems");
tolua_usertype(tolua_S,"cCraftingGrid");
tolua_usertype(tolua_S,"cCraftingRecipe");
tolua_usertype(tolua_S,"cPlugin");
tolua_usertype(tolua_S,"cLuaChunk");
- tolua_usertype(tolua_S,"NIBBLETYPE");
tolua_usertype(tolua_S,"cStringMap");
+ tolua_usertype(tolua_S,"cPluginManager");
+ tolua_usertype(tolua_S,"cBlockArea");
tolua_usertype(tolua_S,"Lua__cPacket_BlockDig");
- tolua_usertype(tolua_S,"cTCPLink");
tolua_usertype(tolua_S,"Lua__cTCPLink");
tolua_usertype(tolua_S,"cServer");
tolua_usertype(tolua_S,"cRoot");
- tolua_usertype(tolua_S,"cMCLogger");
- tolua_usertype(tolua_S,"cGroup");
+ tolua_usertype(tolua_S,"cVine");
tolua_usertype(tolua_S,"cTracer");
+ tolua_usertype(tolua_S,"cGroup");
tolua_usertype(tolua_S,"cPlugin::CommandStruct");
tolua_usertype(tolua_S,"cPickup");
tolua_usertype(tolua_S,"cItems");
@@ -197,13 +204,13 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cClientHandle");
tolua_usertype(tolua_S,"cStep");
tolua_usertype(tolua_S,"cFurnaceRecipe");
- tolua_usertype(tolua_S,"cCuboid");
+ tolua_usertype(tolua_S,"cMCLogger");
tolua_usertype(tolua_S,"cChatColor");
- tolua_usertype(tolua_S,"Vector3i");
+ tolua_usertype(tolua_S,"cCuboid");
tolua_usertype(tolua_S,"cPacket_PickupSpawn");
tolua_usertype(tolua_S,"Lua__cWebPlugin");
tolua_usertype(tolua_S,"Lua__cPawn");
- tolua_usertype(tolua_S,"cStairs");
+ tolua_usertype(tolua_S,"Vector3i");
tolua_usertype(tolua_S,"cItem");
tolua_usertype(tolua_S,"Vector3f");
tolua_usertype(tolua_S,"cPlugin_Lua");
@@ -212,27 +219,27 @@ static void tolua_reg_types (lua_State* tolua_S)
tolua_usertype(tolua_S,"cPacket");
tolua_usertype(tolua_S,"cPacket_BlockDig");
tolua_usertype(tolua_S,"cWebAdmin");
+ tolua_usertype(tolua_S,"cTCPLink");
tolua_usertype(tolua_S,"cCraftingRecipes");
tolua_usertype(tolua_S,"cGroupManager");
tolua_usertype(tolua_S,"Lua__cPickup");
- tolua_usertype(tolua_S,"cWebPlugin");
tolua_usertype(tolua_S,"Lua__cPlugin");
- tolua_usertype(tolua_S,"cPluginManager");
+ tolua_usertype(tolua_S,"Lua__cEntity");
tolua_usertype(tolua_S,"cPacket_BlockPlace");
tolua_usertype(tolua_S,"cLadder");
+ tolua_usertype(tolua_S,"cWebPlugin");
tolua_usertype(tolua_S,"Lua__cPlayer");
- tolua_usertype(tolua_S,"HTTPFormData");
tolua_usertype(tolua_S,"cIniFile");
tolua_usertype(tolua_S,"cEntity");
tolua_usertype(tolua_S,"HTTPRequest");
tolua_usertype(tolua_S,"cPawn");
tolua_usertype(tolua_S,"cPlayer");
tolua_usertype(tolua_S,"cTorch");
+ tolua_usertype(tolua_S,"HTTPFormData");
tolua_usertype(tolua_S,"cInventory");
tolua_usertype(tolua_S,"cWorld");
tolua_usertype(tolua_S,"cPlugin_NewLua");
- tolua_usertype(tolua_S,"cVine");
- tolua_usertype(tolua_S,"Lua__cEntity");
+ tolua_usertype(tolua_S,"cStairs");
tolua_usertype(tolua_S,"Vector3d");
}
@@ -8047,8 +8054,8 @@ static int tolua_AllToLua_cPlugin_OnBlockToPickup00(lua_State* tolua_S)
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) ||
- (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"BLOCKTYPE",0,&tolua_err)) ||
- (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"NIBBLETYPE",0,&tolua_err)) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isusertype(tolua_S,4,"const cPlayer",0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const cItem",0,&tolua_err)) ||
(tolua_isvaluenil(tolua_S,6,&tolua_err) || !tolua_isusertype(tolua_S,6,"cItems",0,&tolua_err)) ||
@@ -8059,8 +8066,8 @@ static int tolua_AllToLua_cPlugin_OnBlockToPickup00(lua_State* tolua_S)
#endif
{
cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0);
- BLOCKTYPE a_BlockType = *((BLOCKTYPE*) tolua_tousertype(tolua_S,2,0));
- NIBBLETYPE a_BlockMeta = *((NIBBLETYPE*) tolua_tousertype(tolua_S,3,0));
+ char a_BlockType = (( char) tolua_tonumber(tolua_S,2,0));
+ unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,3,0));
const cPlayer* a_Player = ((const cPlayer*) tolua_tousertype(tolua_S,4,0));
const cItem* a_EquippedItem = ((const cItem*) tolua_tousertype(tolua_S,5,0));
cItems* a_Pickups = ((cItems*) tolua_tousertype(tolua_S,6,0));
@@ -8695,12 +8702,10 @@ public:
return ( bool ) cPlugin:: OnPostCrafting(a_Player,a_Grid,a_Recipe);
};
};
- bool OnBlockToPickup( BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
+ bool OnBlockToPickup( char a_BlockType, unsigned char a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
if (push_method("OnBlockToPickup", tolua_AllToLua_cPlugin_OnBlockToPickup00)) {
- void* tolua_obj0 = (void*)new BLOCKTYPE(a_BlockType);
- tolua_pushusertype_and_takeownership(lua_state, tolua_obj0, "BLOCKTYPE");
- void* tolua_obj1 = (void*)new NIBBLETYPE(a_BlockMeta);
- tolua_pushusertype_and_takeownership(lua_state, tolua_obj1, "NIBBLETYPE");
+ tolua_pushnumber(lua_state, (lua_Number)a_BlockType);
+ tolua_pushnumber(lua_state, (lua_Number)a_BlockMeta);
tolua_pushusertype(lua_state, (void*)a_Player, "const cPlayer");
tolua_pushusertype(lua_state, (void*)&a_EquippedItem, "const cItem");
tolua_pushusertype(lua_state, (void*)&a_Pickups, "cItems");
@@ -8814,7 +8819,7 @@ public:
bool cPlugin__OnPostCrafting( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
return ( bool )cPlugin::OnPostCrafting(a_Player,a_Grid,a_Recipe);
};
- bool cPlugin__OnBlockToPickup( BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
+ bool cPlugin__OnBlockToPickup( char a_BlockType, unsigned char a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
return ( bool )cPlugin::OnBlockToPickup(a_BlockType,a_BlockMeta,a_Player,a_EquippedItem,a_Pickups);
};
bool cPlugin__OnWeatherChanged( cWorld* a_World) {
@@ -9513,8 +9518,8 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnBlockToPickup00(lua_State* tol
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"Lua__cPlugin",0,&tolua_err) ||
- (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"BLOCKTYPE",0,&tolua_err)) ||
- (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"NIBBLETYPE",0,&tolua_err)) ||
+ !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
!tolua_isusertype(tolua_S,4,"const cPlayer",0,&tolua_err) ||
(tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const cItem",0,&tolua_err)) ||
(tolua_isvaluenil(tolua_S,6,&tolua_err) || !tolua_isusertype(tolua_S,6,"cItems",0,&tolua_err)) ||
@@ -9525,8 +9530,8 @@ static int tolua_AllToLua_Lua__cPlugin_cPlugin__OnBlockToPickup00(lua_State* tol
#endif
{
Lua__cPlugin* self = (Lua__cPlugin*) tolua_tousertype(tolua_S,1,0);
- BLOCKTYPE a_BlockType = *((BLOCKTYPE*) tolua_tousertype(tolua_S,2,0));
- NIBBLETYPE a_BlockMeta = *((NIBBLETYPE*) tolua_tousertype(tolua_S,3,0));
+ char a_BlockType = ((char) tolua_tonumber(tolua_S,2,0));
+ unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,3,0));
const cPlayer* a_Player = ((const cPlayer*) tolua_tousertype(tolua_S,4,0));
const cItem* a_EquippedItem = ((const cItem*) tolua_tousertype(tolua_S,5,0));
cItems* a_Pickups = ((cItems*) tolua_tousertype(tolua_S,6,0));
@@ -10122,12 +10127,10 @@ public:
return ( bool ) cPlugin_NewLua:: OnPostCrafting(a_Player,a_Grid,a_Recipe);
};
};
- bool OnBlockToPickup( BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
+ bool OnBlockToPickup( char a_BlockType, unsigned char a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
if (push_method("OnBlockToPickup", tolua_AllToLua_cPlugin_OnBlockToPickup00)) {
- void* tolua_obj0 = (void*)new BLOCKTYPE(a_BlockType);
- tolua_pushusertype_and_takeownership(lua_state, tolua_obj0, "BLOCKTYPE");
- void* tolua_obj1 = (void*)new NIBBLETYPE(a_BlockMeta);
- tolua_pushusertype_and_takeownership(lua_state, tolua_obj1, "NIBBLETYPE");
+ tolua_pushnumber(lua_state, (lua_Number)a_BlockType);
+ tolua_pushnumber(lua_state, (lua_Number)a_BlockMeta);
tolua_pushusertype(lua_state, (void*)a_Player, "const cPlayer");
tolua_pushusertype(lua_state, (void*)&a_EquippedItem, "const cItem");
tolua_pushusertype(lua_state, (void*)&a_Pickups, "cItems");
@@ -10244,7 +10247,7 @@ public:
bool cPlugin_NewLua__OnPostCrafting( const cPlayer* a_Player, const cCraftingGrid* a_Grid, cCraftingRecipe* a_Recipe) {
return ( bool )cPlugin_NewLua::OnPostCrafting(a_Player,a_Grid,a_Recipe);
};
- bool cPlugin_NewLua__OnBlockToPickup( BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
+ bool cPlugin_NewLua__OnBlockToPickup( char a_BlockType, unsigned char a_BlockMeta, const cPlayer* a_Player, const cItem& a_EquippedItem, cItems& a_Pickups) {
return ( bool )cPlugin_NewLua::OnBlockToPickup(a_BlockType,a_BlockMeta,a_Player,a_EquippedItem,a_Pickups);
};
bool cPlugin_NewLua__OnWeatherChanged( cWorld* a_World) {
@@ -17844,6 +17847,937 @@ static int tolua_AllToLua_cGroup_GetColor00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: new of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_new00
+static int tolua_AllToLua_cBlockArea_new00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ {
+ cBlockArea* tolua_ret = (cBlockArea*) Mtolua_new((cBlockArea)());
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockArea");
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: new_local of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_new00_local
+static int tolua_AllToLua_cBlockArea_new00_local(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertable(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ {
+ cBlockArea* tolua_ret = (cBlockArea*) Mtolua_new((cBlockArea)());
+ tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockArea");
+ tolua_register_gc(tolua_S,lua_gettop(tolua_S));
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: delete of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_delete00
+static int tolua_AllToLua_cBlockArea_delete00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL);
+#endif
+ Mtolua_delete(self);
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Clear of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Clear00
+static int tolua_AllToLua_cBlockArea_Clear00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL);
+#endif
+ {
+ self->Clear();
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Read of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Read00
+static int tolua_AllToLua_cBlockArea_Read00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",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_isnumber(tolua_S,7,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,8,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,9,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_MinBlockY = ((int) tolua_tonumber(tolua_S,5,0));
+ int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,6,0));
+ int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,7,0));
+ int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,8,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Read'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->Read(a_World,a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Read'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Read of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Read01
+static int tolua_AllToLua_cBlockArea_Read01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",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_isnumber(tolua_S,7,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,8,0,&tolua_err) ||
+ !tolua_isnumber(tolua_S,9,0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,10,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_MinBlockY = ((int) tolua_tonumber(tolua_S,5,0));
+ int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,6,0));
+ int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,7,0));
+ int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,8,0));
+ int a_DataTypes = ((int) tolua_tonumber(tolua_S,9,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Read'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->Read(a_World,a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ,a_DataTypes);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBlockArea_Read00(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Write of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Write00
+static int tolua_AllToLua_cBlockArea_Write00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Write'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->Write(a_World,a_MinBlockX,a_MinBlockY,a_MinBlockZ);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'Write'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: Write of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Write01
+static int tolua_AllToLua_cBlockArea_Write01(lua_State* tolua_S)
+{
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,2,"cWorld",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_isnoobj(tolua_S,7,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0));
+ int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0));
+ int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,5,0));
+ int a_DataTypes = ((int) tolua_tonumber(tolua_S,6,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Write'", NULL);
+#endif
+ {
+ bool tolua_ret = (bool) self->Write(a_World,a_MinBlockX,a_MinBlockY,a_MinBlockZ,a_DataTypes);
+ tolua_pushboolean(tolua_S,(bool)tolua_ret);
+ }
+ }
+ return 1;
+tolua_lerror:
+ return tolua_AllToLua_cBlockArea_Write00(tolua_S);
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetRelBlockType of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockType00
+static int tolua_AllToLua_cBlockArea_SetRelBlockType00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+ char a_BlockType = (( char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockType'", NULL);
+#endif
+ {
+ self->SetRelBlockType(a_RelX,a_RelY,a_RelZ,a_BlockType);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetRelBlockType'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetBlockType of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockType00
+static int tolua_AllToLua_cBlockArea_SetBlockType00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+ char a_BlockType = (( char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockType'", NULL);
+#endif
+ {
+ self->SetBlockType(a_BlockX,a_BlockY,a_BlockZ,a_BlockType);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetBlockType'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetRelBlockMeta of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockMeta00
+static int tolua_AllToLua_cBlockArea_SetRelBlockMeta00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+ unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockMeta'", NULL);
+#endif
+ {
+ self->SetRelBlockMeta(a_RelX,a_RelY,a_RelZ,a_BlockMeta);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetRelBlockMeta'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetBlockMeta of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockMeta00
+static int tolua_AllToLua_cBlockArea_SetBlockMeta00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+ unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL);
+#endif
+ {
+ self->SetBlockMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockMeta);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetRelBlockLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockLight00
+static int tolua_AllToLua_cBlockArea_SetRelBlockLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+ unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockLight'", NULL);
+#endif
+ {
+ self->SetRelBlockLight(a_RelX,a_RelY,a_RelZ,a_BlockLight);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetRelBlockLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetBlockLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockLight00
+static int tolua_AllToLua_cBlockArea_SetBlockLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+ unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockLight'", NULL);
+#endif
+ {
+ self->SetBlockLight(a_BlockX,a_BlockY,a_BlockZ,a_BlockLight);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetBlockLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetRelBlockSkyLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00
+static int tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+ unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockSkyLight'", NULL);
+#endif
+ {
+ self->SetRelBlockSkyLight(a_RelX,a_RelY,a_RelZ,a_BlockSkyLight);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetRelBlockSkyLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: SetBlockSkyLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockSkyLight00
+static int tolua_AllToLua_cBlockArea_SetBlockSkyLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+ unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,5,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockSkyLight'", NULL);
+#endif
+ {
+ self->SetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ,a_BlockSkyLight);
+ }
+ }
+ return 0;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'SetBlockSkyLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetRelBlockType of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockType00
+static int tolua_AllToLua_cBlockArea_GetRelBlockType00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockType'", NULL);
+#endif
+ {
+ char tolua_ret = ( char) self->GetRelBlockType(a_RelX,a_RelY,a_RelZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetRelBlockType'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetBlockType of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockType00
+static int tolua_AllToLua_cBlockArea_GetBlockType00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL);
+#endif
+ {
+ char tolua_ret = ( char) self->GetBlockType(a_BlockX,a_BlockY,a_BlockZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetRelBlockMeta of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockMeta00
+static int tolua_AllToLua_cBlockArea_GetRelBlockMeta00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockMeta'", NULL);
+#endif
+ {
+ unsigned char tolua_ret = ( unsigned char) self->GetRelBlockMeta(a_RelX,a_RelY,a_RelZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetRelBlockMeta'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetBlockMeta of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockMeta00
+static int tolua_AllToLua_cBlockArea_GetBlockMeta00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL);
+#endif
+ {
+ unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_BlockX,a_BlockY,a_BlockZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetRelBlockLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockLight00
+static int tolua_AllToLua_cBlockArea_GetRelBlockLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockLight'", NULL);
+#endif
+ {
+ unsigned char tolua_ret = ( unsigned char) self->GetRelBlockLight(a_RelX,a_RelY,a_RelZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetRelBlockLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetBlockLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockLight00
+static int tolua_AllToLua_cBlockArea_GetBlockLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockLight'", NULL);
+#endif
+ {
+ unsigned char tolua_ret = ( unsigned char) self->GetBlockLight(a_BlockX,a_BlockY,a_BlockZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetBlockLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetRelBlockSkyLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00
+static int tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_RelX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_RelY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockSkyLight'", NULL);
+#endif
+ {
+ unsigned char tolua_ret = ( unsigned char) self->GetRelBlockSkyLight(a_RelX,a_RelY,a_RelZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetRelBlockSkyLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetBlockSkyLight of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockSkyLight00
+static int tolua_AllToLua_cBlockArea_GetBlockSkyLight00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cBlockArea",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_isnoobj(tolua_S,5,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0);
+ int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0));
+ int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0));
+ int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockSkyLight'", NULL);
+#endif
+ {
+ unsigned char tolua_ret = ( unsigned char) self->GetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ);
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetBlockSkyLight'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
+/* method: GetDataTypes of class cBlockArea */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetDataTypes00
+static int tolua_AllToLua_cBlockArea_GetDataTypes00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,2,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0);
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDataTypes'", NULL);
+#endif
+ {
+ int tolua_ret = (int) self->GetDataTypes();
+ tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'GetDataTypes'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* get function: m_ProtocolVersion of class cPacket_Login */
#ifndef TOLUA_DISABLE_tolua_get_cPacket_Login_m_ProtocolVersion
static int tolua_get_cPacket_Login_m_ProtocolVersion(lua_State* tolua_S)
@@ -21561,6 +22495,43 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"HasCommand",tolua_AllToLua_cGroup_HasCommand00);
tolua_function(tolua_S,"GetColor",tolua_AllToLua_cGroup_GetColor00);
tolua_endmodule(tolua_S);
+ #ifdef __cplusplus
+ tolua_cclass(tolua_S,"cBlockArea","cBlockArea","",tolua_collect_cBlockArea);
+ #else
+ tolua_cclass(tolua_S,"cBlockArea","cBlockArea","",NULL);
+ #endif
+ tolua_beginmodule(tolua_S,"cBlockArea");
+ tolua_constant(tolua_S,"baTypes",cBlockArea::baTypes);
+ tolua_constant(tolua_S,"baMetas",cBlockArea::baMetas);
+ tolua_constant(tolua_S,"baLight",cBlockArea::baLight);
+ tolua_constant(tolua_S,"baSkyLight",cBlockArea::baSkyLight);
+ tolua_function(tolua_S,"new",tolua_AllToLua_cBlockArea_new00);
+ tolua_function(tolua_S,"new_local",tolua_AllToLua_cBlockArea_new00_local);
+ tolua_function(tolua_S,".call",tolua_AllToLua_cBlockArea_new00_local);
+ tolua_function(tolua_S,"delete",tolua_AllToLua_cBlockArea_delete00);
+ tolua_function(tolua_S,"Clear",tolua_AllToLua_cBlockArea_Clear00);
+ tolua_function(tolua_S,"Read",tolua_AllToLua_cBlockArea_Read00);
+ tolua_function(tolua_S,"Read",tolua_AllToLua_cBlockArea_Read01);
+ tolua_function(tolua_S,"Write",tolua_AllToLua_cBlockArea_Write00);
+ tolua_function(tolua_S,"Write",tolua_AllToLua_cBlockArea_Write01);
+ tolua_function(tolua_S,"SetRelBlockType",tolua_AllToLua_cBlockArea_SetRelBlockType00);
+ tolua_function(tolua_S,"SetBlockType",tolua_AllToLua_cBlockArea_SetBlockType00);
+ tolua_function(tolua_S,"SetRelBlockMeta",tolua_AllToLua_cBlockArea_SetRelBlockMeta00);
+ tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cBlockArea_SetBlockMeta00);
+ tolua_function(tolua_S,"SetRelBlockLight",tolua_AllToLua_cBlockArea_SetRelBlockLight00);
+ tolua_function(tolua_S,"SetBlockLight",tolua_AllToLua_cBlockArea_SetBlockLight00);
+ tolua_function(tolua_S,"SetRelBlockSkyLight",tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00);
+ tolua_function(tolua_S,"SetBlockSkyLight",tolua_AllToLua_cBlockArea_SetBlockSkyLight00);
+ tolua_function(tolua_S,"GetRelBlockType",tolua_AllToLua_cBlockArea_GetRelBlockType00);
+ tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cBlockArea_GetBlockType00);
+ tolua_function(tolua_S,"GetRelBlockMeta",tolua_AllToLua_cBlockArea_GetRelBlockMeta00);
+ tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cBlockArea_GetBlockMeta00);
+ tolua_function(tolua_S,"GetRelBlockLight",tolua_AllToLua_cBlockArea_GetRelBlockLight00);
+ tolua_function(tolua_S,"GetBlockLight",tolua_AllToLua_cBlockArea_GetBlockLight00);
+ tolua_function(tolua_S,"GetRelBlockSkyLight",tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00);
+ tolua_function(tolua_S,"GetBlockSkyLight",tolua_AllToLua_cBlockArea_GetBlockSkyLight00);
+ tolua_function(tolua_S,"GetDataTypes",tolua_AllToLua_cBlockArea_GetDataTypes00);
+ tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cPacket_Login","cPacket_Login","cPacket",NULL);
tolua_beginmodule(tolua_S,"cPacket_Login");
tolua_variable(tolua_S,"m_ProtocolVersion",tolua_get_cPacket_Login_m_ProtocolVersion,tolua_set_cPacket_Login_m_ProtocolVersion);
diff --git a/source/Bindings.h b/source/Bindings.h
index a4762b61d..aa87406e5 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 07/02/12 10:32:19.
+** Generated automatically by tolua++-1.0.92 on 07/02/12 18:28:58.
*/
/* Exported function */
diff --git a/source/BlockArea.cpp b/source/BlockArea.cpp
new file mode 100644
index 000000000..7750b94fb
--- /dev/null
+++ b/source/BlockArea.cpp
@@ -0,0 +1,626 @@
+
+// BlockArea.cpp
+
+// Implements the cBlockArea object representing an area of block data that can be queried from cWorld and then accessed again without further queries
+// The object also supports writing the blockdata back into cWorld, even into other coords
+
+#include "Globals.h"
+#include "BlockArea.h"
+#include "cWorld.h"
+
+
+
+
+
+cBlockArea::cBlockArea(void) :
+ m_SizeX(0),
+ m_SizeY(0),
+ m_SizeZ(0),
+ m_BlockTypes(NULL),
+ m_BlockMetas(NULL),
+ m_BlockLight(NULL),
+ m_BlockSkyLight(NULL)
+{
+}
+
+
+
+
+
+cBlockArea::~cBlockArea()
+{
+ Clear();
+}
+
+
+
+
+
+void cBlockArea::Clear(void)
+{
+ delete[] m_BlockTypes; m_BlockTypes = NULL;
+ delete[] m_BlockMetas; m_BlockMetas = NULL;
+ delete[] m_BlockLight; m_BlockLight = NULL;
+ delete[] m_BlockSkyLight; m_BlockSkyLight = NULL;
+ m_SizeX = 0;
+ m_SizeY = 0;
+ m_SizeZ = 0;
+}
+
+
+
+
+bool cBlockArea::Read(cWorld * a_World, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes)
+{
+ // Normalize the coords:
+ if (a_MinBlockX > a_MaxBlockX)
+ {
+ std::swap(a_MinBlockX, a_MaxBlockX);
+ }
+ if (a_MinBlockY > a_MaxBlockY)
+ {
+ std::swap(a_MinBlockY, a_MaxBlockY);
+ }
+ if (a_MinBlockZ > a_MaxBlockZ)
+ {
+ std::swap(a_MinBlockZ, a_MaxBlockZ);
+ }
+
+ // Check coords validity:
+ if (a_MinBlockY < 0)
+ {
+ LOGWARNING("cBlockArea:Read(): MinBlockY less than zero, adjusting to zero");
+ a_MinBlockY = 0;
+ }
+ else if (a_MinBlockY >= cChunkDef::Height)
+ {
+ LOGWARNING("cBlockArea::Read(): MinBlockY more than chunk height, adjusting to chunk height");
+ a_MinBlockY = cChunkDef::Height - 1;
+ }
+ if (a_MaxBlockY < 0)
+ {
+ LOGWARNING("cBlockArea:Read(): MaxBlockY less than zero, adjusting to zero");
+ a_MaxBlockY = 0;
+ }
+ else if (a_MinBlockY >= cChunkDef::Height)
+ {
+ LOGWARNING("cBlockArea::Read(): MaxBlockY more than chunk height, adjusting to chunk height");
+ a_MaxBlockY = cChunkDef::Height - 1;
+ }
+
+ // Allocate the needed memory:
+ Clear();
+ if (!SetSize(a_MaxBlockX - a_MinBlockX, a_MaxBlockY - a_MinBlockY, a_MaxBlockZ - a_MinBlockZ, a_DataTypes))
+ {
+ return false;
+ }
+ m_OriginX = a_MinBlockX;
+ m_OriginY = a_MinBlockY;
+ m_OriginZ = a_MinBlockZ;
+ cChunkReader Reader(*this);
+
+ // Convert block coords to chunks coords:
+ int MinChunkX, MaxChunkX;
+ int MinChunkZ, MaxChunkZ;
+ cChunkDef::AbsoluteToRelative(a_MinBlockX, a_MinBlockY, a_MinBlockZ, MinChunkX, MinChunkZ);
+ cChunkDef::AbsoluteToRelative(a_MaxBlockX, a_MaxBlockY, a_MaxBlockZ, MaxChunkX, MaxChunkZ);
+
+ // Query block data:
+ if (!a_World->ForEachChunkInRect(MinChunkX, MaxChunkX, MinChunkZ, MaxChunkZ, Reader))
+ {
+ Clear();
+ return false;
+ }
+ return true;
+}
+
+
+
+
+
+bool cBlockArea::Write(cWorld * a_World, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes)
+{
+ // TODO
+ ASSERT(!"Not implemented yet");
+ return false;
+}
+
+
+
+
+
+
+void cBlockArea::SetRelBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType)
+{
+ if (m_BlockTypes == NULL)
+ {
+ LOGWARNING("cBlockArea: BlockTypes have not been read!");
+ return;
+ }
+ m_BlockTypes[MakeIndex(a_RelX, a_RelY, a_RelZ)] = a_BlockType;
+}
+
+
+
+
+
+void cBlockArea::SetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType)
+{
+ SetRelBlockType(a_BlockX - m_OriginX, a_BlockY - m_OriginY, a_BlockZ - m_OriginZ, a_BlockType);
+}
+
+
+
+
+
+void cBlockArea::SetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockMeta)
+{
+ SetRelNibble(a_RelX, a_RelY, a_RelZ, a_BlockMeta, m_BlockMetas);
+}
+
+
+
+
+
+void cBlockArea::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta)
+{
+ SetNibble(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta, m_BlockMetas);
+}
+
+
+
+
+
+void cBlockArea::SetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockLight)
+{
+ SetRelNibble(a_RelX, a_RelY, a_RelZ, a_BlockLight, m_BlockLight);
+}
+
+
+
+
+
+void cBlockArea::SetBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockLight)
+{
+ SetNibble(a_BlockX, a_BlockY, a_BlockZ, a_BlockLight, m_BlockLight);
+}
+
+
+
+
+
+void cBlockArea::SetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockSkyLight)
+{
+ SetRelNibble(a_RelX, a_RelY, a_RelZ, a_BlockSkyLight, m_BlockSkyLight);
+}
+
+
+
+
+
+void cBlockArea::SetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockSkyLight)
+{
+ SetNibble(a_BlockX, a_BlockY, a_BlockZ, a_BlockSkyLight, m_BlockSkyLight);
+}
+
+
+
+
+
+BLOCKTYPE cBlockArea::GetRelBlockType(int a_RelX, int a_RelY, int a_RelZ)
+{
+ if (m_BlockTypes == NULL)
+ {
+ LOGWARNING("cBlockArea: BlockTypes have not been read!");
+ return E_BLOCK_AIR;
+ }
+ return m_BlockTypes[MakeIndex(a_RelX, a_RelY, a_RelZ)];
+}
+
+
+
+
+
+BLOCKTYPE cBlockArea::GetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ return GetRelBlockType(a_BlockX - m_OriginX, a_BlockY - m_OriginY, a_BlockZ - m_OriginZ);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetRelBlockMeta(int a_RelX, int a_RelY, int a_RelZ)
+{
+ return GetRelNibble(a_RelX, a_RelY, a_RelZ, m_BlockMetas);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockMetas);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetRelBlockLight(int a_RelX, int a_RelY, int a_RelZ)
+{
+ return GetRelNibble(a_RelX, a_RelY, a_RelZ, m_BlockLight);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockLight);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ)
+{
+ return GetRelNibble(a_RelX, a_RelY, a_RelZ, m_BlockSkyLight);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ)
+{
+ return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockSkyLight);
+}
+
+
+
+
+
+int cBlockArea::GetDataTypes(void) const
+{
+ int res = 0;
+ if (m_BlockTypes != NULL)
+ {
+ res |= baTypes;
+ }
+ if (m_BlockMetas != NULL)
+ {
+ res |= baMetas;
+ }
+ if (m_BlockLight != NULL)
+ {
+ res |= baLight;
+ }
+ if (m_BlockSkyLight != NULL)
+ {
+ res |= baSkyLight;
+ }
+ return res;
+}
+
+
+
+
+
+bool cBlockArea::SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes)
+{
+ ASSERT(m_BlockTypes == NULL); // Has been cleared
+
+ if (a_DataTypes & baTypes)
+ {
+ m_BlockTypes = new BLOCKTYPE[a_SizeX * a_SizeY * a_SizeZ];
+ if (m_BlockTypes == NULL)
+ {
+ return false;
+ }
+ }
+ if (a_DataTypes & baMetas)
+ {
+ m_BlockMetas = new NIBBLETYPE[a_SizeX * a_SizeY * a_SizeZ];
+ if (m_BlockMetas == NULL)
+ {
+ delete[] m_BlockTypes;
+ return false;
+ }
+ }
+ if (a_DataTypes & baLight)
+ {
+ m_BlockLight = new NIBBLETYPE[a_SizeX * a_SizeY * a_SizeZ];
+ if (m_BlockLight == NULL)
+ {
+ delete[] m_BlockMetas;
+ delete[] m_BlockTypes;
+ return false;
+ }
+ }
+ if (a_DataTypes & baSkyLight)
+ {
+ m_BlockSkyLight = new NIBBLETYPE[a_SizeX * a_SizeY * a_SizeZ];
+ if (m_BlockSkyLight == NULL)
+ {
+ delete[] m_BlockLight;
+ delete[] m_BlockMetas;
+ delete[] m_BlockTypes;
+ return false;
+ }
+ }
+ m_SizeX = a_SizeX;
+ m_SizeY = a_SizeY;
+ m_SizeZ = a_SizeZ;
+ return true;
+}
+
+
+
+
+
+int cBlockArea::MakeIndex(int a_RelX, int a_RelY, int a_RelZ)
+{
+ return a_RelX + a_RelZ * m_SizeZ + a_RelY * m_SizeX * m_SizeZ;
+}
+
+
+
+
+
+void cBlockArea::SetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array)
+{
+ if (a_Array == NULL)
+ {
+ LOGWARNING("cBlockArea: datatype has not been read!");
+ return;
+ }
+ a_Array[MakeIndex(a_RelX, a_RelY, a_RelZ)] = a_Value;
+}
+
+
+
+
+
+void cBlockArea::SetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array)
+{
+ SetRelNibble(a_BlockX - m_OriginX, a_BlockY - m_OriginY, a_BlockZ - m_OriginZ, a_Value, a_Array);
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array)
+{
+ if (a_Array == NULL)
+ {
+ LOGWARNING("cBlockArea: datatype has not been read!");
+ return 16;
+ }
+ return a_Array[MakeIndex(a_RelX, a_RelY, a_RelZ)];
+}
+
+
+
+
+
+NIBBLETYPE cBlockArea::GetNibble(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array)
+{
+ return GetRelNibble(a_BlockX - m_OriginX, a_BlockY - m_OriginY, a_BlockZ - m_OriginZ, a_Array);
+}
+
+
+
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// cBlockArea::cChunkReader:
+
+cBlockArea::cChunkReader::cChunkReader(cBlockArea & a_Area) :
+ m_Area(a_Area),
+ m_OriginX(a_Area.m_OriginX),
+ m_OriginY(a_Area.m_OriginY),
+ m_OriginZ(a_Area.m_OriginZ)
+{
+}
+
+
+
+
+
+void cBlockArea::cChunkReader::CopyNibbles(NIBBLETYPE * a_AreaDst, const NIBBLETYPE * a_ChunkSrc)
+{
+ int SizeY = m_Area.m_SizeY;
+ int MinY = m_OriginY;
+
+ // SizeX, SizeZ are the dmensions of the block data to copy from the current chunk (size of the geometric union)
+ // OffX, OffZ are the offsets of the current chunk data from the area origin
+ // BaseX, BaseZ are the offsets of the area data within the current chunk from the chunk borders
+ int SizeX = cChunkDef::Width;
+ int SizeZ = cChunkDef::Width;
+ int OffX, OffZ;
+ int BaseX, BaseZ;
+ OffX = m_CurrentChunkX * cChunkDef::Width - m_OriginX;
+ if (OffX < 0)
+ {
+ BaseX = -OffX;
+ SizeX += OffX; // SizeX is decreased, OffX is negative
+ OffX = 0;
+ }
+ else
+ {
+ BaseX = 0;
+ }
+ OffZ = m_CurrentChunkZ * cChunkDef::Width - m_OriginZ;
+ if (OffZ < 0)
+ {
+ BaseZ = -OffZ;
+ SizeZ += OffZ; // SizeZ is decreased, OffZ is negative
+ OffZ = 0;
+ }
+ else
+ {
+ BaseZ = 0;
+ }
+ // If the chunk extends beyond the area in the X or Z axis, cut off the Size:
+ if ((m_CurrentChunkX + 1) * cChunkDef::Width > m_OriginX + m_Area.m_SizeX)
+ {
+ SizeX -= (m_CurrentChunkX + 1) * cChunkDef::Width - (m_OriginX + m_Area.m_SizeX);
+ }
+ if ((m_CurrentChunkZ + 1) * cChunkDef::Width > m_OriginZ + m_Area.m_SizeZ)
+ {
+ SizeZ -= (m_CurrentChunkZ + 1) * cChunkDef::Width - (m_OriginZ + m_Area.m_SizeZ);
+ }
+
+ for (int y = 0; y < SizeY; y++)
+ {
+ int ChunkY = MinY + y;
+ int AreaY = y;
+ for (int z = 0; z < SizeZ; z++)
+ {
+ int ChunkZ = BaseZ + z;
+ int AreaZ = OffZ + z;
+ for (int x = 0; x < SizeX; x++)
+ {
+ int ChunkX = BaseX + x;
+ int AreaX = OffX + x;
+ a_AreaDst[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = cChunkDef::GetNibble(a_ChunkSrc, ChunkX, ChunkY, ChunkZ);
+ } // for x
+ } // for z
+ } // for y
+}
+
+
+
+
+
+bool cBlockArea::cChunkReader::Coords(int a_ChunkX, int a_ChunkZ)
+{
+ m_CurrentChunkX = a_ChunkX;
+ m_CurrentChunkZ = a_ChunkZ;
+ return true;
+}
+
+
+
+
+
+void cBlockArea::cChunkReader::BlockTypes(const BLOCKTYPE * a_BlockTypes)
+{
+ if (m_Area.m_BlockTypes == NULL)
+ {
+ // Don't want BlockTypes
+ return;
+ }
+
+ int SizeY = m_Area.m_SizeY;
+ int MinY = m_OriginY;
+
+ // SizeX, SizeZ are the dmensions of the block data to copy from the current chunk (size of the geometric union)
+ // OffX, OffZ are the offsets of the current chunk data from the area origin
+ // BaseX, BaseZ are the offsets of the area data within the current chunk from the chunk borders
+ int SizeX = cChunkDef::Width;
+ int SizeZ = cChunkDef::Width;
+ int OffX, OffZ;
+ int BaseX, BaseZ;
+ OffX = m_CurrentChunkX * cChunkDef::Width - m_OriginX;
+ if (OffX < 0)
+ {
+ BaseX = -OffX;
+ SizeX += OffX; // SizeX is decreased, OffX is negative
+ OffX = 0;
+ }
+ else
+ {
+ BaseX = 0;
+ }
+ OffZ = m_CurrentChunkZ * cChunkDef::Width - m_OriginZ;
+ if (OffZ < 0)
+ {
+ BaseZ = -OffZ;
+ SizeZ += OffZ; // SizeZ is decreased, OffZ is negative
+ OffZ = 0;
+ }
+ else
+ {
+ BaseZ = 0;
+ }
+ // If the chunk extends beyond the area in the X or Z axis, cut off the Size:
+ if ((m_CurrentChunkX + 1) * cChunkDef::Width > m_OriginX + m_Area.m_SizeX)
+ {
+ SizeX -= (m_CurrentChunkX + 1) * cChunkDef::Width - (m_OriginX + m_Area.m_SizeX);
+ }
+ if ((m_CurrentChunkZ + 1) * cChunkDef::Width > m_OriginZ + m_Area.m_SizeZ)
+ {
+ SizeZ -= (m_CurrentChunkZ + 1) * cChunkDef::Width - (m_OriginZ + m_Area.m_SizeZ);
+ }
+
+ for (int y = 0; y < SizeY; y++)
+ {
+ int ChunkY = MinY + y;
+ int AreaY = y;
+ for (int z = 0; z < SizeZ; z++)
+ {
+ int ChunkZ = BaseZ + z;
+ int AreaZ = OffZ + z;
+ for (int x = 0; x < SizeX; x++)
+ {
+ int ChunkX = BaseX + x;
+ int AreaX = OffX + x;
+ m_Area.m_BlockTypes[m_Area.MakeIndex(AreaX, AreaY, AreaZ)] = cChunkDef::GetBlock(a_BlockTypes, ChunkX, ChunkY, ChunkZ);
+ } // for x
+ } // for z
+ } // for y
+}
+
+
+
+
+
+void cBlockArea::cChunkReader::BlockMeta(const NIBBLETYPE * a_BlockMetas)
+{
+ if (m_Area.m_BlockMetas == NULL)
+ {
+ // Don't want metas
+ return;
+ }
+ CopyNibbles(m_Area.m_BlockMetas, a_BlockMetas);
+}
+
+
+
+
+
+void cBlockArea::cChunkReader::BlockLight(const NIBBLETYPE * a_BlockLight)
+{
+ if (m_Area.m_BlockLight == NULL)
+ {
+ // Don't want light
+ return;
+ }
+ CopyNibbles(m_Area.m_BlockLight, a_BlockLight);
+}
+
+
+
+
+
+void cBlockArea::cChunkReader::BlockSkyLight(const NIBBLETYPE * a_BlockSkyLight)
+{
+ if (m_Area.m_BlockSkyLight == NULL)
+ {
+ // Don't want skylight
+ return;
+ }
+ CopyNibbles(m_Area.m_BlockSkyLight, a_BlockSkyLight);
+}
+
+
+
+
+
diff --git a/source/BlockArea.h b/source/BlockArea.h
new file mode 100644
index 000000000..49505f945
--- /dev/null
+++ b/source/BlockArea.h
@@ -0,0 +1,138 @@
+
+// BlockArea.h
+
+// Interfaces to the cBlockArea object representing an area of block data that can be queried from cWorld and then accessed again without further queries
+// The object also supports writing the blockdata back into cWorld, even into other coords
+
+
+
+
+
+#pragma once
+
+
+
+
+
+// fwd: "cWorld.h"
+class cWorld;
+
+
+
+
+
+// tolua_begin
+class cBlockArea
+{
+ // tolua_end
+ DISALLOW_COPY_AND_ASSIGN(cBlockArea);
+ // tolua_begin
+
+public:
+
+ /// What data is to be queried (bit-mask)
+ enum
+ {
+ baTypes = 1,
+ baMetas = 2,
+ baLight = 4,
+ baSkyLight = 8,
+ } ;
+
+ cBlockArea(void);
+ ~cBlockArea();
+
+ /// Clears the data stored to reclaim memory
+ void Clear(void);
+
+ /// Reads an area of blocks specified. Returns true if successful. All coords are inclusive.
+ bool Read(cWorld * a_World, int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ, int a_DataTypes = baTypes | baMetas);
+
+ /// Writes the area back into cWorld at the coords specified. Returns true if successful.
+ bool Write(cWorld * a_World, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes = baTypes | baMetas);
+
+ // TODO: Write() is not too good an interface: if it fails, there's no way to repeat only for the parts that didn't write
+ // A better way may be to return a list of cBlockAreas for each part that didn't succeed writing, so that the caller may try again
+
+ // Setters:
+ void SetRelBlockType (int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType);
+ void SetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType);
+ void SetRelBlockMeta (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockMeta);
+ void SetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta);
+ void SetRelBlockLight (int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockLight);
+ void SetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockLight);
+ void SetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_BlockSkyLight);
+ void SetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockSkyLight);
+
+ // Getters:
+ BLOCKTYPE GetRelBlockType (int a_RelX, int a_RelY, int a_RelZ);
+ BLOCKTYPE GetBlockType (int a_BlockX, int a_BlockY, int a_BlockZ);
+ NIBBLETYPE GetRelBlockMeta (int a_RelX, int a_RelY, int a_RelZ);
+ NIBBLETYPE GetBlockMeta (int a_BlockX, int a_BlockY, int a_BlockZ);
+ NIBBLETYPE GetRelBlockLight (int a_RelX, int a_RelY, int a_RelZ);
+ NIBBLETYPE GetBlockLight (int a_BlockX, int a_BlockY, int a_BlockZ);
+ NIBBLETYPE GetRelBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ);
+ NIBBLETYPE GetBlockSkyLight (int a_BlockX, int a_BlockY, int a_BlockZ);
+
+ /// Returns the datatypes that are stored in the object (bitmask of baXXX values)
+ int GetDataTypes(void) const;
+
+protected:
+
+ // tolua_end
+
+ class cChunkReader :
+ public cChunkDataCallback
+ {
+ public:
+ cChunkReader(cBlockArea & a_Area);
+
+ protected:
+ cBlockArea & m_Area;
+ int m_OriginX;
+ int m_OriginY;
+ int m_OriginZ;
+ int m_CurrentChunkX;
+ int m_CurrentChunkZ;
+
+ void CopyNibbles(NIBBLETYPE * a_AreaDst, const NIBBLETYPE * a_ChunkSrc);
+
+ // cChunkDataCallback overrides:
+ virtual bool Coords (int a_ChunkX, int a_ChunkZ) override;
+ virtual void BlockTypes (const BLOCKTYPE * a_BlockTypes) override;
+ virtual void BlockMeta (const NIBBLETYPE * a_BlockMetas) override;
+ virtual void BlockLight (const NIBBLETYPE * a_BlockLight) override;
+ virtual void BlockSkyLight(const NIBBLETYPE * a_BlockSkyLight) override;
+ } ;
+
+ // tolua_begin
+
+ int m_OriginX;
+ int m_OriginY;
+ int m_OriginZ;
+ int m_SizeX;
+ int m_SizeY;
+ int m_SizeZ;
+
+ BLOCKTYPE * m_BlockTypes;
+ NIBBLETYPE * m_BlockMetas; // Each meta is stored as a separate byte for faster access
+ NIBBLETYPE * m_BlockLight; // Each light value is stored as a separate byte for faster access
+ NIBBLETYPE * m_BlockSkyLight; // Each light value is stored as a separate byte for faster access
+
+ bool SetSize(int a_SizeX, int a_SizeY, int a_SizeZ, int a_DataTypes);
+
+ int MakeIndex(int a_RelX, int a_RelY, int a_RelZ);
+
+ // Basic Setters:
+ void SetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array);
+ void SetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_Value, NIBBLETYPE * a_Array);
+
+ // Basic Getters:
+ NIBBLETYPE GetRelNibble(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE * a_Array);
+ NIBBLETYPE GetNibble (int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE * a_Array);
+} ;
+// tolua_end
+
+
+
+
diff --git a/source/ChunkDef.h b/source/ChunkDef.h
index 90ca84a1c..a9a10335c 100644
--- a/source/ChunkDef.h
+++ b/source/ChunkDef.h
@@ -41,6 +41,10 @@ typedef std::list<cBlockEntity *> cBlockEntityList;
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// NOTE: when changing the BLOCKTYPE or NIBBLETYPE types, you need to change them both in this file and in AllToLua.pkg
+// (for some reason, just including the ChunkDef.h file in AllToLua.pkg doesn't work in ToLua)
+
/// The datatype used by blockdata
typedef char BLOCKTYPE;
@@ -50,6 +54,8 @@ typedef unsigned char NIBBLETYPE;
/// The type used by the heightmap
typedef unsigned char HEIGHTTYPE;
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index 47474f9a4..0cf6e6c6d 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -1165,6 +1165,35 @@ bool cChunkMap::IsChunkLighted(int a_ChunkX, int a_ChunkZ)
+bool cChunkMap::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback)
+{
+ bool Result = true;
+ cCSLock Lock(m_CSLayers);
+ for (int z = a_MinChunkZ; z <= a_MaxChunkZ; z++)
+ {
+ for (int x = a_MinChunkX; x <= a_MaxChunkX; x++)
+ {
+ cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z);
+ if ((Chunk == NULL) || (!Chunk->IsValid()))
+ {
+ // Not present / not valid
+ Result = false;
+ continue;
+ }
+ if (!a_Callback.Coords(x, z))
+ {
+ continue;
+ }
+ Chunk->GetAllData(a_Callback);
+ }
+ }
+ return Result;
+}
+
+
+
+
+
void cChunkMap::GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty)
{
a_NumChunksValid = 0;
diff --git a/source/cChunkMap.h b/source/cChunkMap.h
index e00ed80c1..5baa32485 100644
--- a/source/cChunkMap.h
+++ b/source/cChunkMap.h
@@ -171,6 +171,9 @@ public:
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
+ /// Calls the callback for each chunk in the coords specified (all cords are inclusive). Returns true if all chunks have been processed successfully
+ bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback);
+
/// Returns the number of valid chunks and the number of dirty chunks
void GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty);
diff --git a/source/cWorld.cpp b/source/cWorld.cpp
index 2c732df7f..c2a943493 100644
--- a/source/cWorld.cpp
+++ b/source/cWorld.cpp
@@ -50,8 +50,6 @@
#include "Vector3d.h"
-#include <time.h>
-
#include "tolua++.h"
#ifndef _WIN32
@@ -1819,6 +1817,15 @@ bool cWorld::IsChunkLighted(int a_ChunkX, int a_ChunkZ)
+bool cWorld::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback)
+{
+ return m_ChunkMap->ForEachChunkInRect(a_MinChunkX, a_MaxChunkX, a_MinChunkZ, a_MaxChunkZ, a_Callback);
+}
+
+
+
+
+
void cWorld::SaveAllChunks(void)
{
LOG("Saving all chunks...");
diff --git a/source/cWorld.h b/source/cWorld.h
index f885bfd35..fd594f22b 100644
--- a/source/cWorld.h
+++ b/source/cWorld.h
@@ -209,6 +209,9 @@ public:
void QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback = NULL);
bool IsChunkLighted(int a_ChunkX, int a_ChunkZ);
+
+ /// Calls the callback for each chunk in the coords specified (all cords are inclusive). Returns true if all chunks have been processed successfully
+ bool ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback);
void SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta ); //tolua_export
void FastSetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, char a_BlockMeta ); //tolua_export