Remove duplicate code in main menu
[oweals/minetest.git] / src / clientobject.cpp
index 787efef294c988dae5c5e6f758e0fd0a1daf9f0a..93f3b1cca69fce3deb1176c8e00bb92db6efd440 100644 (file)
@@ -26,10 +26,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        ClientActiveObject
 */
 
-core::map<u16, ClientActiveObject::Factory> ClientActiveObject::m_types;
-
-ClientActiveObject::ClientActiveObject(u16 id):
-       ActiveObject(id)
+ClientActiveObject::ClientActiveObject(u16 id, IGameDef *gamedef,
+               ClientEnvironment *env):
+       ActiveObject(id),
+       m_gamedef(gamedef),
+       m_env(env)
 {
 }
 
@@ -38,7 +39,8 @@ ClientActiveObject::~ClientActiveObject()
        removeFromScene();
 }
 
-ClientActiveObject* ClientActiveObject::create(u8 type)
+ClientActiveObject* ClientActiveObject::create(u8 type, IGameDef *gamedef,
+               ClientEnvironment *env)
 {
        // Find factory function
        core::map<u16, Factory>::Node *n;
@@ -47,12 +49,12 @@ ClientActiveObject* ClientActiveObject::create(u8 type)
        {
                // If factory is not found, just return.
                dstream<<"WARNING: ClientActiveObject: No factory for type="
-                               <<type<<std::endl;
+                               <<(int)type<<std::endl;
                return NULL;
        }
 
        Factory f = n->getValue();
-       ClientActiveObject *object = (*f)();
+       ClientActiveObject *object = (*f)(gamedef, env);
        return object;
 }