mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Cleanup] use std::make_unique (#1259)
* Convert common/eq_limits.cpp to use make_unique * Convert common/net/console_server.cpp to use make_unique * Convert common/net/servertalk_client_connection.cpp to use make_unique * Convert common/net/servertalk_legacy_client_connection.cpp to use make_unique * Convert common/net/servertalk_server.cpp to use make_unique * Convert common/net/websocket_server.cpp to use make_unique * Convert common/net/websocket_server_connection.cpp to use make_unique * Convert common/shareddb.cpp to use make_unique * Convert eqlaunch/worldserver.cpp to use make_unique * Convert loginserver/server_manager.cpp to use make_unique * Convert loginserver/world_server.cpp to use make_unique * Convert queryserv/worldserver.cpp to use make_unique * Convert ucs/worldserver.cpp to use make_unique * Convert world/clientlist.cpp to use make_unique * Convert world/expedition.cpp to use make_unique * Convert world/launcher_link.cpp to use make_unique * Convert world/login_server.cpp to use make_unique * Convert world/main.cpp to use make_unique * Convert world/ucs.cpp to use make_unique * Convert world/web_interface.cpp to use make_unique * Convert world/zonelist.cpp to use make_unique * Convert world/zoneserver.cpp to use make_unique * Convert zone/client.cpp to use make_unique * Convert zone/corpse.cpp to use make_unique * Convert zone/dynamiczone.cpp to use make_unique * Convert zone/expedition.cpp to use make_unique * Convert zone/main.cpp to use make_unique * Convert zone/mob_ai.cpp to use make_unique * Convert zone/mob_movement_manager.cpp to use make_unique * Convert zone/pathfinder_nav_mesh.cpp to use make_unique * Convert zone/worldserver.cpp to use make_unique
This commit is contained in:
committed by
GitHub
parent
fa9478ac44
commit
7a46a6595c
@@ -46,7 +46,7 @@ ClientList::ClientList()
|
||||
{
|
||||
NextCLEID = 1;
|
||||
|
||||
m_tick.reset(new EQ::Timer(5000, true, std::bind(&ClientList::OnTick, this, std::placeholders::_1)));
|
||||
m_tick = std::make_unique<EQ::Timer>(5000, true, std::bind(&ClientList::OnTick, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
ClientList::~ClientList() {
|
||||
|
||||
@@ -112,7 +112,7 @@ bool Expedition::SetNewLeader(uint32_t character_id)
|
||||
void Expedition::SendZonesExpeditionDeleted()
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionID_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionDeleted, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionDeleted, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionID_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
zoneserver_list.SendPacket(pack.get());
|
||||
@@ -121,7 +121,7 @@ void Expedition::SendZonesExpeditionDeleted()
|
||||
void Expedition::SendZonesDurationUpdate()
|
||||
{
|
||||
uint32_t packsize = sizeof(ServerExpeditionUpdateDuration_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionDzDuration, packsize));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionDzDuration, packsize);
|
||||
auto packbuf = reinterpret_cast<ServerExpeditionUpdateDuration_Struct*>(pack->pBuffer);
|
||||
packbuf->expedition_id = GetID();
|
||||
packbuf->new_duration_seconds = static_cast<uint32_t>(m_duration.count());
|
||||
@@ -131,7 +131,7 @@ void Expedition::SendZonesDurationUpdate()
|
||||
void Expedition::SendZonesExpireWarning(uint32_t minutes_remaining)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionExpireWarning_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionExpireWarning, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionExpireWarning, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionExpireWarning_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->minutes_remaining = minutes_remaining;
|
||||
@@ -141,7 +141,7 @@ void Expedition::SendZonesExpireWarning(uint32_t minutes_remaining)
|
||||
void Expedition::SendZonesLeaderChanged()
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionLeaderID_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionLeaderChanged, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionLeaderChanged, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionLeaderID_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->leader_id = m_leader_id;
|
||||
|
||||
@@ -45,7 +45,7 @@ LauncherLink::LauncherLink(int id, std::shared_ptr<EQ::Net::ServertalkServerConn
|
||||
m_bootTimer.Disable();
|
||||
|
||||
tcpc->OnMessage(std::bind(&LauncherLink::ProcessMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_process_timer.reset(new EQ::Timer(100, true, std::bind(&LauncherLink::Process, this, std::placeholders::_1)));
|
||||
m_process_timer = std::make_unique<EQ::Timer>(100, true, std::bind(&LauncherLink::Process, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
LauncherLink::~LauncherLink() {
|
||||
@@ -296,4 +296,4 @@ void LauncherLink::Shutdown() {
|
||||
auto pack = new ServerPacket(ServerOP_ShutdownAll);
|
||||
SendPacket(pack);
|
||||
delete pack;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-10
@@ -342,7 +342,7 @@ bool LoginServer::Connect()
|
||||
}
|
||||
|
||||
if (IsLegacy) {
|
||||
legacy_client.reset(new EQ::Net::ServertalkLegacyClient(LoginServerAddress, LoginServerPort, false));
|
||||
legacy_client = std::make_unique<EQ::Net::ServertalkLegacyClient>(LoginServerAddress, LoginServerPort, false);
|
||||
legacy_client->OnConnect(
|
||||
[this](EQ::Net::ServertalkLegacyClient *client) {
|
||||
if (client) {
|
||||
@@ -356,12 +356,12 @@ bool LoginServer::Connect()
|
||||
SendStatus();
|
||||
zoneserver_list.SendLSZones();
|
||||
|
||||
statusupdate_timer.reset(
|
||||
new EQ::Timer(
|
||||
statusupdate_timer = std::make_unique<EQ::Timer>(
|
||||
|
||||
LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
|
||||
SendStatus();
|
||||
}
|
||||
)
|
||||
|
||||
);
|
||||
}
|
||||
else {
|
||||
@@ -448,7 +448,7 @@ bool LoginServer::Connect()
|
||||
);
|
||||
}
|
||||
else {
|
||||
client.reset(new EQ::Net::ServertalkClient(LoginServerAddress, LoginServerPort, false, "World", ""));
|
||||
client = std::make_unique<EQ::Net::ServertalkClient>(LoginServerAddress, LoginServerPort, false, "World", "");
|
||||
client->OnConnect(
|
||||
[this](EQ::Net::ServertalkClient *client) {
|
||||
if (client) {
|
||||
@@ -461,12 +461,12 @@ bool LoginServer::Connect()
|
||||
SendStatus();
|
||||
zoneserver_list.SendLSZones();
|
||||
|
||||
statusupdate_timer.reset(
|
||||
new EQ::Timer(
|
||||
statusupdate_timer = std::make_unique<EQ::Timer>(
|
||||
|
||||
LoginServer_StatusUpdateInterval, true, [this](EQ::Timer *t) {
|
||||
SendStatus();
|
||||
}
|
||||
));
|
||||
);
|
||||
}
|
||||
else {
|
||||
LogInfo(
|
||||
@@ -552,7 +552,7 @@ bool LoginServer::Connect()
|
||||
);
|
||||
}
|
||||
|
||||
m_keepalive.reset(new EQ::Timer(5000, true, std::bind(&LoginServer::OnKeepAlive, this, std::placeholders::_1)));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(5000, true, std::bind(&LoginServer::OnKeepAlive, this, std::placeholders::_1));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -649,4 +649,4 @@ void LoginServer::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
SendPacket(&pack);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -445,13 +445,13 @@ int main(int argc, char** argv) {
|
||||
std::unique_ptr<EQ::Net::ConsoleServer> console;
|
||||
if (Config->TelnetEnabled) {
|
||||
LogInfo("Console (TCP) listener started");
|
||||
console.reset(new EQ::Net::ConsoleServer(Config->TelnetIP, Config->TelnetTCPPort));
|
||||
console = std::make_unique<EQ::Net::ConsoleServer>(Config->TelnetIP, Config->TelnetTCPPort);
|
||||
RegisterConsoleFunctions(console);
|
||||
}
|
||||
|
||||
zoneserver_list.Init();
|
||||
std::unique_ptr<EQ::Net::ServertalkServer> server_connection;
|
||||
server_connection.reset(new EQ::Net::ServertalkServer());
|
||||
server_connection = std::make_unique<EQ::Net::ServertalkServer>();
|
||||
|
||||
EQ::Net::ServertalkServerOptions server_opts;
|
||||
server_opts.port = Config->WorldTCPPort;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ void UCSConnection::SetConnection(std::shared_ptr<EQ::Net::ServertalkServerConne
|
||||
);
|
||||
}
|
||||
|
||||
m_keepalive.reset(new EQ::Timer(1000, true, std::bind(&UCSConnection::OnKeepAlive, this, std::placeholders::_1)));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(1000, true, std::bind(&UCSConnection::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
const std::shared_ptr<EQ::Net::ServertalkServerConnection> &UCSConnection::GetConnection() const
|
||||
|
||||
@@ -146,7 +146,7 @@ WebInterfaceList::~WebInterfaceList()
|
||||
|
||||
void WebInterfaceList::AddConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
|
||||
{
|
||||
m_interfaces.insert(std::make_pair(connection->GetUUID(), std::unique_ptr<WebInterface>(new WebInterface(connection))));
|
||||
m_interfaces.insert(std::make_pair(connection->GetUUID(), std::make_unique<WebInterface>(connection)));
|
||||
}
|
||||
|
||||
void WebInterfaceList::RemoveConnection(std::shared_ptr<EQ::Net::ServertalkServerConnection> connection)
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@ ZSList::ZSList()
|
||||
CurGroupID = 1;
|
||||
memset(pLockedZones, 0, sizeof(pLockedZones));
|
||||
|
||||
m_tick.reset(new EQ::Timer(5000, true, std::bind(&ZSList::OnTick, this, std::placeholders::_1)));
|
||||
m_keepalive.reset(new EQ::Timer(2500, true, std::bind(&ZSList::OnKeepAlive, this, std::placeholders::_1)));
|
||||
m_tick = std::make_unique<EQ::Timer>(5000, true, std::bind(&ZSList::OnTick, this, std::placeholders::_1));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(2500, true, std::bind(&ZSList::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
ZSList::~ZSList() {
|
||||
|
||||
@@ -70,12 +70,12 @@ ZoneServer::ZoneServer(std::shared_ptr<EQ::Net::ServertalkServerConnection> conn
|
||||
|
||||
tcpc->OnMessage(std::bind(&ZoneServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
boot_timer_obj.reset(new EQ::Timer(100, true, [this](EQ::Timer *obj) {
|
||||
boot_timer_obj = std::make_unique<EQ::Timer>(100, true, [this](EQ::Timer *obj) {
|
||||
if (zone_boot_timer.Check()) {
|
||||
LSBootUpdate(GetZoneID(), true);
|
||||
zone_boot_timer.Disable();
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
this->console = console;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user