summaryrefslogtreecommitdiff
path: root/src/mapgen.h
diff options
context:
space:
mode:
authorLoïc Blot <nerzhul@users.noreply.github.com>2017-06-03 19:57:02 +0200
committerGitHub <noreply@github.com>2017-06-03 19:57:02 +0200
commitc6d54411056da2dd563015c9f90c4c5c0863bc71 (patch)
tree5d3b6fcedf46ce066022dd575b9570352a50a0c1 /src/mapgen.h
parent72eec0f6f55b8515606de05d88717a78e978dd2a (diff)
downloadminetest-c6d54411056da2dd563015c9f90c4c5c0863bc71.tar.gz
minetest-c6d54411056da2dd563015c9f90c4c5c0863bc71.tar.bz2
minetest-c6d54411056da2dd563015c9f90c4c5c0863bc71.zip
Properly remove SAO when worldedges are overtaken (#5889)
* LuaEntitySAO: Remove beyond outermost mapchunk edges Based on a commit by, and with help from, nerzhul. Add 2 functions to class Mapgen: A function to calculate actual mapgen edges, called from the Mapgen constructor. A function called indirectly from content_sao.cpp per entity step to check SAO position is within mapgen edges. * Calculate borders from params not mapgen, which is not available everytime
Diffstat (limited to 'src/mapgen.h')
-rw-r--r--src/mapgen.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/mapgen.h b/src/mapgen.h
index 1efd2bff7..222838011 100644
--- a/src/mapgen.h
+++ b/src/mapgen.h
@@ -138,7 +138,10 @@ struct MapgenParams {
water_level(1),
mapgen_limit(MAX_MAP_GENERATION_LIMIT),
flags(MG_CAVES | MG_LIGHT | MG_DECORATIONS),
- bparams(NULL)
+ bparams(NULL),
+ m_sao_limit_min(MAX_MAP_GENERATION_LIMIT * BS),
+ m_sao_limit_max(MAX_MAP_GENERATION_LIMIT * BS),
+ m_sao_limit_calculated(false)
{
}
@@ -146,6 +149,14 @@ struct MapgenParams {
virtual void readParams(const Settings *settings);
virtual void writeParams(Settings *settings) const;
+
+ bool saoPosOverLimit(const v3f &p);
+private:
+ void calcMapgenEdges();
+
+ float m_sao_limit_min;
+ float m_sao_limit_max;
+ bool m_sao_limit_calculated;
};