From afcf1a41d82dc78b4cfe92f6abca5dc0d7bc5c4d Mon Sep 17 00:00:00 2001 From: est31 Date: Tue, 23 Feb 2016 01:14:00 +0100 Subject: [PATCH 1/4] Fix android build Android had a linker error since commit: 31e0667a4a53a238d0321194b57b083bd74c0a5b "Add Lua interface to HTTPFetchRequest" Fixes #3766. Thanks to @MoNTE48 for reporting the bug. --- build/android/jni/Android.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index ff9d9ec4..0528c560 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -303,6 +303,7 @@ LOCAL_SRC_FILES += \ jni/src/script/lua_api/l_rollback.cpp \ jni/src/script/lua_api/l_server.cpp \ jni/src/script/lua_api/l_settings.cpp \ + jni/src/script/lua_api/l_http.cpp \ jni/src/script/lua_api/l_util.cpp \ jni/src/script/lua_api/l_vmanip.cpp \ jni/src/script/scripting_game.cpp \ From 62fb95a95abbf8aef98425f98429628360a193a5 Mon Sep 17 00:00:00 2001 From: nerzhul Date: Tue, 23 Feb 2016 10:58:13 +0100 Subject: [PATCH 2/4] GOTBLOCKS & DELETEBLOCKS: test packet size only once --- src/network/serverpackethandler.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/network/serverpackethandler.cpp b/src/network/serverpackethandler.cpp index 7e348a94..ef99a634 100644 --- a/src/network/serverpackethandler.cpp +++ b/src/network/serverpackethandler.cpp @@ -762,14 +762,14 @@ void Server::handleCommand_GotBlocks(NetworkPacket* pkt) RemoteClient *client = getClient(pkt->getPeerId()); - for (u16 i = 0; i < count; i++) { - if ((s16)pkt->getSize() < 1 + (i + 1) * 6) - throw con::InvalidIncomingDataException + if ((s16)pkt->getSize() < 1 + (int)count * 6) { + throw con::InvalidIncomingDataException ("GOTBLOCKS length is too short"); + } + + for (u16 i = 0; i < count; i++) { v3s16 p; - *pkt >> p; - client->GotBlock(p); } } @@ -865,13 +865,14 @@ void Server::handleCommand_DeletedBlocks(NetworkPacket* pkt) RemoteClient *client = getClient(pkt->getPeerId()); - for (u16 i = 0; i < count; i++) { - if ((s16)pkt->getSize() < 1 + (i + 1) * 6) - throw con::InvalidIncomingDataException + if ((s16)pkt->getSize() < 1 + (int)count * 6) { + throw con::InvalidIncomingDataException ("DELETEDBLOCKS length is too short"); + } + + for (u16 i = 0; i < count; i++) { v3s16 p; *pkt >> p; - client->SetBlockNotSent(p); } } From 6485df01f1d4757b6d23d493f8c560880220d45c Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 21 Feb 2016 13:28:34 +0000 Subject: [PATCH 3/4] Sheet Ore: Eliminate crash caused by PcgRandom range max < min In the calculation of y_start, when 'column height max' was large it caused nmin.Y + max_height > nmax.Y - max_height Now, in this situation y_start is set to the midpoint between nmin.Y and nmax.Y Limit y0 and y1 to between nmin.Y and nmax.Y, otherwise index calculation, which has no checks for limits, places them at unwanted locations in the voxelmanip --- src/mg_ore.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mg_ore.cpp b/src/mg_ore.cpp index 6b6e0d7a..25790161 100644 --- a/src/mg_ore.cpp +++ b/src/mg_ore.cpp @@ -179,7 +179,12 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed, MapNode n_ore(c_ore, 0, ore_param2); u16 max_height = column_height_max; - int y_start = pr.range(nmin.Y + max_height, nmax.Y - max_height); + int y_start_min = nmin.Y + max_height; + int y_start_max = nmax.Y - max_height; + + int y_start = y_start_min < y_start_max ? + pr.range(y_start_min, y_start_max) : + (y_start_min + y_start_max) / 2; if (!noise) { int sx = nmax.X - nmin.X + 1; @@ -204,10 +209,10 @@ void OreSheet::generate(MMVManip *vm, int mapseed, u32 blockseed, u16 height = pr.range(column_height_min, column_height_max); int ymidpoint = y_start + noiseval; - int y0 = ymidpoint - height * (1 - column_midpoint_factor); - int y1 = y0 + height; + int y0 = MYMAX(nmin.Y, ymidpoint - height * (1 - column_midpoint_factor)); + int y1 = MYMIN(nmax.Y, y0 + height - 1); - for (int y = y0; y < y1; y++) { + for (int y = y0; y <= y1; y++) { u32 i = vm->m_area.index(x, y, z); if (!vm->m_area.contains(i)) continue; From d264deafd8b63971ed095cb20448710ac7386022 Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Tue, 23 Feb 2016 20:32:57 +0100 Subject: [PATCH 4/4] Shaders: fix fog not affecting opaque liquids --- client/shaders/nodes_shader/opengl_fragment.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/shaders/nodes_shader/opengl_fragment.glsl b/client/shaders/nodes_shader/opengl_fragment.glsl index 49befa8d..6862842a 100644 --- a/client/shaders/nodes_shader/opengl_fragment.glsl +++ b/client/shaders/nodes_shader/opengl_fragment.glsl @@ -194,7 +194,7 @@ void main(void) vec4 col = vec4(color.rgb * gl_Color.rgb, 1.0); -#if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT || MATERIAL_TYPE == TILE_MATERIAL_LIQUID_OPAQUE +#if MATERIAL_TYPE == TILE_MATERIAL_LIQUID_TRANSPARENT float alpha = gl_Color.a; if (fogDistance != 0.0) { float d = max(0.0, min(vPosition.z / fogDistance * 1.5 - 0.6, 1.0));