Remove duplicate code in main menu
[oweals/minetest.git] / src / clientobject.cpp
index ee2ad0b9fcd7cf0aa71fc6ee3ba768761abed0fe..93f3b1cca69fce3deb1176c8e00bb92db6efd440 100644 (file)
@@ -26,8 +26,11 @@ with this program; if not, write to the Free Software Foundation, Inc.,
        ClientActiveObject
 */
 
-ClientActiveObject::ClientActiveObject(u16 id):
-       ActiveObject(id)
+ClientActiveObject::ClientActiveObject(u16 id, IGameDef *gamedef,
+               ClientEnvironment *env):
+       ActiveObject(id),
+       m_gamedef(gamedef),
+       m_env(env)
 {
 }
 
@@ -36,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;
@@ -50,7 +54,7 @@ ClientActiveObject* ClientActiveObject::create(u8 type)
        }
 
        Factory f = n->getValue();
-       ClientActiveObject *object = (*f)();
+       ClientActiveObject *object = (*f)(gamedef, env);
        return object;
 }