impl mutable IntoIter for EntityList

This commit is contained in:
mykola2312 2023-09-09 16:19:39 +03:00
parent 5709e81df0
commit b8d48483f1
2 changed files with 13 additions and 0 deletions

View file

@ -178,3 +178,12 @@ impl<'a> IntoIterator for &'a EntityList {
(1..).zip(&self.ents)
}
}
impl<'a> IntoIterator for &'a mut EntityList {
type Item = (usize, &'a mut Entity);
type IntoIter = std::iter::Zip<std::ops::RangeFrom<usize>, std::slice::IterMut<'a, Entity>>;
fn into_iter(self) -> Self::IntoIter {
(1..).zip(&mut self.ents)
}
}

View file

@ -32,6 +32,10 @@ impl World {
pub fn test(&mut self) -> Result<(), FE> {
//let actor_type = self.entlist.get_type_idx("Actor").unwrap();
//let ent = self.entlist.get_entity_mut(2122);
for (id, ent) in &mut self.entlist {
ent.flags = 1;
}
let ent = self.entlist.get_entity_mut(2158);
let esh = ent.get_esh()?;
for (name, value) in &esh.props {