Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
4964: allow freecam to center on world border r=def- a=C0D3D3V

fixes ddnet#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 ddnet#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

ddnet#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 <[email protected]>
Co-authored-by: Jupeyy <[email protected]>
Co-authored-by: ChillerDrgon <[email protected]>
  • Loading branch information
4 people authored Apr 15, 2022
4 parents 740a184 + aeaaa67 + 3435e3a + 18ca71a commit e81ebfb
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
19 changes: 11 additions & 8 deletions src/engine/client/graphics_threaded.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/engine/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,8 @@ int CServer::Run()
free(Client.m_pPersistentData);
}

m_NetServer.Close();

return ErrorShutdown();
}

Expand Down
5 changes: 3 additions & 2 deletions src/engine/shared/network_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions src/engine/shared/network_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/game/client/components/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit e81ebfb

Please sign in to comment.