]> git.lizzy.rs Git - minetest.git/blobdiff - src/clientobject.cpp
Particles: Do not add digging particles for airlike nodes (#6392)
[minetest.git] / src / clientobject.cpp
index 37f693c5e1310d0b4306fa9ff720b684db1e9adf..f4b69201ba9ad6fc38240995d7e0d388fdcf951f 100644 (file)
@@ -20,16 +20,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "clientobject.h"
 #include "debug.h"
 #include "porting.h"
-#include "constants.h"
 
 /*
        ClientActiveObject
 */
 
-ClientActiveObject::ClientActiveObject(u16 id, IGameDef *gamedef,
+ClientActiveObject::ClientActiveObject(u16 id, Client *client,
                ClientEnvironment *env):
        ActiveObject(id),
-       m_gamedef(gamedef),
+       m_client(client),
        m_env(env)
 {
 }
@@ -39,30 +38,27 @@ ClientActiveObject::~ClientActiveObject()
        removeFromScene(true);
 }
 
-ClientActiveObject* ClientActiveObject::create(u8 type, IGameDef *gamedef,
-               ClientEnvironment *env)
+ClientActiveObject* ClientActiveObject::create(ActiveObjectType type,
+               Client *client, ClientEnvironment *env)
 {
        // Find factory function
-       std::map<u16, Factory>::iterator n;
-       n = m_types.find(type);
-       if(n == m_types.end())
-       {
+       auto n = m_types.find(type);
+       if (n == m_types.end()) {
                // If factory is not found, just return.
-               dstream<<"WARNING: ClientActiveObject: No factory for type="
-                               <<(int)type<<std::endl;
+               warningstream << "ClientActiveObject: No factory for type="
+                               << (int)type << std::endl;
                return NULL;
        }
 
        Factory f = n->second;
-       ClientActiveObject *object = (*f)(gamedef, env);
+       ClientActiveObject *object = (*f)(client, env);
        return object;
 }
 
 void ClientActiveObject::registerType(u16 type, Factory f)
 {
-       std::map<u16, Factory>::iterator n;
-       n = m_types.find(type);
-       if(n != m_types.end())
+       auto n = m_types.find(type);
+       if (n != m_types.end())
                return;
        m_types[type] = f;
 }