mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add map limit config option
This commit is contained in:
parent
a5e5aa5be9
commit
ec796b8e81
11 changed files with 38 additions and 43 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue