aboutsummaryrefslogtreecommitdiff
path: root/src/mapgen
diff options
context:
space:
mode:
authorparamat <paramat@users.noreply.github.com>2018-02-20 19:32:24 +0000
committerparamat <mat.gregory@virginmedia.com>2018-02-26 17:21:45 +0000
commit359a940dde0d0d85b288c8af6b10bccbd021f9c1 (patch)
tree7eda6f7869726595c25e80961e74059a5f99f91a /src/mapgen
parent88a7160ad8c303e7c1cb7c3141583fab131b2dda (diff)
downloadminetest-359a940dde0d0d85b288c8af6b10bccbd021f9c1.tar.gz
minetest-359a940dde0d0d85b288c8af6b10bccbd021f9c1.tar.bz2
minetest-359a940dde0d0d85b288c8af6b10bccbd021f9c1.zip
SAO limits: Allow SAOs to exist outside the set 'mapgen limit'
Diffstat (limited to 'src/mapgen')
-rw-r--r--src/mapgen/mapgen.cpp26
-rw-r--r--src/mapgen/mapgen.h4
2 files changed, 4 insertions, 26 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp
index 69aa174da..5e581086f 100644
--- a/src/mapgen/mapgen.cpp
+++ b/src/mapgen/mapgen.cpp
@@ -1079,13 +1079,11 @@ void MapgenParams::writeParams(Settings *settings) const
bparams->writeParams(settings);
}
-// Calculate edges of outermost generated mapchunks (less than
-// 'mapgen_limit'), and corresponding exact limits for SAO entities.
+
+// Calculate exact edges of the outermost mapchunks that are within the
+// set 'mapgen_limit'.
void MapgenParams::calcMapgenEdges()
{
- if (m_mapgen_edges_calculated)
- return;
-
// Central chunk offset, in blocks
s16 ccoff_b = -chunksize / 2;
// Chunksize, in nodes
@@ -1110,31 +1108,15 @@ void MapgenParams::calcMapgenEdges()
// Mapgen edges, in nodes
mapgen_edge_min = ccmin - numcmin * csize_n;
mapgen_edge_max = ccmax + numcmax * csize_n;
- // SAO position limits, in Irrlicht units
- m_sao_limit_min = mapgen_edge_min * BS - 3.0f;
- m_sao_limit_max = mapgen_edge_max * BS + 3.0f;
m_mapgen_edges_calculated = true;
}
-bool MapgenParams::saoPosOverLimit(const v3f &p)
+s32 MapgenParams::getSpawnRangeMax()
{
if (!m_mapgen_edges_calculated)
calcMapgenEdges();
- return p.X < m_sao_limit_min ||
- p.X > m_sao_limit_max ||
- p.Y < m_sao_limit_min ||
- p.Y > m_sao_limit_max ||
- p.Z < m_sao_limit_min ||
- p.Z > m_sao_limit_max;
-}
-
-
-s32 MapgenParams::getSpawnRangeMax()
-{
- calcMapgenEdges();
-
return MYMIN(-mapgen_edge_min, mapgen_edge_max);
}
diff --git a/src/mapgen/mapgen.h b/src/mapgen/mapgen.h
index f97eabf82..6ca907573 100644
--- a/src/mapgen/mapgen.h
+++ b/src/mapgen/mapgen.h
@@ -139,14 +139,10 @@ struct MapgenParams {
virtual void readParams(const Settings *settings);
virtual void writeParams(Settings *settings) const;
- bool saoPosOverLimit(const v3f &p);
s32 getSpawnRangeMax();
private:
void calcMapgenEdges();
-
- float m_sao_limit_min = -MAX_MAP_GENERATION_LIMIT * BS;
- float m_sao_limit_max = MAX_MAP_GENERATION_LIMIT * BS;
bool m_mapgen_edges_calculated = false;
};