diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-04 16:58:04 +0100 |
---|---|---|
committer | Loic Blot <loic.blot@unix-experience.fr> | 2015-03-04 17:02:36 +0100 |
commit | 06f328207fa0a3e606992d3569b061b335eb0f48 (patch) | |
tree | 324ce16ead2a4080882bd23077d93e446811add5 /src/environment.cpp | |
parent | 2066655aae2022384fc12a10c04dccfd2996f0ac (diff) | |
download | minetest-06f328207fa0a3e606992d3569b061b335eb0f48.tar.gz minetest-06f328207fa0a3e606992d3569b061b335eb0f48.tar.bz2 minetest-06f328207fa0a3e606992d3569b061b335eb0f48.zip |
ABMHandler and player_collisions use sequential read/write. Switch from std::list to std::vector
* Also remove dead code Map::unloadUnusedData which is dead since a long time
Diffstat (limited to 'src/environment.cpp')
-rw-r--r-- | src/environment.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index 217d50fd5..0a3d36019 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -382,7 +382,7 @@ ServerEnvironment::~ServerEnvironment() m_map->drop(); // Delete ActiveBlockModifiers - for(std::list<ABMWithState>::iterator + for(std::vector<ABMWithState>::iterator i = m_abms.begin(); i != m_abms.end(); ++i){ delete i->abm; } @@ -560,7 +560,7 @@ private: ServerEnvironment *m_env; std::map<content_t, std::vector<ActiveABM> > m_aabms; public: - ABMHandler(std::list<ABMWithState> &abms, + ABMHandler(std::vector<ABMWithState> &abms, float dtime_s, ServerEnvironment *env, bool use_timers): m_env(env) @@ -568,8 +568,8 @@ public: if(dtime_s < 0.001) return; INodeDefManager *ndef = env->getGameDef()->ndef(); - for(std::list<ABMWithState>::iterator - i = abms.begin(); i != abms.end(); ++i){ + for(std::vector<ABMWithState>::iterator + i = abms.begin(); i != abms.end(); ++i) { ActiveBlockModifier *abm = i->abm; float trigger_interval = abm->getTriggerInterval(); if(trigger_interval < 0.001) @@ -1182,7 +1182,7 @@ void ServerEnvironment::step(float dtime) <<") being handled"<<std::endl;*/ MapBlock *block = m_map->getBlockNoCreateNoEx(p); - if(block==NULL) + if(block == NULL) continue; // Set current time as timestamp @@ -2081,7 +2081,7 @@ void ClientEnvironment::step(float dtime) LocalPlayer *lplayer = getLocalPlayer(); assert(lplayer); // collision info queue - std::list<CollisionInfo> player_collisions; + std::vector<CollisionInfo> player_collisions; /* Get the speed the player is going @@ -2196,10 +2196,8 @@ void ClientEnvironment::step(float dtime) //std::cout<<"Looped "<<loopcount<<" times."<<std::endl; - for(std::list<CollisionInfo>::iterator - i = player_collisions.begin(); - i != player_collisions.end(); ++i) - { + for(std::vector<CollisionInfo>::iterator i = player_collisions.begin(); + i != player_collisions.end(); ++i) { CollisionInfo &info = *i; v3f speed_diff = info.new_speed - info.old_speed;; // Handle only fall damage |