forked from 0ad/0ad
In preparation of D1513, allow the NetClientSession to find out if it's the "Local Client", refs #5163.
For good practice, mention all members in the affected member initializer list: Add booelan m_IsLocalClient and u32 m_HostID to the member initializer list (to not have them undefined, even though they are not read from until they are set). Add the strings m_GUID and m_UserName for completeness (even though the default constructor is already called for strings). Use nullptr instead of NULL for pointers. Comments By: Vladislav This was SVN commit r21841.
This commit is contained in:
parent
8ae179aaae
commit
2588682c09
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017 Wildfire Games.
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -33,7 +33,7 @@ const u32 MAXIMUM_HOST_TIMEOUT = std::numeric_limits<u32>::max();
|
||||
static const int CHANNEL_COUNT = 1;
|
||||
|
||||
CNetClientSession::CNetClientSession(CNetClient& client) :
|
||||
m_Client(client), m_FileTransferer(this), m_Host(NULL), m_Server(NULL), m_Stats(NULL)
|
||||
m_Client(client), m_FileTransferer(this), m_Host(nullptr), m_Server(nullptr), m_Stats(nullptr), m_IsLocalClient(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -80,6 +80,7 @@ bool CNetClientSession::Connect(const CStr& server, const u16 port, const bool i
|
||||
|
||||
m_Host = host;
|
||||
m_Server = peer;
|
||||
m_IsLocalClient = isLocalClient;
|
||||
|
||||
// Prevent the local client of the host from timing out too quickly.
|
||||
#if (ENET_VERSION >= ENET_VERSION_CREATE(1, 3, 4))
|
||||
@ -200,10 +201,8 @@ u32 CNetClientSession::GetMeanRTT() const
|
||||
return m_Server->roundTripTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
CNetServerSession::CNetServerSession(CNetServerWorker& server, ENetPeer* peer) :
|
||||
m_Server(server), m_FileTransferer(this), m_Peer(peer)
|
||||
m_Server(server), m_FileTransferer(this), m_Peer(peer), m_IsLocalClient(false), m_HostID(0), m_GUID(), m_UserName()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017 Wildfire Games.
|
||||
/* Copyright (C) 2018 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@ -115,6 +115,8 @@ private:
|
||||
ENetHost* m_Host;
|
||||
ENetPeer* m_Server;
|
||||
CNetStatsTable* m_Stats;
|
||||
|
||||
bool m_IsLocalClient;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user