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 f6b2520b5105f2613ccf3ffccc608c4e37776a88 (patch)
parent 2b80d6ae4bff46c11c2d2656e811d53b072fdd60
Author: Alex Karle <alex@karle.co>
Date:   Sun, 31 May 2020 23:24:57 -0400

Euchre::Host/Dealer: Add 'settings' object to Dealer

This can be provided at table creation time and will be passed to the
players as part of the broadcast gamestate.

It will be on the client to obey the settings, for now, so the server
will just accept whatever hash-ref the client gives.

Diffstat:
Mlib/Euchre/Dealer.pm | 2++
Mlib/Euchre/Host.pm | 2++
2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm @@ -13,6 +13,7 @@ use Class::Tiny qw(id), { password => '', game => sub { Euchre::Game->new() }, players => sub { {} }, + settings => sub { {} }, start_time => sub { time }, }; @@ -220,6 +221,7 @@ sub broadcast_gamestate { game => $msg, is_spectator => $p->is_spectator ? 1 : 0, table_id => $self->id, + settings => $self->settings, }; if (!$p->is_spectator) { diff --git a/lib/Euchre/Host.pm b/lib/Euchre/Host.pm @@ -117,6 +117,7 @@ sub pong { # player_name # table # password (opt) +# settings (hash-ref, opt) sub join_table { my ($p, $msg) = @_; @@ -139,6 +140,7 @@ sub join_table { if (!exists $DEALERS{$tid}) { $DEALERS{$tid} = Euchre::Dealer->new( id => $tid, + (exists $msg->{settings} ? (settings => $msg->{settings}) : ()), (exists $msg->{password} ? (password => $msg->{password}) : ()), ); $TOTAL_TABLES++;