commit b48f17b024e0dd4c4363c2a2329a7271a129dd79 (patch)
parent f0950f856035500bc3cdb2a8cf909fa35cd0e8fd
Author: Alex Karle <alex@karle.co>
Date: Tue, 5 May 2020 23:40:27 -0400
Euchre::Dealer: Tweak broadcasted gamestate
I noticed that is_spectator is perly ("") for false. Make sure it's
either 0 or 1 explicitly.
Also, don't 'redact' the hands, just delete them.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm
@@ -188,18 +188,18 @@ sub broadcast_gamestate {
my $msg = {
%{$self->game},
- hands => 'redacted',
players => $self->player_names,
spectators => \@snames,
hand_lengths => $self->game->hand_lengths,
};
+ delete $msg->{hands};
for my $p (values %{$self->players}) {
my $json = {
msg_type => 'game_state',
game => $msg,
- is_spectator => $p->is_spectator,
+ is_spectator => $p->is_spectator ? 1 : 0,
};
if (!$p->is_spectator) {