Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/NetClient.h
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | class CNetClient : public CFsm | ||||
friend class CNetFileReceiveTask_ClientRejoin; | friend class CNetFileReceiveTask_ClientRejoin; | ||||
public: | public: | ||||
/** | /** | ||||
* Construct a client associated with the given game object. | * Construct a client associated with the given game object. | ||||
* The game must exist for the lifetime of this object. | * The game must exist for the lifetime of this object. | ||||
*/ | */ | ||||
CNetClient(CGame* game, bool isLocalClient); | CNetClient(CGame* game); | ||||
virtual ~CNetClient(); | virtual ~CNetClient(); | ||||
/** | /** | ||||
* We assume that adding a tracing function that's only called | * We assume that adding a tracing function that's only called | ||||
* during GC is better for performance than using a | * during GC is better for performance than using a | ||||
* PersistentRooted<T> where each value needs to be added to | * PersistentRooted<T> where each value needs to be added to | ||||
* the root set. | * the root set. | ||||
Show All 12 Lines | public: | ||||
void SetUserName(const CStrW& username); | void SetUserName(const CStrW& username); | ||||
/** | /** | ||||
* Set the name of the hosting player. | * Set the name of the hosting player. | ||||
* This is needed for the secure lobby authentication. | * This is needed for the secure lobby authentication. | ||||
*/ | */ | ||||
void SetHostingPlayerName(const CStr& hostingPlayerName); | void SetHostingPlayerName(const CStr& hostingPlayerName); | ||||
void SetControllerSecret(const std::string& secret); | |||||
bool IsController() const { return m_IsController; } | |||||
/** | /** | ||||
* Set the game password. | * Set the game password. | ||||
*/ | */ | ||||
void SetGamePassword(const CStr& hashedPassword); | void SetGamePassword(const CStr& hashedPassword); | ||||
/** | /** | ||||
* Returns the GUID of the local client. | * Returns the GUID of the local client. | ||||
* Used for distinguishing observers. | * Used for distinguishing observers. | ||||
▲ Show 20 Lines • Show All 188 Lines • ▼ Show 20 Lines | private: | ||||
u16 m_ServerPort; | u16 m_ServerPort; | ||||
bool m_UseSTUN; | bool m_UseSTUN; | ||||
/** | /** | ||||
* Password to join the game. | * Password to join the game. | ||||
*/ | */ | ||||
CStr m_Password; | CStr m_Password; | ||||
/// The 'secret' used to identify the controller of the game. | |||||
std::string m_ControllerSecret; | |||||
/// Note that this is just a "gui hint" with no actual impact on being controller. | |||||
bool m_IsController = false; | |||||
/// Current network session (or NULL if not connected) | /// Current network session (or NULL if not connected) | ||||
CNetClientSession* m_Session; | CNetClientSession* m_Session; | ||||
std::thread m_PollingThread; | std::thread m_PollingThread; | ||||
/// Turn manager associated with the current game (or NULL if we haven't started the game yet) | /// Turn manager associated with the current game (or NULL if we haven't started the game yet) | ||||
CNetClientTurnManager* m_ClientTurnManager; | CNetClientTurnManager* m_ClientTurnManager; | ||||
/// Unique-per-game identifier of this client, used to identify the sender of simulation commands | /// Unique-per-game identifier of this client, used to identify the sender of simulation commands | ||||
u32 m_HostID; | u32 m_HostID; | ||||
/// True if the player is currently rejoining or has already rejoined the game. | /// True if the player is currently rejoining or has already rejoined the game. | ||||
bool m_Rejoin; | bool m_Rejoin; | ||||
/// Whether to prevent the client of the host from timing out | |||||
bool m_IsLocalClient; | |||||
/// Latest copy of game setup attributes heard from the server | /// Latest copy of game setup attributes heard from the server | ||||
JS::PersistentRootedValue m_GameAttributes; | JS::PersistentRootedValue m_GameAttributes; | ||||
/// Latest copy of player assignments heard from the server | /// Latest copy of player assignments heard from the server | ||||
PlayerAssignmentMap m_PlayerAssignments; | PlayerAssignmentMap m_PlayerAssignments; | ||||
/// Globally unique identifier to distinguish users beyond the lifetime of a single network session | /// Globally unique identifier to distinguish users beyond the lifetime of a single network session | ||||
CStr m_GUID; | CStr m_GUID; | ||||
Show All 15 Lines |
Wildfire Games · Phabricator