client removes Shot objects when they expire
This commit is contained in:
parent
1ceacd913d
commit
f0b1b91a9f
@ -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
|
// For now, we are going to do a very crude shove data into
|
||||||
// packet from keyboard and mouse events.
|
// packet from keyboard and mouse events.
|
||||||
// TODO: Clean this up and make it more robust
|
// TODO: Clean this up and make it more robust
|
||||||
|
@ -75,6 +75,7 @@ class Client
|
|||||||
float m_drawing_shot_distance;
|
float m_drawing_shot_distance;
|
||||||
bool m_shot_fired;
|
bool m_shot_fired;
|
||||||
std::list< refptr<Shot> > m_shots;
|
std::list< refptr<Shot> > m_shots;
|
||||||
|
typedef std::list< refptr<Shot> >::iterator m_shots_iterator_t;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user