Fix flipped from and to checks.
This commit is contained in:
parent
2d195a7f79
commit
a883474609
@ -72,9 +72,9 @@ impl Game {
|
|||||||
target.tile = play.from;
|
target.tile = play.from;
|
||||||
|
|
||||||
// Check for target promotion.
|
// Check for target promotion.
|
||||||
let hex = Hex::from_tile(play.to);
|
let hex = Hex::from_tile(play.from);
|
||||||
if !target.promoted && Hex::is_back(hex.x, hex.y, target.player) {
|
if !target.promoted && Hex::is_back(hex.x, hex.y, target.player) {
|
||||||
println!("promotion {} {} ({}, {})", target.class, play.to, hex.x, hex.y);
|
println!("promotion {} {} ({}, {})", target.class, play.from, hex.x, hex.y);
|
||||||
target.promoted = true;
|
target.promoted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,7 +101,7 @@ impl Game {
|
|||||||
self.board.pieces[pid as usize] = Some(piece);
|
self.board.pieces[pid as usize] = Some(piece);
|
||||||
|
|
||||||
// Check for piece promotion.
|
// Check for piece promotion.
|
||||||
let hex = Hex::from_tile(play.from);
|
let hex = Hex::from_tile(play.to);
|
||||||
if !piece.promoted && Hex::is_back(hex.x, hex.y, piece.player) {
|
if !piece.promoted && Hex::is_back(hex.x, hex.y, piece.player) {
|
||||||
println!("promotion {} {} ({}, {})", piece.class, play.to, hex.x, hex.y);
|
println!("promotion {} {} ({}, {})", piece.class, play.to, hex.x, hex.y);
|
||||||
if let Some(piece) = &mut self.board.pieces[pid as usize] {
|
if let Some(piece) = &mut self.board.pieces[pid as usize] {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user