minor styles
This commit is contained in:
parent
2aa1602dc1
commit
7fab1b2cce
2 changed files with 4 additions and 8 deletions
|
@ -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(_) => (),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
Loading…
Reference in a new issue