diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-01 23:33:48 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-01 23:33:48 +0200 |
commit | af322405454191846507b91251d655c2b0aa864b (patch) | |
tree | 06213c35a56ecbf3ad6e8b509052e1ccd23cb783 /src/environment.cpp | |
parent | ee0d3bacbce612c1abc6016cb7b0d684df25b820 (diff) | |
download | minetest-af322405454191846507b91251d655c2b0aa864b.tar.gz minetest-af322405454191846507b91251d655c2b0aa864b.tar.bz2 minetest-af322405454191846507b91251d655c2b0aa864b.zip |
Players are more like objects + related stuff
Diffstat (limited to 'src/environment.cpp')
-rw-r--r-- | src/environment.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 833ed93c2..17c9ecfff 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -750,7 +750,8 @@ void ServerEnvironment::clearAllObjects() scriptapi_rm_object_reference(m_lua, obj); // Delete active object - delete obj; + if(obj->environmentDeletes()) + delete obj; // Id to be removed from m_active_objects objects_to_remove.push_back(id); } @@ -1181,7 +1182,8 @@ bool ServerEnvironment::addActiveObjectAsStatic(ServerActiveObject *obj) succeeded = false; } - delete obj; + if(obj->environmentDeletes()) + delete obj; return succeeded; } @@ -1296,7 +1298,8 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, { errorstream<<"ServerEnvironment::addActiveObjectRaw(): " <<"no free ids available"<<std::endl; - delete object; + if(object->environmentDeletes()) + delete object; return 0; } object->setId(new_id); @@ -1309,7 +1312,8 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, { errorstream<<"ServerEnvironment::addActiveObjectRaw(): " <<"id is not free ("<<object->getId()<<")"<<std::endl; - delete object; + if(object->environmentDeletes()) + delete object; return 0; } /*infostream<<"ServerEnvironment::addActiveObjectRaw(): " @@ -1411,7 +1415,8 @@ void ServerEnvironment::removeRemovedObjects() scriptapi_rm_object_reference(m_lua, obj); // Delete - delete obj; + if(obj->environmentDeletes()) + delete obj; // Id to be removed from m_active_objects objects_to_remove.push_back(id); } @@ -1699,7 +1704,8 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) scriptapi_rm_object_reference(m_lua, obj); // Delete active object - delete obj; + if(obj->environmentDeletes()) + delete obj; // Id to be removed from m_active_objects objects_to_remove.push_back(id); } |