X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclientobject.cpp;h=f4b69201ba9ad6fc38240995d7e0d388fdcf951f;hb=8a99c8c94a40640c7c337278277f5c027e96f3cb;hp=ff3f4718765a293b1d378c19c4c75b864ab0a1c8;hpb=667975fe3adee935a3f4d2b1a421a295771c664d;p=dragonfireclient.git diff --git a/src/clientobject.cpp b/src/clientobject.cpp index ff3f47187..f4b69201b 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -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) { } @@ -40,11 +39,11 @@ ClientActiveObject::~ClientActiveObject() } ClientActiveObject* ClientActiveObject::create(ActiveObjectType type, - IGameDef *gamedef, ClientEnvironment *env) + Client *client, ClientEnvironment *env) { // Find factory function - UNORDERED_MAP::iterator 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. warningstream << "ClientActiveObject: No factory for type=" << (int)type << std::endl; @@ -52,14 +51,14 @@ ClientActiveObject* ClientActiveObject::create(ActiveObjectType type, } Factory f = n->second; - ClientActiveObject *object = (*f)(gamedef, env); + ClientActiveObject *object = (*f)(client, env); return object; } void ClientActiveObject::registerType(u16 type, Factory f) { - UNORDERED_MAP::iterator 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; }