Tune caves
[oweals/minetest.git] / src / nodemetadata.cpp
index 2f47aba22b184c9dd141170a129671537530ae3c..410b4e2ea78bcb12cf89020dba9451aeb2336312 100644 (file)
@@ -30,9 +30,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        NodeMetadata
 */
 
-core::map<u16, NodeMetadata::Factory> NodeMetadata::m_types;
-core::map<std::string, NodeMetadata::Factory> NodeMetadata::m_names;
-
 NodeMetadata::NodeMetadata(IGameDef *gamedef):
        m_gamedef(gamedef)
 {
@@ -45,7 +42,7 @@ NodeMetadata::~NodeMetadata()
 NodeMetadata* NodeMetadata::create(const std::string &name, IGameDef *gamedef)
 {
        // Find factory function
-       core::map<std::string, Factory>::Node *n;
+       core::map<std::string, Factory2>::Node *n;
        n = m_names.find(name);
        if(n == NULL)
        {
@@ -58,10 +55,8 @@ NodeMetadata* NodeMetadata::create(const std::string &name, IGameDef *gamedef)
        // Try to load the metadata. If it fails, just return.
        try
        {
-               std::istringstream iss("", std::ios_base::binary);
-               
-               Factory f = n->getValue();
-               NodeMetadata *meta = (*f)(iss, gamedef);
+               Factory2 f2 = n->getValue();
+               NodeMetadata *meta = (*f2)(gamedef);
                return meta;
        }
        catch(SerializationError &e)
@@ -120,7 +115,8 @@ void NodeMetadata::serialize(std::ostream &os)
        os<<serializeString(oss.str());
 }
 
-void NodeMetadata::registerType(u16 id, const std::string &name, Factory f)
+void NodeMetadata::registerType(u16 id, const std::string &name, Factory f,
+               Factory2 f2)
 {
        { // typeId
                core::map<u16, Factory>::Node *n;
@@ -129,10 +125,10 @@ void NodeMetadata::registerType(u16 id, const std::string &name, Factory f)
                        m_types.insert(id, f);
        }
        { // typeName
-               core::map<std::string, Factory>::Node *n;
+               core::map<std::string, Factory2>::Node *n;
                n = m_names.find(name);
                if(!n)
-                       m_names.insert(name, f);
+                       m_names.insert(name, f2);
        }
 }