minor styles

This commit is contained in:
Edward Shen 2020-03-22 22:44:27 -04:00
parent 2aa1602dc1
commit 7fab1b2cce
Signed by: edward
GPG key ID: 19182661E818369F
2 changed files with 4 additions and 8 deletions

View file

@ -136,8 +136,7 @@ impl Game {
// It's possible that the player moved the piece in the meantime. // It's possible that the player moved the piece in the meantime.
if !self.playfield.can_active_piece_move_down() { if !self.playfield.can_active_piece_move_down() {
let positions = self.playfield.lock_active_piece(); let positions = self.playfield.lock_active_piece();
self.is_game_over = self.is_game_over = self.is_game_over || positions.iter().map(|p| p.y).all(|y| y < 20);
self.is_game_over || positions.iter().all(|Position { x: _, y }| *y < 20);
if self.clear_lines() > 0 { if self.clear_lines() > 0 {
self.playfield.active_piece = None; self.playfield.active_piece = None;
@ -227,9 +226,6 @@ impl Controllable for Game {
} }
fn hold(&mut self) { fn hold(&mut self) {
match self.playfield.try_swap_hold() { let _ = self.playfield.try_swap_hold();
Ok(_) => {}
Err(_) => (),
}
} }
} }

View file

@ -1,5 +1,5 @@
use crate::playfield::{Matrix, PlayField}; use crate::playfield::PlayField;
use crate::tetromino::{Position, RotationState, Tetromino, TetrominoType}; use crate::tetromino::{Position, RotationState, TetrominoType};
use std::collections::HashMap; use std::collections::HashMap;
pub trait RotationSystem { pub trait RotationSystem {