Fix entities not correctly being removed on switching servers

This commit is contained in:
Thinkofname 2016-04-08 21:36:20 +01:00
parent 1f91a10678
commit 0e23e1d86f
1 changed files with 5 additions and 1 deletions

View File

@ -258,10 +258,14 @@ impl Manager {
/// Deallocates all entities/components excluding the world entity
pub fn remove_all_entities(&mut self, world: &mut world::World, renderer: &mut render::Renderer) {
for e in &mut self.entities[1..] {
for (id, e) in self.entities[1..].iter_mut().enumerate() {
if let Some(set) = e.0.as_mut() {
set.components = BSet::new(self.components.len());
set.removed = true;
self.changed_entity_components.insert(Entity{
id: id + 1,
generation: e.1,
});
}
}
self.process_entity_changes(world, renderer);