aboutsummaryrefslogtreecommitdiff
path: root/src/mg_decoration.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-12-12 14:07:49 -0500
committerkwolekr <kwolekr@minetest.net>2014-12-12 14:08:04 -0500
commitcf8213ea827f38ae5d4b8ef16c396545e3e59657 (patch)
treee739591704b1776002baa1bde7a4ff86de5f06ad /src/mg_decoration.cpp
parentcec141adc1fd0845e27df9b0c88d979dd765e76f (diff)
downloadminetest-cf8213ea827f38ae5d4b8ef16c396545e3e59657.tar.gz
minetest-cf8213ea827f38ae5d4b8ef16c396545e3e59657.tar.bz2
minetest-cf8213ea827f38ae5d4b8ef16c396545e3e59657.zip
Add minetest.clear_registered_decorations() and clear_registered_ores()
Diffstat (limited to 'src/mg_decoration.cpp')
-rw-r--r--src/mg_decoration.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp
index 20b9fbda6..14368c091 100644
--- a/src/mg_decoration.cpp
+++ b/src/mg_decoration.cpp
@@ -38,6 +38,12 @@ FlagDesc flagdesc_deco[] = {
///////////////////////////////////////////////////////////////////////////////
+DecorationManager::DecorationManager(IGameDef *gamedef) :
+ GenElementManager(gamedef)
+{
+}
+
+
size_t DecorationManager::placeAllDecos(Mapgen *mg, u32 seed, v3s16 nmin, v3s16 nmax)
{
size_t nplaced = 0;
@@ -55,6 +61,19 @@ size_t DecorationManager::placeAllDecos(Mapgen *mg, u32 seed, v3s16 nmin, v3s16
}
+void DecorationManager::clear()
+{
+ for (size_t i = 0; i < m_elements.size(); i++) {
+ Decoration *deco = (Decoration *)m_elements[i];
+ if (!deco)
+ continue;
+
+ deco->dropResolverEntries(m_resolver);
+ }
+ m_elements.clear();
+}
+
+
///////////////////////////////////////////////////////////////////////////////
@@ -291,6 +310,13 @@ int DecoSimple::getHeight()
}
+void DecoSimple::dropResolverEntries(NodeResolver *resolver)
+{
+ resolver->cancelNodeList(&c_decos);
+ resolver->cancelNodeList(&c_spawnby);
+}
+
+
///////////////////////////////////////////////////////////////////////////////