diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-02-17 15:04:08 +0100 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-02-17 15:08:37 +0100 |
commit | 3c91ad8fc2b7a7888503e85d31bfe286afa6560d (patch) | |
tree | 3003e3fe5a9617651dc512f828ac7cbc3d5d155b /src | |
parent | 24315db6ef90125c3c62327f2ace654b548811ac (diff) | |
download | minetest-3c91ad8fc2b7a7888503e85d31bfe286afa6560d.tar.gz minetest-3c91ad8fc2b7a7888503e85d31bfe286afa6560d.tar.bz2 minetest-3c91ad8fc2b7a7888503e85d31bfe286afa6560d.zip |
Replace std::list by std::vector into timerUpdate calls
Diffstat (limited to 'src')
-rw-r--r-- | src/client.cpp | 8 | ||||
-rw-r--r-- | src/map.cpp | 7 | ||||
-rw-r--r-- | src/map.h | 4 |
3 files changed, 9 insertions, 10 deletions
diff --git a/src/client.cpp b/src/client.cpp index 38ce54bdc..17661d0c1 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -434,7 +434,7 @@ void Client::step(float dtime) const float map_timer_and_unload_dtime = 5.25; if(m_map_timer_and_unload_interval.step(dtime, map_timer_and_unload_dtime)) { ScopeProfiler sp(g_profiler, "Client: map timer and unload"); - std::list<v3s16> deleted_blocks; + std::vector<v3s16> deleted_blocks; m_env.getMap().timerUpdate(map_timer_and_unload_dtime, g_settings->getFloat("client_unload_unused_data_timeout"), &deleted_blocks); @@ -444,8 +444,8 @@ void Client::step(float dtime) NOTE: This loop is intentionally iterated the way it is. */ - std::list<v3s16>::iterator i = deleted_blocks.begin(); - std::list<v3s16> sendlist; + std::vector<v3s16>::iterator i = deleted_blocks.begin(); + std::vector<v3s16> sendlist; for(;;) { if(sendlist.size() == 255 || i == deleted_blocks.end()) { if(sendlist.empty()) @@ -462,7 +462,7 @@ void Client::step(float dtime) *pkt << (u8) sendlist.size(); u32 k = 0; - for(std::list<v3s16>::iterator + for(std::vector<v3s16>::iterator j = sendlist.begin(); j != sendlist.end(); ++j) { *pkt << *j; diff --git a/src/map.cpp b/src/map.cpp index cfad92e3e..191b05ed5 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -1421,7 +1421,7 @@ bool Map::getDayNightDiff(v3s16 blockpos) Updates usage timers */ void Map::timerUpdate(float dtime, float unload_timeout, - std::list<v3s16> *unloaded_blocks) + std::vector<v3s16> *unloaded_blocks) { bool save_before_unloading = (mapType() == MAPTYPE_SERVER); @@ -1435,8 +1435,7 @@ void Map::timerUpdate(float dtime, float unload_timeout, beginSave(); for(std::map<v2s16, MapSector*>::iterator si = m_sectors.begin(); - si != m_sectors.end(); ++si) - { + si != m_sectors.end(); ++si) { MapSector *sector = si->second; bool all_blocks_deleted = true; @@ -1506,7 +1505,7 @@ void Map::timerUpdate(float dtime, float unload_timeout, } } -void Map::unloadUnreferencedBlocks(std::list<v3s16> *unloaded_blocks) +void Map::unloadUnreferencedBlocks(std::vector<v3s16> *unloaded_blocks) { timerUpdate(0.0, -1.0, unloaded_blocks); } @@ -277,13 +277,13 @@ public: Saves modified blocks before unloading on MAPTYPE_SERVER. */ void timerUpdate(float dtime, float unload_timeout, - std::list<v3s16> *unloaded_blocks=NULL); + std::vector<v3s16> *unloaded_blocks=NULL); /* Unloads all blocks with a zero refCount(). Saves modified blocks before unloading on MAPTYPE_SERVER. */ - void unloadUnreferencedBlocks(std::list<v3s16> *unloaded_blocks=NULL); + void unloadUnreferencedBlocks(std::vector<v3s16> *unloaded_blocks=NULL); // Deletes sectors and their blocks from memory // Takes cache into account |