Information about the current lobby of players.
More...
#include <sharedgamestate.hpp>
|
| std::string | name |
| | name of the lobby as set by the server More...
|
| |
| std::vector< boost::optional< LobbyPlayer > > | players |
| | A vector of length max_players that maps a player's index (technically, index - 1 as player indices are 1-indexed) to their LobbyPlayer info struct (though since a player index could at present not be assigned, this maps to a boost::optional<LobbyPlayer>) More...
|
| |
| int | max_players |
| | The maximum number of players that this game instance can support. More...
|
| |
Information about the current lobby of players.
◆ Lobby() [1/3]
Default Lobby constructor supports exactly 4 players.
◆ Lobby() [2/3]
| Lobby::Lobby |
( |
int |
max_players | ) |
|
|
inlineexplicit |
◆ Lobby() [3/3]
| Lobby::Lobby |
( |
const std::string & |
name, |
|
|
int |
max_players |
|
) |
| |
|
inline |
◆ DEF_SERIALIZE()
| Lobby::DEF_SERIALIZE |
( |
Archive & |
ar, |
|
|
unsigned int |
version |
|
) |
| |
|
inline |
◆ getPlayer() [1/2]
Returns a player's LobbyPlayer struct by the player's EntityID.
- Parameters
-
| id | EntityID of the player whose LobbyPlayer struct is requested. |
- Returns
- Reference to the boost::optional<LobbyPlayer> that contains the LobbyPlayer struct of the player with the given EntityID; if no player in the lobby has this EntityID, the boost::optional will be empty.
◆ getPlayer() [2/2]
| const boost::optional< LobbyPlayer > & Lobby::getPlayer |
( |
int |
playerIndex | ) |
const |
Given a player's 1-indexed player index, this method returns a reference to the boost::optional<LobbyPlayer> that will contain the LobbyPlayer struct for that player if that player index has been assigned.
- Parameters
-
| playerIndex | 1-indexed player index of the player whose LobbyPlayer struct is requested. (I.e., Player 1's 1-indexed player index is 1 though it will be stored at index 0 in the players vector) |
- Returns
- Reference to the boost::optional<LobbyPlayer> that contains the LobbyPlayer struct of the player with the requested 1-indexed player index. If that player index has not been assigned, the boost::optional will be empty.
◆ numPlayersInLobby()
| int Lobby::numPlayersInLobby |
( |
| ) |
const |
Returns the number of players in the lobby Note: use this method and note players.size() to determine the number of current players in the lobby! players.size() should always equal max_players.
- Returns
- Number of current players in the lobby
◆ to_string() [1/2]
| std::string Lobby::to_string |
( |
| ) |
const |
|
inline |
◆ to_string() [2/2]
| std::string Lobby::to_string |
( |
unsigned int |
tab_offset | ) |
const |
Generates a string representation of this Lobby struct.
- Returns
- std::string representation of this Lobby struct
◆ max_players
The maximum number of players that this game instance can support.
◆ name
name of the lobby as set by the server
◆ players
| std::vector<boost::optional<LobbyPlayer> > Lobby::players |
A vector of length max_players that maps a player's index (technically, index - 1 as player indices are 1-indexed) to their LobbyPlayer info struct (though since a player index could at present not be assigned, this maps to a boost::optional<LobbyPlayer>)
The documentation for this struct was generated from the following files: