forked from mirrors/0ad
Use std::unique_ptr for the server turn manager
This commit is contained in:
@@ -177,8 +177,6 @@ CNetServerWorker::~CNetServerWorker()
|
|||||||
|
|
||||||
if (m_Host)
|
if (m_Host)
|
||||||
enet_host_destroy(m_Host);
|
enet_host_destroy(m_Host);
|
||||||
|
|
||||||
delete m_ServerTurnManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1555,7 +1553,7 @@ void CNetServerWorker::PreStartGame(const CStr& initAttribs)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ServerTurnManager = new CNetServerTurnManager(*this);
|
m_ServerTurnManager = std::make_unique<CNetServerTurnManager>(*this);
|
||||||
|
|
||||||
for (CNetServerSession* session : m_Sessions)
|
for (CNetServerSession* session : m_Sessions)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ private:
|
|||||||
|
|
||||||
u32 m_NextHostID{1};
|
u32 m_NextHostID{1};
|
||||||
|
|
||||||
CNetServerTurnManager* m_ServerTurnManager{nullptr};
|
std::unique_ptr<CNetServerTurnManager> m_ServerTurnManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The GUID of the client in control of the game (the 'host' from the players' perspective).
|
* The GUID of the client in control of the game (the 'host' from the players' perspective).
|
||||||
|
|||||||
Reference in New Issue
Block a user