1
0

Sugarcane and cactus max height can be set in world.ini.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@585 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-06-09 13:00:14 +00:00
parent 2c241bb9a4
commit 8189487258
5 changed files with 77 additions and 8 deletions

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 06/09/12 14:43:12. ** Generated automatically by tolua++-1.0.92 on 06/09/12 14:48:28.
*/ */
#ifndef __cplusplus #ifndef __cplusplus
@ -10728,6 +10728,70 @@ static int tolua_AllToLua_cWorld_SetNextBlockTick00(lua_State* tolua_S)
} }
#endif //#ifndef TOLUA_DISABLE #endif //#ifndef TOLUA_DISABLE
/* method: GetMaxSugarcaneHeight of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00
static int tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxSugarcaneHeight'", NULL);
#endif
{
int tolua_ret = (int) self->GetMaxSugarcaneHeight();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'GetMaxSugarcaneHeight'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: GetMaxCactusHeight of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetMaxCactusHeight00
static int tolua_AllToLua_cWorld_GetMaxCactusHeight00(lua_State* tolua_S)
{
#ifndef TOLUA_RELEASE
tolua_Error tolua_err;
if (
!tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) ||
!tolua_isnoobj(tolua_S,2,&tolua_err)
)
goto tolua_lerror;
else
#endif
{
const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxCactusHeight'", NULL);
#endif
{
int tolua_ret = (int) self->GetMaxCactusHeight();
tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
}
}
return 1;
#ifndef TOLUA_RELEASE
tolua_lerror:
tolua_error(tolua_S,"#ferror in function 'GetMaxCactusHeight'.",&tolua_err);
return 0;
#endif
}
#endif //#ifndef TOLUA_DISABLE
/* method: Clear of class cInventory */ /* method: Clear of class cInventory */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_Clear00 #ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_Clear00
static int tolua_AllToLua_cInventory_Clear00(lua_State* tolua_S) static int tolua_AllToLua_cInventory_Clear00(lua_State* tolua_S)
@ -18175,6 +18239,8 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"SetWeather",tolua_AllToLua_cWorld_SetWeather00); tolua_function(tolua_S,"SetWeather",tolua_AllToLua_cWorld_SetWeather00);
tolua_function(tolua_S,"GetWeather",tolua_AllToLua_cWorld_GetWeather00); tolua_function(tolua_S,"GetWeather",tolua_AllToLua_cWorld_GetWeather00);
tolua_function(tolua_S,"SetNextBlockTick",tolua_AllToLua_cWorld_SetNextBlockTick00); tolua_function(tolua_S,"SetNextBlockTick",tolua_AllToLua_cWorld_SetNextBlockTick00);
tolua_function(tolua_S,"GetMaxSugarcaneHeight",tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00);
tolua_function(tolua_S,"GetMaxCactusHeight",tolua_AllToLua_cWorld_GetMaxCactusHeight00);
tolua_endmodule(tolua_S); tolua_endmodule(tolua_S);
tolua_cclass(tolua_S,"cInventory","cInventory","",NULL); tolua_cclass(tolua_S,"cInventory","cInventory","",NULL);
tolua_beginmodule(tolua_S,"cInventory"); tolua_beginmodule(tolua_S,"cInventory");

View File

@ -1,6 +1,6 @@
/* /*
** Lua binding: AllToLua ** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 06/09/12 14:43:13. ** Generated automatically by tolua++-1.0.92 on 06/09/12 14:48:28.
*/ */
/* Exported function */ /* Exported function */

View File

@ -837,8 +837,8 @@ void cChunk::GrowSugarcane(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks)
--Bottom; --Bottom;
} }
// Grow by at most a_NumBlocks, but no more than height 3: // Grow by at most a_NumBlocks, but no more than max height:
int ToGrow = std::min(a_NumBlocks, 4 - (Top - Bottom)); int ToGrow = std::min(a_NumBlocks, m_World->GetMaxSugarcaneHeight() + 1 - (Top - Bottom));
for (int i = 0; i < ToGrow; i++) for (int i = 0; i < ToGrow; i++)
{ {
BLOCKTYPE BlockType; BLOCKTYPE BlockType;
@ -878,8 +878,8 @@ void cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks)
--Bottom; --Bottom;
} }
// Grow by at most a_NumBlocks, but no more than height 3: // Grow by at most a_NumBlocks, but no more than max height:
int ToGrow = std::min(a_NumBlocks, 4 - (Top - Bottom)); int ToGrow = std::min(a_NumBlocks, m_World->GetMaxCactusHeight() + 1 - (Top - Bottom));
for (int i = 0; i < ToGrow; i++) for (int i = 0; i < ToGrow; i++)
{ {
BLOCKTYPE BlockType; BLOCKTYPE BlockType;

View File

@ -973,7 +973,7 @@ bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBone
{ {
return false; return false;
} }
m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, 3); m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, m_MaxSugarcaneHeight);
return true; return true;
} }
@ -983,7 +983,7 @@ bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBone
{ {
return false; return false;
} }
m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, 3); m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, m_MaxCactusHeight);
return true; return true;
} }
} // switch (BlockType) } // switch (BlockType)

View File

@ -313,6 +313,9 @@ public:
/// Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call /// Sets the blockticking to start at the specified block. Only one blocktick per chunk may be set, second call overwrites the first call
void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export void SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ); // tolua_export
int GetMaxSugarcaneHeight(void) const { return m_MaxSugarcaneHeight; } // tolua_export
int GetMaxCactusHeight (void) const { return m_MaxCactusHeight; } // tolua_export
private: private:
friend class cRoot; friend class cRoot;