mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2025-12-25 04:14:34 -08:00
Add the ability to define starting life total during game creation. (#5174)
* Have the server respect gameType info when setting up zones. * ServerPlayer::setupZones is now passed the room->getGameTypes(); * ServerPlayer::setupZones now checks if the GameType String includes "Commander" and then sets the life total to 40 instead. * Formatting. * Remove debug logging imports. * Move game option value declarations to dlg_create_game. * Lint. * Fix mocks. * Add a default for backwards compatibility. --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
@@ -815,13 +815,14 @@ Server_ProtocolHandler::cmdCreateGame(const Command_CreateGame &cmd, Server_Room
|
||||
}
|
||||
|
||||
QString description = nameFromStdString(cmd.description());
|
||||
int startingLifeTotal = cmd.has_starting_life_total() ? cmd.starting_life_total() : 20;
|
||||
|
||||
// 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);
|
||||
cmd.spectators_can_talk(), cmd.spectators_see_everything(), startingLifeTotal, room);
|
||||
|
||||
game->addPlayer(this, rc, asSpectator, asJudge, false);
|
||||
room->addGame(game);
|
||||
|
||||
Reference in New Issue
Block a user