Cockatrice/cockatrice/src/interface/widgets/dialogs
BruebachL 5ea16c805f
[Server/Client/Protocol] Shuffle or reorder player seats before a game starts (#7398)
* [Protocol] Add shuffle players option and player order command/event

Adds a 'Shuffle players at start' option to game creation plus a local
player id on the game state so clients can reconcile seat changes, and a
SET_PLAYER_ORDER command (1206) with a PLAYER_ORDER_CHANGED event (2023)
so the game host can set or randomize the seating order.

Took 6 minutes

* [Server] Shuffle and reorder player seats before a game starts

Auto-shuffles the seats at game start when enabled (now for games with
two or more players instead of three or more) and handles the new
SET_PLAYER_ORDER command so the game host or a moderator can reorder or
randomize the seats before the game starts. Re-seating re-keys the
player ids while keeping the per-user game/seat routing and persistent
player records in sync, then broadcasts the new order to everyone.

* [Client] Add shuffle players option and turn order dialog

Adds the 'Shuffle players at start' checkbox to game creation and a
host-only 'Set turn order...' action that opens a dialog to reorder or
randomize the seats before the game starts. Seating changes are shown in
the game's message log.

* [Client] Move the turn order dialog strings into retranslateUi

Follows the DlgInviteToGame convention so the dialog can be retranslated
instead of freezing its strings at construction time.

* [Server] Keep player ids stable across seat shuffles

* [Client] Lay out table and turn order dialog in seat order

* [Server] Send game-joined player list in seat order

* [Client] Reword the shuffle option to match its behaviour

* [Client] Address the seat-order review comments

- Give the game setup checkboxes a row of their own so they no longer
  collide in the create-game dialog
- Rename DlgTurnOrder::randomize() to isRandomizeRequested()
- Document what the ids in GameState::seatOrder mean
- Keep "Set turn order..." in sync with the game: hidden for non-hosts
  and once the game has started, re-shown when the game ends or hosting
  moves to the local player (new GameState::hostChanged signal)

* [Client] Do not preview a randomized turn order

Randomizing is a request to the server, not a local shuffle. Shuffling the
list locally meant the dialog showed an order the server then discarded, and
let the host re-open it until a favourable order appeared. The dialog now
switches to a mode that says the server will randomize and toggles back to the
manual list on request.

* [Client] Let moderators set the turn order

The server accepts SET_PLAYER_ORDER from the host or a moderator, but the
client hid the action from everyone except the host, making the moderator
branch unreachable. Visibility and the handler now share canSetTurnOrder().

* [Server] Rely on the player order event instead of a full state resend

cmdSetPlayerOrder re-sent the whole game state after reseating, so every
client reloaded its deck view mid-lobby for no reason. The new seating reaches
clients through the Event_PlayerOrderChanged that reseatPlayers broadcasts.

* [Client] Show random turn order in the game selector

The restrictions column listed "open decklists" but not the new seating
option, so a joining player had no way to see that seats will be randomized
each game. Game info already shows the disabled checkbox.

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
2026-11-04 15:44:50 +01:00
..
dlg_connect.cpp [Client] Stop sending the saved login when its checkbox is unticked (#7713) 2026-11-04 07:06:35 +01:00
dlg_connect.h [Client] Stop sending the saved login when its checkbox is unticked (#7713) 2026-11-04 07:06:35 +01:00
dlg_convert_deck_to_cod_format.cpp [Refactor] Move LoadedDeck and DeckFileFormat data types into libcockatrice_deck_list (#7424) 2026-10-31 18:44:11 +01:00
dlg_convert_deck_to_cod_format.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_crash_report.cpp [CrashReporting] Sentry send path with consent gating (#7522) 2026-10-19 14:57:03 +02:00
dlg_crash_report.h [CrashReporting] Sentry send path with consent gating (#7522) 2026-10-19 14:57:03 +02:00
dlg_create_game.cpp [Server/Client/Protocol] Shuffle or reorder player seats before a game starts (#7398) 2026-11-04 15:44:50 +01:00
dlg_create_game.h [Server/Client/Protocol] Shuffle or reorder player seats before a game starts (#7398) 2026-11-04 15:44:50 +01:00
dlg_default_tags_editor.cpp [QtUtils] Use makeLayout() for zero-margin layouts (#7620) 2026-10-24 19:06:18 +02:00
dlg_default_tags_editor.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_edit_avatar.cpp [Avatar] Respect EXIF orientation and decode at target size (#7634) 2026-10-25 00:11:09 +02:00
dlg_edit_avatar.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_edit_password.cpp [Security] Add challenge-response auth with scrypt verifiers and stop storing plaintext passwords (#7193) 2026-10-16 22:52:26 +02:00
dlg_edit_password.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_edit_tokens.cpp [Tests] Name the menus and dialogs the shell GUI tests drive (#7695) 2026-11-04 06:23:44 +01:00
dlg_edit_tokens.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_edit_user.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_edit_user.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_filter_games.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_filter_games.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_forgot_password_challenge.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_forgot_password_challenge.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_forgot_password_request.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_forgot_password_request.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_forgot_password_reset.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_forgot_password_reset.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_invite_to_game.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_invite_to_game.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_load_deck.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_load_deck.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_load_deck_from_clipboard.cpp [Tests] Play card interactions through a Cockatrice event player (#7697) 2026-11-04 06:23:45 +01:00
dlg_load_deck_from_clipboard.h [Refactor] Move LoadedDeck and DeckFileFormat data types into libcockatrice_deck_list (#7424) 2026-10-31 18:44:11 +01:00
dlg_load_deck_from_website.cpp [Client] Add option to load decks from ManaBox (#7642) 2026-11-03 10:33:21 +01:00
dlg_load_deck_from_website.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_load_remote_deck.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_load_remote_deck.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_local_game_options.cpp [Tests] Play card interactions through a Cockatrice event player (#7697) 2026-11-04 06:23:45 +01:00
dlg_local_game_options.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_login_prompt.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_login_prompt.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_manage_sets.cpp [Tests] Name the menus and dialogs the shell GUI tests drive (#7695) 2026-11-04 06:23:44 +01:00
dlg_manage_sets.h [CardDB] Drop the rebalanced-cards setting entirely (#7457) 2026-10-09 06:02:47 +02:00
dlg_my_reports.cpp [Fonts] Migrate ChatLog surfaces to theme font role (#7537) 2026-11-04 07:57:53 +01:00
dlg_my_reports.h [Fonts] Migrate ChatLog surfaces to theme font role (#7537) 2026-11-04 07:57:53 +01:00
dlg_register.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_register.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_report_user.cpp [Fonts] Migrate ChatLog surfaces to theme font role (#7537) 2026-11-04 07:57:53 +01:00
dlg_report_user.h [Fonts] Migrate ChatLog surfaces to theme font role (#7537) 2026-11-04 07:57:53 +01:00
dlg_select_set_for_cards.cpp [QtUtils] Use makeLayout() for zero-margin layouts (#7620) 2026-10-24 19:06:18 +02:00
dlg_select_set_for_cards.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_settings.cpp [Tests] Name the menus and dialogs the shell GUI tests drive (#7695) 2026-11-04 06:23:44 +01:00
dlg_settings.h [Client] Settings: enlarge the settings dialog (#7483) 2026-10-18 22:48:50 +02:00
dlg_share_deck.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_share_deck.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_shared_decks_preview.cpp [Fonts] Migrate DeckList and InterfaceDefault surfaces to theme roles (#7539) 2026-11-04 07:57:54 +01:00
dlg_shared_decks_preview.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_startup_card_check.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_startup_card_check.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_tip_of_the_day.cpp [Tests] Name the menus and dialogs the shell GUI tests drive (#7695) 2026-11-04 06:23:44 +01:00
dlg_tip_of_the_day.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_turn_order.cpp [Server/Client/Protocol] Shuffle or reorder player seats before a game starts (#7398) 2026-11-04 15:44:50 +01:00
dlg_turn_order.h [Server/Client/Protocol] Shuffle or reorder player seats before a game starts (#7398) 2026-11-04 15:44:50 +01:00
dlg_update.cpp [Tests] Name the menus and dialogs the shell GUI tests drive (#7695) 2026-11-04 06:23:44 +01:00
dlg_update.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
dlg_view_log.cpp [Tests] Name the menus and dialogs the shell GUI tests drive (#7695) 2026-11-04 06:23:44 +01:00
dlg_view_log.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
override_printing_warning.cpp [QtUtils] Adopt window fade, path, bold font and confirmation helpers (#7622) 2026-10-24 21:43:50 +02:00
override_printing_warning.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
path_safety_warning.cpp [Client] Warn when data paths point inside the program directory (#7473) 2026-10-11 15:34:49 +02:00
path_safety_warning.h [Client] Warn when data paths point inside the program directory (#7473) 2026-10-11 15:34:49 +02:00
settings_view.cpp [Fonts] Restore DeckList Serif default and live-update all role readers (#7541) 2026-11-04 07:57:55 +01:00
settings_view.h [Client] Settings: isolate the selected section when drilling down (#7488) 2026-10-18 22:48:52 +02:00
tip_of_the_day.cpp [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00
tip_of_the_day.h [Tooling] Apply include-what-you-use across the tree (#7396) 2026-10-08 11:13:50 +02:00