mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
some server code
This commit is contained in:
parent
6923c98dc2
commit
29bf3d3774
18 changed files with 729 additions and 137 deletions
|
|
@ -101,17 +101,17 @@ void Server_Game::startGameIfReady()
|
|||
setActivePlayer(0);
|
||||
}
|
||||
|
||||
ReturnMessage::ReturnCode Server_Game::checkJoin(const QString &_password, bool spectator)
|
||||
ProtocolResponse::ResponseCode Server_Game::checkJoin(const QString &_password, bool spectator)
|
||||
{
|
||||
if (_password != password)
|
||||
return ReturnMessage::ReturnPasswordWrong;
|
||||
return ProtocolResponse::RespWrongPassword;
|
||||
if (spectator) {
|
||||
if (!spectatorsAllowed)
|
||||
return ReturnMessage::ReturnSpectatorsNotAllowed;
|
||||
return ProtocolResponse::RespSpectatorsNotAllowed;
|
||||
} else if (gameStarted || (getPlayerCount() >= getMaxPlayers()))
|
||||
return ReturnMessage::ReturnContextError;
|
||||
return ProtocolResponse::RespContextError;
|
||||
|
||||
return ReturnMessage::ReturnOk;
|
||||
return ProtocolResponse::RespOk;
|
||||
}
|
||||
|
||||
Server_Player *Server_Game::addPlayer(const QString &playerName, bool spectator)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue