euchre-live

Euchre web-app for the socially distant family
git clone git://git.alexkarle.com/euchre-live.git
Log | Files | Refs | README | LICENSE

commit 6d5e9081e6cfca3b1b11db00738296fea96688e3 (patch)
parent 657f2a815616006414e602a90290c74f30031ab4
Author: Alex Karle <alex@karle.co>
Date:   Fri,  3 Apr 2020 23:34:35 -0400

Euchre::Dealer: Add smarter stand/sit logic

You can now swap seats without standing up first :) This also prevents
someone sitting in two places, which is nice

Diffstat:
Mlib/Euchre/Dealer.pm | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm @@ -162,7 +162,8 @@ sub take_seat { if (defined $game->{players}->[$seat]) { send_error($p, 'Seat is taken'); } else { - # Move from standing to sitting + # Move from standing (or sitting) to sitting + stand_up($p) if defined $p->{seat}; $game->{players}->[$seat] = $p; $p->{seat} = $seat; for (my $i = 0; $i < @{$game->{spectators}}; $i++) { @@ -185,6 +186,7 @@ sub stand_up { } else { # Move from sitting to standing push @{$game->{spectators}}, $p; + delete $p->{seat}; $game->{players}->[$seat] = undef; broadcast_gamestate($game); }