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

#include <server_abstract_player.h>

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

Public Member Functions

 Server_AbstractPlayer (Server_Game *_game, int _playerId, const ServerInfo_User &_userInfo, bool _judge, Server_AbstractUserInterface *_handler)
 ~Server_AbstractPlayer () override
void prepareDestroy () override
const DeckListgetDeckList () const
bool getReadyStart () const
void setReadyStart (bool _readyStart)
bool getConceded () const
void setConceded (bool _conceded)
const QMap< QString, Server_CardZone * > & getZones () const
const QMap< int, Server_Arrow * > & getArrows () const
int newCardId ()
int newArrowId () const
void addZone (Server_CardZone *zone)
void addArrow (Server_Arrow *arrow)
void updateArrowId (int id)
bool deleteArrow (int arrowId)
virtual void setupZones ()
virtual void clearZones ()
Response::ResponseCode moveCard (GameEventStorage &ges, Server_CardZone *startzone, const QList< const CardToMove * > &_cards, Server_CardZone *targetzone, int xCoord, int yCoord, bool fixFreeSpaces=true, bool undoingDraw=false, bool isReversed=false)
virtual void onCardBeingMoved (GameEventStorage &ges, const MoveCardStruct &cardStruct, Server_CardZone *startzone, Server_CardZone *targetzone, bool undoingDraw)
void unattachCard (GameEventStorage &ges, Server_Card *card)
Response::ResponseCode setCardAttrHelper (GameEventStorage &ges, int targetPlayerId, const QString &zone, int cardId, CardAttribute attribute, const QString &attrValue, Server_Card *unzonedCard=nullptr)
virtual Response::ResponseCode cmdConcede (const Command_Concede &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdUnconcede (const Command_Unconcede &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdReadyStart (const Command_ReadyStart &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdRollDie (const Command_RollDie &cmd, ResponseContainer &rc, GameEventStorage &ges) const override
virtual Response::ResponseCode cmdMoveCard (const Command_MoveCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdFlipCard (const Command_FlipCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdAttachCard (const Command_AttachCard &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdCreateToken (const Command_CreateToken &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdCreateArrow (const Command_CreateArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdDeleteArrow (const Command_DeleteArrow &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdSetCardAttr (const Command_SetCardAttr &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdSetCardCounter (const Command_SetCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdIncCardCounter (const Command_IncCardCounter &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdDumpZone (const Command_DumpZone &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdRevealCards (const Command_RevealCards &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual Response::ResponseCode cmdChangeZoneProperties (const Command_ChangeZoneProperties &cmd, ResponseContainer &rc, GameEventStorage &ges) override
virtual void getInfo (ServerInfo_Player *info, Server_AbstractParticipant *playerWhosAsking, bool omniscient, bool withUserInfo) override
Public Member Functions inherited from Server_AbstractParticipant
 Server_AbstractParticipant (Server_Game *_game, int _playerId, const ServerInfo_User &_userInfo, bool _judge, Server_AbstractUserInterface *_handler)
 ~Server_AbstractParticipant () override
void removeFromGame ()
Server_AbstractUserInterfacegetUserInterface () const
void setUserInterface (Server_AbstractUserInterface *_userInterface)
void disconnectClient ()
int getPlayerId () const
bool getSpectator () const
bool getJudge () const
Server_GamegetGame () const
int getPingTime () const
bool updatePingTime ()
void getProperties (ServerInfo_PlayerProperties &result, bool withUserInfo)
virtual Response::ResponseCode cmdLeaveGame (const Command_LeaveGame &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdKickFromGame (const Command_KickFromGame &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdJudge (const Command_Judge &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdDeckSelect (const Command_DeckSelect &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdSetSideboardPlan (const Command_SetSideboardPlan &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdSetSideboardLock (const Command_SetSideboardLock &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdGameSay (const Command_GameSay &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdShuffle (const Command_Shuffle &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdMulligan (const Command_Mulligan &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdDrawCards (const Command_DrawCards &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdUndoDraw (const Command_UndoDraw &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdIncCounter (const Command_IncCounter &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdCreateCounter (const Command_CreateCounter &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdSetCounter (const Command_SetCounter &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdDelCounter (const Command_DelCounter &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdNextTurn (const Command_NextTurn &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdSetActivePhase (const Command_SetActivePhase &cmd, ResponseContainer &rc, GameEventStorage &ges)
virtual Response::ResponseCode cmdReverseTurn (const Command_ReverseTurn &, ResponseContainer &, GameEventStorage &ges)
Response::ResponseCode processGameCommand (const GameCommand &command, ResponseContainer &rc, GameEventStorage &ges)
void sendGameEvent (const GameEventContainer &event)
Public Member Functions inherited from ServerInfo_User_Container
 ServerInfo_User_Container (ServerInfo_User *_userInfo=nullptr)
 ServerInfo_User_Container (const ServerInfo_User &_userInfo)
 ServerInfo_User_Container (const ServerInfo_User_Container &other)
ServerInfo_User_Containeroperator= (const ServerInfo_User_Container &other)=default
virtual ~ServerInfo_User_Container ()
ServerInfo_User * getUserInfo () const
void setUserInfo (const ServerInfo_User &_userInfo)
ServerInfo_User & copyUserInfo (ServerInfo_User &result, bool complete, bool internalInfo=false, bool sessionInfo=false) const
ServerInfo_User copyUserInfo (bool complete, bool internalInfo=false, bool sessionInfo=false) const

Protected Member Functions

void revealTopCardIfNeeded (Server_CardZone *zone, GameEventStorage &ges)

Protected Attributes

bool conceded
DeckListdeck
bool sideboardLocked
QMap< QString, Server_CardZone * > zones
bool readyStart
int nextCardId
Protected Attributes inherited from Server_AbstractParticipant
Server_Gamegame
Server_AbstractUserInterfaceuserInterface
int pingTime
int playerId
bool spectator
bool judge
QMutex playerMutex
Protected Attributes inherited from ServerInfo_User_Container
ServerInfo_User * userInfo

Private Member Functions

void sendCreateTokenEvents (Server_CardZone *zone, Server_Card *card, int xCoord, int yCoord, GameEventStorage &ges)
void getPlayerProperties (ServerInfo_PlayerProperties &result) override

Private Attributes

QMap< int, Server_Arrow * > arrows

Constructor & Destructor Documentation

◆ Server_AbstractPlayer()

Server_AbstractPlayer::Server_AbstractPlayer ( Server_Game * _game,
int _playerId,
const ServerInfo_User & _userInfo,
bool _judge,
Server_AbstractUserInterface * _handler )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Server_AbstractPlayer()

Server_AbstractPlayer::~Server_AbstractPlayer ( )
overridedefault

Member Function Documentation

◆ addArrow()

void Server_AbstractPlayer::addArrow ( Server_Arrow * arrow)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addZone()

void Server_AbstractPlayer::addZone ( Server_CardZone * zone)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ clearZones()

void Server_AbstractPlayer::clearZones ( )
virtual

Reimplemented in Server_Player.

Here is the caller graph for this function:

◆ cmdAttachCard()

Response::ResponseCode Server_AbstractPlayer::cmdAttachCard ( const Command_AttachCard & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdChangeZoneProperties()

Response::ResponseCode Server_AbstractPlayer::cmdChangeZoneProperties ( const Command_ChangeZoneProperties & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Reimplemented in Server_Player.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cmdConcede()

Response::ResponseCode Server_AbstractPlayer::cmdConcede ( const Command_Concede & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdCreateArrow()

Response::ResponseCode Server_AbstractPlayer::cmdCreateArrow ( const Command_CreateArrow & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdCreateToken()

Response::ResponseCode Server_AbstractPlayer::cmdCreateToken ( const Command_CreateToken & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdDeleteArrow()

Response::ResponseCode Server_AbstractPlayer::cmdDeleteArrow ( const Command_DeleteArrow & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdDumpZone()

Response::ResponseCode Server_AbstractPlayer::cmdDumpZone ( const Command_DumpZone & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdFlipCard()

Response::ResponseCode Server_AbstractPlayer::cmdFlipCard ( const Command_FlipCard & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdIncCardCounter()

Response::ResponseCode Server_AbstractPlayer::cmdIncCardCounter ( const Command_IncCardCounter & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdMoveCard()

Response::ResponseCode Server_AbstractPlayer::cmdMoveCard ( const Command_MoveCard & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdReadyStart()

Response::ResponseCode Server_AbstractPlayer::cmdReadyStart ( const Command_ReadyStart & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdRevealCards()

Response::ResponseCode Server_AbstractPlayer::cmdRevealCards ( const Command_RevealCards & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdRollDie()

Response::ResponseCode Server_AbstractPlayer::cmdRollDie ( const Command_RollDie & cmd,
ResponseContainer & rc,
GameEventStorage & ges ) const
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdSetCardAttr()

Response::ResponseCode Server_AbstractPlayer::cmdSetCardAttr ( const Command_SetCardAttr & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdSetCardCounter()

Response::ResponseCode Server_AbstractPlayer::cmdSetCardCounter ( const Command_SetCardCounter & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ cmdUnconcede()

Response::ResponseCode Server_AbstractPlayer::cmdUnconcede ( const Command_Unconcede & cmd,
ResponseContainer & rc,
GameEventStorage & ges )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ deleteArrow()

bool Server_AbstractPlayer::deleteArrow ( int arrowId)
Here is the caller graph for this function:

◆ getArrows()

const QMap< int, Server_Arrow * > & Server_AbstractPlayer::getArrows ( ) const
inline

◆ getConceded()

bool Server_AbstractPlayer::getConceded ( ) const
inline

◆ getDeckList()

const DeckList * Server_AbstractPlayer::getDeckList ( ) const
inline

◆ getInfo()

void Server_AbstractPlayer::getInfo ( ServerInfo_Player * info,
Server_AbstractParticipant * playerWhosAsking,
bool omniscient,
bool withUserInfo )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Reimplemented in Server_Player.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getPlayerProperties()

void Server_AbstractPlayer::getPlayerProperties ( ServerInfo_PlayerProperties & result)
overrideprivatevirtual

Reimplemented from Server_AbstractParticipant.

◆ getReadyStart()

bool Server_AbstractPlayer::getReadyStart ( ) const
inline

◆ getZones()

const QMap< QString, Server_CardZone * > & Server_AbstractPlayer::getZones ( ) const
inline
Here is the caller graph for this function:

◆ moveCard()

Response::ResponseCode Server_AbstractPlayer::moveCard ( GameEventStorage & ges,
Server_CardZone * startzone,
const QList< const CardToMove * > & _cards,
Server_CardZone * targetzone,
int xCoord,
int yCoord,
bool fixFreeSpaces = true,
bool undoingDraw = false,
bool isReversed = false )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ newArrowId()

int Server_AbstractPlayer::newArrowId ( ) const
Here is the caller graph for this function:

◆ newCardId()

int Server_AbstractPlayer::newCardId ( )
Here is the caller graph for this function:

◆ onCardBeingMoved()

void Server_AbstractPlayer::onCardBeingMoved ( GameEventStorage & ges,
const MoveCardStruct & cardStruct,
Server_CardZone * startzone,
Server_CardZone * targetzone,
bool undoingDraw )
virtual

Reimplemented in Server_Player.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prepareDestroy()

void Server_AbstractPlayer::prepareDestroy ( )
overridevirtual

Reimplemented from Server_AbstractParticipant.

Here is the call graph for this function:

◆ revealTopCardIfNeeded()

void Server_AbstractPlayer::revealTopCardIfNeeded ( Server_CardZone * zone,
GameEventStorage & ges )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCreateTokenEvents()

void Server_AbstractPlayer::sendCreateTokenEvents ( Server_CardZone * zone,
Server_Card * card,
int xCoord,
int yCoord,
GameEventStorage & ges )
private

Creates and sends the events required to properly communicate the given token creation. Primarily written to handle creating face-down tokens.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCardAttrHelper()

Response::ResponseCode Server_AbstractPlayer::setCardAttrHelper ( GameEventStorage & ges,
int targetPlayerId,
const QString & zone,
int cardId,
CardAttribute attribute,
const QString & attrValue,
Server_Card * unzonedCard = nullptr )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setConceded()

void Server_AbstractPlayer::setConceded ( bool _conceded)
inline
Here is the caller graph for this function:

◆ setReadyStart()

void Server_AbstractPlayer::setReadyStart ( bool _readyStart)
inline
Here is the caller graph for this function:

◆ setupZones()

void Server_AbstractPlayer::setupZones ( )
virtual

Reimplemented in Server_Player.

Here is the caller graph for this function:

◆ unattachCard()

void Server_AbstractPlayer::unattachCard ( GameEventStorage & ges,
Server_Card * card )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateArrowId()

void Server_AbstractPlayer::updateArrowId ( int id)

Member Data Documentation

◆ arrows

QMap<int, Server_Arrow *> Server_AbstractPlayer::arrows
private

◆ conceded

bool Server_AbstractPlayer::conceded
protected

◆ deck

DeckList* Server_AbstractPlayer::deck
protected

◆ nextCardId

int Server_AbstractPlayer::nextCardId
protected

◆ readyStart

bool Server_AbstractPlayer::readyStart
protected

◆ sideboardLocked

bool Server_AbstractPlayer::sideboardLocked
protected

◆ zones

QMap<QString, Server_CardZone *> Server_AbstractPlayer::zones
protected

The documentation for this class was generated from the following files: