diff options
author | Simponic <elizabeth.hunt@simponic.xyz> | 2023-01-27 16:04:34 -0700 |
---|---|---|
committer | Simponic <elizabeth.hunt@simponic.xyz> | 2023-01-27 16:04:34 -0700 |
commit | 7a574f73f9f06d95c4f5d256d55c155cf5923356 (patch) | |
tree | 902a1646b80294ffe3ec6007176c0a79a7881363 /lib/chessh/ssh/client | |
parent | 5220ac5823de6dfb7ddc5112e5a247d70c89d715 (diff) | |
download | chessh-7a574f73f9f06d95c4f5d256d55c155cf5923356.tar.gz chessh-7a574f73f9f06d95c4f5d256d55c155cf5923356.zip |
Don't allow promotion unless player is same color
Diffstat (limited to 'lib/chessh/ssh/client')
-rw-r--r-- | lib/chessh/ssh/client/game/game.ex | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/chessh/ssh/client/game/game.ex b/lib/chessh/ssh/client/game/game.ex index 6d107e6..e863ed9 100644 --- a/lib/chessh/ssh/client/game/game.ex +++ b/lib/chessh/ssh/client/game/game.ex @@ -185,7 +185,8 @@ defmodule Chessh.SSH.Client.Game do cursor: %{x: cursor_x, y: cursor_y} = cursor, client_pid: client_pid, flipped: flipped, - binbo_pid: binbo_pid + binbo_pid: binbo_pid, + color: color } = state ) do new_cursor = @@ -237,12 +238,12 @@ defmodule Chessh.SSH.Client.Game do 1 -> # Light pawn {y, _} = maybe_flipped_to - y == 0 + y == 0 && color == :light 17 -> # Dark pawn {y, _} = maybe_flipped_to - y == Renderer.chess_board_height() - 1 + y == Renderer.chess_board_height() - 1 && color == :dark _ -> false |