Skip to content

Commit e81ebfb

Browse files
bors[bot]C0D3D3VJupeyyChillerDragon
authored
Merge #4964 #4984 #4985
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 ddnet/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]>
4 parents 740a184 + aeaaa67 + 3435e3a + 18ca71a commit e81ebfb

File tree

6 files changed

+25
-14
lines changed

6 files changed

+25
-14
lines changed

src/engine/client/client.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -3271,6 +3271,10 @@ void CClient::Run()
32713271
GameClient()->OnShutdown();
32723272
Disconnect();
32733273

3274+
// close socket
3275+
for(unsigned int i = 0; i < std::size(m_NetClient); i++)
3276+
m_NetClient[i].Close();
3277+
32743278
delete m_pEditor;
32753279
m_pGraphics->Shutdown();
32763280

src/engine/client/graphics_threaded.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -2246,14 +2246,17 @@ int CGraphics_Threaded::IssueInit()
22462246

22472247
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);
22482248
AddBackEndWarningIfExists();
2249-
m_GLUseTrianglesAsQuad = m_pBackend->UseTrianglesAsQuad();
2250-
m_GLTileBufferingEnabled = m_pBackend->HasTileBuffering();
2251-
m_GLQuadBufferingEnabled = m_pBackend->HasQuadBuffering();
2252-
m_GLQuadContainerBufferingEnabled = m_pBackend->HasQuadContainerBuffering();
2253-
m_GLTextBufferingEnabled = (m_GLQuadContainerBufferingEnabled && m_pBackend->HasTextBuffering());
2254-
m_GLHasTextureArrays = m_pBackend->Has2DTextureArrays();
2255-
m_ScreenHiDPIScale = m_ScreenWidth / (float)g_Config.m_GfxScreenWidth;
2256-
m_ScreenRefreshRate = g_Config.m_GfxScreenRefreshRate;
2249+
if(r == 0)
2250+
{
2251+
m_GLUseTrianglesAsQuad = m_pBackend->UseTrianglesAsQuad();
2252+
m_GLTileBufferingEnabled = m_pBackend->HasTileBuffering();
2253+
m_GLQuadBufferingEnabled = m_pBackend->HasQuadBuffering();
2254+
m_GLQuadContainerBufferingEnabled = m_pBackend->HasQuadContainerBuffering();
2255+
m_GLTextBufferingEnabled = (m_GLQuadContainerBufferingEnabled && m_pBackend->HasTextBuffering());
2256+
m_GLHasTextureArrays = m_pBackend->Has2DTextureArrays();
2257+
m_ScreenHiDPIScale = m_ScreenWidth / (float)g_Config.m_GfxScreenWidth;
2258+
m_ScreenRefreshRate = g_Config.m_GfxScreenRefreshRate;
2259+
}
22572260
return r;
22582261
}
22592262

src/engine/server/server.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -2747,6 +2747,8 @@ int CServer::Run()
27472747
free(Client.m_pPersistentData);
27482748
}
27492749

2750+
m_NetServer.Close();
2751+
27502752
return ErrorShutdown();
27512753
}
27522754

src/engine/shared/network_client.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ bool CNetClient::Open(NETADDR BindAddr)
2323

2424
int CNetClient::Close()
2525
{
26-
// TODO: implement me
27-
return 0;
26+
if(!m_Socket)
27+
return 0;
28+
return net_udp_close(m_Socket);
2829
}
2930

3031
int CNetClient::Disconnect(const char *pReason)

src/engine/shared/network_server.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ int CNetServer::SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_NEWCLIENT_N
9696

9797
int CNetServer::Close()
9898
{
99-
// TODO: implement me
100-
return 0;
99+
if(!m_Socket)
100+
return 0;
101+
return net_udp_close(m_Socket);
101102
}
102103

103104
int CNetServer::Drop(int ClientID, const char *pReason)

src/game/client/components/controls.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ void CControls::ClampMousePos()
561561
{
562562
if(m_pClient->m_Snap.m_SpecInfo.m_Active && m_pClient->m_Snap.m_SpecInfo.m_SpectatorID < 0)
563563
{
564-
m_MousePos[g_Config.m_ClDummy].x = clamp(m_MousePos[g_Config.m_ClDummy].x, 200.0f, Collision()->GetWidth() * 32 - 200.0f);
565-
m_MousePos[g_Config.m_ClDummy].y = clamp(m_MousePos[g_Config.m_ClDummy].y, 200.0f, Collision()->GetHeight() * 32 - 200.0f);
564+
m_MousePos[g_Config.m_ClDummy].x = clamp(m_MousePos[g_Config.m_ClDummy].x, 0.0f, Collision()->GetWidth() * 32.0f);
565+
m_MousePos[g_Config.m_ClDummy].y = clamp(m_MousePos[g_Config.m_ClDummy].y, 0.0f, Collision()->GetHeight() * 32.0f);
566566
}
567567
else
568568
{

0 commit comments

Comments
 (0)