From d39f98aeb0b33cbc9549a5ab1db85470fbd835ba Mon Sep 17 00:00:00 2001 From: celeron55 Date: Mon, 17 Oct 2011 10:47:06 +0300 Subject: Improve active object handling log output --- src/environment.cpp | 49 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 10 deletions(-) diff --git a/src/environment.cpp b/src/environment.cpp index 47743bfc7..5c7b295ef 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1343,21 +1343,26 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, bool set_changed) { assert(object); - if(object->getId() == 0) - { + if(object->getId() == 0){ u16 new_id = getFreeServerActiveObjectId(m_active_objects); + verbosestream<<"ServerEnvironment::addActiveObjectRaw(): " + <<"created new id "<setId(new_id); } + else{ + verbosestream<<"ServerEnvironment::addActiveObjectRaw(): " + <<"supplied with id "<getId()<getId(), m_active_objects) == false) { - infostream<<"ServerEnvironment::addActiveObjectRaw(): " + errorstream<<"ServerEnvironment::addActiveObjectRaw(): " <<"id is not free ("<getId()<<")"<getId(), object); - + + verbosestream<<"ServerEnvironment::addActiveObjectRaw(): " + <<"Added id="<getId()<<"; there are now " + <getBasePosition(); std::string staticdata = object->getStaticData(); @@ -1376,6 +1386,12 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, MapBlock *block = m_map->getBlockNoCreateNoEx(blockpos); if(block) { + verbosestream<<"ServerEnvironment::addActiveObjectRaw(): " + <<"found block for storing id="<getId() + <<" statically" + <<" (set_changed="<<(set_changed?"true":"false")<<")" + <m_static_objects.m_active.insert(object->getId(), s_obj); object->m_static_exists = true; object->m_static_block = blockpos; @@ -1384,8 +1400,8 @@ u16 ServerEnvironment::addActiveObjectRaw(ServerActiveObject *object, block->setChangedFlag(); } else{ - infostream<<"ServerEnv: Could not find a block for " - <<"storing newly added static active object"<getId(); @@ -1460,6 +1476,10 @@ void ServerEnvironment::activateObjects(MapBlock *block) // Ignore if no stored objects (to not set changed flag) if(block->m_static_objects.m_stored.size() == 0) return; + verbosestream<<"ServerEnvironment::activateObjects(): " + <<"activating objects of block "<getPos()) + <<" ("<m_static_objects.m_stored.size() + <<" objects)"< new_stored; @@ -1536,6 +1556,10 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) if(m_active_blocks.contains(blockpos_o)) continue; + verbosestream<<"ServerEnvironment::deactivateFarObjects(): " + <<"deactivating object id="<m_static_block = block->getPos(); } else{ - infostream<<"ServerEnv: Could not find or generate " + errorstream<<"ServerEnv: Could not find or generate " <<"a block for storing static object"<m_static_exists = false; continue; @@ -1593,12 +1617,17 @@ void ServerEnvironment::deactivateFarObjects(bool force_delete) // If known by some client, don't delete. if(obj->m_known_by_count > 0 && force_delete == false) { + verbosestream<<"ServerEnvironment::deactivateFarObjects(): " + <<"object id="<m_pending_deactivation = true; continue; } - /*infostream<<"Server: Stored static data. Deleting object." - <