mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-22 15:16:15 -08:00
Fix #1351 - Server ignores only-reg if in "none" auth mode.
When in none auth mode, registered users don't exist; hence the setting
makes the game impossible to join.
Normally the setting would be greyed out when the user is unregistered,
but commit 475c54bf introduced a new edge case where the stored setting
would apply to the field even if the user is unregistered, making the
setting possible to apply in no-reg mode. Regardless, any client could
have done this, not just the default cockatrice.
The server side fix should prevent all issues in the future.
This commit is contained in:
@@ -636,7 +636,9 @@ Response::ResponseCode Server_ProtocolHandler::cmdCreateGame(const Command_Creat
|
||||
if (description.size() > 60)
|
||||
description = description.left(60);
|
||||
|
||||
Server_Game *game = new Server_Game(copyUserInfo(false), gameId, description, QString::fromStdString(cmd.password()), cmd.max_players(), gameTypes, cmd.only_buddies(), cmd.only_registered(), cmd.spectators_allowed(), cmd.spectators_need_password(), cmd.spectators_can_talk(), cmd.spectators_see_everything(), room);
|
||||
// When server doesn't permit registered users to exist, do not honor only-reg setting
|
||||
bool onlyRegisteredUsers = cmd.only_registered() && (server->permitUnregisteredUsers());
|
||||
Server_Game *game = new Server_Game(copyUserInfo(false), gameId, description, QString::fromStdString(cmd.password()), cmd.max_players(), gameTypes, cmd.only_buddies(), onlyRegisteredUsers, cmd.spectators_allowed(), cmd.spectators_need_password(), cmd.spectators_can_talk(), cmd.spectators_see_everything(), room);
|
||||
game->addPlayer(this, rc, false, false);
|
||||
room->addGame(game);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user