diff options
author | rubenwardy <rubenwardy@gmail.com> | 2015-07-13 16:01:31 +0100 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-08-02 14:27:04 +0200 |
commit | ec796b8e814864b433aea75119c307f44b2b33e8 (patch) | |
tree | 4e151014740276ca0c3614e03dc90fbc7b46b4ac /src/map.cpp | |
parent | a5e5aa5be978d2f6e23d4eeab04d2ac9beefe170 (diff) | |
download | minetest-ec796b8e814864b433aea75119c307f44b2b33e8.tar.gz minetest-ec796b8e814864b433aea75119c307f44b2b33e8.tar.bz2 minetest-ec796b8e814864b433aea75119c307f44b2b33e8.zip |
Add map limit config option
Diffstat (limited to 'src/map.cpp')
-rw-r--r-- | src/map.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
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); |