diff options
author | Tor Andersson <tor@ccxvii.net> | 2022-07-24 12:28:05 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2022-07-24 13:05:31 +0200 |
commit | 09c3f5f808581821729cd1de879e22b754a72934 (patch) | |
tree | 24f8cb7320d893e80afb2c7fa9f467660a3b8d24 | |
parent | 007b4d1ce6c868bb2ea631b00839c2a4dce7906e (diff) | |
download | server-09c3f5f808581821729cd1de879e22b754a72934.tar.gz |
Sort player names by role.
-rw-r--r-- | public/style.css | 2 | ||||
-rw-r--r-- | server.js | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/public/style.css b/public/style.css index 1f6fdf6..330e8f4 100644 --- a/public/style.css +++ b/public/style.css @@ -169,7 +169,7 @@ article hr + p { font-style: italic; } .game_main img { display: block; height: 72px; - margin: 4px 0; + margin: 4px 0 4px 4px; border: 1px solid black; } @@ -1015,12 +1015,17 @@ function format_options(options) { function annotate_game(game, user_id) { let players = SQL_SELECT_PLAYERS_JOIN.all(game.game_id) let options = JSON.parse(game.options) + let roles = get_game_roles(game.title_id, game.scenario, options) if (game.options === '{}') game.human_options = "None" else game.human_options = format_options(options) + for (let i = 0; i < players.length; ++i) + players[i].index = roles.indexOf(players[i].role) + players.sort((a, b) => a.index - b.index) + game.is_ready = is_game_ready(game.title_id, game.scenario, options, players) let your_count = 0 |