mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #5687
5687: Use copy assignment rather than copy variable one by one r=heinrich5991 a=Chairn Less code and i find it more clear :) ## Checklist - [ ] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test (especially base/) or added coverage to integration test - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Chairn <chairn.nq@hotmail.fr>
This commit is contained in:
commit
e5e26097bb
|
@ -512,18 +512,13 @@ void ServerBrowserFormatAddresses(char *pBuffer, int BufferSize, NETADDR *pAddrs
|
|||
|
||||
void CServerBrowser::SetInfo(CServerEntry *pEntry, const CServerInfo &Info)
|
||||
{
|
||||
TRISTATE Fav = pEntry->m_Info.m_Favorite;
|
||||
TRISTATE FavAllowPing = pEntry->m_Info.m_FavoriteAllowPing;
|
||||
bool Off = pEntry->m_Info.m_Official;
|
||||
NETADDR aAddresses[MAX_SERVER_ADDRESSES];
|
||||
mem_copy(aAddresses, pEntry->m_Info.m_aAddresses, sizeof(aAddresses));
|
||||
int NumAddresses = pEntry->m_Info.m_NumAddresses;
|
||||
CServerInfo TmpInfo = pEntry->m_Info;
|
||||
pEntry->m_Info = Info;
|
||||
pEntry->m_Info.m_Favorite = Fav;
|
||||
pEntry->m_Info.m_FavoriteAllowPing = FavAllowPing;
|
||||
pEntry->m_Info.m_Official = Off;
|
||||
mem_copy(pEntry->m_Info.m_aAddresses, aAddresses, sizeof(pEntry->m_Info.m_aAddresses));
|
||||
pEntry->m_Info.m_NumAddresses = NumAddresses;
|
||||
pEntry->m_Info.m_Favorite = TmpInfo.m_Favorite;
|
||||
pEntry->m_Info.m_FavoriteAllowPing = TmpInfo.m_FavoriteAllowPing;
|
||||
pEntry->m_Info.m_Official = TmpInfo.m_Official;
|
||||
mem_copy(pEntry->m_Info.m_aAddresses, TmpInfo.m_aAddresses, sizeof(pEntry->m_Info.m_aAddresses));
|
||||
pEntry->m_Info.m_NumAddresses = TmpInfo.m_NumAddresses;
|
||||
ServerBrowserFormatAddresses(pEntry->m_Info.m_aAddress, sizeof(pEntry->m_Info.m_aAddress), pEntry->m_Info.m_aAddresses, pEntry->m_Info.m_NumAddresses);
|
||||
|
||||
class CPlayerScoreNameLess
|
||||
|
|
Loading…
Reference in a new issue