From a8834746094e9a54f758d94ac142056463b981e8 Mon Sep 17 00:00:00 2001 From: yukirij Date: Sun, 18 Aug 2024 18:38:55 -0700 Subject: [PATCH] Fix flipped from and to checks. --- game/src/game/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game/src/game/mod.rs b/game/src/game/mod.rs index 22c4adb..3ac163f 100644 --- a/game/src/game/mod.rs +++ b/game/src/game/mod.rs @@ -72,9 +72,9 @@ impl Game { target.tile = play.from; // 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) { - println!("promotion {} {} ({}, {})", target.class, play.to, hex.x, hex.y); + println!("promotion {} {} ({}, {})", target.class, play.from, hex.x, hex.y); target.promoted = true; } } @@ -101,7 +101,7 @@ impl Game { self.board.pieces[pid as usize] = Some(piece); // 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) { println!("promotion {} {} ({}, {})", piece.class, play.to, hex.x, hex.y); if let Some(piece) = &mut self.board.pieces[pid as usize] {