Fix PlayerSAO deletion warning (0eede97af2927dcda3545192403b0a44f30bcd1f)
authorsfan5 <sfan5@live.de>
Sat, 4 Feb 2017 12:31:21 +0000 (13:31 +0100)
committersfan5 <sfan5@live.de>
Sat, 4 Feb 2017 12:31:21 +0000 (13:31 +0100)
src/serverenvironment.cpp

index 7a5cfafd6826c9ab0203a077f54e591e47e15679..8d86a4e0a994d6b6e0452ba6bdd282d1b3667861 100644 (file)
@@ -2087,9 +2087,7 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete)
 
                        if(block)
                        {
-                               // Force delete object if mapblock is full, but ignore players
-                               if (obj->getType() != ACTIVEOBJECT_TYPE_PLAYER &&
-                                       block->m_static_objects.m_stored.size() >= g_settings->getU16("max_objects_per_block")) {
+                               if (block->m_static_objects.m_stored.size() >= g_settings->getU16("max_objects_per_block")) {
                                        warningstream << "ServerEnv: Trying to store id = " << obj->getId()
                                                << " statically but block " << PP(blockpos)
                                                << " already contains "
@@ -2149,6 +2147,13 @@ 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;