From beab61bbfeca0280bce941c4175837109282c828 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 6 Aug 2014 14:16:36 -0700 Subject: On destroy ender crystal, create bedrock and fire --- src/Entities/EnderCrystal.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Entities/EnderCrystal.cpp b/src/Entities/EnderCrystal.cpp index bf86a6c42..c17bb608e 100644 --- a/src/Entities/EnderCrystal.cpp +++ b/src/Entities/EnderCrystal.cpp @@ -32,9 +32,6 @@ void cEnderCrystal::SpawnOn(cClientHandle & a_ClientHandle) void cEnderCrystal::Tick(float a_Dt, cChunk & a_Chunk) { UNUSED(a_Dt); - - a_Chunk.SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_FIRE, 0); - // No further processing (physics e.t.c.) is needed } @@ -49,6 +46,9 @@ void cEnderCrystal::KilledBy(TakeDamageInfo & a_TDI) m_World->DoExplosionAt(6.0, GetPosX(), GetPosY(), GetPosZ(), true, esEnderCrystal, this); Destroy(); + + m_World->SetBlock(POSX_TOINT, POSY_TOINT, POSZ_TOINT, E_BLOCK_BEDROCK, 0); + m_World->SetBlock(POSX_TOINT, POSY_TOINT + 1, POSZ_TOINT, E_BLOCK_FIRE, 0); } -- cgit v1.2.3 From 0c622522ea52ed07aa12a25827b498acd290b531 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 7 Aug 2014 01:08:31 +0200 Subject: Removed debug message. --- src/Bindings/ManualBindings.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 9ba1501c5..8e6156d97 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -507,7 +507,6 @@ static int tolua_DoWithXYZ(lua_State* tolua_S) int ItemX = ((int)tolua_tonumber(tolua_S, 2, 0)); int ItemY = ((int)tolua_tonumber(tolua_S, 3, 0)); int ItemZ = ((int)tolua_tonumber(tolua_S, 4, 0)); - LOG("x %i y %i z %i", ItemX, ItemY, ItemZ); if (!lua_isfunction( tolua_S, 5)) { return lua_do_error(tolua_S, "Error in function call '#funcname#': Expected a function for parameter #4"); -- cgit v1.2.3 From a73c85d7eb8181b3792f19675c29f43bd8c0b738 Mon Sep 17 00:00:00 2001 From: Howaner Date: Thu, 7 Aug 2014 02:42:42 +0200 Subject: Fixed nether wart digging. Fixes #1265 --- src/BlockInfo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BlockInfo.cpp b/src/BlockInfo.cpp index 4bc3fbbdc..a59229f87 100644 --- a/src/BlockInfo.cpp +++ b/src/BlockInfo.cpp @@ -294,6 +294,7 @@ void cBlockInfo::Initialize(cBlockInfoArray & a_Info) a_Info[E_BLOCK_INACTIVE_COMPARATOR ].m_OneHitDig = true; a_Info[E_BLOCK_LILY_PAD ].m_OneHitDig = true; a_Info[E_BLOCK_MELON_STEM ].m_OneHitDig = true; + a_Info[E_BLOCK_NETHER_WART ].m_OneHitDig = true; a_Info[E_BLOCK_POTATOES ].m_OneHitDig = true; a_Info[E_BLOCK_PUMPKIN_STEM ].m_OneHitDig = true; a_Info[E_BLOCK_REDSTONE_REPEATER_OFF].m_OneHitDig = true; -- cgit v1.2.3 From dcef688ccc0ae60b001ce40fd591a2dfafbac294 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 9 Aug 2014 22:34:59 +0200 Subject: WebAdmin: Added GetURLEncodedString(). --- src/WebAdmin.cpp | 32 ++++++++++++++++++++++++++++++++ src/WebAdmin.h | 5 ++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/WebAdmin.cpp b/src/WebAdmin.cpp index f5dc6fde7..ab6925e55 100644 --- a/src/WebAdmin.cpp +++ b/src/WebAdmin.cpp @@ -444,6 +444,38 @@ AString cWebAdmin::GetHTMLEscapedString(const AString & a_Input) +AString cWebAdmin::GetURLEncodedString(const AString & a_Input) +{ + // Translation table from nibble to hex: + static const char Hex[] = "0123456789abcdef"; + + // Preallocate the output to match input: + AString dst; + size_t len = a_Input.length(); + dst.reserve(len); + + // Loop over input and substitute whatever is needed: + for (size_t i = 0; i < len; i++) + { + char ch = a_Input[i]; + if (isalnum(ch) || (ch == '-') || (ch == '_') || (ch == '.') || (ch == '~')) + { + dst.push_back(ch); + } + else + { + dst.push_back('%'); + dst.push_back(Hex[(ch >> 4) & 0x0f]); + dst.push_back(Hex[ch & 0x0f]); + } + } // for i - a_Input[] + return dst; +} + + + + + AString cWebAdmin::GetBaseURL(const AStringVector & a_URLSplit) { AString BaseURL = "./"; diff --git a/src/WebAdmin.h b/src/WebAdmin.h index d679a097c..018a27b69 100644 --- a/src/WebAdmin.h +++ b/src/WebAdmin.h @@ -134,6 +134,9 @@ public: /** Escapes text passed into it, so it can be embedded into html. */ static AString GetHTMLEscapedString(const AString & a_Input); + + /** Escapes the string for use in an URL */ + static AString GetURLEncodedString(const AString & a_Input); AString GetIPv4Ports(void) const { return m_PortsIPv4; } AString GetIPv6Ports(void) const { return m_PortsIPv6; } @@ -141,7 +144,7 @@ public: // tolua_end /** Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) */ - AString GetBaseURL(const AStringVector& a_URLSplit); + static AString GetBaseURL(const AStringVector & a_URLSplit); protected: /** Common base class for request body data handlers */ -- cgit v1.2.3 From b0dedb01977fe4cd7ebd51db5784d8ca415f1567 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sat, 9 Aug 2014 22:54:43 +0200 Subject: WebAdmin: Manually exported string conversion functions. ToLua generated an extra return value for GetHTMLEscapedString() and GetURLEncodedString(), making them difficult to use. --- src/Bindings/ManualBindings.cpp | 60 ++++++++++++++++++++++++++++++++++++++++- src/WebAdmin.h | 10 +++---- 2 files changed, 64 insertions(+), 6 deletions(-) diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 8e6156d97..6b40cece8 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -2128,6 +2128,62 @@ static int tolua_cWebAdmin_GetPlugins(lua_State * tolua_S) +/** Binding for cWebAdmin::GetHTMLEscapedString. +Manual code required because ToLua generates an extra return value */ +static int tolua_AllToLua_cWebAdmin_GetHTMLEscapedString(lua_State * tolua_S) +{ + // Check the param types: + cLuaState S(tolua_S); + if ( + !S.CheckParamUserTable(1, "cWebAdmin") || + !S.CheckParamString(2) || + !S.CheckParamEnd(3) + ) + { + return 0; + } + + // Get the parameters: + AString Input; + S.GetStackValue(2, Input); + + // Convert and return: + S.Push(cWebAdmin::GetHTMLEscapedString(Input)); + return 1; +} + + + + + +/** Binding for cWebAdmin::GetURLEncodedString. +Manual code required because ToLua generates an extra return value */ +static int tolua_AllToLua_cWebAdmin_GetURLEncodedString(lua_State * tolua_S) +{ + // Check the param types: + cLuaState S(tolua_S); + if ( + !S.CheckParamUserTable(1, "cWebAdmin") || + !S.CheckParamString(2) || + !S.CheckParamEnd(3) + ) + { + return 0; + } + + // Get the parameters: + AString Input; + S.GetStackValue(2, Input); + + // Convert and return: + S.Push(cWebAdmin::GetURLEncodedString(Input)); + return 1; +} + + + + + static int tolua_cWebPlugin_GetTabNames(lua_State * tolua_S) { cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S, 1, NULL); @@ -3264,7 +3320,9 @@ void ManualBindings::Bind(lua_State * tolua_S) tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cWebAdmin"); - tolua_function(tolua_S, "GetPlugins", tolua_cWebAdmin_GetPlugins); + tolua_function(tolua_S, "GetHTMLEscapedString", tolua_AllToLua_cWebAdmin_GetHTMLEscapedString); + tolua_function(tolua_S, "GetPlugins", tolua_cWebAdmin_GetPlugins); + tolua_function(tolua_S, "GetURLEncodedString", tolua_AllToLua_cWebAdmin_GetURLEncodedString); tolua_endmodule(tolua_S); tolua_beginmodule(tolua_S, "cWebPlugin"); diff --git a/src/WebAdmin.h b/src/WebAdmin.h index 018a27b69..f48e8ce9e 100644 --- a/src/WebAdmin.h +++ b/src/WebAdmin.h @@ -132,17 +132,17 @@ public: /** Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) */ AString GetBaseURL(const AString & a_URL); + AString GetIPv4Ports(void) const { return m_PortsIPv4; } + AString GetIPv6Ports(void) const { return m_PortsIPv6; } + + // tolua_end + /** Escapes text passed into it, so it can be embedded into html. */ static AString GetHTMLEscapedString(const AString & a_Input); /** Escapes the string for use in an URL */ static AString GetURLEncodedString(const AString & a_Input); - AString GetIPv4Ports(void) const { return m_PortsIPv4; } - AString GetIPv6Ports(void) const { return m_PortsIPv6; } - - // tolua_end - /** Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) */ static AString GetBaseURL(const AStringVector & a_URLSplit); -- cgit v1.2.3 From 5eb5411f1e9f3683e8ecb6448877ba6cf34b2dbf Mon Sep 17 00:00:00 2001 From: STRWarrior Date: Sun, 10 Aug 2014 11:06:04 +0200 Subject: Removed an old and outdated comment. --- src/Generating/FinishGen.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index e8324095e..eb57a5faa 100644 --- a/src/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp @@ -484,8 +484,6 @@ int cFinishGenSingleTopBlock::GetNumToGen(const cChunkDef::BiomeMap & a_BiomeMap void cFinishGenSingleTopBlock::GenFinish(cChunkDesc & a_ChunkDesc) { - // Add Lilypads on top of water surface in Swampland - int NumToGen = GetNumToGen(a_ChunkDesc.GetBiomeMap()); int ChunkX = a_ChunkDesc.GetChunkX(); int ChunkZ = a_ChunkDesc.GetChunkZ(); -- cgit v1.2.3