diff options
author | kwolekr <kwolekr@minetest.net> | 2014-12-17 03:20:17 -0500 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2014-12-27 02:12:21 -0500 |
commit | b67f37f27ea7d89b2098fa9fcc2533fa1091e695 (patch) | |
tree | b97d7c98fc29677dfc57fa8f8af4332ff9d0c87c /src/mg_decoration.cpp | |
parent | 3ea5ed4ffe600fa11a3deb3de58d5bd5bbb65ee1 (diff) | |
download | minetest-b67f37f27ea7d89b2098fa9fcc2533fa1091e695.tar.gz minetest-b67f37f27ea7d89b2098fa9fcc2533fa1091e695.tar.bz2 minetest-b67f37f27ea7d89b2098fa9fcc2533fa1091e695.zip |
Redefine NodeResolver interface and replace with callback mechanism
Diffstat (limited to 'src/mg_decoration.cpp')
-rw-r--r-- | src/mg_decoration.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mg_decoration.cpp b/src/mg_decoration.cpp index 761b231ed..50e8fb05a 100644 --- a/src/mg_decoration.cpp +++ b/src/mg_decoration.cpp @@ -65,10 +65,7 @@ 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); + delete deco; } m_elements.clear(); } @@ -91,6 +88,12 @@ Decoration::~Decoration() } +void Decoration::resolveNodeNames(NodeResolveInfo *nri) +{ + m_ndef->getIdsFromResolveInfo(nri, c_place_on); +} + + size_t Decoration::placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) { PseudoRandom ps(blockseed + 53); @@ -229,6 +232,14 @@ void Decoration::placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax) /////////////////////////////////////////////////////////////////////////////// +void DecoSimple::resolveNodeNames(NodeResolveInfo *nri) +{ + Decoration::resolveNodeNames(nri); + m_ndef->getIdsFromResolveInfo(nri, c_decos); + m_ndef->getIdsFromResolveInfo(nri, c_spawnby); +} + + bool DecoSimple::canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p) { // Don't bother if there aren't any decorations to place @@ -310,13 +321,6 @@ int DecoSimple::getHeight() } -void DecoSimple::dropResolverEntries(NodeResolver *resolver) -{ - resolver->cancelNodeList(&c_decos); - resolver->cancelNodeList(&c_spawnby); -} - - /////////////////////////////////////////////////////////////////////////////// |