File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -1600,6 +1600,7 @@ impl TryClone for ItemProperty {
1600
1600
1601
1601
struct Association {
1602
1602
item_id : u32 ,
1603
+ essential : bool ,
1603
1604
property_index : u16 ,
1604
1605
}
1605
1606
@@ -1622,16 +1623,14 @@ fn read_ipma<T: Read>(src: &mut BMFFBox<T>) -> Result<TryVec<Association>> {
1622
1623
} ;
1623
1624
let association_count = src. read_u8 ( ) ?;
1624
1625
for _ in 0 ..association_count {
1625
- let first_byte = src. read_u8 ( ) ?;
1626
- let essential_flag = first_byte & 1 << 7 ;
1627
- let value = first_byte - essential_flag;
1628
- let property_index = if flags & 1 != 0 {
1629
- ( ( value as u16 ) << 8 ) | src. read_u8 ( ) ? as u16
1630
- } else {
1631
- value as u16
1632
- } ;
1626
+ let num_association_bytes = if flags & 1 == 1 { 2 } else { 1 } ;
1627
+ let association = src. take ( num_association_bytes) . read_into_try_vec ( ) ?;
1628
+ let mut association = BitReader :: new ( association. as_slice ( ) ) ;
1629
+ let essential = association. read_bool ( ) ?;
1630
+ let property_index = association. read_u16 ( association. remaining ( ) . try_into ( ) ?) ?;
1633
1631
associations. push ( Association {
1634
1632
item_id,
1633
+ essential,
1635
1634
property_index,
1636
1635
} ) ?;
1637
1636
}
You can’t perform that action at this time.
0 commit comments