diff options
Diffstat (limited to 'src/nodedef.cpp')
-rw-r--r-- | src/nodedef.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/nodedef.cpp b/src/nodedef.cpp index f7bb5aba3..686b71604 100644 --- a/src/nodedef.cpp +++ b/src/nodedef.cpp @@ -402,6 +402,9 @@ public: void serialize(std::ostream &os, u16 protocol_version); void deSerialize(std::istream &is); + inline virtual bool getNodeRegistrationStatus() const; + inline virtual void setNodeRegistrationStatus(bool completed); + virtual void pendNodeResolve(NodeResolveInfo *nri); virtual void cancelNodeResolve(NodeResolver *resolver); virtual void runNodeResolverCallbacks(); @@ -441,6 +444,9 @@ private: // List of node strings and node resolver callbacks to perform std::list<NodeResolveInfo *> m_pending_node_lookups; + + // True when all nodes have been registered + bool m_node_registration_complete; }; @@ -1268,10 +1274,28 @@ void ContentFeatures::deSerializeOld(std::istream &is, int version) } +inline bool CNodeDefManager::getNodeRegistrationStatus() const +{ + return m_node_registration_complete; +} + + +inline void CNodeDefManager::setNodeRegistrationStatus(bool completed) +{ + m_node_registration_complete = completed; +} + + void CNodeDefManager::pendNodeResolve(NodeResolveInfo *nri) { nri->resolver->m_ndef = this; - m_pending_node_lookups.push_back(nri); + if (m_node_registration_complete) { + nri->resolver->resolveNodeNames(nri); + nri->resolver->m_lookup_done = true; + delete nri; + } else { + m_pending_node_lookups.push_back(nri); + } } |