diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-03-01 21:17:43 +0100 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-03-01 21:17:48 +0100 |
commit | fab1401922290364fcd260d7390701b46aa3eb75 (patch) | |
tree | 364e101760671e44246729a660e48df5ffb5532f /server.js | |
parent | ba9f82e2344bbbda2d5aa5d81b41a9b52624a4c3 (diff) | |
download | server-fab1401922290364fcd260d7390701b46aa3eb75.tar.gz |
Separate ready and full status for display in game lists.
Diffstat (limited to 'server.js')
-rw-r--r-- | server.js | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1054,11 +1054,15 @@ function get_game_roles(title_id, scenario, options) { return roles } +function is_game_full(title_id, scenario, options, players) { + return get_game_roles(title_id, scenario, options).length === players.length +} + function is_game_ready(title_id, scenario, options, players) { for (let p of players) if (p.is_invite) return false - return get_game_roles(title_id, scenario, options).length === players.length + return is_game_full(title_id, scenario, options, players) } load_rules() @@ -1209,6 +1213,7 @@ function annotate_game(game, user_id, unread) { players[i].index = roles.indexOf(players[i].role) players.sort((a, b) => a.index - b.index) + game.is_full = is_game_full(game.title_id, game.scenario, options, players) game.is_ready = is_game_ready(game.title_id, game.scenario, options, players) game.is_unread = set_has(unread, game.game_id) |