diff options
author | kwolekr <kwolekr@minetest.net> | 2015-05-07 02:34:15 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-05-07 02:36:01 -0400 |
commit | 656575b59d4f0d67452cca7409c9064f690f038c (patch) | |
tree | 2b35b13a8b2819dadfb00799dd92ee702bd83847 /src/nodedef.cpp | |
parent | d720fd564427b64cfab76e4b6177307bc46fa893 (diff) | |
download | minetest-656575b59d4f0d67452cca7409c9064f690f038c.tar.gz minetest-656575b59d4f0d67452cca7409c9064f690f038c.tar.bz2 minetest-656575b59d4f0d67452cca7409c9064f690f038c.zip |
NodeResolver: Remove NodeResolveMethod
This simplifies NodeResolver logic and makes some interfaces cleaner.
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r-- | src/nodedef.cpp | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index 2442799c7..ac432d196 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -406,7 +406,7 @@ public: inline virtual bool getNodeRegistrationStatus() const; inline virtual void setNodeRegistrationStatus(bool completed); - virtual void pendNodeResolve(NodeResolver *nr, NodeResolveMethod how); + virtual void pendNodeResolve(NodeResolver *nr); virtual bool cancelNodeResolveCallback(NodeResolver *nr); virtual void runNodeResolveCallbacks(); virtual void resetNodeResolveState(); @@ -1294,23 +1294,13 @@ inline void CNodeDefManager::setNodeRegistrationStatus(bool completed) } -void CNodeDefManager::pendNodeResolve(NodeResolver *nr, NodeResolveMethod how) +void CNodeDefManager::pendNodeResolve(NodeResolver *nr) { nr->m_ndef = this; - - switch (how) { - case NODE_RESOLVE_NONE: - break; - case NODE_RESOLVE_DIRECT: + if (m_node_registration_complete) nr->nodeResolveInternal(); - break; - case NODE_RESOLVE_DEFERRED: - if (m_node_registration_complete) - nr->nodeResolveInternal(); - else - m_pending_resolve_callbacks.push_back(nr); - break; - } + else + m_pending_resolve_callbacks.push_back(nr); } @@ -1385,19 +1375,6 @@ void NodeResolver::nodeResolveInternal() } -const std::string &NodeResolver::getNodeName(content_t c) const -{ - if (c < m_nodenames.size()) - return m_nodenames[c]; - - if (m_ndef) - return m_ndef->get(c).name; - - static const std::string unknown_str("unknown"); - return unknown_str; -} - - bool NodeResolver::getIdFromNrBacklog(content_t *result_out, const std::string &node_alt, content_t c_fallback) { |