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 b318bc82788a58362b39779c003e0e9083e6f901 (patch)
parent f99bf33f7a23824ae17a2453732648380ff594ec
Author: Alex Karle <alex@karle.co>
Date:   Mon, 20 Apr 2020 22:24:15 -0400

Euchre::Dealer: Fix loner reset_turn bug

If in the second round of calling trump (i.e. no dealer_swap), we need
to do the loner calculation before we reset_turn (otherwise the
out_player could be the first person the play!).

Kudos to ~wee for finding.

Diffstat:
Mlib/Euchre/Dealer.pm | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm @@ -331,6 +331,11 @@ sub order { # Accept the vote... $game->{trump} = $msg->{vote}; $game->{caller} = $p->{seat}; + if ($msg->{loner}) { + my $partner_seat = ($p->{seat} + 2) % 4; + $game->{out_player} = $partner_seat; + $game->{tricks}->[$partner_seat] = 'X'; + } if ($game->{pass_count} < 4) { # Setting phase will block all other play actions until the # dealer is done swapping. Do still broadcast so dealer knows! @@ -344,11 +349,6 @@ sub order { reset_turn($game); } - if ($msg->{loner}) { - my $partner_seat = ($p->{seat} + 2) % 4; - $game->{out_player} = $partner_seat; - $game->{tricks}->[$partner_seat] = 'X'; - } sort_hands($game); broadcast_gamestate($game); } else {