chore: remove dead & unused code
This commit is contained in:
parent
0626085cbe
commit
06e8e5d293
|
@ -66,7 +66,7 @@ fn parse_rom(path: &String) -> io::Result<(state::Land, Vec<state::Rule>, HashMa
|
|||
let x_pos = rom_words.pop_front().unwrap();
|
||||
let y_pos = rom_words.pop_front().unwrap();
|
||||
|
||||
land.sow(x_pos, y_pos, value);
|
||||
land.map.insert((x_pos % land.width, y_pos % land.height), value);
|
||||
}
|
||||
|
||||
println!("World\n=====");
|
||||
|
@ -192,9 +192,9 @@ fn main() -> io::Result<()> {
|
|||
|
||||
for tree_index in trees_to_compost_by_index.iter() {
|
||||
let tree_id = scheduled_trees.swap_remove(*tree_index as usize);
|
||||
let (parent_id, tree_id, recovered_stack_size) = {
|
||||
let (parent_id, recovered_stack_size) = {
|
||||
let tree = trees.remove(&tree_id).unwrap();
|
||||
(tree.parent_id, tree.id, tree.stack_size)
|
||||
(tree.parent_id, tree.stack_size)
|
||||
};
|
||||
let parent = trees.get_mut(&parent_id).unwrap();
|
||||
parent.stack_size += recovered_stack_size;
|
||||
|
|
15
src/state.rs
15
src/state.rs
|
@ -11,11 +11,6 @@ pub struct Land {
|
|||
}
|
||||
|
||||
impl Land {
|
||||
#[deprecated(since="0.0.0", note="please use `derelativize` instead")]
|
||||
pub fn wrap_absolute_coordinates(&self, x: u16, y: u16) -> (u16, u16) {
|
||||
(x % self.width, y % self.height)
|
||||
}
|
||||
|
||||
pub fn derelativize(&self, position: (u16, u16), relative_x: i16, relative_y: i16) -> (u16, u16) {
|
||||
// Note: we don't need to worry about integer overflows directly
|
||||
// because land itself cannot exceed integer limits in size and
|
||||
|
@ -39,16 +34,6 @@ impl Land {
|
|||
|
||||
return (absolute_x, absolute_y);
|
||||
}
|
||||
|
||||
pub fn sow(&mut self, x: u16, y: u16, value: u16) {
|
||||
// We use modulo arithmetic here to account for values that wrap around
|
||||
// the world.
|
||||
self.map.insert((x % self.width, y % self.height), value);
|
||||
}
|
||||
|
||||
pub fn reap(&mut self, x: u16, y: u16) -> u16 {
|
||||
self.map.remove(&(x % self.width, y % self.height)).unwrap_or(0u16)
|
||||
}
|
||||
}
|
||||
|
||||
pub type Rule = VecDeque<u16>;
|
||||
|
|
Loading…
Reference in New Issue