cleanup
This commit is contained in:
parent
6a11320b27
commit
353f5b74e5
3 changed files with 39 additions and 26 deletions
|
@ -117,7 +117,31 @@ impl Board {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn grow_to_include(&mut self, p: Pos) -> (PosInt,PosInt) {
|
||||
pub fn paste_board(&mut self, pos: Pos, source: &Board) {
|
||||
for x in 0..source.width() {
|
||||
for y in 0..source.height() {
|
||||
let offset = (x, y).into();
|
||||
if let Some(tile) = source.get(offset) {
|
||||
self.set(offset + pos, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_rect(&self, pos: Pos, width: usize, height: usize) -> Board {
|
||||
let mut out = Board::new_empty(width, height);
|
||||
for x in 0..width {
|
||||
for y in 0..height {
|
||||
let offset = (x, y).into();
|
||||
if let Some(tile) = self.get(offset + pos) {
|
||||
out.set(offset, tile);
|
||||
}
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
pub fn grow_to_include(&mut self, p: Pos) -> (PosInt, PosInt) {
|
||||
let mut offset_x = 0;
|
||||
let mut offset_y = 0;
|
||||
if p.x < 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue