From acbff37fc9a8f188b6dc956804f2985ca43ce75b Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Wed, 6 May 2020 00:07:14 -0400 Subject: [PATCH] Euchre::Dealer: Add table_id to broadcast_gamestate Previously, this was game.id, but Games don't have the Table name any more (why should they)? Clients may still want to know which Table they are at though --- API.md | 1 + lib/Euchre/Dealer.pm | 1 + public/debug.html | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/API.md b/API.md index 70e3d86..2329e0e 100644 --- a/API.md +++ b/API.md @@ -181,6 +181,7 @@ The response looks like this: } "hand": [ "TH", "JD", "KD", ... ], "is_spectator": 0, + "table_id": "The Cool Kids Table", } ``` diff --git a/lib/Euchre/Dealer.pm b/lib/Euchre/Dealer.pm index 55d3e1b..b33f083 100644 --- a/lib/Euchre/Dealer.pm +++ b/lib/Euchre/Dealer.pm @@ -200,6 +200,7 @@ sub broadcast_gamestate { msg_type => 'game_state', game => $msg, is_spectator => $p->is_spectator ? 1 : 0, + table_id => $self->id, }; if (!$p->is_spectator) { diff --git a/public/debug.html b/public/debug.html index 483a2da..e178f33 100644 --- a/public/debug.html +++ b/public/debug.html @@ -22,7 +22,7 @@ if (msg.msg_type === 'game_state') { GAME_PHASE = msg.game.phase; - gameState = '
Game: ' + msg.game.id + '
' + + gameState = '
Game: ' + msg.table_id + '
' + 'Players: ' + msg.game.players + '
' + 'Spectators: ' + msg.game.spectators + '
' + 'Game Phase: ' + msg.game.phase + '
' + -- libgit2 1.1.1