diff --git a/src/fot/entitylist.rs b/src/fot/entitylist.rs index a5bfbaf..7e86058 100644 --- a/src/fot/entitylist.rs +++ b/src/fot/entitylist.rs @@ -26,8 +26,8 @@ pub struct EntityList { unk1: u32, enc_size: usize, - pub types: Vec, - pub ents: Vec, + types: Vec, + ents: Vec, } impl EntityList { @@ -161,10 +161,10 @@ impl DecoderCtx for EntityList { } impl<'a> IntoIterator for &'a EntityList { - type Item = &'a Entity; - type IntoIter = std::slice::Iter<'a, Entity>; + type Item = (usize, &'a Entity); + type IntoIter = std::iter::Zip, std::slice::Iter<'a, Entity>>; fn into_iter(self) -> Self::IntoIter { - self.ents.iter() + (1..).zip(&self.ents) } } \ No newline at end of file diff --git a/src/fot/world.rs b/src/fot/world.rs index 98aa7d0..1f56e4f 100644 --- a/src/fot/world.rs +++ b/src/fot/world.rs @@ -37,8 +37,8 @@ impl World { self.entlist .encode(EntityEncoding::File)? .dump(Path::new("D:\\entlist.ent"))?;*/ - for ent in &self.entlist { - println!("{}", ent.type_idx); + for (id, ent) in &self.entlist { + println!("{} {}", id, ent.type_idx); } Ok(())