Handle TileTake messages
This commit is contained in:
@@ -19,6 +19,10 @@ impl Board {
|
||||
self.tiles[y * self.width + x] = Some(tile);
|
||||
}
|
||||
|
||||
pub fn take(&mut self, x: usize, y: usize) -> Option<Tile> {
|
||||
self.tiles[y * self.width + x].take()
|
||||
}
|
||||
|
||||
/// Gets the difference between this board and another.
|
||||
pub fn difference(&self, other: &Board) -> Vec<Position2d> {
|
||||
let mut diff = Vec::new();
|
||||
|
@@ -49,6 +49,10 @@ impl Hand {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn push(&mut self, tile: Tile) {
|
||||
self.tiles.push(tile);
|
||||
}
|
||||
|
||||
pub fn remove(&mut self, idx: usize) -> Option<Tile> {
|
||||
if idx < self.tiles.len() {
|
||||
Some(self.tiles.remove(idx))
|
||||
|
Reference in New Issue
Block a user