From 5022c840de75aca19cce06b9b049e49750213825 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 28 Feb 2025 22:26:37 -0800 Subject: [PATCH] Minor cleanup --- tetros/src/tetrisboard/draw.rs | 2 -- tetros/src/tetrisboard/mod.rs | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tetros/src/tetrisboard/draw.rs b/tetros/src/tetrisboard/draw.rs index ea71214..3d3c553 100644 --- a/tetros/src/tetrisboard/draw.rs +++ b/tetros/src/tetrisboard/draw.rs @@ -36,8 +36,6 @@ impl TetrisBoard { if let Some(falling) = falling { for (x, y) in falling.tiles() { - let x = x as usize; - let y = y as usize; let cell = TetrisCell::Blue; let dx = (x + 1) * TetrisBoard::CELL_SIZE; let dy = (y + 1) * TetrisBoard::CELL_SIZE; diff --git a/tetros/src/tetrisboard/mod.rs b/tetros/src/tetrisboard/mod.rs index 761cc8d..41d2f7e 100644 --- a/tetros/src/tetrisboard/mod.rs +++ b/tetros/src/tetrisboard/mod.rs @@ -22,7 +22,7 @@ impl TetrisBoard { pub fn place_tetromino(&mut self, tetromino: FallingTetromino) { for (x, y) in tetromino.tiles() { - let cell = self.get_cell_mut(x as usize, y as usize); + let cell = self.get_cell_mut(x, y); if let Some(cell) = cell { *cell = TetrisCell::Blue; } @@ -31,7 +31,7 @@ impl TetrisBoard { pub fn tetromino_free_below(&self, tetromino: &FallingTetromino) -> bool { for (x, y) in tetromino.tiles() { - let cell = self.get_cell(x as usize, y as usize + 1); + let cell = self.get_cell(x, y + 1); if cell != Some(&TetrisCell::Empty) { return false; }