mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-18 14:08:19 +00:00
commit
89992f2ce5
|
@ -2285,7 +2285,11 @@ void CServer::FillAntibot(CAntibotRoundData *pData)
|
||||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||||
{
|
{
|
||||||
CAntibotPlayerData *pPlayer = &pData->m_aPlayers[i];
|
CAntibotPlayerData *pPlayer = &pData->m_aPlayers[i];
|
||||||
str_copy(pPlayer->m_aAddress, m_NetServer.ClientAddrString(i));
|
// No need for expensive str_copy since we don't truncate and the string is
|
||||||
|
// ASCII anyway
|
||||||
|
static_assert(std::size((CAntibotPlayerData{}).m_aAddress) >= NETADDR_MAXSTRSIZE);
|
||||||
|
static_assert(sizeof(*(CNetServer{}).ClientAddrString(i)) == NETADDR_MAXSTRSIZE);
|
||||||
|
mem_copy(pPlayer->m_aAddress, m_NetServer.ClientAddrString(i), NETADDR_MAXSTRSIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,7 +270,7 @@ public:
|
||||||
void SignalResend();
|
void SignalResend();
|
||||||
int State() const { return m_State; }
|
int State() const { return m_State; }
|
||||||
const NETADDR *PeerAddress() const { return &m_PeerAddr; }
|
const NETADDR *PeerAddress() const { return &m_PeerAddr; }
|
||||||
const char *PeerAddressString() const { return m_aPeerAddrStr; }
|
const char (*PeerAddressString() const)[NETADDR_MAXSTRSIZE] { return &m_aPeerAddrStr; }
|
||||||
void ConnectAddresses(const NETADDR **ppAddrs, int *pNumAddrs) const
|
void ConnectAddresses(const NETADDR **ppAddrs, int *pNumAddrs) const
|
||||||
{
|
{
|
||||||
*ppAddrs = m_aConnectAddrs;
|
*ppAddrs = m_aConnectAddrs;
|
||||||
|
@ -420,7 +420,7 @@ public:
|
||||||
|
|
||||||
// status requests
|
// status requests
|
||||||
const NETADDR *ClientAddr(int ClientId) const { return m_aSlots[ClientId].m_Connection.PeerAddress(); }
|
const NETADDR *ClientAddr(int ClientId) const { return m_aSlots[ClientId].m_Connection.PeerAddress(); }
|
||||||
const char *ClientAddrString(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddressString(); }
|
const char (*ClientAddrString(int ClientID) const)[NETADDR_MAXSTRSIZE] { return m_aSlots[ClientID].m_Connection.PeerAddressString(); }
|
||||||
bool HasSecurityToken(int ClientId) const { return m_aSlots[ClientId].m_Connection.SecurityToken() != NET_SECURITY_TOKEN_UNSUPPORTED; }
|
bool HasSecurityToken(int ClientId) const { return m_aSlots[ClientId].m_Connection.SecurityToken() != NET_SECURITY_TOKEN_UNSUPPORTED; }
|
||||||
NETADDR Address() const { return m_Address; }
|
NETADDR Address() const { return m_Address; }
|
||||||
NETSOCKET Socket() const { return m_Socket; }
|
NETSOCKET Socket() const { return m_Socket; }
|
||||||
|
|
Loading…
Reference in a new issue