Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetClient.h
/* Copyright (C) 2020 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||||||||||
Stan: Year needs rebase propably? | |||||||||||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||||||||||
* | * | ||||||||||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||||||||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||||||||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||||||||||
* (at your option) any later version. | * (at your option) any later version. | ||||||||||||
* | * | ||||||||||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||||||||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | public: | ||||||||||||
/** | /** | ||||||||||||
* Returns the GUID of the local client. | * Returns the GUID of the local client. | ||||||||||||
* Used for distinguishing observers. | * Used for distinguishing observers. | ||||||||||||
*/ | */ | ||||||||||||
CStr GetGUID() const { return m_GUID; } | CStr GetGUID() const { return m_GUID; } | ||||||||||||
/** | /** | ||||||||||||
* Set up a connection to the remote networked server. | * Set up a connection to the remote networked server. | ||||||||||||
* @param server IP address or host name to connect to | * @param server IP address or host name to connect to | ||||||||||||
* @return true on success, false on connection failure | * @return true on success, false on connection failure | ||||||||||||
Done Inline Actions
wraitii: | |||||||||||||
*/ | */ | ||||||||||||
bool SetupConnection(const CStr& server, const u16 port, ENetHost* enetClient); | bool SetupConnection(ENetHost* enetClient); | ||||||||||||
Not Done Inline ActionsNot sure where EnetHost is pulled but you might be missing and include Stan: Not sure where EnetHost is pulled but you might be missing and include | |||||||||||||
Done Inline Actionsit is wroking in svn Silier: it is wroking in svn | |||||||||||||
Not Done Inline ActionsDid you try no pch? Stan: Did you try no pch? | |||||||||||||
Not Done Inline ActionsThe point is that this was already there, so it can't possibly break svn. wraitii: The point is that this was already there, so it can't possibly break svn.
Regardless, it is… | |||||||||||||
void SetupServerData(CStr address, u16 port, bool stun); | |||||||||||||
bool TryToConnect(const CStr& hostJID); | |||||||||||||
Not Done Inline ActionsAs written elsewhere, I think SetupConnection needs to be removed from the public interface now that TryToConnect exists. Add documentation to these functions too. If you keep SetupConnection, move it below the other two so it reflects call order. wraitii: As written elsewhere, I think SetupConnection needs to be removed from the public interface now… | |||||||||||||
Done Inline Actionscant, JSI_Network::StartNetworkHost needs it and using try to connect is overkill even if doable Silier: cant, JSI_Network::StartNetworkHost needs it and using try to connect is overkill even if doable | |||||||||||||
Not Done Inline ActionsAH you're right. Still, I'd move it below + doc. wraitii: AH you're right. Still, I'd move it below + doc. | |||||||||||||
Done Inline Actionshmm, maybe it is actually doable anyway Silier: hmm, maybe it is actually doable anyway | |||||||||||||
/** | /** | ||||||||||||
* Destroy the connection to the server. | * Destroy the connection to the server. | ||||||||||||
* This client probably cannot be used again. | * This client probably cannot be used again. | ||||||||||||
*/ | */ | ||||||||||||
void DestroyConnection(); | void DestroyConnection(); | ||||||||||||
/** | /** | ||||||||||||
▲ Show 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | public: | ||||||||||||
void SendKickPlayerMessage(const CStrW& playerName, bool ban); | void SendKickPlayerMessage(const CStrW& playerName, bool ban); | ||||||||||||
/** | /** | ||||||||||||
* Call when the client has paused or unpaused the game. | * Call when the client has paused or unpaused the game. | ||||||||||||
*/ | */ | ||||||||||||
void SendPausedMessage(bool pause); | void SendPausedMessage(bool pause); | ||||||||||||
private: | private: | ||||||||||||
Not Done Inline ActionsDoc wraitii: Doc | |||||||||||||
void SendAuthenticateMessage(); | void SendAuthenticateMessage(); | ||||||||||||
Not Done Inline Actions
(suggestion) wraitii: (suggestion) | |||||||||||||
// Net message / FSM transition handlers | // Net message / FSM transition handlers | ||||||||||||
static bool OnConnect(void* context, CFsmEvent* event); | static bool OnConnect(void* context, CFsmEvent* event); | ||||||||||||
static bool OnHandshake(void* context, CFsmEvent* event); | static bool OnHandshake(void* context, CFsmEvent* event); | ||||||||||||
static bool OnHandshakeResponse(void* context, CFsmEvent* event); | static bool OnHandshakeResponse(void* context, CFsmEvent* event); | ||||||||||||
static bool OnAuthenticateRequest(void* context, CFsmEvent* event); | static bool OnAuthenticateRequest(void* context, CFsmEvent* event); | ||||||||||||
static bool OnAuthenticate(void* context, CFsmEvent* event); | static bool OnAuthenticate(void* context, CFsmEvent* event); | ||||||||||||
static bool OnChat(void* context, CFsmEvent* event); | static bool OnChat(void* context, CFsmEvent* event); | ||||||||||||
static bool OnReady(void* context, CFsmEvent* event); | static bool OnReady(void* context, CFsmEvent* event); | ||||||||||||
Show All 19 Lines | private: | ||||||||||||
/** | /** | ||||||||||||
* Push a message onto the GUI queue listing the current player assignments. | * Push a message onto the GUI queue listing the current player assignments. | ||||||||||||
*/ | */ | ||||||||||||
void PostPlayerAssignmentsToScript(); | void PostPlayerAssignmentsToScript(); | ||||||||||||
CGame *m_Game; | CGame *m_Game; | ||||||||||||
CStrW m_UserName; | CStrW m_UserName; | ||||||||||||
CStr m_HostingPlayerName; | CStr m_HostingPlayerName; | ||||||||||||
CStr m_ServerAddress; | |||||||||||||
u16 m_ServerPort; | |||||||||||||
bool m_UseSTUN; | |||||||||||||
/// Current network session (or NULL if not connected) | /// Current network session (or NULL if not connected) | ||||||||||||
CNetClientSession* m_Session; | CNetClientSession* m_Session; | ||||||||||||
/// 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 | ||||||||||||
Show All 31 Lines |
Wildfire Games · Phabricator
Year needs rebase propably?