4964: allow freecam to center on world border r=def- a=C0D3D3V

fixes #4953

I think the 200 units or 6.25 blocks more should not bother anyone. 
![fix 2022-04-09_15-14](https://user-images.githubusercontent.com/14315968/162576159-7d73eb8c-b9c9-471b-bed0-7477568376d6.png)
under some circumstances, it will only move to x=1 (or in blocks 0.03) but this should be negligible.  

## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [x] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


4984: Don't read from backend if Init failed r=def- a=Jupeyy

fixes #4981 

This `bug` should not create any uninitended behavior, since these values get reinitialized after the backend creation worked

## 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 if it works standalone, system.c especially
- [ ] 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)


4985: Close sockets r=def- a=ChillerDragon

https://github.com/ddnet/ddnet/pull/4970

Fixes

```
 Direct leak of 205848 byte(s) in 1 object(s) allocated from:
    #0 0x4a200d in malloc (/home/runner/work/ddnet/ddnet/san/DDNet-Server+0x4a200d)
    #1 0xc7fe3f in net_udp_create /home/runner/work/ddnet/ddnet/src/base/system.cpp:1640:41
    #2 0xbf2d0b in CNetServer::Open(NETADDR, CNetBan*, int, int) /home/runner/work/ddnet/ddnet/src/engine/shared/network_server.cpp:55:13
    #3 0x568cdc in CServer::Run() /home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:2448:60
    #4 0x5a922b in main /home/runner/work/ddnet/ddnet/src/engine/server/server.cpp:3718:21
    #5 0x7ff75f52c0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x240b2)
```

## 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 if it works standalone, system.c especially
- [ ] Considered possible null pointers and out of bounds array indexing
- [ ] Changed no physics that affect existing maps
- [x] 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: c0d3d3v <c0d3d3v@mag-keinen-spam.de>
Co-authored-by: Jupeyy <jupjopjap@gmail.com>
Co-authored-by: ChillerDrgon <ChillerDragon@gmail.com>
This commit is contained in:
bors[bot] 2022-04-15 20:37:18 +00:00 committed by GitHub
commit e81ebfb0bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 14 deletions

View file

@ -3271,6 +3271,10 @@ void CClient::Run()
GameClient()->OnShutdown();
Disconnect();
// close socket
for(unsigned int i = 0; i < std::size(m_NetClient); i++)
m_NetClient[i].Close();
delete m_pEditor;
m_pGraphics->Shutdown();

View file

@ -2246,14 +2246,17 @@ int CGraphics_Threaded::IssueInit()
int r = m_pBackend->Init("DDNet Client", &g_Config.m_GfxScreen, &g_Config.m_GfxScreenWidth, &g_Config.m_GfxScreenHeight, &g_Config.m_GfxScreenRefreshRate, g_Config.m_GfxFsaaSamples, Flags, &g_Config.m_GfxDesktopWidth, &g_Config.m_GfxDesktopHeight, &m_ScreenWidth, &m_ScreenHeight, m_pStorage);
AddBackEndWarningIfExists();
m_GLUseTrianglesAsQuad = m_pBackend->UseTrianglesAsQuad();
m_GLTileBufferingEnabled = m_pBackend->HasTileBuffering();
m_GLQuadBufferingEnabled = m_pBackend->HasQuadBuffering();
m_GLQuadContainerBufferingEnabled = m_pBackend->HasQuadContainerBuffering();
m_GLTextBufferingEnabled = (m_GLQuadContainerBufferingEnabled && m_pBackend->HasTextBuffering());
m_GLHasTextureArrays = m_pBackend->Has2DTextureArrays();
m_ScreenHiDPIScale = m_ScreenWidth / (float)g_Config.m_GfxScreenWidth;
m_ScreenRefreshRate = g_Config.m_GfxScreenRefreshRate;
if(r == 0)
{
m_GLUseTrianglesAsQuad = m_pBackend->UseTrianglesAsQuad();
m_GLTileBufferingEnabled = m_pBackend->HasTileBuffering();
m_GLQuadBufferingEnabled = m_pBackend->HasQuadBuffering();
m_GLQuadContainerBufferingEnabled = m_pBackend->HasQuadContainerBuffering();
m_GLTextBufferingEnabled = (m_GLQuadContainerBufferingEnabled && m_pBackend->HasTextBuffering());
m_GLHasTextureArrays = m_pBackend->Has2DTextureArrays();
m_ScreenHiDPIScale = m_ScreenWidth / (float)g_Config.m_GfxScreenWidth;
m_ScreenRefreshRate = g_Config.m_GfxScreenRefreshRate;
}
return r;
}

View file

@ -2747,6 +2747,8 @@ int CServer::Run()
free(Client.m_pPersistentData);
}
m_NetServer.Close();
return ErrorShutdown();
}

View file

@ -23,8 +23,9 @@ bool CNetClient::Open(NETADDR BindAddr)
int CNetClient::Close()
{
// TODO: implement me
return 0;
if(!m_Socket)
return 0;
return net_udp_close(m_Socket);
}
int CNetClient::Disconnect(const char *pReason)

View file

@ -96,8 +96,9 @@ int CNetServer::SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_NEWCLIENT_N
int CNetServer::Close()
{
// TODO: implement me
return 0;
if(!m_Socket)
return 0;
return net_udp_close(m_Socket);
}
int CNetServer::Drop(int ClientID, const char *pReason)

View file

@ -561,8 +561,8 @@ void CControls::ClampMousePos()
{
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID < 0)
{
m_MousePos[g_Config.m_ClDummy].x = clamp(m_MousePos[g_Config.m_ClDummy].x, 200.0f, Collision()->GetWidth() * 32 - 200.0f);
m_MousePos[g_Config.m_ClDummy].y = clamp(m_MousePos[g_Config.m_ClDummy].y, 200.0f, Collision()->GetHeight() * 32 - 200.0f);
m_MousePos[g_Config.m_ClDummy].x = clamp(m_MousePos[g_Config.m_ClDummy].x, 0.0f, Collision()->GetWidth() * 32.0f);
m_MousePos[g_Config.m_ClDummy].y = clamp(m_MousePos[g_Config.m_ClDummy].y, 0.0f, Collision()->GetHeight() * 32.0f);
}
else
{