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/map.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/map.cpp') diff --git a/src/map.cpp b/src/map.cpp index 9974ff363..50b50220d 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -2502,10 +2502,12 @@ ServerMapSector * ServerMap::createSector(v2s16 p2d) /* Do not create over-limit */ - if(p2d.X < -MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p2d.X > MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p2d.Y < -MAP_GENERATION_LIMIT / MAP_BLOCKSIZE - || p2d.Y > MAP_GENERATION_LIMIT / MAP_BLOCKSIZE) + const static u16 map_gen_limit = MYMIN(MAX_MAP_GENERATION_LIMIT, + g_settings->getU16("map_generation_limit")); + if(p2d.X < -map_gen_limit / MAP_BLOCKSIZE + || p2d.X > map_gen_limit / MAP_BLOCKSIZE + || p2d.Y < -map_gen_limit / MAP_BLOCKSIZE + || p2d.Y > map_gen_limit / MAP_BLOCKSIZE) throw InvalidPositionException("createSector(): pos. over limit"); /* @@ -2649,12 +2651,7 @@ MapBlock * ServerMap::createBlock(v3s16 p) /* Do not create over-limit */ - if(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) + if (blockpos_over_limit(p)) throw InvalidPositionException("createBlock(): pos. over limit"); v2s16 p2d(p.X, p.Z); -- cgit v1.2.3