Fix back tile checking for x=0.
This commit is contained in:
parent
08562d9a3e
commit
e5377cd64a
@ -337,12 +337,9 @@ impl Game {
|
|||||||
|
|
||||||
2 => {
|
2 => {
|
||||||
if let Some(piece_id) = self.board.tiles[play.from as usize].piece {
|
if let Some(piece_id) = self.board.tiles[play.from as usize].piece {
|
||||||
println!("A");
|
|
||||||
if let Some(piece) = &self.board.pieces[piece_id as usize] {
|
if let Some(piece) = &self.board.pieces[piece_id as usize] {
|
||||||
println!("B");
|
|
||||||
if piece.player == player {
|
if piece.player == player {
|
||||||
let plays = self.get_alts(piece);
|
let plays = self.get_alts(piece);
|
||||||
println!("plays {}", plays.len());
|
|
||||||
for p in plays {
|
for p in plays {
|
||||||
if p.to == play.to {
|
if p.to == play.to {
|
||||||
valid = true;
|
valid = true;
|
||||||
@ -591,9 +588,7 @@ impl Game {
|
|||||||
/*
|
/*
|
||||||
** Filter valid tiles from allowed.
|
** Filter valid tiles from allowed.
|
||||||
*/
|
*/
|
||||||
println!("C2 {} {} {}", piece.class, piece.promoted, piece_moves.alt.is_some());
|
|
||||||
if let Some(alt_mode) = piece_moves.alt {
|
if let Some(alt_mode) = piece_moves.alt {
|
||||||
println!("C3 {}", alt_mode);
|
|
||||||
match alt_mode {
|
match alt_mode {
|
||||||
// Knight
|
// Knight
|
||||||
1 => {
|
1 => {
|
||||||
@ -616,9 +611,6 @@ impl Game {
|
|||||||
let piece_hex = Hex::from_tile(piece.tile);
|
let piece_hex = Hex::from_tile(piece.tile);
|
||||||
let tile_hex = Hex::from_tile(tile_id);
|
let tile_hex = Hex::from_tile(tile_id);
|
||||||
|
|
||||||
println!("piece_hex {} {} {}", piece_hex.x, piece_hex.y, piece_hex.y);
|
|
||||||
println!("tile_hex {} {} {}", tile_hex.x, tile_hex.y, tile_hex.y);
|
|
||||||
|
|
||||||
let in_rear_cone = if piece.player == 0 {
|
let in_rear_cone = if piece.player == 0 {
|
||||||
if tile_hex.x >= piece_hex.x {
|
if tile_hex.x >= piece_hex.x {
|
||||||
tile_hex.y <= piece_hex.y
|
tile_hex.y <= piece_hex.y
|
||||||
@ -654,7 +646,6 @@ impl Game {
|
|||||||
|
|
||||||
pub fn get_alts(&self, piece:&Piece) -> Vec<Play>
|
pub fn get_alts(&self, piece:&Piece) -> Vec<Play>
|
||||||
{
|
{
|
||||||
println!("C1");
|
|
||||||
self.get_alts_data(piece).iter().map(|info| info.play).collect()
|
self.get_alts_data(piece).iter().map(|info| info.play).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ impl Hex {
|
|||||||
[3, 8],
|
[3, 8],
|
||||||
[4, 8],
|
[4, 8],
|
||||||
];
|
];
|
||||||
if x > 0 && x < 9 {
|
if x >= 0 && x < 9 {
|
||||||
y == COLUMNS[x as usize][1 ^ player as usize]
|
y == COLUMNS[x as usize][1 ^ player as usize]
|
||||||
} else { false }
|
} else { false }
|
||||||
}
|
}
|
||||||
|
@ -1084,6 +1084,8 @@ fn generate_game_state(app:&App, session:&Session) -> protocol::PacketGameStateR
|
|||||||
|
|
||||||
async fn change_context(app:&mut App, conn_id:u32, user_id:Option<u32>, context:Context)
|
async fn change_context(app:&mut App, conn_id:u32, user_id:Option<u32>, context:Context)
|
||||||
{
|
{
|
||||||
|
println!("Context Change: {}", conn_id, );
|
||||||
|
|
||||||
// Clear existing context
|
// Clear existing context
|
||||||
if let Some(conn) = app.connections.get(conn_id as usize).cloned() {
|
if let Some(conn) = app.connections.get(conn_id as usize).cloned() {
|
||||||
match conn.context {
|
match conn.context {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user