fix: correct binary arithmetic that was zeroing out x coordinates in forestry ops

This commit is contained in:
Nat 2024-12-13 11:03:22 -08:00
parent ff6e95a33b
commit 621166e8c6
1 changed files with 5 additions and 4 deletions

View File

@ -89,11 +89,12 @@ fn parse_forestry_op(tokens: &Vec<&str>, opcode: u16) -> Result<u16, String> {
Err(format!("Cannot reach cell at {relative_y} along the Y-axis; trees may only access cells in the range of -16 to 15"))
} else {
Ok(
opcode<<11
| stack<<10
| ((relative_x as u16)<<5) & 0b11111
| (relative_y as u16) & 0b11111
(opcode<<11)
| (stack<<10)
| (((relative_x as u16) & 0b11111)<<5)
| ((relative_y as u16) & 0b11111)
)
}
}