diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-09 15:00:14 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-09 15:00:14 +0200 |
commit | 8189487258df0490583b52322e357d7f7dfcb0e9 (patch) | |
tree | 3e5bf73b613da7a8a98b447982982f5573e1bd46 /source | |
parent | Plants growable by bonemeal are settable in the world.ini. Default matches vanilla MC. (diff) | |
download | cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.tar cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.tar.gz cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.tar.bz2 cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.tar.lz cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.tar.xz cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.tar.zst cuberite-8189487258df0490583b52322e357d7f7dfcb0e9.zip |
Diffstat (limited to '')
-rw-r--r-- | source/Bindings.cpp | 68 | ||||
-rw-r--r-- | source/Bindings.h | 2 | ||||
-rw-r--r-- | source/cChunk.cpp | 8 | ||||
-rw-r--r-- | source/cWorld.cpp | 4 | ||||
-rw-r--r-- | source/cWorld.h | 3 |
5 files changed, 77 insertions, 8 deletions
diff --git a/source/Bindings.cpp b/source/Bindings.cpp index 1b6494237..166a8adce 100644 --- a/source/Bindings.cpp +++ b/source/Bindings.cpp @@ -1,6 +1,6 @@ /*
** 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
@@ -10728,6 +10728,70 @@ static int tolua_AllToLua_cWorld_SetNextBlockTick00(lua_State* tolua_S) }
#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 */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_Clear00
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,"GetWeather",tolua_AllToLua_cWorld_GetWeather00);
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_cclass(tolua_S,"cInventory","cInventory","",NULL);
tolua_beginmodule(tolua_S,"cInventory");
diff --git a/source/Bindings.h b/source/Bindings.h index 81db3d493..918a8324a 100644 --- a/source/Bindings.h +++ b/source/Bindings.h @@ -1,6 +1,6 @@ /*
** 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 */
diff --git a/source/cChunk.cpp b/source/cChunk.cpp index 526300972..21c84b8ce 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -837,8 +837,8 @@ void cChunk::GrowSugarcane(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) --Bottom;
}
- // Grow by at most a_NumBlocks, but no more than height 3:
- int ToGrow = std::min(a_NumBlocks, 4 - (Top - Bottom));
+ // Grow by at most a_NumBlocks, but no more than max height:
+ int ToGrow = std::min(a_NumBlocks, m_World->GetMaxSugarcaneHeight() + 1 - (Top - Bottom));
for (int i = 0; i < ToGrow; i++)
{
BLOCKTYPE BlockType;
@@ -878,8 +878,8 @@ void cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) --Bottom;
}
- // Grow by at most a_NumBlocks, but no more than height 3:
- int ToGrow = std::min(a_NumBlocks, 4 - (Top - Bottom));
+ // Grow by at most a_NumBlocks, but no more than max height:
+ int ToGrow = std::min(a_NumBlocks, m_World->GetMaxCactusHeight() + 1 - (Top - Bottom));
for (int i = 0; i < ToGrow; i++)
{
BLOCKTYPE BlockType;
diff --git a/source/cWorld.cpp b/source/cWorld.cpp index 664a25bdd..1cac3633b 100644 --- a/source/cWorld.cpp +++ b/source/cWorld.cpp @@ -973,7 +973,7 @@ bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBone {
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;
}
@@ -983,7 +983,7 @@ bool cWorld::GrowPlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBone {
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;
}
} // switch (BlockType)
diff --git a/source/cWorld.h b/source/cWorld.h index 79f904f54..70b3ad88e 100644 --- a/source/cWorld.h +++ b/source/cWorld.h @@ -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
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:
friend class cRoot;
|