diff --git a/src/environment.cpp b/src/environment.cpp index 0a3d36019..9daa9e042 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1675,12 +1675,13 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) // Ignore if no stored objects (to not set changed flag) if(block->m_static_objects.m_stored.empty()) return; + verbosestream<<"ServerEnvironment::activateObjects(): " <<"activating objects of block "<getPos()) <<" ("<m_static_objects.m_stored.size() <<" objects)"<m_static_objects.m_stored.size() > g_settings->getU16("max_objects_per_block")); - if(large_amount){ + if (large_amount) { errorstream<<"suspiciously large amount of objects detected: " <m_static_objects.m_stored.size()<<" in " <getPos()) @@ -1695,7 +1696,7 @@ void ServerEnvironment::activateObjects(MapBlock *block, u32 dtime_s) // Activate stored objects std::vector new_stored; - for(std::list::iterator + for (std::vector::iterator i = block->m_static_objects.m_stored.begin(); i != block->m_static_objects.m_stored.end(); ++i) { StaticObject &s_obj = *i; diff --git a/src/itemdef.cpp b/src/itemdef.cpp index d356b96c5..3b4d2596a 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -249,8 +249,8 @@ public: virtual ~CItemDefManager() { #ifndef SERVER - const std::list &values = m_clientcached.getValues(); - for(std::list::const_iterator + const std::vector &values = m_clientcached.getValues(); + for(std::vector::const_iterator i = values.begin(); i != values.end(); ++i) { ClientCached *cc = *i; diff --git a/src/staticobject.cpp b/src/staticobject.cpp index 16d98605b..2e7d45a47 100644 --- a/src/staticobject.cpp +++ b/src/staticobject.cpp @@ -47,10 +47,9 @@ void StaticObjectList::serialize(std::ostream &os) // count u16 count = m_stored.size() + m_active.size(); writeU16(os, count); - for(std::list::iterator + for(std::vector::iterator i = m_stored.begin(); - i != m_stored.end(); ++i) - { + i != m_stored.end(); ++i) { StaticObject &s_obj = *i; s_obj.serialize(os); } @@ -68,8 +67,7 @@ void StaticObjectList::deSerialize(std::istream &is) u8 version = readU8(is); // count u16 count = readU16(is); - for(u16 i=0; i #include -#include +#include #include #include "debug.h" @@ -95,7 +95,7 @@ public: from m_stored and inserted to m_active. The caller directly manipulates these containers. */ - std::list m_stored; + std::vector m_stored; std::map m_active; private: diff --git a/src/util/container.h b/src/util/container.h index 5e9f13d88..3ffd885e4 100644 --- a/src/util/container.h +++ b/src/util/container.h @@ -77,7 +77,6 @@ private: std::queue m_queue; }; -#if 1 template class MutexedMap { @@ -109,9 +108,9 @@ public: return true; } - std::list getValues() + std::vector getValues() { - std::list result; + std::vector result; for(typename std::map::iterator i = m_values.begin(); i != m_values.end(); ++i){ @@ -129,7 +128,6 @@ private: std::map m_values; JMutex m_mutex; }; -#endif /* Generates ids for comparable values.