Fix extent checking direction in move validation.
This commit is contained in:
parent
20b2c03c0d
commit
d0bad35995
@ -578,18 +578,11 @@ impl Game {
|
||||
|
||||
pub fn get_drops(&self, piece:&Piece) -> Vec<Play>
|
||||
{
|
||||
let mut piece = piece.clone();
|
||||
let mut moves = Vec::new();
|
||||
|
||||
for tile_id in 0..self.board.tiles.len() {
|
||||
let tile = &self.board.tiles[tile_id];
|
||||
|
||||
if tile.piece.is_none() {
|
||||
piece.tile = tile_id as u8;
|
||||
|
||||
if self.can_drop(&piece, tile_id as u8, flags::NONE) {
|
||||
moves.push(Play::from_drop(piece.class, tile_id as u8));
|
||||
}
|
||||
if self.can_drop(&piece, tile_id as u8, flags::NONE) {
|
||||
moves.push(Play::from_drop(piece.class, tile_id as u8));
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,9 +654,9 @@ impl Game {
|
||||
*/
|
||||
if (flags & flags::IGNORE_EXTENT as u32) == 0 {
|
||||
valid = valid && if piece.player == 0 {
|
||||
hex.y > self.board.columns[hex.x as usize].extent[1] as i8
|
||||
hex.y < self.board.columns[hex.x as usize].extent[1] as i8
|
||||
} else {
|
||||
hex.y < self.board.columns[hex.x as usize].extent[0] as i8
|
||||
hex.y > self.board.columns[hex.x as usize].extent[0] as i8
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user