SAO: re-add old ActiveObjectTypes for a future migration layer
parent
f8d5af7536
commit
c58d49977d
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(): "
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue