1
0
forked from mirrors/0ad

Initialize more members of CNetClient

The username and the jid have to be set before the client is connected.
With this commit it's not possible to initialize them to late.
This commit is contained in:
phosit
2024-11-10 20:37:40 +01:00
parent b686dfa047
commit f03be7b568
4 changed files with 14 additions and 46 deletions
+3 -14
View File
@@ -65,9 +65,10 @@ constexpr u32 NETWORK_BAD_PING = DEFAULT_TURN_LENGTH * COMMAND_DELAY_MP / 2;
CNetClient *g_NetClient = NULL;
CNetClient::CNetClient(CGame* game) :
CNetClient::CNetClient(CGame* game, const CStrW& username, const CStr& hostJID) :
m_Session(NULL),
m_UserName(L"anonymous"),
m_UserName{username},
m_HostJID{hostJID},
m_HostID((u32)-1), m_ClientTurnManager(NULL), m_Game(game),
m_LastConnectionCheck(0),
m_ServerAddress(),
@@ -154,18 +155,6 @@ void CNetClient::TraceMember(JSTracer *trc)
JS::TraceEdge(trc, &guiMessage, "m_GuiMessageQueue");
}
void CNetClient::SetUserName(const CStrW& username)
{
ENSURE(!m_Session); // must be called before we start the connection
m_UserName = username;
}
void CNetClient::SetHostJID(const CStr& jid)
{
m_HostJID = jid;
}
void CNetClient::SetGamePassword(const CStr& hashedPassword)
{
// Hash on top with the user's name, to make sure not all