client removes Shot objects when they expire

This commit is contained in:
Josh Holtrop 2012-10-06 21:28:15 -04:00
parent 1ceacd913d
commit f0b1b91a9f
2 changed files with 10 additions and 0 deletions

View File

@ -291,6 +291,15 @@ void Client::update(double elapsed_time)
}
}
for (m_shots_iterator_t it = m_shots.begin(); it != m_shots.end(); )
{
sf::Vector3f shot_position = (*it)->get_position();
if (shot_position.z <= 0.0)
it = m_shots.erase(it);
else
it++;
}
// For now, we are going to do a very crude shove data into
// packet from keyboard and mouse events.
// TODO: Clean this up and make it more robust

View File

@ -75,6 +75,7 @@ class Client
float m_drawing_shot_distance;
bool m_shot_fired;
std::list< refptr<Shot> > m_shots;
typedef std::list< refptr<Shot> >::iterator m_shots_iterator_t;
};
#endif