Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
Server_Game Class Reference

#include <server_game.h>

Inheritance diagram for Server_Game:
[legend]
Collaboration diagram for Server_Game:
[legend]

Signals

void sigStartGameIfReady (bool override)
void gameInfoChanged (ServerInfo_Game gameInfo)

Public Member Functions

 Server_Game (const ServerInfo_User &_creatorInfo, int _gameId, const QString &_description, const QString &_password, int _maxPlayers, const QList< int > &_gameTypes, bool _onlyBuddies, bool _onlyRegistered, bool _spectatorsAllowed, bool _spectatorsNeedPassword, bool _spectatorsCanTalk, bool _spectatorsSeeEverything, int _startingLifeTotal, bool _shareDecklistsOnLoad, Server_Room *parent)
 ~Server_Game () override
Server_RoomgetRoom () const
void getInfo (ServerInfo_Game &result) const
int getHostId () const
ServerInfo_User * getCreatorInfo () const
bool getGameStarted () const
int getPlayerCount () const
int getSpectatorCount () const
QMap< int, Server_AbstractPlayer * > getPlayers () const
Server_AbstractPlayergetPlayer (int id) const
const QMap< int, Server_AbstractParticipant * > & getParticipants () const
int getGameId () const
QString getDescription () const
QString getPassword () const
int getMaxPlayers () const
bool getSpectatorsAllowed () const
bool getSpectatorsNeedPassword () const
bool getSpectatorsCanTalk () const
bool getSpectatorsSeeEverything () const
int getStartingLifeTotal () const
bool getShareDecklistsOnLoad () const
Response::ResponseCode checkJoin (ServerInfo_User *user, const QString &_password, bool spectator, bool overrideRestrictions, bool asJudge)
bool containsUser (const QString &userName) const
void addPlayer (Server_AbstractUserInterface *userInterface, ResponseContainer &rc, bool spectator, bool judge, bool broadcastUpdate=true)
void removeParticipant (Server_AbstractParticipant *participant, Event_Leave::LeaveReason reason)
void removeArrowsRelatedToPlayer (GameEventStorage &ges, Server_AbstractPlayer *player)
void unattachCards (GameEventStorage &ges, Server_AbstractPlayer *player)
bool kickParticipant (int playerId)
void startGameIfReady (bool forceStartGame)
void stopGameIfFinished ()
int getActivePlayer () const
int getActivePhase () const
void setActivePlayer (int newPlayer)
void setActivePhase (int newPhase)
void removeArrows (int newPhase, bool force=false)
void nextTurn ()
int getSecondsElapsed () const
bool reverseTurnOrder ()
void createGameJoinedEvent (Server_AbstractParticipant *participant, ResponseContainer &rc, bool resuming)
GameEventContainer * prepareGameEvent (const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context=0)
GameEventContext prepareGameEventContext (const ::google::protobuf::Message &gameEventContext)
void sendGameStateToPlayers ()
void sendGameEventContainer (GameEventContainer *cont, GameEventStorageItem::EventRecipients recipients=GameEventStorageItem::SendToPrivate|GameEventStorageItem::SendToOthers, int privatePlayerId=-1)

Public Attributes

QRecursiveMutex gameMutex

Private Slots

void pingClockTimeout ()
void doStartGameIfReady (bool forceStartGame=false)

Private Member Functions

void createGameStateChangedEvent (Event_GameStateChanged *event, Server_AbstractParticipant *recipient, bool omniscient, bool withUserInfo)
void storeGameInformation ()

Private Attributes

Server_Roomroom
int nextPlayerId
int hostId
ServerInfo_User * creatorInfo
QMap< int, Server_AbstractParticipant * > participants
QSet< QString > allPlayersEver
QSet< QString > allSpectatorsEver
bool gameStarted
bool gameClosed
int gameId
QString description
QString password
int maxPlayers
QList< int > gameTypes
int activePlayer
int activePhase
bool onlyBuddies
bool onlyRegistered
bool spectatorsAllowed
bool spectatorsNeedPassword
bool spectatorsCanTalk
bool spectatorsSeeEverything
int startingLifeTotal
bool shareDecklistsOnLoad
int inactivityCounter
int startTimeOfThisGame
int secondsElapsed
bool firstGameStarted
bool turnOrderReversed
QDateTime startTime
QTimer * pingClock
QList< GameReplay * > replayList
GameReplay * currentReplay

Constructor & Destructor Documentation

◆ Server_Game()

Server_Game::Server_Game ( const ServerInfo_User & _creatorInfo,
int _gameId,
const QString & _description,
const QString & _password,
int _maxPlayers,
const QList< int > & _gameTypes,
bool _onlyBuddies,
bool _onlyRegistered,
bool _spectatorsAllowed,
bool _spectatorsNeedPassword,
bool _spectatorsCanTalk,
bool _spectatorsSeeEverything,
int _startingLifeTotal,
bool _shareDecklistsOnLoad,
Server_Room * parent )
Here is the call graph for this function:

◆ ~Server_Game()

Server_Game::~Server_Game ( )
override
Here is the call graph for this function:

Member Function Documentation

◆ addPlayer()

void Server_Game::addPlayer ( Server_AbstractUserInterface * userInterface,
ResponseContainer & rc,
bool spectator,
bool judge,
bool broadcastUpdate = true )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkJoin()

Response::ResponseCode Server_Game::checkJoin ( ServerInfo_User * user,
const QString & _password,
bool spectator,
bool overrideRestrictions,
bool asJudge )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ containsUser()

bool Server_Game::containsUser ( const QString & userName) const
Here is the caller graph for this function:

◆ createGameJoinedEvent()

void Server_Game::createGameJoinedEvent ( Server_AbstractParticipant * participant,
ResponseContainer & rc,
bool resuming )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createGameStateChangedEvent()

void Server_Game::createGameStateChangedEvent ( Event_GameStateChanged * event,
Server_AbstractParticipant * recipient,
bool omniscient,
bool withUserInfo )
private
Here is the caller graph for this function:

◆ doStartGameIfReady

void Server_Game::doStartGameIfReady ( bool forceStartGame = false)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ gameInfoChanged

void Server_Game::gameInfoChanged ( ServerInfo_Game gameInfo)
signal
Here is the caller graph for this function:

◆ getActivePhase()

int Server_Game::getActivePhase ( ) const
inline

◆ getActivePlayer()

int Server_Game::getActivePlayer ( ) const
inline

◆ getCreatorInfo()

ServerInfo_User * Server_Game::getCreatorInfo ( ) const
inline
Here is the caller graph for this function:

◆ getDescription()

QString Server_Game::getDescription ( ) const
inline
Here is the caller graph for this function:

◆ getGameId()

int Server_Game::getGameId ( ) const
inline
Here is the caller graph for this function:

◆ getGameStarted()

bool Server_Game::getGameStarted ( ) const
inline

◆ getHostId()

int Server_Game::getHostId ( ) const
inline

◆ getInfo()

void Server_Game::getInfo ( ServerInfo_Game & result) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxPlayers()

int Server_Game::getMaxPlayers ( ) const
inline
Here is the caller graph for this function:

◆ getParticipants()

const QMap< int, Server_AbstractParticipant * > & Server_Game::getParticipants ( ) const
inline
Here is the caller graph for this function:

◆ getPassword()

QString Server_Game::getPassword ( ) const
inline
Here is the caller graph for this function:

◆ getPlayer()

Server_AbstractPlayer * Server_Game::getPlayer ( int id) const

◆ getPlayerCount()

int Server_Game::getPlayerCount ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayers()

QMap< int, Server_AbstractPlayer * > Server_Game::getPlayers ( ) const
Here is the caller graph for this function:

◆ getRoom()

Server_Room * Server_Game::getRoom ( ) const
inline

◆ getSecondsElapsed()

int Server_Game::getSecondsElapsed ( ) const
inline

◆ getShareDecklistsOnLoad()

bool Server_Game::getShareDecklistsOnLoad ( ) const
inline

◆ getSpectatorCount()

int Server_Game::getSpectatorCount ( ) const
Here is the caller graph for this function:

◆ getSpectatorsAllowed()

bool Server_Game::getSpectatorsAllowed ( ) const
inline
Here is the caller graph for this function:

◆ getSpectatorsCanTalk()

bool Server_Game::getSpectatorsCanTalk ( ) const
inline

◆ getSpectatorsNeedPassword()

bool Server_Game::getSpectatorsNeedPassword ( ) const
inline
Here is the caller graph for this function:

◆ getSpectatorsSeeEverything()

bool Server_Game::getSpectatorsSeeEverything ( ) const
inline

◆ getStartingLifeTotal()

int Server_Game::getStartingLifeTotal ( ) const
inline

◆ kickParticipant()

bool Server_Game::kickParticipant ( int playerId)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nextTurn()

void Server_Game::nextTurn ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pingClockTimeout

void Server_Game::pingClockTimeout ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareGameEvent()

GameEventContainer * Server_Game::prepareGameEvent ( const ::google::protobuf::Message & gameEvent,
int playerId,
GameEventContext * context = 0 )
Here is the caller graph for this function:

◆ prepareGameEventContext()

GameEventContext Server_Game::prepareGameEventContext ( const ::google::protobuf::Message & gameEventContext)

◆ removeArrows()

void Server_Game::removeArrows ( int newPhase,
bool force = false )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeArrowsRelatedToPlayer()

void Server_Game::removeArrowsRelatedToPlayer ( GameEventStorage & ges,
Server_AbstractPlayer * player )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ removeParticipant()

void Server_Game::removeParticipant ( Server_AbstractParticipant * participant,
Event_Leave::LeaveReason reason )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reverseTurnOrder()

bool Server_Game::reverseTurnOrder ( )
inline

◆ sendGameEventContainer()

void Server_Game::sendGameEventContainer ( GameEventContainer * cont,
GameEventStorageItem::EventRecipients recipients = GameEventStorageItem::SendToPrivate | GameEventStorageItem::SendToOthers,
int privatePlayerId = -1 )
Here is the caller graph for this function:

◆ sendGameStateToPlayers()

void Server_Game::sendGameStateToPlayers ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActivePhase()

void Server_Game::setActivePhase ( int newPhase)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setActivePlayer()

void Server_Game::setActivePlayer ( int newPlayer)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigStartGameIfReady

void Server_Game::sigStartGameIfReady ( bool override)
signal
Here is the caller graph for this function:

◆ startGameIfReady()

void Server_Game::startGameIfReady ( bool forceStartGame)
Here is the call graph for this function:

◆ stopGameIfFinished()

void Server_Game::stopGameIfFinished ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ storeGameInformation()

void Server_Game::storeGameInformation ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ unattachCards()

void Server_Game::unattachCards ( GameEventStorage & ges,
Server_AbstractPlayer * player )
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ activePhase

int Server_Game::activePhase
private

◆ activePlayer

int Server_Game::activePlayer
private

◆ allPlayersEver

QSet<QString> Server_Game::allPlayersEver
private

◆ allSpectatorsEver

QSet<QString> Server_Game::allSpectatorsEver
private

◆ creatorInfo

ServerInfo_User* Server_Game::creatorInfo
private

◆ currentReplay

GameReplay* Server_Game::currentReplay
private

◆ description

QString Server_Game::description
private

◆ firstGameStarted

bool Server_Game::firstGameStarted
private

◆ gameClosed

bool Server_Game::gameClosed
private

◆ gameId

int Server_Game::gameId
private

◆ gameMutex

QRecursiveMutex Server_Game::gameMutex
mutable

◆ gameStarted

bool Server_Game::gameStarted
private

◆ gameTypes

QList<int> Server_Game::gameTypes
private

◆ hostId

int Server_Game::hostId
private

◆ inactivityCounter

int Server_Game::inactivityCounter
private

◆ maxPlayers

int Server_Game::maxPlayers
private

◆ nextPlayerId

int Server_Game::nextPlayerId
private

◆ onlyBuddies

bool Server_Game::onlyBuddies
private

◆ onlyRegistered

bool Server_Game::onlyRegistered
private

◆ participants

QMap<int, Server_AbstractParticipant *> Server_Game::participants
private

◆ password

QString Server_Game::password
private

◆ pingClock

QTimer* Server_Game::pingClock
private

◆ replayList

QList<GameReplay *> Server_Game::replayList
private

◆ room

Server_Room* Server_Game::room
private

◆ secondsElapsed

int Server_Game::secondsElapsed
private

◆ shareDecklistsOnLoad

bool Server_Game::shareDecklistsOnLoad
private

◆ spectatorsAllowed

bool Server_Game::spectatorsAllowed
private

◆ spectatorsCanTalk

bool Server_Game::spectatorsCanTalk
private

◆ spectatorsNeedPassword

bool Server_Game::spectatorsNeedPassword
private

◆ spectatorsSeeEverything

bool Server_Game::spectatorsSeeEverything
private

◆ startingLifeTotal

int Server_Game::startingLifeTotal
private

◆ startTime

QDateTime Server_Game::startTime
private

◆ startTimeOfThisGame

int Server_Game::startTimeOfThisGame
private

◆ turnOrderReversed

bool Server_Game::turnOrderReversed
private

The documentation for this class was generated from the following files:
  • libcockatrice_network/libcockatrice/network/server/remote/game/server_game.h
  • libcockatrice_network/libcockatrice/network/server/remote/game/server_game.cpp