Merged the usable portion of the "gens" branch.
Splitting off the Composable generator and fiddling with LuaChunk / ChunkDesc is good, other generators not good yet. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1171 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
234244d27d
commit
2960f43782
@ -1455,14 +1455,6 @@
|
||||
RelativePath="..\source\Bindings.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\LuaChunk.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\LuaChunk.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\LuaCommandBinder.cpp"
|
||||
>
|
||||
@ -1686,6 +1678,10 @@
|
||||
RelativePath="..\source\Generating\Caves.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\Generating\ChunkDesc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\Generating\ChunkGenerator.cpp"
|
||||
>
|
||||
@ -1702,6 +1698,14 @@
|
||||
RelativePath="..\source\Generating\CompoGen.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\Generating\ComposableGenerator.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\Generating\ComposableGenerator.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\source\Generating\FinishGen.cpp"
|
||||
>
|
||||
|
@ -53,6 +53,6 @@ $cfile "MCLogger.h"
|
||||
$cfile "Tracer.h"
|
||||
$cfile "Group.h"
|
||||
$cfile "BlockArea.h"
|
||||
$cfile "LuaChunk.h"
|
||||
$cfile "Generating/ChunkDesc.h"
|
||||
$cfile "CraftingRecipes.h"
|
||||
$cfile "LuaItems.h"
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 01/19/13 07:27:33.
|
||||
** Generated automatically by tolua++-1.0.92 on 01/25/13 19:08:52.
|
||||
*/
|
||||
|
||||
#ifndef __cplusplus
|
||||
@ -52,7 +52,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);
|
||||
#include "Tracer.h"
|
||||
#include "Group.h"
|
||||
#include "BlockArea.h"
|
||||
#include "LuaChunk.h"
|
||||
#include "Generating/ChunkDesc.h"
|
||||
#include "CraftingRecipes.h"
|
||||
#include "LuaItems.h"
|
||||
|
||||
@ -162,7 +162,7 @@ static void tolua_reg_types (lua_State* tolua_S)
|
||||
tolua_usertype(tolua_S,"cBlockArea");
|
||||
tolua_usertype(tolua_S,"cInventory");
|
||||
tolua_usertype(tolua_S,"cRoot");
|
||||
tolua_usertype(tolua_S,"Vector3i");
|
||||
tolua_usertype(tolua_S,"cTracer");
|
||||
tolua_usertype(tolua_S,"cLuaItems");
|
||||
tolua_usertype(tolua_S,"cCraftingGrid");
|
||||
tolua_usertype(tolua_S,"cPlugin::CommandStruct");
|
||||
@ -170,12 +170,12 @@ static void tolua_reg_types (lua_State* tolua_S)
|
||||
tolua_usertype(tolua_S,"cItems");
|
||||
tolua_usertype(tolua_S,"cGroup");
|
||||
tolua_usertype(tolua_S,"cClientHandle");
|
||||
tolua_usertype(tolua_S,"cTracer");
|
||||
tolua_usertype(tolua_S,"cChunkDesc");
|
||||
tolua_usertype(tolua_S,"cFurnaceRecipe");
|
||||
tolua_usertype(tolua_S,"cMCLogger");
|
||||
tolua_usertype(tolua_S,"cChatColor");
|
||||
tolua_usertype(tolua_S,"cCuboid");
|
||||
tolua_usertype(tolua_S,"cLuaChunk");
|
||||
tolua_usertype(tolua_S,"Vector3i");
|
||||
tolua_usertype(tolua_S,"Lua__cWebPlugin");
|
||||
tolua_usertype(tolua_S,"Lua__cPawn");
|
||||
tolua_usertype(tolua_S,"cPawn");
|
||||
@ -18790,14 +18790,14 @@ static int tolua_AllToLua_cBlockArea_HasBlockSkyLights00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: FillBlocks of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_FillBlocks00
|
||||
static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S)
|
||||
/* method: FillBlocks of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillBlocks00
|
||||
static int tolua_AllToLua_cChunkDesc_FillBlocks00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
@ -18806,9 +18806,9 @@ static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
char a_BlockType = ((char) tolua_tonumber(tolua_S,2,0));
|
||||
unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,3,0));
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0));
|
||||
unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,3,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillBlocks'", NULL);
|
||||
#endif
|
||||
@ -18825,14 +18825,14 @@ static int tolua_AllToLua_cLuaChunk_FillBlocks00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetBlock of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetBlock00
|
||||
static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S)
|
||||
/* method: SetBlock of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlock00
|
||||
static int tolua_AllToLua_cChunkDesc_SetBlock00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",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) ||
|
||||
@ -18844,12 +18844,12 @@ static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Y = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,4,0));
|
||||
char a_BlockType = ((char) tolua_tonumber(tolua_S,5,0));
|
||||
unsigned char a_BlockMeta = ((unsigned char) tolua_tonumber(tolua_S,6,0));
|
||||
unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0));
|
||||
unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlock'", NULL);
|
||||
#endif
|
||||
@ -18866,14 +18866,14 @@ static int tolua_AllToLua_cLuaChunk_SetBlock00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: GetBlock of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetBlock00
|
||||
static int tolua_AllToLua_cLuaChunk_GetBlock00(lua_State* tolua_S)
|
||||
/* method: GetBlock of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlock00
|
||||
static int tolua_AllToLua_cChunkDesc_GetBlock00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",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) ||
|
||||
@ -18883,7 +18883,7 @@ static int tolua_AllToLua_cLuaChunk_GetBlock00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Y = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,4,0));
|
||||
@ -18891,7 +18891,7 @@ static int tolua_AllToLua_cLuaChunk_GetBlock00(lua_State* tolua_S)
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlock'", NULL);
|
||||
#endif
|
||||
{
|
||||
char tolua_ret = (char) self->GetBlock(a_X,a_Y,a_Z);
|
||||
unsigned char tolua_ret = ( unsigned char) self->GetBlock(a_X,a_Y,a_Z);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||
}
|
||||
}
|
||||
@ -18904,14 +18904,14 @@ static int tolua_AllToLua_cLuaChunk_GetBlock00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: GetBlockMeta of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetBlockMeta00
|
||||
static int tolua_AllToLua_cLuaChunk_GetBlockMeta00(lua_State* tolua_S)
|
||||
/* method: GetBlockMeta of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockMeta00
|
||||
static int tolua_AllToLua_cChunkDesc_GetBlockMeta00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",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) ||
|
||||
@ -18921,7 +18921,7 @@ static int tolua_AllToLua_cLuaChunk_GetBlockMeta00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Y = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,4,0));
|
||||
@ -18929,7 +18929,7 @@ static int tolua_AllToLua_cLuaChunk_GetBlockMeta00(lua_State* tolua_S)
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL);
|
||||
#endif
|
||||
{
|
||||
char tolua_ret = (char) self->GetBlockMeta(a_X,a_Y,a_Z);
|
||||
unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_X,a_Y,a_Z);
|
||||
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
|
||||
}
|
||||
}
|
||||
@ -18942,14 +18942,14 @@ static int tolua_AllToLua_cLuaChunk_GetBlockMeta00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetBiome of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetBiome00
|
||||
static int tolua_AllToLua_cLuaChunk_SetBiome00(lua_State* tolua_S)
|
||||
/* method: SetBiome of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBiome00
|
||||
static int tolua_AllToLua_cChunkDesc_SetBiome00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",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) ||
|
||||
@ -18959,7 +18959,7 @@ static int tolua_AllToLua_cLuaChunk_SetBiome00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
int a_BiomeID = ((int) tolua_tonumber(tolua_S,4,0));
|
||||
@ -18979,14 +18979,14 @@ static int tolua_AllToLua_cLuaChunk_SetBiome00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: GetBiome of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetBiome00
|
||||
static int tolua_AllToLua_cLuaChunk_GetBiome00(lua_State* tolua_S)
|
||||
/* method: GetBiome of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBiome00
|
||||
static int tolua_AllToLua_cChunkDesc_GetBiome00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
@ -18995,7 +18995,7 @@ static int tolua_AllToLua_cLuaChunk_GetBiome00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
@ -19015,14 +19015,14 @@ static int tolua_AllToLua_cLuaChunk_GetBiome00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetHeight of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetHeight00
|
||||
static int tolua_AllToLua_cLuaChunk_SetHeight00(lua_State* tolua_S)
|
||||
/* method: SetHeight of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetHeight00
|
||||
static int tolua_AllToLua_cChunkDesc_SetHeight00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",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) ||
|
||||
@ -19032,7 +19032,7 @@ static int tolua_AllToLua_cLuaChunk_SetHeight00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
int a_Height = ((int) tolua_tonumber(tolua_S,4,0));
|
||||
@ -19052,14 +19052,14 @@ static int tolua_AllToLua_cLuaChunk_SetHeight00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: GetHeight of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_GetHeight00
|
||||
static int tolua_AllToLua_cLuaChunk_GetHeight00(lua_State* tolua_S)
|
||||
/* method: GetHeight of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetHeight00
|
||||
static int tolua_AllToLua_cChunkDesc_GetHeight00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnumber(tolua_S,3,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,4,&tolua_err)
|
||||
@ -19068,7 +19068,7 @@ static int tolua_AllToLua_cLuaChunk_GetHeight00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
int a_X = ((int) tolua_tonumber(tolua_S,2,0));
|
||||
int a_Z = ((int) tolua_tonumber(tolua_S,3,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
@ -19088,14 +19088,14 @@ static int tolua_AllToLua_cLuaChunk_GetHeight00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetUseDefaultBiomes of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00
|
||||
static int tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00(lua_State* tolua_S)
|
||||
/* method: SetUseDefaultBiomes of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00
|
||||
static int tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
@ -19103,7 +19103,7 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
bool a_bUseDefaultBiomes = ((bool) tolua_toboolean(tolua_S,2,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultBiomes'", NULL);
|
||||
@ -19121,21 +19121,21 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: IsUsingDefaultBiomes of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00
|
||||
static int tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00(lua_State* tolua_S)
|
||||
/* method: IsUsingDefaultBiomes of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00
|
||||
static int tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultBiomes'", NULL);
|
||||
#endif
|
||||
@ -19153,14 +19153,14 @@ static int tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetUseDefaultComposition of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00
|
||||
static int tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00(lua_State* tolua_S)
|
||||
/* method: SetUseDefaultHeight of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00
|
||||
static int tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
@ -19168,7 +19168,72 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00(lua_State* tolua_
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
bool a_bUseDefaultHeight = ((bool) tolua_toboolean(tolua_S,2,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultHeight'", NULL);
|
||||
#endif
|
||||
{
|
||||
self->SetUseDefaultHeight(a_bUseDefaultHeight);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'SetUseDefaultHeight'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: IsUsingDefaultHeight of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00
|
||||
static int tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultHeight'", NULL);
|
||||
#endif
|
||||
{
|
||||
bool tolua_ret = (bool) self->IsUsingDefaultHeight();
|
||||
tolua_pushboolean(tolua_S,(bool)tolua_ret);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_lerror:
|
||||
tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultHeight'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetUseDefaultComposition of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00
|
||||
static int tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
bool a_bUseDefaultComposition = ((bool) tolua_toboolean(tolua_S,2,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultComposition'", NULL);
|
||||
@ -19186,21 +19251,21 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00(lua_State* tolua_
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: IsUsingDefaultComposition of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00
|
||||
static int tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00(lua_State* tolua_S)
|
||||
/* method: IsUsingDefaultComposition of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00
|
||||
static int tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultComposition'", NULL);
|
||||
#endif
|
||||
@ -19218,14 +19283,14 @@ static int tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00(lua_State* tolua
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetUseDefaultStructures of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00
|
||||
static int tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00(lua_State* tolua_S)
|
||||
/* method: SetUseDefaultStructures of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00
|
||||
static int tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
@ -19233,7 +19298,7 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00(lua_State* tolua_S
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
bool a_bUseDefaultStructures = ((bool) tolua_toboolean(tolua_S,2,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultStructures'", NULL);
|
||||
@ -19251,21 +19316,21 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00(lua_State* tolua_S
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: IsUsingDefaultStructures of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00
|
||||
static int tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00(lua_State* tolua_S)
|
||||
/* method: IsUsingDefaultStructures of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00
|
||||
static int tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultStructures'", NULL);
|
||||
#endif
|
||||
@ -19283,14 +19348,14 @@ static int tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00(lua_State* tolua_
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: SetUseDefaultFinish of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00
|
||||
static int tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00(lua_State* tolua_S)
|
||||
/* method: SetUseDefaultFinish of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00
|
||||
static int tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isboolean(tolua_S,2,0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,3,&tolua_err)
|
||||
)
|
||||
@ -19298,7 +19363,7 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00(lua_State* tolua_S)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
bool a_bUseDefaultFinish = ((bool) tolua_toboolean(tolua_S,2,0));
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultFinish'", NULL);
|
||||
@ -19316,21 +19381,21 @@ static int tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00(lua_State* tolua_S)
|
||||
}
|
||||
#endif //#ifndef TOLUA_DISABLE
|
||||
|
||||
/* method: IsUsingDefaultFinish of class cLuaChunk */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaChunk_IsUsingDefaultFinish00
|
||||
static int tolua_AllToLua_cLuaChunk_IsUsingDefaultFinish00(lua_State* tolua_S)
|
||||
/* method: IsUsingDefaultFinish of class cChunkDesc */
|
||||
#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00
|
||||
static int tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00(lua_State* tolua_S)
|
||||
{
|
||||
#ifndef TOLUA_RELEASE
|
||||
tolua_Error tolua_err;
|
||||
if (
|
||||
!tolua_isusertype(tolua_S,1,"cLuaChunk",0,&tolua_err) ||
|
||||
!tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) ||
|
||||
!tolua_isnoobj(tolua_S,2,&tolua_err)
|
||||
)
|
||||
goto tolua_lerror;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
cLuaChunk* self = (cLuaChunk*) tolua_tousertype(tolua_S,1,0);
|
||||
const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0);
|
||||
#ifndef TOLUA_RELEASE
|
||||
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultFinish'", NULL);
|
||||
#endif
|
||||
@ -20573,6 +20638,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_constant(tolua_S,"E_BLOCK_REDSTONE_LAMP_ON",E_BLOCK_REDSTONE_LAMP_ON);
|
||||
tolua_constant(tolua_S,"E_BLOCK_DOUBLE_WOODEN_SLAB",E_BLOCK_DOUBLE_WOODEN_SLAB);
|
||||
tolua_constant(tolua_S,"E_BLOCK_WOODEN_SLAB",E_BLOCK_WOODEN_SLAB);
|
||||
tolua_constant(tolua_S,"E_BLOCK_COCOA_POD",E_BLOCK_COCOA_POD);
|
||||
tolua_constant(tolua_S,"E_BLOCK_COCA_PLANT",E_BLOCK_COCA_PLANT);
|
||||
tolua_constant(tolua_S,"E_BLOCK_SANDSTONE_STAIRS",E_BLOCK_SANDSTONE_STAIRS);
|
||||
tolua_constant(tolua_S,"E_BLOCK_EMERALD_ORE",E_BLOCK_EMERALD_ORE);
|
||||
@ -21802,24 +21868,26 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
|
||||
tolua_function(tolua_S,"HasBlockLights",tolua_AllToLua_cBlockArea_HasBlockLights00);
|
||||
tolua_function(tolua_S,"HasBlockSkyLights",tolua_AllToLua_cBlockArea_HasBlockSkyLights00);
|
||||
tolua_endmodule(tolua_S);
|
||||
tolua_cclass(tolua_S,"cLuaChunk","cLuaChunk","",NULL);
|
||||
tolua_beginmodule(tolua_S,"cLuaChunk");
|
||||
tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cLuaChunk_FillBlocks00);
|
||||
tolua_function(tolua_S,"SetBlock",tolua_AllToLua_cLuaChunk_SetBlock00);
|
||||
tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cLuaChunk_GetBlock00);
|
||||
tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cLuaChunk_GetBlockMeta00);
|
||||
tolua_function(tolua_S,"SetBiome",tolua_AllToLua_cLuaChunk_SetBiome00);
|
||||
tolua_function(tolua_S,"GetBiome",tolua_AllToLua_cLuaChunk_GetBiome00);
|
||||
tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cLuaChunk_SetHeight00);
|
||||
tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cLuaChunk_GetHeight00);
|
||||
tolua_function(tolua_S,"SetUseDefaultBiomes",tolua_AllToLua_cLuaChunk_SetUseDefaultBiomes00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultBiomes",tolua_AllToLua_cLuaChunk_IsUsingDefaultBiomes00);
|
||||
tolua_function(tolua_S,"SetUseDefaultComposition",tolua_AllToLua_cLuaChunk_SetUseDefaultComposition00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultComposition",tolua_AllToLua_cLuaChunk_IsUsingDefaultComposition00);
|
||||
tolua_function(tolua_S,"SetUseDefaultStructures",tolua_AllToLua_cLuaChunk_SetUseDefaultStructures00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultStructures",tolua_AllToLua_cLuaChunk_IsUsingDefaultStructures00);
|
||||
tolua_function(tolua_S,"SetUseDefaultFinish",tolua_AllToLua_cLuaChunk_SetUseDefaultFinish00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultFinish",tolua_AllToLua_cLuaChunk_IsUsingDefaultFinish00);
|
||||
tolua_cclass(tolua_S,"cChunkDesc","cChunkDesc","",NULL);
|
||||
tolua_beginmodule(tolua_S,"cChunkDesc");
|
||||
tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cChunkDesc_FillBlocks00);
|
||||
tolua_function(tolua_S,"SetBlock",tolua_AllToLua_cChunkDesc_SetBlock00);
|
||||
tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cChunkDesc_GetBlock00);
|
||||
tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cChunkDesc_GetBlockMeta00);
|
||||
tolua_function(tolua_S,"SetBiome",tolua_AllToLua_cChunkDesc_SetBiome00);
|
||||
tolua_function(tolua_S,"GetBiome",tolua_AllToLua_cChunkDesc_GetBiome00);
|
||||
tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cChunkDesc_SetHeight00);
|
||||
tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cChunkDesc_GetHeight00);
|
||||
tolua_function(tolua_S,"SetUseDefaultBiomes",tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultBiomes",tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00);
|
||||
tolua_function(tolua_S,"SetUseDefaultHeight",tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultHeight",tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00);
|
||||
tolua_function(tolua_S,"SetUseDefaultComposition",tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultComposition",tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00);
|
||||
tolua_function(tolua_S,"SetUseDefaultStructures",tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultStructures",tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00);
|
||||
tolua_function(tolua_S,"SetUseDefaultFinish",tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00);
|
||||
tolua_function(tolua_S,"IsUsingDefaultFinish",tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00);
|
||||
tolua_endmodule(tolua_S);
|
||||
#ifdef __cplusplus
|
||||
tolua_cclass(tolua_S,"cCraftingGrid","cCraftingGrid","",tolua_collect_cCraftingGrid);
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
** Lua binding: AllToLua
|
||||
** Generated automatically by tolua++-1.0.92 on 01/19/13 07:27:34.
|
||||
** Generated automatically by tolua++-1.0.92 on 01/25/13 19:08:52.
|
||||
*/
|
||||
|
||||
/* Exported function */
|
||||
|
@ -14,7 +14,7 @@ Interfaces to the various biome generators:
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
191
source/Generating/ChunkDesc.h
Normal file
191
source/Generating/ChunkDesc.h
Normal file
@ -0,0 +1,191 @@
|
||||
|
||||
// ChunkDesc.h
|
||||
|
||||
// Declares the cChunkDesc class representing the chunk description used while generating a chunk. This class is also exported to Lua for HOOK_CHUNK_GENERATING.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../ChunkDef.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cChunkDesc // tolua_export
|
||||
{ // tolua_export
|
||||
public:
|
||||
cChunkDesc(
|
||||
cChunkDef::BlockTypes & a_BlockTypes,
|
||||
cChunkDef::BlockNibbles & a_BlockNibbles ,
|
||||
cChunkDef::HeightMap & a_HeightMap,
|
||||
cChunkDef::BiomeMap & a_BiomeMap
|
||||
)
|
||||
: m_BiomeMap(a_BiomeMap)
|
||||
, m_BlockTypes(a_BlockTypes)
|
||||
, m_BlockMeta(a_BlockNibbles)
|
||||
, m_HeightMap(a_HeightMap)
|
||||
, m_bUseDefaultBiomes(true)
|
||||
, m_bUseDefaultHeight(true)
|
||||
, m_bUseDefaultComposition(true)
|
||||
, m_bUseDefaultStructures(true)
|
||||
, m_bUseDefaultFinish(true)
|
||||
{
|
||||
memset(m_BlockTypes, 0, sizeof(cChunkDef::BlockTypes));
|
||||
memset(m_BlockMeta, 0, sizeof(cChunkDef::BlockNibbles));
|
||||
memset(m_BiomeMap, 0, sizeof(cChunkDef::BiomeMap));
|
||||
memset(m_HeightMap, 0, sizeof(cChunkDef::HeightMap));
|
||||
}
|
||||
|
||||
~cChunkDesc()
|
||||
{}
|
||||
|
||||
// tolua_begin
|
||||
|
||||
|
||||
|
||||
// Block functions:
|
||||
void FillBlocks(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
const NIBBLETYPE CompressedMeta = a_BlockMeta | a_BlockMeta << 4;
|
||||
memset(m_BlockTypes, a_BlockType, sizeof(cChunkDef::BlockTypes));
|
||||
memset(m_BlockMeta, CompressedMeta, sizeof(cChunkDef::BlockNibbles));
|
||||
}
|
||||
|
||||
|
||||
void SetBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
|
||||
{
|
||||
cChunkDef::SetBlock( m_BlockTypes, a_X, a_Y, a_Z, a_BlockType );
|
||||
cChunkDef::SetNibble( m_BlockMeta, a_X, a_Y, a_Z, a_BlockMeta );
|
||||
}
|
||||
|
||||
|
||||
BLOCKTYPE GetBlock( int a_X, int a_Y, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetBlock( m_BlockTypes, a_X, a_Y, a_Z );
|
||||
}
|
||||
|
||||
|
||||
NIBBLETYPE GetBlockMeta( int a_X, int a_Y, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetNibble( m_BlockMeta, a_X, a_Y, a_Z );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Biome functinos
|
||||
void SetBiome( int a_X, int a_Z, int a_BiomeID )
|
||||
{
|
||||
cChunkDef::SetBiome( m_BiomeMap, a_X, a_Z, (EMCSBiome)a_BiomeID );
|
||||
}
|
||||
|
||||
|
||||
int GetBiome( int a_X, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetBiome( m_BiomeMap, a_X, a_Z );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Height functions
|
||||
void SetHeight( int a_X, int a_Z, int a_Height )
|
||||
{
|
||||
cChunkDef::SetHeight( m_HeightMap, a_X, a_Z, a_Height );
|
||||
}
|
||||
|
||||
|
||||
int GetHeight( int a_X, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetHeight( m_HeightMap, a_X, a_Z );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Functions to explicitly tell the server to use default behavior for certain parts of generating terrain
|
||||
void SetUseDefaultBiomes(bool a_bUseDefaultBiomes)
|
||||
{
|
||||
m_bUseDefaultBiomes = a_bUseDefaultBiomes;
|
||||
}
|
||||
|
||||
|
||||
bool IsUsingDefaultBiomes(void) const
|
||||
{
|
||||
return m_bUseDefaultBiomes;
|
||||
}
|
||||
|
||||
|
||||
void SetUseDefaultHeight(bool a_bUseDefaultHeight)
|
||||
{
|
||||
m_bUseDefaultHeight = a_bUseDefaultHeight;
|
||||
}
|
||||
|
||||
|
||||
bool IsUsingDefaultHeight(void) const
|
||||
{
|
||||
return m_bUseDefaultHeight;
|
||||
}
|
||||
|
||||
|
||||
void SetUseDefaultComposition(bool a_bUseDefaultComposition)
|
||||
{
|
||||
m_bUseDefaultComposition = a_bUseDefaultComposition;
|
||||
}
|
||||
|
||||
|
||||
bool IsUsingDefaultComposition(void) const
|
||||
{
|
||||
return m_bUseDefaultComposition;
|
||||
}
|
||||
|
||||
|
||||
void SetUseDefaultStructures(bool a_bUseDefaultStructures)
|
||||
{
|
||||
m_bUseDefaultStructures = a_bUseDefaultStructures;
|
||||
}
|
||||
|
||||
|
||||
bool IsUsingDefaultStructures(void) const
|
||||
{
|
||||
return m_bUseDefaultStructures;
|
||||
}
|
||||
|
||||
|
||||
void SetUseDefaultFinish(bool a_bUseDefaultFinish)
|
||||
{
|
||||
m_bUseDefaultFinish = a_bUseDefaultFinish;
|
||||
}
|
||||
|
||||
|
||||
bool IsUsingDefaultFinish(void) const
|
||||
{
|
||||
return m_bUseDefaultFinish;
|
||||
}
|
||||
|
||||
// tolua_end
|
||||
|
||||
|
||||
// Accessors used by cChunkGenerator::Generator descendants:
|
||||
cChunkDef::BiomeMap & GetBiomeMap (void) { return m_BiomeMap; }
|
||||
cChunkDef::BlockTypes & GetBlockTypes(void) { return m_BlockTypes; }
|
||||
cChunkDef::BlockNibbles & GetBlockMetas(void) { return m_BlockMeta; }
|
||||
cChunkDef::HeightMap & GetHeightMap (void) { return m_HeightMap; }
|
||||
|
||||
private:
|
||||
bool m_bUseDefaultBiomes;
|
||||
bool m_bUseDefaultHeight;
|
||||
bool m_bUseDefaultComposition;
|
||||
bool m_bUseDefaultStructures;
|
||||
bool m_bUseDefaultFinish;
|
||||
|
||||
cChunkDef::BiomeMap & m_BiomeMap;
|
||||
cChunkDef::BlockTypes & m_BlockTypes;
|
||||
cChunkDef::BlockNibbles & m_BlockMeta;
|
||||
cChunkDef::HeightMap & m_HeightMap;
|
||||
} ; // tolua_export
|
||||
|
||||
|
||||
|
||||
|
@ -4,16 +4,10 @@
|
||||
#include "ChunkGenerator.h"
|
||||
#include "../World.h"
|
||||
#include "../../iniFile/iniFile.h"
|
||||
#include "BioGen.h"
|
||||
#include "HeiGen.h"
|
||||
#include "CompoGen.h"
|
||||
#include "StructGen.h"
|
||||
#include "FinishGen.h"
|
||||
#include "../Root.h"
|
||||
#include "../PluginManager.h"
|
||||
#include "../LuaChunk.h"
|
||||
#include "Ravines.h"
|
||||
#include "Caves.h"
|
||||
#include "ChunkDesc.h"
|
||||
#include "ComposableGenerator.h"
|
||||
|
||||
|
||||
|
||||
@ -29,31 +23,13 @@ const int QUEUE_SKIP_LIMIT = 500;
|
||||
|
||||
|
||||
|
||||
static BLOCKTYPE GetIniBlock(cIniFile & a_IniFile, const AString & a_SectionName, const AString & a_ValueName, const AString & a_Default)
|
||||
{
|
||||
AString BlockType = a_IniFile.GetValueSet(a_SectionName, a_ValueName, a_Default);
|
||||
BLOCKTYPE Block = BlockStringToType(BlockType);
|
||||
if (Block < 0)
|
||||
{
|
||||
LOGWARN("[&s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(),a_Default.c_str());
|
||||
return BlockStringToType(a_Default);
|
||||
}
|
||||
return Block;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cChunkGenerator:
|
||||
|
||||
cChunkGenerator::cChunkGenerator(void)
|
||||
: super("cChunkGenerator")
|
||||
, m_World(NULL)
|
||||
, m_BiomeGen(NULL)
|
||||
, m_HeightGen(NULL)
|
||||
, m_CompositionGen(NULL)
|
||||
cChunkGenerator::cChunkGenerator(void) :
|
||||
super("cChunkGenerator"),
|
||||
m_World(NULL),
|
||||
m_Generator(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
@ -75,12 +51,28 @@ bool cChunkGenerator::Start(cWorld * a_World, cIniFile & a_IniFile)
|
||||
MTRand rnd;
|
||||
m_World = a_World;
|
||||
m_Seed = a_IniFile.GetValueSetI("Seed", "Seed", rnd.randInt());
|
||||
AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable");
|
||||
|
||||
InitBiomeGen(a_IniFile);
|
||||
InitHeightGen(a_IniFile);
|
||||
InitCompositionGen(a_IniFile);
|
||||
InitStructureGens(a_IniFile);
|
||||
InitFinishGens(a_IniFile);
|
||||
if (NoCaseCompare(GeneratorName, "RoughHills") == 0)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NoCaseCompare(GeneratorName, "composable") != 0)
|
||||
{
|
||||
LOGWARN("[Generator]::Generator value \"%s\" not recognized, using \"Composable\".", GeneratorName.c_str());
|
||||
}
|
||||
m_Generator = new cComposableGenerator(*this);
|
||||
}
|
||||
|
||||
if (m_Generator == NULL)
|
||||
{
|
||||
LOGERROR("Generator could not start, aborting the server");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_Generator->Initialize(a_World, a_IniFile);
|
||||
|
||||
a_IniFile.WriteFile();
|
||||
|
||||
@ -98,289 +90,8 @@ void cChunkGenerator::Stop(void)
|
||||
m_evtRemoved.Set(); // Wake up anybody waiting for empty queue
|
||||
Wait();
|
||||
|
||||
// Delete the generating composition:
|
||||
for (cFinishGenList::const_iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
}
|
||||
m_FinishGens.clear();
|
||||
for (cStructureGenList::const_iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
}
|
||||
m_StructureGens.clear();
|
||||
delete m_CompositionGen;
|
||||
m_CompositionGen = NULL;
|
||||
delete m_HeightGen;
|
||||
m_HeightGen = NULL;
|
||||
delete m_BiomeGen;
|
||||
m_BiomeGen = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::InitBiomeGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", "");
|
||||
if (BiomeGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator]::BiomeGen value not found in world.ini, using \"DistortedVoronoi\".");
|
||||
BiomeGenName = "DistortedVoronoi";
|
||||
}
|
||||
|
||||
bool CacheOffByDefault = false;
|
||||
if (NoCaseCompare(BiomeGenName, "constant") == 0)
|
||||
{
|
||||
AString Biome = a_IniFile.GetValueSet("Generator", "ConstantBiome", "Plains");
|
||||
EMCSBiome b = StringToBiome(Biome);
|
||||
if (b == -1)
|
||||
{
|
||||
LOGWARN("[Generator]::ConstantBiome value \"%s\" not recognized, using \"Plains\".", Biome.c_str());
|
||||
b = biPlains;
|
||||
}
|
||||
m_BiomeGen = new cBioGenConstant(b);
|
||||
CacheOffByDefault = true; // we're generating faster than a cache would retrieve data :)
|
||||
}
|
||||
else if (NoCaseCompare(BiomeGenName, "checkerboard") == 0)
|
||||
{
|
||||
int BiomeSize = a_IniFile.GetValueSetI("Generator", "CheckerboardBiomeSize", 64);
|
||||
AString Biomes = a_IniFile.GetValueSet ("Generator", "CheckerBoardBiomes", "");
|
||||
m_BiomeGen = new cBioGenCheckerboard(BiomeSize, Biomes);
|
||||
CacheOffByDefault = true; // we're (probably) generating faster than a cache would retrieve data
|
||||
}
|
||||
else if (NoCaseCompare(BiomeGenName, "voronoi") == 0)
|
||||
{
|
||||
int CellSize = a_IniFile.GetValueSetI("Generator", "VoronoiCellSize", 64);
|
||||
AString Biomes = a_IniFile.GetValueSet ("Generator", "VoronoiBiomes", "");
|
||||
m_BiomeGen = new cBioGenVoronoi(m_Seed, CellSize, Biomes);
|
||||
}
|
||||
else if (NoCaseCompare(BiomeGenName, "multistepmap") == 0)
|
||||
{
|
||||
m_BiomeGen = new cBioGenMultiStepMap(m_Seed);
|
||||
((cBioGenMultiStepMap *)m_BiomeGen)->Init(a_IniFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NoCaseCompare(BiomeGenName, "distortedvoronoi") != 0)
|
||||
{
|
||||
LOGWARNING("Unknown BiomeGen \"%s\", using \"DistortedVoronoi\" instead.", BiomeGenName.c_str());
|
||||
}
|
||||
int CellSize = a_IniFile.GetValueSetI("Generator", "DistortedVoronoiCellSize", 96);
|
||||
AString Biomes = a_IniFile.GetValueSet ("Generator", "DistortedVoronoiBiomes", "");
|
||||
m_BiomeGen = new cBioGenDistortedVoronoi(m_Seed, CellSize, Biomes);
|
||||
}
|
||||
|
||||
// Add a cache, if requested:
|
||||
int CacheSize = a_IniFile.GetValueSetI("Generator", "BiomeGenCacheSize", CacheOffByDefault ? 0 : 64);
|
||||
if (CacheSize > 0)
|
||||
{
|
||||
if (CacheSize < 4)
|
||||
{
|
||||
LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
|
||||
CacheSize, 4
|
||||
);
|
||||
CacheSize = 4;
|
||||
}
|
||||
LOGINFO("Using a cache for biomegen of size %d.", CacheSize);
|
||||
m_BiomeGen = new cBioGenCache(m_BiomeGen, CacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::InitHeightGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "");
|
||||
if (HeightGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator]::HeightGen value not found in world.ini, using \"Biomal\".");
|
||||
HeightGenName = "Biomal";
|
||||
}
|
||||
|
||||
bool CacheOffByDefault = false;
|
||||
if (NoCaseCompare(HeightGenName, "flat") == 0)
|
||||
{
|
||||
int Height = a_IniFile.GetValueSetI("Generator", "FlatHeight", 5);
|
||||
m_HeightGen = new cHeiGenFlat(Height);
|
||||
CacheOffByDefault = true; // We're generating faster than a cache would retrieve data
|
||||
}
|
||||
else if (NoCaseCompare(HeightGenName, "classic") == 0)
|
||||
{
|
||||
// These used to be in terrain.ini, but now they are in world.ini (so that multiple worlds can have different values):
|
||||
float HeightFreq1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq1", 0.1);
|
||||
float HeightFreq2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq2", 1.0);
|
||||
float HeightFreq3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq3", 2.0);
|
||||
float HeightAmp1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp1", 1.0);
|
||||
float HeightAmp2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp2", 0.5);
|
||||
float HeightAmp3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp3", 0.5);
|
||||
m_HeightGen = new cHeiGenClassic(m_Seed, HeightFreq1, HeightAmp1, HeightFreq2, HeightAmp2, HeightFreq3, HeightAmp3);
|
||||
}
|
||||
else // "biomal" or <not found>
|
||||
{
|
||||
if (NoCaseCompare(HeightGenName, "biomal") != 0)
|
||||
{
|
||||
LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str());
|
||||
}
|
||||
m_HeightGen = new cHeiGenBiomal(m_Seed, *m_BiomeGen);
|
||||
}
|
||||
|
||||
// Add a cache, if requested:
|
||||
int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64);
|
||||
if (CacheSize > 0)
|
||||
{
|
||||
if (CacheSize < 4)
|
||||
{
|
||||
LOGWARNING("Heightgen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
|
||||
CacheSize, 4
|
||||
);
|
||||
CacheSize = 4;
|
||||
}
|
||||
LOGINFO("Using a cache for Heightgen of size %d.", CacheSize);
|
||||
m_HeightGen = new cHeiGenCache(m_HeightGen, CacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", "");
|
||||
if (CompoGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator]::CompositionGen value not found in world.ini, using \"Biomal\".");
|
||||
CompoGenName = "Biomal";
|
||||
}
|
||||
if (NoCaseCompare(CompoGenName, "sameblock") == 0)
|
||||
{
|
||||
int Block = GetIniBlock(a_IniFile, "Generator", "SameBlockType", "stone");
|
||||
bool Bedrocked = (a_IniFile.GetValueSetI("Generator", "SameBlockBedrocked", 1) != 0);
|
||||
m_CompositionGen = new cCompoGenSameBlock((BLOCKTYPE)Block, Bedrocked);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0)
|
||||
{
|
||||
m_CompositionGen = new cCompoGenDebugBiomes;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "classic") == 0)
|
||||
{
|
||||
int SeaLevel = a_IniFile.GetValueSetI("Generator", "ClassicSeaLevel", 60);
|
||||
int BeachHeight = a_IniFile.GetValueSetI("Generator", "ClassicBeachHeight", 2);
|
||||
int BeachDepth = a_IniFile.GetValueSetI("Generator", "ClassicBeachDepth", 4);
|
||||
BLOCKTYPE BlockTop = GetIniBlock(a_IniFile, "Generator", "ClassicBlockTop", "grass");
|
||||
BLOCKTYPE BlockMiddle = GetIniBlock(a_IniFile, "Generator", "ClassicBlockMiddle", "dirt");
|
||||
BLOCKTYPE BlockBottom = GetIniBlock(a_IniFile, "Generator", "ClassicBlockBottom", "stone");
|
||||
BLOCKTYPE BlockBeach = GetIniBlock(a_IniFile, "Generator", "ClassicBlockBeach", "sand");
|
||||
BLOCKTYPE BlockBeachBottom = GetIniBlock(a_IniFile, "Generator", "ClassicBlockBeachBottom", "sandstone");
|
||||
BLOCKTYPE BlockSea = GetIniBlock(a_IniFile, "Generator", "ClassicBlockSea", "stationarywater");
|
||||
m_CompositionGen = new cCompoGenClassic(
|
||||
SeaLevel, BeachHeight, BeachDepth, BlockTop, BlockMiddle, BlockBottom, BlockBeach,
|
||||
BlockBeachBottom, BlockSea
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NoCaseCompare(CompoGenName, "biomal") != 0)
|
||||
{
|
||||
LOGWARN("Unknown CompositionGen \"%s\", using \"biomal\" instead.", CompoGenName.c_str());
|
||||
}
|
||||
int SeaLevel = a_IniFile.GetValueSetI("Generator", "BiomalSeaLevel", 62);
|
||||
m_CompositionGen = new cCompoGenBiomal(m_Seed, SeaLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::InitStructureGens(cIniFile & a_IniFile)
|
||||
{
|
||||
AString Structures = a_IniFile.GetValueSet("Generator", "Structures", "Ravines,WormNestCaves,OreNests,Trees");
|
||||
|
||||
AStringVector Str = StringSplit(Structures, ",");
|
||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
||||
{
|
||||
if (NoCaseCompare(*itr, "trees") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenTrees(m_Seed, m_BiomeGen, m_HeightGen, m_CompositionGen));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "marblecaves") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenMarbleCaves(m_Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "dualridgecaves") == 0)
|
||||
{
|
||||
float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3);
|
||||
m_StructureGens.push_back(new cStructGenDualRidgeCaves(m_Seed, Threshold));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "orenests") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenOreNests(m_Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "ravines") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenRavines(m_Seed, 128));
|
||||
}
|
||||
//*
|
||||
// TODO: Not implemented yet; need a name
|
||||
else if (NoCaseCompare(*itr, "wormnestcaves") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenWormNestCaves(m_Seed));
|
||||
}
|
||||
//*/
|
||||
else
|
||||
{
|
||||
LOGWARNING("Unknown structure generator: \"%s\". Ignoring.", itr->c_str());
|
||||
}
|
||||
} // for itr - Str[]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
{
|
||||
AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
|
||||
|
||||
AStringVector Str = StringSplit(Structures, ",");
|
||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
||||
{
|
||||
// Finishers, alpha-sorted:
|
||||
if (NoCaseCompare(*itr, "BottomLava") == 0)
|
||||
{
|
||||
int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", 10);
|
||||
m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "DeadBushes") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenDeadBushes(m_Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Ice") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenIce);
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Lilypads") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenLilypads(m_Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "PreSimulator") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenPreSimulator);
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Snow") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenSnow);
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "SprinkleFoliage") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(m_Seed));
|
||||
}
|
||||
} // for itr - Str[]
|
||||
delete m_Generator;
|
||||
m_Generator = NULL;
|
||||
}
|
||||
|
||||
|
||||
@ -419,9 +130,9 @@ void cChunkGenerator::QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_Chunk
|
||||
|
||||
void cChunkGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
|
||||
{
|
||||
if (m_BiomeGen != NULL) // Quick fix for generator deinitializing before the world storage finishes loading
|
||||
if (m_Generator != NULL)
|
||||
{
|
||||
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
|
||||
m_Generator->GenerateBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
|
||||
}
|
||||
}
|
||||
|
||||
@ -455,12 +166,24 @@ int cChunkGenerator::GetQueueLength(void)
|
||||
|
||||
EMCSBiome cChunkGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ)
|
||||
{
|
||||
cChunkDef::BiomeMap Biomes;
|
||||
int Y = 0;
|
||||
int ChunkX, ChunkZ;
|
||||
cWorld::AbsoluteToRelative(a_BlockX, Y, a_BlockZ, ChunkX, Y, ChunkZ);
|
||||
m_BiomeGen->GenBiomes(ChunkX, ChunkZ, Biomes);
|
||||
return cChunkDef::GetBiome(Biomes, a_BlockX, a_BlockZ);
|
||||
ASSERT(m_Generator != NULL);
|
||||
return m_Generator->GetBiomeAt(a_BlockX, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BLOCKTYPE cChunkGenerator::GetIniBlock(cIniFile & a_IniFile, const AString & a_SectionName, const AString & a_ValueName, const AString & a_Default)
|
||||
{
|
||||
AString BlockType = a_IniFile.GetValueSet(a_SectionName, a_ValueName, a_Default);
|
||||
BLOCKTYPE Block = BlockStringToType(BlockType);
|
||||
if (Block < 0)
|
||||
{
|
||||
LOGWARN("[&s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(),a_Default.c_str());
|
||||
return BlockStringToType(a_Default);
|
||||
}
|
||||
return Block;
|
||||
}
|
||||
|
||||
|
||||
@ -550,48 +273,9 @@ void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
||||
cEntityList Entities;
|
||||
cBlockEntityList BlockEntities;
|
||||
|
||||
cLuaChunk LuaChunk( BlockTypes, BlockMeta, HeightMap, BiomeMap );
|
||||
if( cRoot::Get()->GetPluginManager()->CallHookChunkGenerating(m_World, a_ChunkX, a_ChunkZ, &LuaChunk ) )
|
||||
{
|
||||
// A plugin interrupted generation, handle something plugin specific
|
||||
if( LuaChunk.IsUsingDefaultBiomes() )
|
||||
{
|
||||
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, BiomeMap);
|
||||
}
|
||||
if( LuaChunk.IsUsingDefaultComposition() )
|
||||
{
|
||||
m_CompositionGen->ComposeTerrain(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities);
|
||||
}
|
||||
if( LuaChunk.IsUsingDefaultStructures() )
|
||||
{
|
||||
for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
||||
{
|
||||
(*itr)->GenStructures(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, Entities, BlockEntities);
|
||||
} // for itr - m_StructureGens[]
|
||||
}
|
||||
if( LuaChunk.IsUsingDefaultFinish() )
|
||||
{
|
||||
for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
||||
{
|
||||
(*itr)->GenFinish(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities);
|
||||
} // for itr - m_FinishGens[]
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the composed generator:
|
||||
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, BiomeMap);
|
||||
m_HeightGen->GenHeightMap(a_ChunkX, a_ChunkZ, HeightMap);
|
||||
m_CompositionGen->ComposeTerrain(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities);
|
||||
for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
||||
{
|
||||
(*itr)->GenStructures(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, Entities, BlockEntities);
|
||||
} // for itr - m_StructureGens[]
|
||||
for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
||||
{
|
||||
(*itr)->GenFinish(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities);
|
||||
} // for itr - m_FinishGens[]
|
||||
}
|
||||
cChunkDesc LuaChunk(BlockTypes, BlockMeta, HeightMap, BiomeMap);
|
||||
cRoot::Get()->GetPluginManager()->CallHookChunkGenerating(m_World, a_ChunkX, a_ChunkZ, &LuaChunk);
|
||||
m_Generator->DoGenerate(a_ChunkX, a_ChunkZ, LuaChunk, Entities, BlockEntities);
|
||||
|
||||
m_World->SetChunkData(
|
||||
a_ChunkX, a_ChunkY, a_ChunkZ,
|
||||
@ -608,3 +292,39 @@ void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ)
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// cChunkGenerator::cGenerator:
|
||||
|
||||
cChunkGenerator::cGenerator::cGenerator(cChunkGenerator & a_ChunkGenerator) :
|
||||
m_ChunkGenerator(a_ChunkGenerator)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cChunkGenerator::cGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile)
|
||||
{
|
||||
m_World = a_World;
|
||||
UNUSED(a_IniFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EMCSBiome cChunkGenerator::cGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ)
|
||||
{
|
||||
cChunkDef::BiomeMap Biomes;
|
||||
int Y = 0;
|
||||
int ChunkX, ChunkZ;
|
||||
cWorld::AbsoluteToRelative(a_BlockX, Y, a_BlockZ, ChunkX, Y, ChunkZ);
|
||||
GenerateBiomes(ChunkX, ChunkZ, Biomes);
|
||||
return cChunkDef::GetBiome(Biomes, a_BlockX, a_BlockZ);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
// cChunkGenerator.h
|
||||
// ChunkGenerator.h
|
||||
|
||||
// Interfaces to the cChunkGenerator class representing the thread that generates chunks
|
||||
|
||||
@ -10,12 +10,6 @@ Before generating, the thread checks if the chunk hasn't been already generated.
|
||||
It is theoretically possible to have multiple generator threads by having multiple instances of this object,
|
||||
but then it MAY happen that the chunk is generated twice.
|
||||
If the generator queue is overloaded, the generator skips chunks with no clients in them
|
||||
|
||||
Generating works by composing several algorithms:
|
||||
Biome, TerrainHeight, TerrainComposition, Ores, Structures and SmallFoliage
|
||||
Each algorithm may be chosen from a pool of available algorithms in the same class and combined with others,
|
||||
based on user's preferences in the world.ini.
|
||||
See http://forum.mc-server.org/showthread.php?tid=409 for details.
|
||||
*/
|
||||
|
||||
|
||||
@ -34,134 +28,42 @@ See http://forum.mc-server.org/showthread.php?tid=409 for details.
|
||||
// fwd:
|
||||
class cWorld;
|
||||
class cIniFile;
|
||||
|
||||
// TODO: remove this:
|
||||
class cWorldGenerator;
|
||||
class cChunkDesc;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a biome generator must implement
|
||||
A biome generator takes chunk coords on input and outputs an array of biome indices for that chunk on output.
|
||||
The output array is sequenced in the same way as the MapChunk packet's biome data.
|
||||
*/
|
||||
class cBiomeGen
|
||||
{
|
||||
public:
|
||||
virtual ~cBiomeGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
/// Generates biomes for the given chunk
|
||||
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a terrain height generator must implement
|
||||
A terrain height generator takes chunk coords on input and outputs an array of terrain heights for that chunk.
|
||||
The output array is sequenced in the same way as the BiomeGen's biome data.
|
||||
The generator may request biome information from the underlying BiomeGen, it may even request information for
|
||||
other chunks than the one it's currently generating (possibly neighbors - for averaging)
|
||||
*/
|
||||
class cTerrainHeightGen
|
||||
{
|
||||
public:
|
||||
virtual ~cTerrainHeightGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
/// Generates heightmap for the given chunk
|
||||
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a terrain composition generator must implement
|
||||
Terrain composition takes chunk coords on input and outputs the blockdata for that entire chunk, along with
|
||||
the list of entities. It is supposed to make use of the underlying TerrainHeightGen and BiomeGen for that purpose,
|
||||
but it may request information for other chunks than the one it's currently generating from them.
|
||||
*/
|
||||
class cTerrainCompositionGen
|
||||
{
|
||||
public:
|
||||
virtual ~cTerrainCompositionGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
virtual void ComposeTerrain(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // BlockTypes to be generated (the whole array gets initialized, even air)
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // BlockMetas to be generated (the whole array gets initialized)
|
||||
const cChunkDef::HeightMap & a_HeightMap, // The height map to fit
|
||||
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
||||
cEntityList & a_Entities, // Entitites may be generated along with the terrain
|
||||
cBlockEntityList & a_BlockEntities // Block entitites may be generated (chests / furnaces / ...)
|
||||
) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a structure generator must implement
|
||||
Structures are generated after the terrain composition took place. It should modify the blocktype data to account
|
||||
for whatever structures the generator is generating.
|
||||
Note that ores are considered structures too, at least from the interface point of view.
|
||||
Also note that a worldgenerator may contain multiple structure generators, one for each type of structure
|
||||
*/
|
||||
class cStructureGen
|
||||
{
|
||||
public:
|
||||
virtual ~cStructureGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
virtual void GenStructures(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
||||
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
||||
cEntityList & a_Entities, // Entities may be added or deleted
|
||||
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
||||
) = 0;
|
||||
} ;
|
||||
|
||||
typedef std::list<cStructureGen *> cStructureGenList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a finisher must implement
|
||||
Finisher implements small additions after all structures have been generated.
|
||||
*/
|
||||
class cFinishGen
|
||||
{
|
||||
public:
|
||||
virtual ~cFinishGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
virtual void GenFinish(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
||||
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
||||
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
||||
cEntityList & a_Entities, // Entities may be added or deleted
|
||||
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
||||
) = 0;
|
||||
} ;
|
||||
|
||||
typedef std::list<cFinishGen *> cFinishGenList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// The chunk generator itself
|
||||
class cChunkGenerator :
|
||||
cIsThread
|
||||
{
|
||||
typedef cIsThread super;
|
||||
|
||||
public:
|
||||
/// The interface that a class has to implement to become a generator
|
||||
class cGenerator
|
||||
{
|
||||
public:
|
||||
cGenerator(cChunkGenerator & a_ChunkGenerator);
|
||||
virtual ~cGenerator() {} ; // Force a virtual destructor
|
||||
|
||||
/// Called to initialize the generator on server startup.
|
||||
virtual void Initialize(cWorld * a_World, cIniFile & a_IniFile);
|
||||
|
||||
/// Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading.
|
||||
virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
|
||||
|
||||
/// Returns the biome at the specified coords. Used by ChunkMap if an invalid chunk is queried for biome. Default implementation uses GenerateBiomes().
|
||||
virtual EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ);
|
||||
|
||||
/// Called in a separate thread to do the actual chunk generation. Generator should generate into a_ChunkDesc, a_Entities and a_BlockEntities.
|
||||
virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities) = 0;
|
||||
|
||||
protected:
|
||||
cChunkGenerator & m_ChunkGenerator;
|
||||
cWorld * m_World;
|
||||
} ;
|
||||
|
||||
|
||||
cChunkGenerator (void);
|
||||
~cChunkGenerator();
|
||||
@ -169,9 +71,10 @@ public:
|
||||
bool Start(cWorld * a_World, cIniFile & a_IniFile);
|
||||
void Stop(void);
|
||||
|
||||
void QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); // Queues the chunk for generation; removes duplicate requests
|
||||
/// Queues the chunk for generation; removes duplicate requests
|
||||
void QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ);
|
||||
|
||||
/// Generates the biomes for the specified chunk (directly, not in a separate thread)
|
||||
/// Generates the biomes for the specified chunk (directly, not in a separate thread). Used by the world loader if biomes failed loading.
|
||||
void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap);
|
||||
|
||||
void WaitForQueueEmpty(void);
|
||||
@ -180,40 +83,24 @@ public:
|
||||
|
||||
int GetSeed(void) const { return m_Seed; }
|
||||
|
||||
/// Returns the biome at the specified coords. Used by ChunkMap if an invalid chunk is queried for biome
|
||||
EMCSBiome GetBiomeAt(int a_BlockX, int a_BlockZ);
|
||||
|
||||
/// Reads a block type from the ini file; returns the blocktype on success, emits a warning and returns a_Default's representation on failure.
|
||||
static BLOCKTYPE GetIniBlock(cIniFile & a_IniFile, const AString & a_SectionName, const AString & a_ValueName, const AString & a_Default);
|
||||
|
||||
private:
|
||||
|
||||
cWorld * m_World;
|
||||
|
||||
// The generation composition:
|
||||
cBiomeGen * m_BiomeGen;
|
||||
cTerrainHeightGen * m_HeightGen;
|
||||
cTerrainCompositionGen * m_CompositionGen;
|
||||
cStructureGenList m_StructureGens;
|
||||
cFinishGenList m_FinishGens;
|
||||
|
||||
int m_Seed;
|
||||
|
||||
cCriticalSection m_CS;
|
||||
cChunkCoordsList m_Queue;
|
||||
cEvent m_Event; // Set when an item is added to the queue or the thread should terminate
|
||||
cEvent m_evtRemoved; // Set when an item is removed from the queue
|
||||
cEvent m_Event; ///< Set when an item is added to the queue or the thread should terminate
|
||||
cEvent m_evtRemoved; ///< Set when an item is removed from the queue
|
||||
|
||||
/// Reads the biome gen settings from the ini and initializes m_BiomeGen accordingly
|
||||
void InitBiomeGen(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the HeightGen settings from the ini and initializes m_HeightGen accordingly
|
||||
void InitHeightGen(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the CompositionGen settings from the ini and initializes m_CompositionGen accordingly
|
||||
void InitCompositionGen(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the structures to generate from the ini and initializes m_StructureGens accordingly
|
||||
void InitStructureGens(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the finishers from the ini and initializes m_FinishGens accordingly
|
||||
void InitFinishGens(cIniFile & a_IniFile);
|
||||
cGenerator * m_Generator; ///< The actual generator engine used to generate chunks
|
||||
|
||||
// cIsThread override:
|
||||
virtual void Execute(void) override;
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
405
source/Generating/ComposableGenerator.cpp
Normal file
405
source/Generating/ComposableGenerator.cpp
Normal file
@ -0,0 +1,405 @@
|
||||
|
||||
// ComposableGenerator.cpp
|
||||
|
||||
// Implements the cComposableGenerator class representing the chunk generator that takes the composition approach to generating chunks
|
||||
|
||||
#include "Globals.h"
|
||||
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../World.h"
|
||||
#include "../../iniFile/iniFile.h"
|
||||
#include "../Root.h"
|
||||
#include "ChunkDesc.h"
|
||||
|
||||
// Individual composed algorithms:
|
||||
#include "BioGen.h"
|
||||
#include "HeiGen.h"
|
||||
#include "CompoGen.h"
|
||||
#include "StructGen.h"
|
||||
#include "FinishGen.h"
|
||||
#include "Ravines.h"
|
||||
#include "Caves.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) :
|
||||
super(a_ChunkGenerator),
|
||||
m_BiomeGen(NULL),
|
||||
m_HeightGen(NULL),
|
||||
m_CompositionGen(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cComposableGenerator::~cComposableGenerator()
|
||||
{
|
||||
// Delete the generating composition:
|
||||
for (cFinishGenList::const_iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
}
|
||||
m_FinishGens.clear();
|
||||
for (cStructureGenList::const_iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
||||
{
|
||||
delete *itr;
|
||||
}
|
||||
m_StructureGens.clear();
|
||||
delete m_CompositionGen;
|
||||
m_CompositionGen = NULL;
|
||||
delete m_HeightGen;
|
||||
m_HeightGen = NULL;
|
||||
delete m_BiomeGen;
|
||||
m_BiomeGen = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile)
|
||||
{
|
||||
super::Initialize(a_World, a_IniFile);
|
||||
|
||||
InitBiomeGen(a_IniFile);
|
||||
InitHeightGen(a_IniFile);
|
||||
InitCompositionGen(a_IniFile);
|
||||
InitStructureGens(a_IniFile);
|
||||
InitFinishGens(a_IniFile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
|
||||
{
|
||||
if (m_BiomeGen != NULL) // Quick fix for generator deinitializing before the world storage finishes loading
|
||||
{
|
||||
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities)
|
||||
{
|
||||
cChunkDef::BiomeMap & BiomeMap = a_ChunkDesc.GetBiomeMap();
|
||||
cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
|
||||
cChunkDef::BlockNibbles & BlockMeta = a_ChunkDesc.GetBlockMetas();
|
||||
cChunkDef::HeightMap & HeightMap = a_ChunkDesc.GetHeightMap();
|
||||
cEntityList & Entities = a_Entities;
|
||||
cBlockEntityList & BlockEntities = a_BlockEntities;
|
||||
|
||||
if (a_ChunkDesc.IsUsingDefaultBiomes())
|
||||
{
|
||||
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, BiomeMap);
|
||||
}
|
||||
|
||||
if (a_ChunkDesc.IsUsingDefaultHeight())
|
||||
{
|
||||
m_HeightGen->GenHeightMap(a_ChunkX, a_ChunkZ, HeightMap);
|
||||
}
|
||||
|
||||
if (a_ChunkDesc.IsUsingDefaultComposition())
|
||||
{
|
||||
m_CompositionGen->ComposeTerrain(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, a_Entities, a_BlockEntities);
|
||||
}
|
||||
|
||||
if (a_ChunkDesc.IsUsingDefaultStructures())
|
||||
{
|
||||
for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr)
|
||||
{
|
||||
(*itr)->GenStructures(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, Entities, BlockEntities);
|
||||
} // for itr - m_StructureGens[]
|
||||
}
|
||||
|
||||
if (a_ChunkDesc.IsUsingDefaultFinish())
|
||||
{
|
||||
for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr)
|
||||
{
|
||||
(*itr)->GenFinish(a_ChunkX, a_ChunkZ, BlockTypes, BlockMeta, HeightMap, BiomeMap, Entities, BlockEntities);
|
||||
} // for itr - m_FinishGens[]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", "");
|
||||
if (BiomeGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator]::BiomeGen value not found in world.ini, using \"DistortedVoronoi\".");
|
||||
BiomeGenName = "DistortedVoronoi";
|
||||
}
|
||||
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
bool CacheOffByDefault = false;
|
||||
if (NoCaseCompare(BiomeGenName, "constant") == 0)
|
||||
{
|
||||
AString Biome = a_IniFile.GetValueSet("Generator", "ConstantBiome", "Plains");
|
||||
EMCSBiome b = StringToBiome(Biome);
|
||||
if (b == -1)
|
||||
{
|
||||
LOGWARN("[Generator]::ConstantBiome value \"%s\" not recognized, using \"Plains\".", Biome.c_str());
|
||||
b = biPlains;
|
||||
}
|
||||
m_BiomeGen = new cBioGenConstant(b);
|
||||
CacheOffByDefault = true; // we're generating faster than a cache would retrieve data :)
|
||||
}
|
||||
else if (NoCaseCompare(BiomeGenName, "checkerboard") == 0)
|
||||
{
|
||||
int BiomeSize = a_IniFile.GetValueSetI("Generator", "CheckerboardBiomeSize", 64);
|
||||
AString Biomes = a_IniFile.GetValueSet ("Generator", "CheckerBoardBiomes", "");
|
||||
m_BiomeGen = new cBioGenCheckerboard(BiomeSize, Biomes);
|
||||
CacheOffByDefault = true; // we're (probably) generating faster than a cache would retrieve data
|
||||
}
|
||||
else if (NoCaseCompare(BiomeGenName, "voronoi") == 0)
|
||||
{
|
||||
int CellSize = a_IniFile.GetValueSetI("Generator", "VoronoiCellSize", 64);
|
||||
AString Biomes = a_IniFile.GetValueSet ("Generator", "VoronoiBiomes", "");
|
||||
m_BiomeGen = new cBioGenVoronoi(Seed, CellSize, Biomes);
|
||||
}
|
||||
else if (NoCaseCompare(BiomeGenName, "multistepmap") == 0)
|
||||
{
|
||||
m_BiomeGen = new cBioGenMultiStepMap(Seed);
|
||||
((cBioGenMultiStepMap *)m_BiomeGen)->Init(a_IniFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NoCaseCompare(BiomeGenName, "distortedvoronoi") != 0)
|
||||
{
|
||||
LOGWARNING("Unknown BiomeGen \"%s\", using \"DistortedVoronoi\" instead.", BiomeGenName.c_str());
|
||||
}
|
||||
int CellSize = a_IniFile.GetValueSetI("Generator", "DistortedVoronoiCellSize", 96);
|
||||
AString Biomes = a_IniFile.GetValueSet ("Generator", "DistortedVoronoiBiomes", "");
|
||||
m_BiomeGen = new cBioGenDistortedVoronoi(Seed, CellSize, Biomes);
|
||||
}
|
||||
|
||||
// Add a cache, if requested:
|
||||
int CacheSize = a_IniFile.GetValueSetI("Generator", "BiomeGenCacheSize", CacheOffByDefault ? 0 : 64);
|
||||
if (CacheSize > 0)
|
||||
{
|
||||
if (CacheSize < 4)
|
||||
{
|
||||
LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
|
||||
CacheSize, 4
|
||||
);
|
||||
CacheSize = 4;
|
||||
}
|
||||
LOGINFO("Using a cache for biomegen of size %d.", CacheSize);
|
||||
m_BiomeGen = new cBioGenCache(m_BiomeGen, CacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "");
|
||||
if (HeightGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator]::HeightGen value not found in world.ini, using \"Biomal\".");
|
||||
HeightGenName = "Biomal";
|
||||
}
|
||||
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
bool CacheOffByDefault = false;
|
||||
if (NoCaseCompare(HeightGenName, "flat") == 0)
|
||||
{
|
||||
int Height = a_IniFile.GetValueSetI("Generator", "FlatHeight", 5);
|
||||
m_HeightGen = new cHeiGenFlat(Height);
|
||||
CacheOffByDefault = true; // We're generating faster than a cache would retrieve data
|
||||
}
|
||||
else if (NoCaseCompare(HeightGenName, "classic") == 0)
|
||||
{
|
||||
// These used to be in terrain.ini, but now they are in world.ini (so that multiple worlds can have different values):
|
||||
float HeightFreq1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq1", 0.1);
|
||||
float HeightFreq2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq2", 1.0);
|
||||
float HeightFreq3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq3", 2.0);
|
||||
float HeightAmp1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp1", 1.0);
|
||||
float HeightAmp2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp2", 0.5);
|
||||
float HeightAmp3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp3", 0.5);
|
||||
m_HeightGen = new cHeiGenClassic(Seed, HeightFreq1, HeightAmp1, HeightFreq2, HeightAmp2, HeightFreq3, HeightAmp3);
|
||||
}
|
||||
else // "biomal" or <not found>
|
||||
{
|
||||
if (NoCaseCompare(HeightGenName, "biomal") != 0)
|
||||
{
|
||||
LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str());
|
||||
}
|
||||
m_HeightGen = new cHeiGenBiomal(Seed, *m_BiomeGen);
|
||||
}
|
||||
|
||||
// Add a cache, if requested:
|
||||
int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64);
|
||||
if (CacheSize > 0)
|
||||
{
|
||||
if (CacheSize < 4)
|
||||
{
|
||||
LOGWARNING("Heightgen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d",
|
||||
CacheSize, 4
|
||||
);
|
||||
CacheSize = 4;
|
||||
}
|
||||
LOGINFO("Using a cache for Heightgen of size %d.", CacheSize);
|
||||
m_HeightGen = new cHeiGenCache(m_HeightGen, CacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile)
|
||||
{
|
||||
AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", "");
|
||||
if (CompoGenName.empty())
|
||||
{
|
||||
LOGWARN("[Generator]::CompositionGen value not found in world.ini, using \"Biomal\".");
|
||||
CompoGenName = "Biomal";
|
||||
}
|
||||
if (NoCaseCompare(CompoGenName, "sameblock") == 0)
|
||||
{
|
||||
int Block = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "SameBlockType", "stone");
|
||||
bool Bedrocked = (a_IniFile.GetValueSetI("Generator", "SameBlockBedrocked", 1) != 0);
|
||||
m_CompositionGen = new cCompoGenSameBlock((BLOCKTYPE)Block, Bedrocked);
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0)
|
||||
{
|
||||
m_CompositionGen = new cCompoGenDebugBiomes;
|
||||
}
|
||||
else if (NoCaseCompare(CompoGenName, "classic") == 0)
|
||||
{
|
||||
int SeaLevel = a_IniFile.GetValueSetI("Generator", "ClassicSeaLevel", 60);
|
||||
int BeachHeight = a_IniFile.GetValueSetI("Generator", "ClassicBeachHeight", 2);
|
||||
int BeachDepth = a_IniFile.GetValueSetI("Generator", "ClassicBeachDepth", 4);
|
||||
BLOCKTYPE BlockTop = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "ClassicBlockTop", "grass");
|
||||
BLOCKTYPE BlockMiddle = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "ClassicBlockMiddle", "dirt");
|
||||
BLOCKTYPE BlockBottom = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "ClassicBlockBottom", "stone");
|
||||
BLOCKTYPE BlockBeach = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "ClassicBlockBeach", "sand");
|
||||
BLOCKTYPE BlockBeachBottom = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "ClassicBlockBeachBottom", "sandstone");
|
||||
BLOCKTYPE BlockSea = m_ChunkGenerator.GetIniBlock(a_IniFile, "Generator", "ClassicBlockSea", "stationarywater");
|
||||
m_CompositionGen = new cCompoGenClassic(
|
||||
SeaLevel, BeachHeight, BeachDepth, BlockTop, BlockMiddle, BlockBottom, BlockBeach,
|
||||
BlockBeachBottom, BlockSea
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (NoCaseCompare(CompoGenName, "biomal") != 0)
|
||||
{
|
||||
LOGWARN("Unknown CompositionGen \"%s\", using \"biomal\" instead.", CompoGenName.c_str());
|
||||
}
|
||||
int SeaLevel = a_IniFile.GetValueSetI("Generator", "BiomalSeaLevel", 62);
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
m_CompositionGen = new cCompoGenBiomal(Seed, SeaLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile)
|
||||
{
|
||||
AString Structures = a_IniFile.GetValueSet("Generator", "Structures", "Ravines,WormNestCaves,OreNests,Trees");
|
||||
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
AStringVector Str = StringSplit(Structures, ",");
|
||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
||||
{
|
||||
if (NoCaseCompare(*itr, "trees") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenTrees(Seed, m_BiomeGen, m_HeightGen, m_CompositionGen));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "marblecaves") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenMarbleCaves(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "dualridgecaves") == 0)
|
||||
{
|
||||
float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3);
|
||||
m_StructureGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "orenests") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenOreNests(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "ravines") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenRavines(Seed, 128));
|
||||
}
|
||||
//*
|
||||
// TODO: Not implemented yet; need a name
|
||||
else if (NoCaseCompare(*itr, "wormnestcaves") == 0)
|
||||
{
|
||||
m_StructureGens.push_back(new cStructGenWormNestCaves(Seed));
|
||||
}
|
||||
//*/
|
||||
else
|
||||
{
|
||||
LOGWARNING("Unknown structure generator: \"%s\". Ignoring.", itr->c_str());
|
||||
}
|
||||
} // for itr - Str[]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile)
|
||||
{
|
||||
int Seed = m_ChunkGenerator.GetSeed();
|
||||
AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator");
|
||||
|
||||
AStringVector Str = StringSplit(Structures, ",");
|
||||
for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr)
|
||||
{
|
||||
// Finishers, alpha-sorted:
|
||||
if (NoCaseCompare(*itr, "BottomLava") == 0)
|
||||
{
|
||||
int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", 10);
|
||||
m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "DeadBushes") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenDeadBushes(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Ice") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenIce);
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Lilypads") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenLilypads(Seed));
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "PreSimulator") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenPreSimulator);
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "Snow") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenSnow);
|
||||
}
|
||||
else if (NoCaseCompare(*itr, "SprinkleFoliage") == 0)
|
||||
{
|
||||
m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed));
|
||||
}
|
||||
} // for itr - Str[]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
178
source/Generating/ComposableGenerator.h
Normal file
178
source/Generating/ComposableGenerator.h
Normal file
@ -0,0 +1,178 @@
|
||||
|
||||
// ComposableGenerator.h
|
||||
|
||||
// Declares the cComposableGenerator class representing the chunk generator that takes the composition approach to generating chunks
|
||||
|
||||
/*
|
||||
Generating works by composing several algorithms:
|
||||
Biome, TerrainHeight, TerrainComposition, Ores, Structures and SmallFoliage
|
||||
Each algorithm may be chosen from a pool of available algorithms in the same class and combined with others,
|
||||
based on user's preferences in the world.ini.
|
||||
See http://forum.mc-server.org/showthread.php?tid=409 for details.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a biome generator must implement
|
||||
A biome generator takes chunk coords on input and outputs an array of biome indices for that chunk on output.
|
||||
The output array is sequenced in the same way as the MapChunk packet's biome data.
|
||||
*/
|
||||
class cBiomeGen
|
||||
{
|
||||
public:
|
||||
virtual ~cBiomeGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
/// Generates biomes for the given chunk
|
||||
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a terrain height generator must implement
|
||||
A terrain height generator takes chunk coords on input and outputs an array of terrain heights for that chunk.
|
||||
The output array is sequenced in the same way as the BiomeGen's biome data.
|
||||
The generator may request biome information from the underlying BiomeGen, it may even request information for
|
||||
other chunks than the one it's currently generating (possibly neighbors - for averaging)
|
||||
*/
|
||||
class cTerrainHeightGen
|
||||
{
|
||||
public:
|
||||
virtual ~cTerrainHeightGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
/// Generates heightmap for the given chunk
|
||||
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a terrain composition generator must implement
|
||||
Terrain composition takes chunk coords on input and outputs the blockdata for that entire chunk, along with
|
||||
the list of entities. It is supposed to make use of the underlying TerrainHeightGen and BiomeGen for that purpose,
|
||||
but it may request information for other chunks than the one it's currently generating from them.
|
||||
*/
|
||||
class cTerrainCompositionGen
|
||||
{
|
||||
public:
|
||||
virtual ~cTerrainCompositionGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
virtual void ComposeTerrain(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // BlockTypes to be generated (the whole array gets initialized, even air)
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // BlockMetas to be generated (the whole array gets initialized)
|
||||
const cChunkDef::HeightMap & a_HeightMap, // The height map to fit
|
||||
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
||||
cEntityList & a_Entities, // Entitites may be generated along with the terrain
|
||||
cBlockEntityList & a_BlockEntities // Block entitites may be generated (chests / furnaces / ...)
|
||||
) = 0;
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a structure generator must implement
|
||||
Structures are generated after the terrain composition took place. It should modify the blocktype data to account
|
||||
for whatever structures the generator is generating.
|
||||
Note that ores are considered structures too, at least from the interface point of view.
|
||||
Also note that a worldgenerator may contain multiple structure generators, one for each type of structure
|
||||
*/
|
||||
class cStructureGen
|
||||
{
|
||||
public:
|
||||
virtual ~cStructureGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
virtual void GenStructures(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
||||
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
||||
cEntityList & a_Entities, // Entities may be added or deleted
|
||||
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
||||
) = 0;
|
||||
} ;
|
||||
|
||||
typedef std::list<cStructureGen *> cStructureGenList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** The interface that a finisher must implement
|
||||
Finisher implements small additions after all structures have been generated.
|
||||
*/
|
||||
class cFinishGen
|
||||
{
|
||||
public:
|
||||
virtual ~cFinishGen() {} // Force a virtual destructor in descendants
|
||||
|
||||
virtual void GenFinish(
|
||||
int a_ChunkX, int a_ChunkZ,
|
||||
cChunkDef::BlockTypes & a_BlockTypes, // Block types to read and change
|
||||
cChunkDef::BlockNibbles & a_BlockMeta, // Block meta to read and change
|
||||
cChunkDef::HeightMap & a_HeightMap, // Height map to read and change by the current data
|
||||
const cChunkDef::BiomeMap & a_BiomeMap, // Biomes to adhere to
|
||||
cEntityList & a_Entities, // Entities may be added or deleted
|
||||
cBlockEntityList & a_BlockEntities // Block entities may be added or deleted
|
||||
) = 0;
|
||||
} ;
|
||||
|
||||
typedef std::list<cFinishGen *> cFinishGenList;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cComposableGenerator :
|
||||
public cChunkGenerator::cGenerator
|
||||
{
|
||||
typedef cChunkGenerator::cGenerator super;
|
||||
|
||||
public:
|
||||
cComposableGenerator(cChunkGenerator & a_ChunkGenerator);
|
||||
virtual ~cComposableGenerator();
|
||||
|
||||
virtual void Initialize(cWorld * a_World, cIniFile & a_IniFile) override;
|
||||
virtual void GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) override;
|
||||
virtual void DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities) override;
|
||||
|
||||
protected:
|
||||
// The generation composition:
|
||||
cBiomeGen * m_BiomeGen;
|
||||
cTerrainHeightGen * m_HeightGen;
|
||||
cTerrainCompositionGen * m_CompositionGen;
|
||||
cStructureGenList m_StructureGens;
|
||||
cFinishGenList m_FinishGens;
|
||||
|
||||
/// Reads the biome gen settings from the ini and initializes m_BiomeGen accordingly
|
||||
void InitBiomeGen(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the HeightGen settings from the ini and initializes m_HeightGen accordingly
|
||||
void InitHeightGen(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the CompositionGen settings from the ini and initializes m_CompositionGen accordingly
|
||||
void InitCompositionGen(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the structures to generate from the ini and initializes m_StructureGens accordingly
|
||||
void InitStructureGens(cIniFile & a_IniFile);
|
||||
|
||||
/// Reads the finishers from the ini and initializes m_FinishGens accordingly
|
||||
void InitFinishGens(cIniFile & a_IniFile);
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
@ -14,7 +14,7 @@ Interfaces to the various height generators:
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ChunkGenerator.h"
|
||||
#include "ComposableGenerator.h"
|
||||
#include "../Noise.h"
|
||||
|
||||
|
||||
|
@ -109,6 +109,10 @@ void cLightingThread::Stop(void)
|
||||
{
|
||||
{
|
||||
cCSLock Lock(m_CS);
|
||||
for (sItems::iterator itr = m_Queue.begin(), end = m_Queue.end(); itr != end; ++itr)
|
||||
{
|
||||
delete itr->m_ChunkStay;
|
||||
}
|
||||
m_Queue.clear();
|
||||
}
|
||||
m_ShouldTerminate = true;
|
||||
|
@ -1,4 +0,0 @@
|
||||
#include "Globals.h"
|
||||
|
||||
#include "LuaChunk.h"
|
||||
|
@ -1,139 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "ChunkDef.h"
|
||||
|
||||
class cLuaChunk // tolua_export
|
||||
{ // tolua_export
|
||||
public:
|
||||
cLuaChunk( cChunkDef::BlockTypes & a_BlockTypes
|
||||
, cChunkDef::BlockNibbles & a_BlockNibbles
|
||||
, cChunkDef::HeightMap & a_HeightMap
|
||||
, cChunkDef::BiomeMap & a_BiomeMap
|
||||
)
|
||||
: m_BiomeMap( a_BiomeMap )
|
||||
, m_BlockTypes( a_BlockTypes )
|
||||
, m_BlockMeta( a_BlockNibbles )
|
||||
, m_HeightMap( a_HeightMap )
|
||||
, m_bUseDefaultBiomes( false )
|
||||
, m_bUseDefaultComposition( false )
|
||||
, m_bUseDefaultStructures( false )
|
||||
, m_bUseDefaultFinish( false )
|
||||
{
|
||||
memset( m_BlockTypes, 0, sizeof( cChunkDef::BlockTypes ) );
|
||||
memset( m_BlockMeta, 0, sizeof( cChunkDef::BlockNibbles ) );
|
||||
memset( m_BiomeMap, 0, sizeof( cChunkDef::BiomeMap ) );
|
||||
memset( m_HeightMap, 0, sizeof( cChunkDef::HeightMap ) );
|
||||
}
|
||||
~cLuaChunk()
|
||||
{}
|
||||
|
||||
// tolua_begin
|
||||
|
||||
// Block functions
|
||||
void FillBlocks( char a_BlockType, unsigned char a_BlockMeta )
|
||||
{
|
||||
const NIBBLETYPE CompressedMeta = a_BlockMeta | a_BlockMeta << 4;
|
||||
memset( m_BlockTypes, a_BlockType, sizeof( cChunkDef::BlockTypes ) );
|
||||
memset( m_BlockMeta, CompressedMeta, sizeof( cChunkDef::BlockNibbles ) );
|
||||
}
|
||||
|
||||
void SetBlock( int a_X, int a_Y, int a_Z, char a_BlockType, unsigned char a_BlockMeta )
|
||||
{
|
||||
cChunkDef::SetBlock( m_BlockTypes, a_X, a_Y, a_Z, a_BlockType );
|
||||
cChunkDef::SetNibble( m_BlockMeta, a_X, a_Y, a_Z, a_BlockMeta );
|
||||
}
|
||||
|
||||
char GetBlock( int a_X, int a_Y, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetBlock( m_BlockTypes, a_X, a_Y, a_Z );
|
||||
}
|
||||
|
||||
char GetBlockMeta( int a_X, int a_Y, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetNibble( m_BlockMeta, a_X, a_Y, a_Z );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Biome functinos
|
||||
void SetBiome( int a_X, int a_Z, int a_BiomeID )
|
||||
{
|
||||
cChunkDef::SetBiome( m_BiomeMap, a_X, a_Z, (EMCSBiome)a_BiomeID );
|
||||
}
|
||||
|
||||
int GetBiome( int a_X, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetBiome( m_BiomeMap, a_X, a_Z );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Height functions
|
||||
void SetHeight( int a_X, int a_Z, int a_Height )
|
||||
{
|
||||
cChunkDef::SetHeight( m_HeightMap, a_X, a_Z, a_Height );
|
||||
}
|
||||
|
||||
int GetHeight( int a_X, int a_Z )
|
||||
{
|
||||
return cChunkDef::GetHeight( m_HeightMap, a_X, a_Z );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Functions to explicitly tell the server to use default behavior for certain parts of generating terrain
|
||||
void SetUseDefaultBiomes( bool a_bUseDefaultBiomes )
|
||||
{
|
||||
m_bUseDefaultBiomes = a_bUseDefaultBiomes;
|
||||
}
|
||||
bool IsUsingDefaultBiomes()
|
||||
{
|
||||
return m_bUseDefaultBiomes;
|
||||
}
|
||||
|
||||
void SetUseDefaultComposition( bool a_bUseDefaultComposition )
|
||||
{
|
||||
m_bUseDefaultComposition = a_bUseDefaultComposition;
|
||||
}
|
||||
bool IsUsingDefaultComposition()
|
||||
{
|
||||
return m_bUseDefaultComposition;
|
||||
}
|
||||
|
||||
void SetUseDefaultStructures( bool a_bUseDefaultStructures )
|
||||
{
|
||||
m_bUseDefaultStructures = a_bUseDefaultStructures;
|
||||
}
|
||||
bool IsUsingDefaultStructures()
|
||||
{
|
||||
return m_bUseDefaultStructures;
|
||||
}
|
||||
|
||||
void SetUseDefaultFinish( bool a_bUseDefaultFinish )
|
||||
{
|
||||
m_bUseDefaultFinish = a_bUseDefaultFinish;
|
||||
}
|
||||
bool IsUsingDefaultFinish()
|
||||
{
|
||||
return m_bUseDefaultFinish;
|
||||
}
|
||||
|
||||
// tolua_end
|
||||
|
||||
private:
|
||||
bool m_bUseDefaultBiomes;
|
||||
bool m_bUseDefaultComposition;
|
||||
bool m_bUseDefaultStructures;
|
||||
bool m_bUseDefaultFinish;
|
||||
|
||||
cChunkDef::BiomeMap & m_BiomeMap;
|
||||
cChunkDef::BlockTypes & m_BlockTypes;
|
||||
cChunkDef::BlockNibbles & m_BlockMeta;
|
||||
cChunkDef::HeightMap & m_HeightMap;
|
||||
}; // tolua_export
|
@ -79,7 +79,7 @@ bool cPlugin::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ)
|
||||
|
||||
|
||||
|
||||
bool cPlugin::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk)
|
||||
bool cPlugin::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_pLuaChunk)
|
||||
{
|
||||
UNUSED(a_World);
|
||||
UNUSED(a_ChunkX);
|
||||
|
@ -15,7 +15,7 @@ class cItem;
|
||||
class cEntity;
|
||||
class cPawn;
|
||||
class cWorld;
|
||||
class cLuaChunk;
|
||||
class cChunkDesc;
|
||||
struct TakeDamageInfo;
|
||||
|
||||
// fwd: cPlayer.h
|
||||
@ -51,7 +51,7 @@ public:
|
||||
// TODO: virtual bool OnBlockToPickup (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups);
|
||||
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message);
|
||||
virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
|
||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk);
|
||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_pLuaChunk);
|
||||
virtual bool OnCollectPickup (cPlayer * a_Player, cPickup * a_Pickup);
|
||||
virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason);
|
||||
|
@ -349,7 +349,7 @@ bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int
|
||||
|
||||
|
||||
|
||||
bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_LuaChunk)
|
||||
bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_LuaChunk)
|
||||
{
|
||||
HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATING);
|
||||
if (Plugins == m_Hooks.end())
|
||||
|
@ -15,8 +15,8 @@ class cPlugin;
|
||||
// fwd: World.h
|
||||
class cWorld;
|
||||
|
||||
// fwd: LuaChunk.h
|
||||
class cLuaChunk;
|
||||
// fwd: ChunkDesc.h
|
||||
class cChunkDesc;
|
||||
|
||||
// fwd: Player.h
|
||||
class cPlayer;
|
||||
@ -100,7 +100,7 @@ public: // tolua_export
|
||||
// TODO: bool CallHookBlockToPickup (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups);
|
||||
bool CallHookChat (cPlayer * a_Player, const AString & a_Message);
|
||||
bool CallHookChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ);
|
||||
bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_Chunk);
|
||||
bool CallHookChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_Chunk);
|
||||
bool CallHookCollectPickup (cPlayer * a_Player, cPickup & a_Pickup);
|
||||
bool CallHookCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe);
|
||||
bool CallHookDisconnect (cPlayer * a_Player, const AString & a_Reason);
|
||||
|
@ -219,7 +219,7 @@ bool cPlugin_NewLua::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_Chun
|
||||
|
||||
|
||||
|
||||
bool cPlugin_NewLua::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk)
|
||||
bool cPlugin_NewLua::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_pLuaChunk)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
const char * FnName = GetHookFnName(cPluginManager::HOOK_CHUNK_GENERATING);
|
||||
@ -232,7 +232,7 @@ bool cPlugin_NewLua::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_Chu
|
||||
tolua_pushusertype(m_LuaState, a_World, "cWorld");
|
||||
tolua_pushnumber (m_LuaState, a_ChunkX);
|
||||
tolua_pushnumber (m_LuaState, a_ChunkZ);
|
||||
tolua_pushusertype(m_LuaState, a_pLuaChunk, "cLuaChunk");
|
||||
tolua_pushusertype(m_LuaState, a_pLuaChunk, "cChunkDesc");
|
||||
|
||||
if (!CallFunction(4, 1, FnName))
|
||||
{
|
||||
|
@ -33,7 +33,7 @@ public:
|
||||
// TODO: virtual bool OnBlockToPickup (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups) override;
|
||||
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message) override;
|
||||
virtual bool OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
|
||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_pLuaChunk ) override;
|
||||
virtual bool OnCollectPickup (cPlayer * a_Player, cPickup * a_Pickup) override;
|
||||
virtual bool OnCraftingNoRecipe (const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
|
||||
|
@ -272,7 +272,7 @@ void cPlugin_Squirrel::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_Ch
|
||||
|
||||
|
||||
|
||||
bool cPlugin_Squirrel::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk)
|
||||
bool cPlugin_Squirrel::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_pLuaChunk)
|
||||
{
|
||||
cCSLock Lock(m_CriticalSection);
|
||||
if(!m_Plugin->HasFunction("OnChunkGenerating")) return false;
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
virtual bool OnBlockToPickup (BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, const cPlayer * a_Player, const cItem & a_EquippedItem, cItems & a_Pickups);
|
||||
virtual bool OnChat (cPlayer * a_Player, const AString & a_Message) override;
|
||||
virtual void OnChunkGenerated (cWorld * a_World, int a_ChunkX, int a_ChunkZ) override;
|
||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cLuaChunk * a_pLuaChunk ) override;
|
||||
virtual bool OnChunkGenerating (cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_pLuaChunk ) override;
|
||||
virtual bool OnCollectPickup (cPlayer * a_Player, cPickup * a_Pickup) override;
|
||||
virtual bool OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) override;
|
||||
virtual bool OnDisconnect (cPlayer * a_Player, const AString & a_Reason) override;
|
||||
|
Loading…
Reference in New Issue
Block a user