Cockatrice/libcockatrice_interfaces/libcockatrice/interfaces
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
..
interface_cache_storage_settings_provider.h [Settings] Split cache_settings monolith into multiple SettingsManager sub-classes (#7050) 2026-07-27 11:25:39 +02:00
interface_card_database_path_provider.h [Fix-Warnings] Mark const getters as [[nodiscard]] (#6365) 2025-11-28 21:38:54 +01:00
interface_card_preference_provider.h [CardDB] Drop the rebalanced-cards setting entirely (#7457) 2026-10-09 06:02:47 +02:00
interface_card_set_priority_controller.h [CardDB] Reload after the first run enables all sets without freezing startup (#7470) 2026-10-13 06:29:16 +02:00
interface_cards_display_settings_provider.h [CardDB] Drop the rebalanced-cards setting entirely (#7457) 2026-10-09 06:02:47 +02:00
interface_chat_settings_provider.h [Client] Tabbed room channels with unread states and collapsible chat (#7478) 2026-10-16 22:46:39 +02:00
interface_deck_editor_settings_provider.h [Settings] Shuffle some settings around (#7084) 2026-08-08 22:27:41 +02:00
interface_game_settings_provider.h [Server/Client/Protocol] Shuffle or reorder player seats before a game starts (#7398) 2026-11-04 15:44:50 +01:00
interface_interface_settings_provider.h [Game] Playmats (#7101) 2026-08-21 10:40:49 +02:00
interface_network_settings_provider.h Clean up inter-library dependencies with interfaces (#6280) 2025-11-08 22:19:40 +01:00
interface_paths_settings_provider.h [Settings] Split cache_settings monolith into multiple SettingsManager sub-classes (#7050) 2026-07-27 11:25:39 +02:00
interface_personal_settings_provider.h [Settings] Shuffle some settings around (#7084) 2026-08-08 22:27:41 +02:00
interface_sound_settings_provider.h [Settings] Split cache_settings monolith into multiple SettingsManager sub-classes (#7050) 2026-07-27 11:25:39 +02:00
interface_tabs_settings_provider.h [Mods] Properly close card art rules tab on disconnect (#7227) 2026-09-01 11:31:49 +02:00
interface_updates_settings_provider.h [Settings] Split cache_settings monolith into multiple SettingsManager sub-classes (#7050) 2026-07-27 11:25:39 +02:00
interface_visual_deck_storage_settings_provider.h [Settings] Shuffle some settings around (#7084) 2026-08-08 22:27:41 +02:00
noop_card_database_path_provider.h [Fix-Warnings] Mark const getters as [[nodiscard]] (#6365) 2025-11-28 21:38:54 +01:00
noop_card_preference_provider.h [CardDB] Drop the rebalanced-cards setting entirely (#7457) 2026-10-09 06:02:47 +02:00
noop_card_set_priority_controller.h [CardDB] Keep parse-time set filtering and bust the cache on enablement changes (#7448) 2026-10-09 06:09:18 +02:00