aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2017-02-15 17:36:47 +0100
committersfan5 <sfan5@live.de>2017-02-15 17:36:47 +0100
commita5e4273575c7a82459c4f9025ee19ee57eed4698 (patch)
treebc287b0cdddf9b2c5f8902cef8fbe456a5e441ee
parenteb49009d023e6e3b5d59a97b8fb5fed5eee83296 (diff)
downloadminetest-a5e4273575c7a82459c4f9025ee19ee57eed4698.tar.gz
minetest-a5e4273575c7a82459c4f9025ee19ee57eed4698.tar.bz2
minetest-a5e4273575c7a82459c4f9025ee19ee57eed4698.zip
Fix >5 year old PlayerSAO deletion bug
force_delete=true is usually set at shutdown in order to also remove PlayerSAOs, however when too many objects per block are detected force_delete is also set to true. This was intended only for the current loop iteration but obviously persisted to the next iterations thereby deleting all other remaining SAOs.
-rw-r--r--src/serverenvironment.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/serverenvironment.cpp b/src/serverenvironment.cpp
index 8d86a4e0a..61faaace7 100644
--- a/src/serverenvironment.cpp
+++ b/src/serverenvironment.cpp
@@ -1941,11 +1941,14 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s)
If block wasn't generated (not in memory or on disk),
*/
-void ServerEnvironment::deactivateFarObjects(bool force_delete)
+void ServerEnvironment::deactivateFarObjects(bool _force_delete)
{
std::vector<u16> objects_to_remove;
for(ActiveObjectMap::iterator i = m_active_objects.begin();
i != m_active_objects.end(); ++i) {
+ // force_delete might be overriden per object
+ bool force_delete = _force_delete;
+
ServerActiveObject* obj = i->second;
assert(obj);
@@ -2147,13 +2150,6 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
continue;
}
- if (!force_delete && obj->getType() == ACTIVEOBJECT_TYPE_PLAYER) {
- warningstream << "ServerEnvironment::deactivateFarObjects(): "
- << "Trying to delete player object, THIS SHOULD NEVER HAPPEN!"
- << std::endl;
- continue;
- }
-
verbosestream<<"ServerEnvironment::deactivateFarObjects(): "
<<"object id="<<id<<" is not known by clients"
<<"; deleting"<<std::endl;