Emergency 20 Dokumentation  4.2.0
em5::multiplayer::client::Client Class Reference

EMERGENCY 5 multiplayer client class. More...

#include <Client.h>

Inheritance diagram for em5::multiplayer::client::Client:
em5::multiplayer::SessionBase

Public Member Functions

 Client ()
 Constructor. More...
 
virtual ~Client ()
 Destructor. More...
 
bool joinSession (const multiplayer::HostEntry &hostEntry, const std::string &playerName, const std::string &sessionPassword)
 
void joinLocalSession (const std::string &dataPath, const MapIdentifier &mapIdentifier, const std::string &playerName, const std::string &sessionPassword)
 "Joins" a local session.(Which effectively creates a local host instance) This session is only used for testing the multiplayer serialization part More...
 
void closeSession ()
 Closes the currently running session and closes all related network connections. More...
 
bool getReadyState () const
 
void setReadyState (bool isReady)
 
void changeUserData (uint32 newUserData)
 
JoinResponse getJoinResponse () const
 
void sendOperationMessageToHost (const OperationMessage operationMessageId, const qsf::game::BitStream &operationMessageData)
 Sends data to the host. More...
 
void onCommandExecuted (const qsf::game::Command &command, const std::vector< qsf::Entity * > &callers, qsf::game::CommandContext &context)
 
void onSendHighscoreSubmitInitiated ()
 
void onSendHighscoreSubmitDeclined ()
 
void onSendHighscoreSubmitAccept ()
 
virtual bool startup (qsf::Map &map) override
 Is called when the map was successfully loaded but before game is initialized. More...
 
virtual void loadingFinished () override
 Is called when the map was successfully loaded and any further game initializations where done. More...
 
- Public Member Functions inherited from em5::multiplayer::SessionBase
 SessionBase ()
 Default constructor. More...
 
virtual ~SessionBase ()
 Destructor. More...
 
uint32 getLocalPlayerIndex () const
 
const std::string & getSessionName () const
 
const std::string & getSessionPassword () const
 
uint32 getMaximumPlayerCount () const
 
qsf::GlobalAssetId getGlobalMapAssetId () const
 
multiplayer::GameMode getGameMode () const
 
uint32 getDuration () const
 
const std::string & getGameModificationString () const
 
bool isUsingPlayerSeparation () const
 
uint8 getMapQualityToUse () const
 
State getCurrentState () const
 
const std::list< ChatMessage > & getChatHistory () const
 
const std::unordered_map< uint32, PlayerInfo > & getPlayerList () const
 
const PlayerInfogetPlayerByIndex (uint32 playerIndex) const
 
void sendChatMessage (const std::string &message)
 
OperationMessageHandlerManagergetOperationMessageHandlerManager ()
 

Public Attributes

boost::signals2::signal< void()> disconnected
 Called when the client is disconnected. More...
 
- Public Attributes inherited from em5::multiplayer::SessionBase
boost::signals2::signal< void(State, State)> currentStateChanged
 
boost::signals2::signal< void(const ChatMessage &)> chatMessage
 
boost::signals2::signal< void(uint32, const PlayerInfo &)> playerJoined
 
boost::signals2::signal< void(uint32, const PlayerInfo &)> playerLeft
 
boost::signals2::signal< void(uint32, bool)> playerChangeReady
 
boost::signals2::signal< void(uint32, uint32)> playerUserDataChanged
 
boost::signals2::signal< void(const GameModeUpdateData &)> gameModeDataChanged
 

Protected Member Functions

virtual void onSendChatMessage (const ChatMessage &chatMessage) override
 
- Protected Member Functions inherited from em5::multiplayer::SessionBase
virtual void onChatMessageReceived (const ChatMessage &chatMessage)
 
void setLocalPlayerIndex (uint32 localPlayerIndex)
 
void setSessionName (const std::string &name)
 
void setSessionPassword (const std::string &password)
 
void setMaximumPlayerCount (uint32 count)
 
void setGlobalMapAssetId (qsf::GlobalAssetId globalAssetId)
 
void setGameMode (multiplayer::GameMode mode)
 
void setDuration (uint32 duration)
 
void setGameModificationString (const std::string &string)
 
void setUsingPlayerSeparation (bool isUsingPlayerSeparation)
 
void setCurrentState (State state)
 
void addChatMessage (const ChatMessage &message)
 
void clearChatHistory ()
 
void handleChatMessageData (uint64 dataSize, const qsf::game::BitStream &bitStream)
 
void setupGameSession ()
 
void onPlayerUserDataChanged (uint32 playerIndex, uint32 userData)
 
void setupMap (qsf::Map &map)
 Common modifications of the map for host and client. More...
 

Additional Inherited Members

- Public Types inherited from em5::multiplayer::SessionBase
enum  State : uint8 {
  State::NONE, State::CONNECTING_TO_HOST, State::CONNECTED_TO_HOST, State::LOBBY,
  State::LOADING_SCREEN, State::IN_GAME, State::POST_GAME, State::POST_GAME_FINISH
}
 
- Static Public Member Functions inherited from em5::multiplayer::SessionBase
static void generateContentAuthenticationChecksums (ContentAuthenticationChecksums &checksums)
 
- Static Public Attributes inherited from em5::multiplayer::SessionBase
static const uint32 CHAT_HISTORY_SIZE
 
- Protected Attributes inherited from em5::multiplayer::SessionBase
std::unordered_map< uint32, PlayerInfomPlayerInfoMap
 key=playerIndex value=PlayerInfo More...
 

Detailed Description

EMERGENCY 5 multiplayer client class.

Constructor & Destructor Documentation

em5::multiplayer::client::Client::Client ( )

Constructor.

virtual em5::multiplayer::client::Client::~Client ( )
virtual

Destructor.

Member Function Documentation

void em5::multiplayer::client::Client::changeUserData ( uint32  newUserData)
void em5::multiplayer::client::Client::closeSession ( )

Closes the currently running session and closes all related network connections.

JoinResponse em5::multiplayer::client::Client::getJoinResponse ( ) const
bool em5::multiplayer::client::Client::getReadyState ( ) const
void em5::multiplayer::client::Client::joinLocalSession ( const std::string &  dataPath,
const MapIdentifier mapIdentifier,
const std::string &  playerName,
const std::string &  sessionPassword 
)

"Joins" a local session.(Which effectively creates a local host instance) This session is only used for testing the multiplayer serialization part

Parameters
[in]dataPathThe path where the local client will find the files for the game player/command recorder.
bool em5::multiplayer::client::Client::joinSession ( const multiplayer::HostEntry hostEntry,
const std::string &  playerName,
const std::string &  sessionPassword 
)
virtual void em5::multiplayer::client::Client::loadingFinished ( )
overridevirtual

Is called when the map was successfully loaded and any further game initializations where done.

Implements em5::multiplayer::SessionBase.

void em5::multiplayer::client::Client::onCommandExecuted ( const qsf::game::Command command,
const std::vector< qsf::Entity * > &  callers,
qsf::game::CommandContext context 
)
virtual void em5::multiplayer::client::Client::onSendChatMessage ( const ChatMessage chatMessage)
overrideprotectedvirtual
void em5::multiplayer::client::Client::onSendHighscoreSubmitAccept ( )
void em5::multiplayer::client::Client::onSendHighscoreSubmitDeclined ( )
void em5::multiplayer::client::Client::onSendHighscoreSubmitInitiated ( )
void em5::multiplayer::client::Client::sendOperationMessageToHost ( const OperationMessage  operationMessageId,
const qsf::game::BitStream operationMessageData 
)

Sends data to the host.

void em5::multiplayer::client::Client::setReadyState ( bool  isReady)
virtual bool em5::multiplayer::client::Client::startup ( qsf::Map map)
overridevirtual

Is called when the map was successfully loaded but before game is initialized.

Implements em5::multiplayer::SessionBase.

Member Data Documentation

boost::signals2::signal<void()> em5::multiplayer::client::Client::disconnected

Called when the client is disconnected.

Note
  • Recommended slot signature: void onDisconnected()
  • Only called in case there was actually a connection

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