HoverRace
2.0
|
Base class for connected players. More...
#include <Player.h>
Public Types | |
enum | ConnectionState { ConnectionState::DISCONNECTED, ConnectionState::CONNECTING, ConnectionState::CONNECTED, ConnectionState::DISCONNECTING } |
using | connectionStateChanged_t = boost::signals2::signal< void()> |
using | nameChangedSignal_t = boost::signals2::signal< void()> |
Public Member Functions | |
Player ()=delete | |
Player (std::shared_ptr< Profile > profile, bool local, bool human, bool competing) | |
Constructor. More... | |
virtual | ~Player () |
void | AttachMainCharacter (MainCharacter::MainCharacter *mainCharacter) |
Attach the main character (when joining a game session). More... | |
void | DetachMainCharacter () |
Detach the main character (when leaving a game session). More... | |
ConnectionState | GetConnectionState () const |
connectionStateChanged_t & | GetConnectionStateChangedSignal () |
MainCharacter::MainCharacter * | GetMainCharacter () const |
Retrieve the main character, if attached. More... | |
const std::string & | GetName () const |
Retrieve the display name of the player. More... | |
nameChangedSignal_t & | GetNameChangedSignal () |
Profile * | GetProfile () const |
bool | IsCompeting () const |
bool | IsHuman () const |
bool | IsLocal () const |
void | SetNameSuffix (const std::string &suffix) |
Sets the suffix on the display name. More... | |
std::shared_ptr< Profile > | ShareProfile () const |
virtual std::ostream & | StreamOut (std::ostream &os) const |
Protected Member Functions | |
virtual void | Disconnect ()=0 |
void | SetConnectionState (ConnectionState state) |
Private Attributes | |
bool | competing |
ConnectionState | connectionState |
connectionStateChanged_t | connectionStateChangedSignal |
bool | human |
bool | local |
MainCharacter::MainCharacter * | mainCharacter |
std::string | name |
nameChangedSignal_t | nameChangedSignal |
std::shared_ptr< Profile > | profile |
Base class for connected players.
using HoverRace::Player::Player::connectionStateChanged_t = boost::signals2::signal<void()> |
using HoverRace::Player::Player::nameChangedSignal_t = boost::signals2::signal<void()> |
|
strong |
|
delete |
HoverRace::Player::Player::Player | ( | std::shared_ptr< Profile > | profile, |
bool | local, | ||
bool | human, | ||
bool | competing | ||
) |
Constructor.
profile | The profile. |
local | true if the player is controlled by the local client. |
human | true if the player is controlled by a human. |
competing | true if the player can compete in game sessions or false if the player can only spectate. |
|
inlinevirtual |
|
inline |
Attach the main character (when joining a game session).
mainCharacter | The main character (may be nullptr to detach). |
|
inline |
Detach the main character (when leaving a game session).
|
protectedpure virtual |
Implemented in HoverRace::Player::LocalPlayer.
|
inline |
|
inline |
|
inline |
Retrieve the main character, if attached.
nullptr
if detached).
|
inline |
Retrieve the display name of the player.
This is not necessarily the same name as the profile, although it is based on the profile name. In the case of multiple players with the same name, a suffix may be added to disambiguate them.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
protected |
void HoverRace::Player::Player::SetNameSuffix | ( | const std::string & | suffix | ) |
Sets the suffix on the display name.
The suffix is used to disambiguate the player name when multiple players have the same name (e.g. they are sharing the same profile).
suffix | The suffix (may be empty for no suffix). |
|
inline |
|
virtual |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |