diff options
Diffstat (limited to 'src/environment.cpp')
-rw-r--r-- | src/environment.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/environment.cpp b/src/environment.cpp index b1372431f..60a26e65f 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -2383,13 +2383,16 @@ void ClientEnvironment::step(float dtime) g_profiler->avg("CEnv: num of simple objects", m_simple_objects.size()); for(std::vector<ClientSimpleObject*>::iterator i = m_simple_objects.begin(); i != m_simple_objects.end();) { - ClientSimpleObject *simple = *i; std::vector<ClientSimpleObject*>::iterator cur = i; - ++i; + ClientSimpleObject *simple = *cur; + simple->step(dtime); - if(simple->m_to_be_removed){ + if(simple->m_to_be_removed) { delete simple; - m_simple_objects.erase(cur); + i = m_simple_objects.erase(cur); + } + else { + ++i; } } } |