R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
server::IRoom Class Referenceabstract

Interface for a game room. More...

#include <IRoom.hpp>

Inheritance diagram for server::IRoom:
Inheritance graph
Collaboration diagram for server::IRoom:
Collaboration graph

Public Member Functions

virtual ~IRoom ()=default
 
virtual bool join (uint32_t playerId)=0
 Join a player to the room.
 
virtual bool joinAsSpectator (uint32_t playerId)=0
 Join a player to the room as a spectator.
 
virtual bool leave (uint32_t playerId)=0
 Remove a player from the room.
 
virtual std::string getId () const =0
 Get the room's unique identifier.
 
virtual std::string getName () const =0
 Get the room's display name.
 
virtual RoomState getState () const =0
 Get current state of the room.
 
virtual void setState (RoomState state)=0
 Set the state of the room.
 
virtual size_t getPlayerCount () const =0
 Get number of players currently in room.
 
virtual size_t getMaxPlayers () const =0
 Get maximum number of players allowed.
 
virtual bool isFull () const =0
 Check if room is full.
 
virtual std::vector< uint32_t > getPlayers () const =0
 Get list of player IDs in this room.
 
virtual std::vector< uint32_t > getSpectators () const =0
 Get list of spectator IDs in this room.
 
virtual bool hasPlayer (uint32_t playerId) const =0
 Check if a player is in this room.
 
virtual bool hasSpectator (uint32_t playerId) const =0
 Check if a spectator is in this room.
 
virtual RoomInfo getInfo () const =0
 Get room information.
 

Detailed Description

Interface for a game room.

Defines basic operations for a game room like joining, leaving, and retrieving information.

Definition at line 47 of file IRoom.hpp.

Constructor & Destructor Documentation

◆ ~IRoom()

virtual server::IRoom::~IRoom ( )
virtualdefault

Member Function Documentation

◆ getId()

virtual std::string server::IRoom::getId ( ) const
pure virtual

Get the room's unique identifier.

Returns
Room ID

Implemented in server::Room.

◆ getInfo()

virtual RoomInfo server::IRoom::getInfo ( ) const
pure virtual

Get room information.

Returns
RoomInfo struct

Implemented in server::Room.

◆ getMaxPlayers()

virtual size_t server::IRoom::getMaxPlayers ( ) const
pure virtual

Get maximum number of players allowed.

Returns
Max players

Implemented in server::Room.

◆ getName()

virtual std::string server::IRoom::getName ( ) const
pure virtual

Get the room's display name.

Returns
Room name

Implemented in server::Room.

◆ getPlayerCount()

virtual size_t server::IRoom::getPlayerCount ( ) const
pure virtual

Get number of players currently in room.

Returns
Player count

Implemented in server::Room.

◆ getPlayers()

virtual std::vector< uint32_t > server::IRoom::getPlayers ( ) const
pure virtual

Get list of player IDs in this room.

Returns
Vector of player IDs

Implemented in server::Room.

◆ getSpectators()

virtual std::vector< uint32_t > server::IRoom::getSpectators ( ) const
pure virtual

Get list of spectator IDs in this room.

Returns
Vector of spectator IDs

Implemented in server::Room.

◆ getState()

virtual RoomState server::IRoom::getState ( ) const
pure virtual

Get current state of the room.

Returns
RoomState

Implemented in server::Room.

◆ hasPlayer()

virtual bool server::IRoom::hasPlayer ( uint32_t  playerId) const
pure virtual

Check if a player is in this room.

Parameters
playerIdPlayer ID to check
Returns
true if player is in room

Implemented in server::Room.

◆ hasSpectator()

virtual bool server::IRoom::hasSpectator ( uint32_t  playerId) const
pure virtual

Check if a spectator is in this room.

Parameters
playerIdSpectator ID to check
Returns
true if spectator is in room

Implemented in server::Room.

◆ isFull()

virtual bool server::IRoom::isFull ( ) const
pure virtual

Check if room is full.

Returns
true if full, false otherwise

Implemented in server::Room.

◆ join()

virtual bool server::IRoom::join ( uint32_t  playerId)
pure virtual

Join a player to the room.

Parameters
playerIdUnique identifier of the player
Returns
true if player successfully joined, false otherwise

Implemented in server::Room.

◆ joinAsSpectator()

virtual bool server::IRoom::joinAsSpectator ( uint32_t  playerId)
pure virtual

Join a player to the room as a spectator.

Parameters
playerIdUnique identifier of the player
Returns
true if spectator successfully joined, false otherwise

Implemented in server::Room.

◆ leave()

virtual bool server::IRoom::leave ( uint32_t  playerId)
pure virtual

Remove a player from the room.

Parameters
playerIdUnique identifier of the player
Returns
true if player successfully left, false otherwise

Implemented in server::Room.

◆ setState()

virtual void server::IRoom::setState ( RoomState  state)
pure virtual

Set the state of the room.

Parameters
stateNew state

Implemented in server::Room.


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