fix read atoms not incrementing the cursor
This commit is contained in:
@@ -197,26 +197,32 @@ pub fn exec<Binary: Scannable + ?Sized>(
|
||||
Atom::ReadU8(slot) => {
|
||||
let Some(value) = read::<_, u8>(bin, cursor) else { return None };
|
||||
if let Some(slot) = saves.get_mut(slot as usize) { *slot = value as _ }
|
||||
cursor = cursor.wrapping_add(1)
|
||||
}
|
||||
Atom::ReadI8(slot) => {
|
||||
let Some(value) = read::<_, i8>(bin, cursor) else { return None };
|
||||
if let Some(slot) = saves.get_mut(slot as usize) { *slot = value as _ }
|
||||
cursor = cursor.wrapping_add(1)
|
||||
}
|
||||
Atom::ReadU16(slot) => {
|
||||
let Some(value) = read::<_, u16>(bin, cursor) else { return None };
|
||||
if let Some(slot) = saves.get_mut(slot as usize) { *slot = value as _ }
|
||||
cursor = cursor.wrapping_add(2)
|
||||
}
|
||||
Atom::ReadI16(slot) => {
|
||||
let Some(value) = read::<_, i16>(bin, cursor) else { return None };
|
||||
if let Some(slot) = saves.get_mut(slot as usize) { *slot = value as _ }
|
||||
cursor = cursor.wrapping_add(2)
|
||||
}
|
||||
Atom::ReadU32(slot) => {
|
||||
let Some(value) = read::<_, u32>(bin, cursor) else { return None };
|
||||
if let Some(slot) = saves.get_mut(slot as usize) { *slot = value as _ }
|
||||
cursor = cursor.wrapping_add(4)
|
||||
}
|
||||
Atom::ReadI32(slot) => {
|
||||
let Some(value) = read::<_, i32>(bin, cursor) else { return None };
|
||||
if let Some(slot) = saves.get_mut(slot as usize) { *slot = value as _ }
|
||||
cursor = cursor.wrapping_add(4)
|
||||
}
|
||||
Atom::Zero(slot) => {
|
||||
if let Some(slot) = saves.get_mut(slot as usize) {
|
||||
|
||||
Reference in New Issue
Block a user