diff --git a/src/client/Client.cc b/src/client/Client.cc index 1599f71..b53f7b3 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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 diff --git a/src/client/Client.h b/src/client/Client.h index 4c37d2f..a4cd811 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -75,6 +75,7 @@ class Client float m_drawing_shot_distance; bool m_shot_fired; std::list< refptr > m_shots; + typedef std::list< refptr >::iterator m_shots_iterator_t; }; #endif