summaryrefslogtreecommitdiff
path: root/src/mapblock.h
diff options
context:
space:
mode:
authorrubenwardy <rubenwardy@gmail.com>2015-07-13 16:01:31 +0100
committerest31 <MTest31@outlook.com>2015-08-02 14:27:04 +0200
commitec796b8e814864b433aea75119c307f44b2b33e8 (patch)
tree4e151014740276ca0c3614e03dc90fbc7b46b4ac /src/mapblock.h
parenta5e5aa5be978d2f6e23d4eeab04d2ac9beefe170 (diff)
downloadminetest-ec796b8e814864b433aea75119c307f44b2b33e8.tar.gz
minetest-ec796b8e814864b433aea75119c307f44b2b33e8.tar.bz2
minetest-ec796b8e814864b433aea75119c307f44b2b33e8.zip
Add map limit config option
Diffstat (limited to 'src/mapblock.h')
-rw-r--r--src/mapblock.h17
1 files changed, 9 insertions, 8 deletions
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<MapBlock*> 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
-