From cf8213ea827f38ae5d4b8ef16c396545e3e59657 Mon Sep 17 00:00:00 2001 From: kwolekr Date: Fri, 12 Dec 2014 14:07:49 -0500 Subject: Add minetest.clear_registered_decorations() and clear_registered_ores() --- src/mg_decoration.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/mg_decoration.cpp') 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); +} + + /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3