diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-02-17 11:37:55 +0100 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-02-17 11:37:55 +0100 |
commit | c58d49977da5aab88f5a9d5b540c6237ca5cdcb5 (patch) | |
tree | a5bc0c0987b57cbee1052c0289c19cbf5274fcb3 /src | |
parent | f8d5af753617d502920556cff88f451ef670c210 (diff) | |
download | minetest-c58d49977da5aab88f5a9d5b540c6237ca5cdcb5.tar.gz minetest-c58d49977da5aab88f5a9d5b540c6237ca5cdcb5.tar.bz2 minetest-c58d49977da5aab88f5a9d5b540c6237ca5cdcb5.zip |
SAO: re-add old ActiveObjectTypes for a future migration layer
Diffstat (limited to 'src')
-rw-r--r-- | src/activeobject.h | 5 | ||||
-rw-r--r-- | src/clientobject.cpp | 7 | ||||
-rw-r--r-- | src/clientobject.h | 2 | ||||
-rw-r--r-- | src/environment.cpp | 4 | ||||
-rw-r--r-- | src/serverobject.cpp | 5 | ||||
-rw-r--r-- | src/serverobject.h | 2 |
6 files changed, 14 insertions, 11 deletions
diff --git a/src/activeobject.h b/src/activeobject.h index 3dd1f98f5..76893280a 100644 --- a/src/activeobject.h +++ b/src/activeobject.h @@ -27,6 +27,11 @@ enum ActiveObjectType { ACTIVEOBJECT_TYPE_INVALID = 0, ACTIVEOBJECT_TYPE_TEST = 1, ACTIVEOBJECT_TYPE_ITEM = 2, + // Compat layer, migrating objects from 0.3 to 0.4+ + ACTIVEOBJECT_TYPE_RAT = 3, + ACTIVEOBJECT_TYPE_OERKKI1 = 4, + ACTIVEOBJECT_TYPE_FIREFLY = 5, + ACTIVEOBJECT_TYPE_MOBV2 = 6, ACTIVEOBJECT_TYPE_LUAENTITY = 7, // Special type, not stored as a static object ACTIVEOBJECT_TYPE_PLAYER = 100, diff --git a/src/clientobject.cpp b/src/clientobject.cpp index 37f693c5e..ae1be092f 100644 --- a/src/clientobject.cpp +++ b/src/clientobject.cpp @@ -39,14 +39,13 @@ ClientActiveObject::~ClientActiveObject() removeFromScene(true); } -ClientActiveObject* ClientActiveObject::create(u8 type, IGameDef *gamedef, - ClientEnvironment *env) +ClientActiveObject* ClientActiveObject::create(ActiveObjectType type, + IGameDef *gamedef, ClientEnvironment *env) { // Find factory function std::map<u16, Factory>::iterator n; n = m_types.find(type); - if(n == m_types.end()) - { + if(n == m_types.end()) { // If factory is not found, just return. dstream<<"WARNING: ClientActiveObject: No factory for type=" <<(int)type<<std::endl; diff --git a/src/clientobject.h b/src/clientobject.h index 24150628e..4a77139e2 100644 --- a/src/clientobject.h +++ b/src/clientobject.h @@ -86,7 +86,7 @@ public: virtual void initialize(const std::string &data){} // Create a certain type of ClientActiveObject - static ClientActiveObject* create(u8 type, IGameDef *gamedef, + static ClientActiveObject* create(ActiveObjectType type, IGameDef *gamedef, ClientEnvironment *env); // If returns true, punch will not be sent to the server diff --git a/src/environment.cpp b/src/environment.cpp index e1f79803b..166523a4f 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1700,7 +1700,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) StaticObject &s_obj = *i; // Create an active object from the data ServerActiveObject *obj = ServerActiveObject::create - (s_obj.type, this, 0, s_obj.pos, s_obj.data); + ((ActiveObjectType) s_obj.type, this, 0, s_obj.pos, s_obj.data); // If couldn't create object, store static data back. if(obj==NULL) { @@ -2488,7 +2488,7 @@ void ClientEnvironment::addActiveObject(u16 id, u8 type, const std::string &init_data) { ClientActiveObject* obj = - ClientActiveObject::create(type, m_gamedef, this); + ClientActiveObject::create((ActiveObjectType) type, m_gamedef, this); if(obj == NULL) { infostream<<"ClientEnvironment::addActiveObject(): " diff --git a/src/serverobject.cpp b/src/serverobject.cpp index 81307bc34..98d82550f 100644 --- a/src/serverobject.cpp +++ b/src/serverobject.cpp @@ -38,15 +38,14 @@ ServerActiveObject::~ServerActiveObject() { } -ServerActiveObject* ServerActiveObject::create(u8 type, +ServerActiveObject* ServerActiveObject::create(ActiveObjectType type, ServerEnvironment *env, u16 id, v3f pos, const std::string &data) { // Find factory function std::map<u16, Factory>::iterator n; n = m_types.find(type); - if(n == m_types.end()) - { + if(n == m_types.end()) { // If factory is not found, just return. dstream<<"WARNING: ServerActiveObject: No factory for type=" <<type<<std::endl; diff --git a/src/serverobject.h b/src/serverobject.h index 96485d7a3..878c37773 100644 --- a/src/serverobject.h +++ b/src/serverobject.h @@ -71,7 +71,7 @@ public: { return true; } // Create a certain type of ServerActiveObject - static ServerActiveObject* create(u8 type, + static ServerActiveObject* create(ActiveObjectType type, ServerEnvironment *env, u16 id, v3f pos, const std::string &data); |