From 111e7e1cc8316e4812e85fddc579feaeedecbb58 Mon Sep 17 00:00:00 2001 From: paramat Date: Fri, 17 Feb 2017 15:50:51 +0000 Subject: [PATCH] Voxelmanip: Do not emerge or blit to blocks over map gen limit Placing a structure that extends into mapblocks that extend past map_gen_limit causes a crash. For example a sapling growing at the world edge which adds leaves beyond the edge, or placing a structure using the lua voxelmanip, or placing a schematic or l-system tree. Do not run the 'load_if_inexistent' block of code if the mapblock is over limit, this also marks the mapblock with the flag VMANIP_BLOCK_DATA_INEXIST which later prevents blitting back those mapblocks. This fix therefore uses existing functionality by having the same effect as the 'load_if_inexistent' bool being false. --- src/map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map.cpp b/src/map.cpp index ffba77262..a415bda96 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -3161,7 +3161,7 @@ void MMVManip::initialEmerge(v3s16 blockpos_min, v3s16 blockpos_max, if(block_data_inexistent) { - if (load_if_inexistent) { + if (load_if_inexistent && !blockpos_over_limit(p)) { ServerMap *svrmap = (ServerMap *)m_map; block = svrmap->emergeBlock(p, false); if (block == NULL)