]> git.lizzy.rs Git - minetest.git/blobdiff - src/mapblock.h
Remove ClientMap::m_camera_mutex
[minetest.git] / src / mapblock.h
index ba33c01a2eef145f24803241c795de1f31d3ea56..73c17ee601f6c7b9bf16a3a4983e0160001c8205 100644 (file)
@@ -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;
@@ -503,7 +504,7 @@ class MapBlock /*: public NodeContainer*/
 
        // These don't write or read version by itself
        // Set disk to true for on-disk format, false for over-the-network format
-       // Precondition: version >= SER_FMT_CLIENT_VER_LOWEST
+       // Precondition: version >= SER_FMT_VER_LOWEST_WRITE
        void serialize(std::ostream &os, u8 version, bool disk);
        // If disk == true: In addition to doing other things, will add
        // unknown blocks from id-name mapping to wndef
@@ -636,15 +637,28 @@ class MapBlock /*: public NodeContainer*/
 
 typedef std::vector<MapBlock*> MapBlockVect;
 
+inline bool objectpos_over_limit(v3f p)
+{
+       const static float map_gen_limit_bs = MYMIN(MAX_MAP_GENERATION_LIMIT,
+               g_settings->getU16("map_generation_limit")) * BS;
+       return (p.X < -map_gen_limit_bs
+               || p.X >  map_gen_limit_bs
+               || p.Y < -map_gen_limit_bs
+               || p.Y >  map_gen_limit_bs
+               || p.Z < -map_gen_limit_bs
+               || p.Z >  map_gen_limit_bs);
+}
+
 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 +695,3 @@ inline void getNodeSectorPosWithOffset(const v2s16 &p, v2s16 &block, v2s16 &offs
 std::string analyze_block(MapBlock *block);
 
 #endif
-