From f8ddd6f9391c6c2729393b71d73d708c5a17ca4d Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Fri, 27 Aug 2021 00:40:33 -0400 Subject: [PATCH] Only skip flags in XCLC if they exist I guess older esp files don't have flags in the struct, which wasn't mentioned by the UESP mod file format page. --- src/parser.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/parser.rs b/src/parser.rs index ae199fb..860bf46 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -487,8 +487,13 @@ fn parse_cell_fields<'a>(input: &'a [u8]) -> IResult<&'a [u8], CellData> { let (remaining, y) = le_i32(remaining)?; cell_data.x = Some(x); cell_data.y = Some(y); - let (remaining, _) = take(4usize)(remaining)?; - input = remaining; + if field.size == 12 { + // older (v. 0.94) files don't have the flags in this struct + let (remaining, _) = take(4usize)(remaining)?; + input = remaining; + } else { + input = remaining; + } } "XXXX" => { let (remaining, size) = le_u32(input)?;