remove silly size param from read_ctx because Decoder doesn't require it anymore

This commit is contained in:
mykola2312 2023-09-08 19:54:41 +03:00
parent 1fdcad3548
commit 74f70c5171
3 changed files with 4 additions and 8 deletions

View file

@ -105,7 +105,7 @@ impl DecoderCtx<EntityEncoding, EntityEncoding> for EntityList {
first = false;
}
let ent: Entity = rd.read_ctx(0, &mut ent_list)?;
let ent: Entity = rd.read_ctx(&mut ent_list)?;
ent_list.ents.push(ent);
}
@ -123,7 +123,7 @@ impl DecoderCtx<EntityEncoding, EntityEncoding> for EntityList {
let ent_count = rd.read_u16()?;
ent_list.unk1 = rd.read_u32()?;
for _ in 1..ent_count {
let ent: Entity = rd.read_ctx(0, &mut ent_list)?;
let ent: Entity = rd.read_ctx(&mut ent_list)?;
ent_list.ents.push(ent);
}

View file

@ -58,11 +58,7 @@ impl<'a> ReadStream<'a> {
// read_opt - decode with optional paramters. required for complex structure
// with different origins (save / entfile) like entities
pub fn read_ctx<T: DecoderCtx<DCtx, ECtx>, DCtx, ECtx>(
&mut self,
size: usize,
ctx: DCtx,
) -> Result<T> {
pub fn read_ctx<T: DecoderCtx<DCtx, ECtx>, DCtx, ECtx>(&mut self, ctx: DCtx) -> Result<T> {
Ok(T::decode(self, ctx)?)
}

View file

@ -85,7 +85,7 @@ impl DecoderCtx<WorldOffsetSize, ()> for World {
let sgd: SGD = rd.read()?;
let ssg: SSG = rd.read()?;
let entlist: EntityList = rd.read_ctx(0, EntityEncoding::World)?;
let entlist: EntityList = rd.read_ctx(EntityEncoding::World)?;
let unparsed = rd.read_bytes(data.len() - rd.offset())?;