From ec796b8e814864b433aea75119c307f44b2b33e8 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 13 Jul 2015 16:01:31 +0100 Subject: Add map limit config option --- src/mapblock.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/mapblock.h') diff --git a/src/mapblock.h b/src/mapblock.h index ba33c01a2..334136b92 100644 --- a/src/mapblock.h +++ b/src/mapblock.h @@ -31,6 +31,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "nodetimer.h" #include "modifiedstate.h" #include "util/numeric.h" // getContainerPos +#include "settings.h" class Map; class NodeMetadataList; @@ -638,13 +639,14 @@ typedef std::vector MapBlockVect; inline bool blockpos_over_limit(v3s16 p) { - return - (p.X < -MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p.X > MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p.Y < -MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p.Y > MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p.Z < -MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p.Z > MAP_GENERATION_LIMIT / MAP_BLOCKSIZE); + const static u16 map_gen_limit = MYMIN(MAX_MAP_GENERATION_LIMIT, + g_settings->getU16("map_generation_limit")); + return (p.X < -map_gen_limit / MAP_BLOCKSIZE + || p.X > map_gen_limit / MAP_BLOCKSIZE + || p.Y < -map_gen_limit / MAP_BLOCKSIZE + || p.Y > map_gen_limit / MAP_BLOCKSIZE + || p.Z < -map_gen_limit / MAP_BLOCKSIZE + || p.Z > map_gen_limit / MAP_BLOCKSIZE); } /* @@ -681,4 +683,3 @@ inline void getNodeSectorPosWithOffset(const v2s16 &p, v2s16 &block, v2s16 &offs std::string analyze_block(MapBlock *block); #endif - -- cgit v1.2.3