From ea1fda5ebc7fe0aa276de768cacd81df365c69a3 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Mon, 17 Oct 2011 20:57:58 +0300 Subject: Made a scheme to get rid of the objects in the worst object flooded blocks --- src/environment.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/environment.cpp b/src/environment.cpp index 1319e3744..174ee1e1d 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -887,9 +887,10 @@ void ServerEnvironment::step(float dtime) if(block==NULL) continue; active_object_count_wider += - block->m_static_objects.m_active.size(); + block->m_static_objects.m_active.size() + + block->m_static_objects.m_stored.size(); - if(block->m_static_objects.m_stored.size() != 0){ + /*if(block->m_static_objects.m_stored.size() != 0){ errorstream<<"ServerEnvironment::step(): " <getPos())<<" contains " <m_static_objects.m_stored.size() @@ -897,7 +898,7 @@ void ServerEnvironment::step(float dtime) <<"when spawning objects, when counting active " <<"objects in wide area. relative position: " <<"("<getPos()) <<" ("<m_static_objects.m_stored.size() <<" objects)"<m_static_objects.m_stored.size() >= 51); + bool large_amount = (block->m_static_objects.m_stored.size() > 49); if(large_amount){ errorstream<<"suspiciously large amount of objects detected: " <m_static_objects.m_stored.size()<<" in " <getPos()) - <<"; not activating."<m_static_objects.m_stored.clear(); + block->raiseModified(MOD_STATE_WRITE_NEEDED); return; } // A list for objects that couldn't be converted to static for some @@ -1645,10 +1649,12 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) if(block) { - if(block->m_static_objects.m_stored.size() >= 50){ + if(block->m_static_objects.m_stored.size() >= 49){ errorstream<<"ServerEnv: Trying to store id="<getId() <<" statically but block "<m_static_objects.m_stored.size() + <<" (over 49) objects." <<" Forcing delete."<