mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-28 00:42:19 -07:00
[Client] Confirm before joining a full game as a spectator
This commit is contained in:
parent
d36865518e
commit
229a6bc16e
1 changed files with 15 additions and 2 deletions
|
|
@ -364,9 +364,22 @@ void GameSelector::joinGame(const bool asSpectator, const bool asJudge)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool spectator = asSpectator || game.player_count() == game.max_players();
|
|
||||||
|
|
||||||
bool overrideRestrictions = !tabSupervisor->getAdminLocked();
|
bool overrideRestrictions = !tabSupervisor->getAdminLocked();
|
||||||
|
|
||||||
|
// Joining a full game without override privileges silently becomes a
|
||||||
|
// spectator join, so ask first instead of surprising the player.
|
||||||
|
const bool gameFull = game.player_count() == game.max_players();
|
||||||
|
if (gameFull && !asSpectator && !asJudge && !overrideRestrictions) {
|
||||||
|
const QMessageBox::StandardButton answer =
|
||||||
|
QMessageBox::question(this, tr("Join game"), tr("The game is full. Join as a spectator instead?"),
|
||||||
|
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||||||
|
if (answer != QMessageBox::Yes) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool spectator = asSpectator || gameFull;
|
||||||
|
|
||||||
QString password;
|
QString password;
|
||||||
if (game.with_password() && !(spectator && !game.spectators_need_password()) && !overrideRestrictions) {
|
if (game.with_password() && !(spectator && !game.spectators_need_password()) && !overrideRestrictions) {
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue