From 74255b49c074a8edbd776ad4b2546a246bb026bd Mon Sep 17 00:00:00 2001 From: phosit Date: Thu, 16 Apr 2026 18:24:03 +0200 Subject: [PATCH] Use std::unique_ptr for the server turn manager --- source/network/NetServer.cpp | 4 +--- source/network/NetServer.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index 7f88cc7bce..6c826585e5 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -177,8 +177,6 @@ CNetServerWorker::~CNetServerWorker() if (m_Host) enet_host_destroy(m_Host); - - delete m_ServerTurnManager; } @@ -1555,7 +1553,7 @@ void CNetServerWorker::PreStartGame(const CStr& initAttribs) return; } - m_ServerTurnManager = new CNetServerTurnManager(*this); + m_ServerTurnManager = std::make_unique(*this); for (CNetServerSession* session : m_Sessions) { diff --git a/source/network/NetServer.h b/source/network/NetServer.h index e08c2faf16..1fed5b9088 100644 --- a/source/network/NetServer.h +++ b/source/network/NetServer.h @@ -284,7 +284,7 @@ private: u32 m_NextHostID{1}; - CNetServerTurnManager* m_ServerTurnManager{nullptr}; + std::unique_ptr m_ServerTurnManager; /** * The GUID of the client in control of the game (the 'host' from the players' perspective).