mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +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:
parent
fa9478ac44
commit
7a46a6595c
@ -794,7 +794,7 @@ void EQ::inventory::InitializeDynamicLookups() {
|
||||
continue;
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<mob> == (int)MobVersion::<mob>
|
||||
inventory_dynamic_nongm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
inventory_dynamic_nongm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
|
||||
|
||||
// clamp affected fields to the lowest standard
|
||||
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
|
||||
@ -864,7 +864,7 @@ void EQ::inventory::InitializeDynamicLookups() {
|
||||
}
|
||||
|
||||
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<client> == (int)MobVersion::<client>
|
||||
inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
|
||||
inventory_dynamic_gm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
|
||||
|
||||
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
|
||||
inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
|
||||
{
|
||||
m_server.reset(new EQ::Net::TCPServer());
|
||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||
m_server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
ConsoleServerConnection *c = new ConsoleServerConnection(this, connection);
|
||||
m_connections.insert(std::make_pair(c->GetUUID(), std::unique_ptr<ConsoleServerConnection>(c)));
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials)
|
||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this))))
|
||||
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this)))
|
||||
{
|
||||
m_port = port;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6)
|
||||
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this))))
|
||||
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this)))
|
||||
{
|
||||
m_port = port;
|
||||
m_ipv6 = ipv6;
|
||||
|
||||
@ -13,7 +13,7 @@ void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
|
||||
m_encrypted = opts.encrypted;
|
||||
m_credentials = opts.credentials;
|
||||
m_allow_downgrade = opts.allow_downgrade;
|
||||
m_server.reset(new EQ::Net::TCPServer());
|
||||
m_server = std::make_unique<EQ::Net::TCPServer>();
|
||||
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this, m_encrypted, m_allow_downgrade));
|
||||
});
|
||||
|
||||
@ -34,8 +34,8 @@ struct EQ::Net::WebsocketServer::Impl
|
||||
|
||||
EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
{
|
||||
_impl.reset(new Impl());
|
||||
_impl->server.reset(new EQ::Net::TCPServer());
|
||||
_impl = std::make_unique<Impl>();
|
||||
_impl->server = std::make_unique<EQ::Net::TCPServer>();
|
||||
_impl->server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||
auto wsc = _impl->ws_server.get_connection();
|
||||
WebsocketServerConnection *c = new WebsocketServerConnection(this, connection, wsc);
|
||||
@ -53,7 +53,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
return websocketpp::lib::error_code();
|
||||
});
|
||||
|
||||
_impl->ping_timer.reset(new EQ::Timer(5000, true, [this](EQ::Timer *t) {
|
||||
_impl->ping_timer = std::make_unique<EQ::Timer>(5000, true, [this](EQ::Timer *t) {
|
||||
auto iter = _impl->connections.begin();
|
||||
|
||||
while (iter != _impl->connections.end()) {
|
||||
@ -67,7 +67,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
|
||||
|
||||
iter++;
|
||||
}
|
||||
}));
|
||||
});
|
||||
|
||||
_impl->methods.insert(std::make_pair("login", MethodHandlerEntry(std::bind(&WebsocketServer::Login, this, std::placeholders::_1, std::placeholders::_2), 0)));
|
||||
_impl->methods.insert(std::make_pair("subscribe", MethodHandlerEntry(std::bind(&WebsocketServer::Subscribe, this, std::placeholders::_1, std::placeholders::_2), 0)));
|
||||
|
||||
@ -20,7 +20,7 @@ EQ::Net::WebsocketServerConnection::WebsocketServerConnection(WebsocketServer *p
|
||||
std::shared_ptr<TCPConnection> connection,
|
||||
std::shared_ptr<websocket_connection> ws_connection)
|
||||
{
|
||||
_impl.reset(new Impl());
|
||||
_impl = std::make_unique<Impl>();
|
||||
_impl->parent = parent;
|
||||
_impl->connection = connection;
|
||||
_impl->id = EQ::Util::UUID::Generate().ToString();
|
||||
|
||||
@ -928,8 +928,8 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("items");
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
items_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
items_hash = std::unique_ptr<EQ::FixedMemoryHashSet<EQ::ItemData>>(new EQ::FixedMemoryHashSet<EQ::ItemData>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size()));
|
||||
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(reinterpret_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading Items: {}", ex.what());
|
||||
@ -1353,8 +1353,8 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("faction");
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
faction_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
faction_hash = std::unique_ptr<EQ::FixedMemoryHashSet<NPCFactionList>>(new EQ::FixedMemoryHashSet<NPCFactionList>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size()));
|
||||
faction_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
faction_hash = std::make_unique<EQ::FixedMemoryHashSet<NPCFactionList>>(reinterpret_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size());
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading npc factions: {}", ex.what());
|
||||
@ -1555,7 +1555,7 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("skill_caps");
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
skill_caps_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
skill_caps_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogError("Error loading skill caps: {}", ex.what());
|
||||
@ -1712,7 +1712,7 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
||||
mutex.Lock();
|
||||
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("spells");
|
||||
spells_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
*records = *reinterpret_cast<uint32*>(spells_mmf->Get());
|
||||
*sp = reinterpret_cast<const SPDat_Spell_Struct*>((char*)spells_mmf->Get() + 4);
|
||||
@ -1920,7 +1920,7 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
|
||||
mutex.Lock();
|
||||
|
||||
std::string file_name = Config->SharedMemDir + prefix + std::string("base_data");
|
||||
base_data_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name));
|
||||
base_data_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
mutex.Unlock();
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading Base Data: {}", ex.what());
|
||||
@ -2223,15 +2223,15 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("loot");
|
||||
mutex.Lock();
|
||||
std::string file_name_lt = Config->SharedMemDir + prefix + std::string("loot_table");
|
||||
loot_table_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name_lt));
|
||||
loot_table_hash = std::unique_ptr<EQ::FixedMemoryVariableHashSet<LootTable_Struct>>(new EQ::FixedMemoryVariableHashSet<LootTable_Struct>(
|
||||
loot_table_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name_lt);
|
||||
loot_table_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootTable_Struct>>(
|
||||
reinterpret_cast<uint8*>(loot_table_mmf->Get()),
|
||||
loot_table_mmf->Size()));
|
||||
loot_table_mmf->Size());
|
||||
std::string file_name_ld = Config->SharedMemDir + prefix + std::string("loot_drop");
|
||||
loot_drop_mmf = std::unique_ptr<EQ::MemoryMappedFile>(new EQ::MemoryMappedFile(file_name_ld));
|
||||
loot_drop_hash = std::unique_ptr<EQ::FixedMemoryVariableHashSet<LootDrop_Struct>>(new EQ::FixedMemoryVariableHashSet<LootDrop_Struct>(
|
||||
loot_drop_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name_ld);
|
||||
loot_drop_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootDrop_Struct>>(
|
||||
reinterpret_cast<uint8*>(loot_drop_mmf->Get()),
|
||||
loot_drop_mmf->Size()));
|
||||
loot_drop_mmf->Size());
|
||||
mutex.Unlock();
|
||||
} catch(std::exception &ex) {
|
||||
LogError("Error loading loot: {}", ex.what());
|
||||
|
||||
@ -29,7 +29,7 @@ WorldServer::WorldServer(std::map<std::string, ZoneLaunch *> &zones, const char
|
||||
m_config(config),
|
||||
m_zones(zones)
|
||||
{
|
||||
m_connection.reset(new EQ::Net::ServertalkClient(config->WorldIP, config->WorldTCPPort, false, "Launcher", config->SharedKey));
|
||||
m_connection = std::make_unique<EQ::Net::ServertalkClient>(config->WorldIP, config->WorldTCPPort, false, "Launcher", config->SharedKey);
|
||||
m_connection->OnConnect([this](EQ::Net::ServertalkClient *client) {
|
||||
OnConnected();
|
||||
});
|
||||
@ -138,4 +138,4 @@ void WorldServer::SendStatus(const char *short_name, uint32 start_count, bool ru
|
||||
|
||||
m_connection->SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ ServerManager::ServerManager()
|
||||
{
|
||||
int listen_port = server.config.GetVariableInt("general", "listen_port", 5998);
|
||||
|
||||
server_connection.reset(new EQ::Net::ServertalkServer());
|
||||
server_connection = std::make_unique<EQ::Net::ServertalkServer>();
|
||||
EQ::Net::ServertalkServerOptions opts;
|
||||
opts.port = listen_port;
|
||||
opts.ipv6 = false;
|
||||
@ -68,7 +68,7 @@ ServerManager::ServerManager()
|
||||
++iter;
|
||||
}
|
||||
|
||||
world_servers.push_back(std::unique_ptr<WorldServer>(new WorldServer(world_connection)));
|
||||
world_servers.push_back(std::make_unique<WorldServer>(world_connection));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@ WorldServer::WorldServer(std::shared_ptr<EQ::Net::ServertalkServerConnection> wo
|
||||
std::bind(&WorldServer::ProcessLSAccountUpdate, this, std::placeholders::_1, std::placeholders::_2)
|
||||
);
|
||||
|
||||
m_keepalive.reset(new EQ::Timer(5000, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1)));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(5000, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
WorldServer::~WorldServer() = default;
|
||||
@ -1317,4 +1317,4 @@ void WorldServer::OnKeepAlive(EQ::Timer *t)
|
||||
{
|
||||
ServerPacket pack(ServerOP_KeepAlive, 0);
|
||||
connection->SendPacket(&pack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ WorldServer::~WorldServer()
|
||||
|
||||
void WorldServer::Connect()
|
||||
{
|
||||
m_connection.reset(new EQ::Net::ServertalkClient(Config->WorldIP, Config->WorldTCPPort, false, "QueryServ", Config->SharedKey));
|
||||
m_connection = std::make_unique<EQ::Net::ServertalkClient>(Config->WorldIP, Config->WorldTCPPort, false, "QueryServ", Config->SharedKey);
|
||||
m_connection->OnMessage(std::bind(&WorldServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
}
|
||||
|
||||
@ -185,4 +185,4 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ void Client55ToServerSayLink(std::string& serverSayLink, const std::string& clie
|
||||
|
||||
WorldServer::WorldServer()
|
||||
{
|
||||
m_connection.reset(new EQ::Net::ServertalkClient(Config->WorldIP, Config->WorldTCPPort, false, "UCS", Config->SharedKey));
|
||||
m_connection = std::make_unique<EQ::Net::ServertalkClient>(Config->WorldIP, Config->WorldTCPPort, false, "UCS", Config->SharedKey);
|
||||
m_connection->OnMessage(std::bind(&WorldServer::ProcessMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -756,7 +756,7 @@ bool Client::AddPacket(const EQApplicationPacket *pApp, bool bAckreq) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
auto c = std::unique_ptr<CLIENTPACKET>(new CLIENTPACKET);
|
||||
auto c = std::make_unique<CLIENTPACKET>();
|
||||
|
||||
c->ack_req = bAckreq;
|
||||
c->app = pApp->Copy();
|
||||
@ -773,7 +773,7 @@ bool Client::AddPacket(EQApplicationPacket** pApp, bool bAckreq) {
|
||||
//drop the packet because it will never get sent.
|
||||
return(false);
|
||||
}
|
||||
auto c = std::unique_ptr<CLIENTPACKET>(new CLIENTPACKET);
|
||||
auto c = std::make_unique<CLIENTPACKET>();
|
||||
|
||||
c->ack_req = bAckreq;
|
||||
c->app = *pApp;
|
||||
@ -3221,7 +3221,7 @@ void Client::MessageString(const CZClientMessageString_Struct* msg)
|
||||
else
|
||||
{
|
||||
uint32_t outsize = sizeof(FormattedMessage_Struct) + msg->args_size;
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_FormattedMessage, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_FormattedMessage, outsize);
|
||||
auto outbuf = reinterpret_cast<FormattedMessage_Struct*>(outapp->pBuffer);
|
||||
outbuf->string_id = msg->string_id;
|
||||
outbuf->type = msg->chat_type;
|
||||
@ -9511,7 +9511,7 @@ void Client::SendCrossZoneMessage(
|
||||
else if (!character_name.empty() && !message.empty())
|
||||
{
|
||||
uint32_t pack_size = sizeof(CZMessagePlayer_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_CZMessagePlayer, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_CZMessagePlayer, pack_size);
|
||||
auto buf = reinterpret_cast<CZMessagePlayer_Struct*>(pack->pBuffer);
|
||||
buf->type = chat_type;
|
||||
strn0cpy(buf->character_name, character_name.c_str(), sizeof(buf->character_name));
|
||||
@ -9544,7 +9544,7 @@ void Client::SendCrossZoneMessageString(
|
||||
|
||||
uint32_t args_size = static_cast<uint32_t>(argument_buffer.size());
|
||||
uint32_t pack_size = sizeof(CZClientMessageString_Struct) + args_size;
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_CZClientMessageString, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_CZClientMessageString, pack_size);
|
||||
auto buf = reinterpret_cast<CZClientMessageString_Struct*>(pack->pBuffer);
|
||||
buf->string_id = string_id;
|
||||
buf->chat_type = chat_type;
|
||||
@ -9791,7 +9791,7 @@ void Client::SendExpeditionLockoutTimers()
|
||||
uint32_t lockout_count = static_cast<uint32_t>(lockout_entries.size());
|
||||
uint32_t lockout_entries_size = sizeof(ExpeditionLockoutTimerEntry_Struct) * lockout_count;
|
||||
uint32_t outsize = sizeof(ExpeditionLockoutTimers_Struct) + lockout_entries_size;
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzExpeditionLockoutTimers, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzExpeditionLockoutTimers, outsize);
|
||||
auto outbuf = reinterpret_cast<ExpeditionLockoutTimers_Struct*>(outapp->pBuffer);
|
||||
outbuf->count = lockout_count;
|
||||
if (!lockout_entries.empty())
|
||||
@ -9804,7 +9804,7 @@ void Client::SendExpeditionLockoutTimers()
|
||||
void Client::RequestPendingExpeditionInvite()
|
||||
{
|
||||
uint32_t packsize = sizeof(ServerExpeditionCharacterID_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionRequestInvite, packsize));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionRequestInvite, packsize);
|
||||
auto packbuf = reinterpret_cast<ServerExpeditionCharacterID_Struct*>(pack->pBuffer);
|
||||
packbuf->character_id = CharacterID();
|
||||
worldserver.SendPacket(pack.get());
|
||||
@ -9894,7 +9894,7 @@ void Client::SendDzCompassUpdate()
|
||||
uint32 count = static_cast<uint32_t>(compass_entries.size());
|
||||
uint32 entries_size = sizeof(DynamicZoneCompassEntry_Struct) * count;
|
||||
uint32 outsize = sizeof(DynamicZoneCompass_Struct) + entries_size;
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzCompass, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzCompass, outsize);
|
||||
auto outbuf = reinterpret_cast<DynamicZoneCompass_Struct*>(outapp->pBuffer);
|
||||
outbuf->count = count;
|
||||
memcpy(outbuf->entries, compass_entries.data(), entries_size);
|
||||
@ -9972,7 +9972,7 @@ void Client::MovePCDynamicZone(uint32 zone_id, int zone_version, bool msg_if_inv
|
||||
uint32 count = static_cast<uint32_t>(client_dzs.size());
|
||||
uint32 entries_size = sizeof(DynamicZoneChooseZoneEntry_Struct) * count;
|
||||
uint32 outsize = sizeof(DynamicZoneChooseZone_Struct) + entries_size;
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzChooseZone, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzChooseZone, outsize);
|
||||
auto outbuf = reinterpret_cast<DynamicZoneChooseZone_Struct*>(outapp->pBuffer);
|
||||
outbuf->count = count;
|
||||
for (int i = 0; i < client_dzs.size(); ++i)
|
||||
|
||||
@ -1631,7 +1631,7 @@ void Corpse::LoadPlayerCorpseDecayTime(uint32 corpse_db_id){
|
||||
|
||||
void Corpse::SendWorldSpawnPlayerCorpseInZone(uint32_t zone_id)
|
||||
{
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct)));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_SpawnPlayerCorpse, sizeof(SpawnPlayerCorpse_Struct));
|
||||
SpawnPlayerCorpse_Struct* spc = reinterpret_cast<SpawnPlayerCorpse_Struct*>(pack->pBuffer);
|
||||
spc->player_corpse_id = corpse_db_id;
|
||||
spc->zone_id = zone_id;
|
||||
|
||||
@ -380,7 +380,7 @@ void DynamicZone::RemoveAllCharacters(bool enable_removal_timers)
|
||||
else if (GetInstanceID() != 0)
|
||||
{
|
||||
uint32_t packsize = sizeof(ServerDzCharacter_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_DzRemoveAllCharacters, packsize));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllCharacters, packsize);
|
||||
auto packbuf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||
packbuf->zone_id = GetZoneID();
|
||||
packbuf->instance_id = GetInstanceID();
|
||||
@ -429,7 +429,7 @@ void DynamicZone::SendInstanceCharacterChange(uint32_t character_id, bool remove
|
||||
else if (GetInstanceID() != 0)
|
||||
{
|
||||
uint32_t packsize = sizeof(ServerDzCharacter_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_DzCharacterChange, packsize));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCharacterChange, packsize);
|
||||
auto packbuf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
|
||||
packbuf->zone_id = GetZoneID();
|
||||
packbuf->instance_id = GetInstanceID();
|
||||
|
||||
@ -102,7 +102,7 @@ Expedition* Expedition::TryCreate(
|
||||
|
||||
if (expedition_id)
|
||||
{
|
||||
auto expedition = std::unique_ptr<Expedition>(new Expedition(
|
||||
auto expedition = std::make_unique<Expedition>(
|
||||
expedition_id,
|
||||
expedition_uuid,
|
||||
dynamiczone,
|
||||
@ -110,7 +110,7 @@ Expedition* Expedition::TryCreate(
|
||||
ExpeditionMember{ request.GetLeaderID(), request.GetLeaderName() },
|
||||
request.GetMinPlayers(),
|
||||
request.GetMaxPlayers()
|
||||
));
|
||||
);
|
||||
|
||||
LogExpeditions(
|
||||
"Created [{}] [{}] instance id: [{}] leader: [{}] minplayers: [{}] maxplayers: [{}]",
|
||||
@ -172,7 +172,7 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
|
||||
|
||||
dynamic_zone_ids.emplace_back(dynamic_zone_id);
|
||||
|
||||
std::unique_ptr<Expedition> expedition = std::unique_ptr<Expedition>(new Expedition(
|
||||
std::unique_ptr<Expedition> expedition = std::make_unique<Expedition>(
|
||||
expedition_id,
|
||||
row[col::uuid], // expedition uuid
|
||||
DynamicZone{ dynamic_zone_id },
|
||||
@ -180,7 +180,7 @@ void Expedition::CacheExpeditions(MySQLRequestResult& results)
|
||||
ExpeditionMember{ leader_id, row[col::leader_name] }, // expedition leader id, name
|
||||
strtoul(row[col::min_players], nullptr, 10), // min_players
|
||||
strtoul(row[col::max_players], nullptr, 10) // max_players
|
||||
));
|
||||
);
|
||||
|
||||
bool add_replay_on_join = (strtoul(row[col::add_replay_on_join], nullptr, 10) != 0);
|
||||
bool is_locked = (strtoul(row[col::is_locked], nullptr, 10) != 0);
|
||||
@ -1429,7 +1429,7 @@ void Expedition::SendWorldPendingInvite(const ExpeditionInvite& invite, const st
|
||||
std::unique_ptr<EQApplicationPacket> Expedition::CreateExpireWarningPacket(uint32_t minutes_remaining)
|
||||
{
|
||||
uint32_t outsize = sizeof(ExpeditionExpireWarning);
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzExpeditionEndsWarning, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzExpeditionEndsWarning, outsize);
|
||||
auto buf = reinterpret_cast<ExpeditionExpireWarning*>(outapp->pBuffer);
|
||||
buf->minutes_remaining = minutes_remaining;
|
||||
return outapp;
|
||||
@ -1438,7 +1438,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateExpireWarningPacket(uint3
|
||||
std::unique_ptr<EQApplicationPacket> Expedition::CreateInfoPacket(bool clear)
|
||||
{
|
||||
uint32_t outsize = sizeof(ExpeditionInfo_Struct);
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzExpeditionInfo, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzExpeditionInfo, outsize);
|
||||
auto info = reinterpret_cast<ExpeditionInfo_Struct*>(outapp->pBuffer);
|
||||
if (!clear)
|
||||
{
|
||||
@ -1454,7 +1454,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateInvitePacket(
|
||||
const std::string& inviter_name, const std::string& swap_remove_name)
|
||||
{
|
||||
uint32_t outsize = sizeof(ExpeditionInvite_Struct);
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzExpeditionInvite, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzExpeditionInvite, outsize);
|
||||
auto outbuf = reinterpret_cast<ExpeditionInvite_Struct*>(outapp->pBuffer);
|
||||
strn0cpy(outbuf->inviter_name, inviter_name.c_str(), sizeof(outbuf->inviter_name));
|
||||
strn0cpy(outbuf->expedition_name, m_expedition_name.c_str(), sizeof(outbuf->expedition_name));
|
||||
@ -1470,7 +1470,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateMemberListPacket(bool cle
|
||||
uint32_t member_count = clear ? 0 : static_cast<uint32_t>(m_members.size());
|
||||
uint32_t member_entries_size = sizeof(ExpeditionMemberEntry_Struct) * member_count;
|
||||
uint32_t outsize = sizeof(ExpeditionMemberList_Struct) + member_entries_size;
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzMemberList, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzMemberList, outsize);
|
||||
auto buf = reinterpret_cast<ExpeditionMemberList_Struct*>(outapp->pBuffer);
|
||||
|
||||
buf->member_count = member_count;
|
||||
@ -1491,7 +1491,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateMemberListNamePacket(
|
||||
const std::string& name, bool remove_name)
|
||||
{
|
||||
uint32_t outsize = sizeof(ExpeditionMemberListName_Struct);
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzMemberListName, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzMemberListName, outsize);
|
||||
auto buf = reinterpret_cast<ExpeditionMemberListName_Struct*>(outapp->pBuffer);
|
||||
buf->add_name = !remove_name;
|
||||
strn0cpy(buf->name, name.c_str(), sizeof(buf->name));
|
||||
@ -1503,7 +1503,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateMemberListStatusPacket(
|
||||
{
|
||||
// member list status uses member list struct with a single entry
|
||||
uint32_t outsize = sizeof(ExpeditionMemberList_Struct) + sizeof(ExpeditionMemberEntry_Struct);
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzMemberListStatus, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzMemberListStatus, outsize);
|
||||
auto buf = reinterpret_cast<ExpeditionMemberList_Struct*>(outapp->pBuffer);
|
||||
buf->member_count = 1;
|
||||
|
||||
@ -1517,7 +1517,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateMemberListStatusPacket(
|
||||
std::unique_ptr<EQApplicationPacket> Expedition::CreateLeaderNamePacket()
|
||||
{
|
||||
uint32_t outsize = sizeof(ExpeditionSetLeaderName_Struct);
|
||||
auto outapp = std::unique_ptr<EQApplicationPacket>(new EQApplicationPacket(OP_DzSetLeaderName, outsize));
|
||||
auto outapp = std::make_unique<EQApplicationPacket>(OP_DzSetLeaderName, outsize);
|
||||
auto buf = reinterpret_cast<ExpeditionSetLeaderName_Struct*>(outapp->pBuffer);
|
||||
strn0cpy(buf->leader_name, m_leader.name.c_str(), sizeof(buf->leader_name));
|
||||
return outapp;
|
||||
@ -1526,7 +1526,7 @@ std::unique_ptr<EQApplicationPacket> Expedition::CreateLeaderNamePacket()
|
||||
void Expedition::SendWorldExpeditionUpdate(uint16_t server_opcode)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionID_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(server_opcode, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionID_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->sender_zone_id = zone ? zone->GetZoneID() : 0;
|
||||
@ -1539,7 +1539,7 @@ void Expedition::SendWorldAddPlayerInvite(
|
||||
{
|
||||
auto server_opcode = pending ? ServerOP_ExpeditionSaveInvite : ServerOP_ExpeditionDzAddPlayer;
|
||||
uint32_t pack_size = sizeof(ServerDzCommand_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(server_opcode, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzCommand_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->is_char_online = false;
|
||||
@ -1553,7 +1553,7 @@ void Expedition::SendWorldLockoutDuration(
|
||||
const ExpeditionLockoutTimer& lockout, int seconds, bool members_only)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionLockout_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionLockoutDuration, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionLockoutDuration, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionLockout_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->expire_time = lockout.GetExpireTime();
|
||||
@ -1570,7 +1570,7 @@ void Expedition::SendWorldLockoutUpdate(
|
||||
const ExpeditionLockoutTimer& lockout, bool remove, bool members_only)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionLockout_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionLockout, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionLockout, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionLockout_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->expire_time = lockout.GetExpireTime();
|
||||
@ -1586,7 +1586,7 @@ void Expedition::SendWorldLockoutUpdate(
|
||||
void Expedition::SendWorldMakeLeaderRequest(uint32_t requester_id, const std::string& new_leader_name)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerDzCommandMakeLeader_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionDzMakeLeader, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionDzMakeLeader, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzCommandMakeLeader_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->requester_id = requester_id;
|
||||
@ -1598,7 +1598,7 @@ void Expedition::SendWorldMemberChanged(const std::string& char_name, uint32_t c
|
||||
{
|
||||
// notify other zones of added or removed member
|
||||
uint32_t pack_size = sizeof(ServerExpeditionMemberChange_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionMemberChange, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionMemberChange, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionMemberChange_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->sender_zone_id = zone ? zone->GetZoneID() : 0;
|
||||
@ -1612,7 +1612,7 @@ void Expedition::SendWorldMemberChanged(const std::string& char_name, uint32_t c
|
||||
void Expedition::SendWorldMemberStatus(uint32_t character_id, ExpeditionMemberStatus status)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionMemberStatus_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionMemberStatus, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionMemberStatus, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionMemberStatus_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->sender_zone_id = zone ? zone->GetZoneID() : 0;
|
||||
@ -1625,7 +1625,7 @@ void Expedition::SendWorldMemberStatus(uint32_t character_id, ExpeditionMemberSt
|
||||
void Expedition::SendWorldDzLocationUpdate(uint16_t server_opcode, const DynamicZoneLocation& location)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerDzLocation_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(server_opcode, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
|
||||
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
|
||||
buf->owner_id = GetID();
|
||||
buf->dz_zone_id = m_dynamiczone.GetZoneID();
|
||||
@ -1644,7 +1644,7 @@ void Expedition::SendWorldMemberSwapped(
|
||||
const std::string& remove_char_name, uint32_t remove_char_id, const std::string& add_char_name, uint32_t add_char_id)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionMemberSwap_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionMemberSwap, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionMemberSwap, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionMemberSwap_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->sender_zone_id = zone ? zone->GetZoneID() : 0;
|
||||
@ -1659,7 +1659,7 @@ void Expedition::SendWorldMemberSwapped(
|
||||
void Expedition::SendWorldSettingChanged(uint16_t server_opcode, bool setting_value)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionSetting_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(server_opcode, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionSetting_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->sender_zone_id = zone ? zone->GetZoneID() : 0;
|
||||
@ -1675,7 +1675,7 @@ void Expedition::SendWorldGetOnlineMembers(
|
||||
uint32_t count = static_cast<uint32_t>(expedition_character_ids.size());
|
||||
uint32_t entries_size = sizeof(ServerExpeditionCharacterEntry_Struct) * count;
|
||||
uint32_t pack_size = sizeof(ServerExpeditionCharacters_Struct) + entries_size;
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionGetOnlineMembers, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionGetOnlineMembers, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionCharacters_Struct*>(pack->pBuffer);
|
||||
buf->sender_zone_id = zone ? zone->GetZoneID() : 0;
|
||||
buf->sender_instance_id = zone ? zone->GetInstanceID() : 0;
|
||||
@ -1695,7 +1695,7 @@ void Expedition::SendWorldCharacterLockout(
|
||||
uint32_t character_id, const ExpeditionLockoutTimer& lockout, bool remove)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionCharacterLockout_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionCharacterLockout, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionCharacterLockout, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionCharacterLockout_Struct*>(pack->pBuffer);
|
||||
buf->remove = remove;
|
||||
buf->character_id = character_id;
|
||||
@ -1710,7 +1710,7 @@ void Expedition::SendWorldCharacterLockout(
|
||||
void Expedition::SendWorldSetSecondsRemaining(uint32_t seconds_remaining)
|
||||
{
|
||||
uint32_t pack_size = sizeof(ServerExpeditionUpdateDuration_Struct);
|
||||
auto pack = std::unique_ptr<ServerPacket>(new ServerPacket(ServerOP_ExpeditionSecondsRemaining, pack_size));
|
||||
auto pack = std::make_unique<ServerPacket>(ServerOP_ExpeditionSecondsRemaining, pack_size);
|
||||
auto buf = reinterpret_cast<ServerExpeditionUpdateDuration_Struct*>(pack->pBuffer);
|
||||
buf->expedition_id = GetID();
|
||||
buf->new_duration_seconds = seconds_remaining;
|
||||
|
||||
@ -484,7 +484,7 @@ int main(int argc, char** argv) {
|
||||
*/
|
||||
if (!websocker_server_opened && Config->ZonePort != 0) {
|
||||
LogInfo("Websocket Server listener started ([{}]:[{}])", Config->TelnetIP.c_str(), Config->ZonePort);
|
||||
ws_server.reset(new EQ::Net::WebsocketServer(Config->TelnetIP, Config->ZonePort));
|
||||
ws_server = std::make_unique<EQ::Net::WebsocketServer>(Config->TelnetIP, Config->ZonePort);
|
||||
RegisterApiService(ws_server);
|
||||
websocker_server_opened = true;
|
||||
}
|
||||
@ -501,7 +501,7 @@ int main(int argc, char** argv) {
|
||||
opts.daybreak_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
||||
opts.daybreak_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
||||
opts.daybreak_options.outgoing_data_rate = RuleR(Network, ClientDataRate);
|
||||
eqsm.reset(new EQ::Net::EQStreamManager(opts));
|
||||
eqsm = std::make_unique<EQ::Net::EQStreamManager>(opts);
|
||||
eqsf_open = true;
|
||||
|
||||
eqsm->OnNewConnection([&stream_identifier](std::shared_ptr<EQ::Net::EQStream> stream) {
|
||||
|
||||
@ -435,13 +435,13 @@ void Mob::AI_Start(uint32 iMoveDelay) {
|
||||
time_until_can_move = 0;
|
||||
|
||||
pAIControlled = true;
|
||||
AI_think_timer = std::unique_ptr<Timer>(new Timer(AIthink_duration));
|
||||
AI_think_timer = std::make_unique<Timer>(AIthink_duration);
|
||||
AI_think_timer->Trigger();
|
||||
|
||||
AI_walking_timer = std::unique_ptr<Timer>(new Timer(0));
|
||||
AI_movement_timer = std::unique_ptr<Timer>(new Timer(AImovement_duration));
|
||||
AI_target_check_timer = std::unique_ptr<Timer>(new Timer(AItarget_check_duration));
|
||||
AI_feign_remember_timer = std::unique_ptr<Timer>(new Timer(AIfeignremember_delay));
|
||||
AI_walking_timer = std::make_unique<Timer>(0);
|
||||
AI_movement_timer = std::make_unique<Timer>(AImovement_duration);
|
||||
AI_target_check_timer = std::make_unique<Timer>(AItarget_check_duration);
|
||||
AI_feign_remember_timer = std::make_unique<Timer>(AIfeignremember_delay);
|
||||
AI_scan_door_open_timer = std::make_unique<Timer>(AI_scan_door_open_interval);
|
||||
|
||||
if (GetBodyType() == BT_Animal && !RuleB(NPC, AnimalsOpenDoors)) {
|
||||
@ -453,9 +453,9 @@ void Mob::AI_Start(uint32 iMoveDelay) {
|
||||
}
|
||||
|
||||
if (CastToNPC()->WillAggroNPCs())
|
||||
AI_scan_area_timer = std::unique_ptr<Timer>(new Timer(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax))));
|
||||
AI_scan_area_timer = std::make_unique<Timer>(RandomTimer(RuleI(NPC, NPCToNPCAggroTimerMin), RuleI(NPC, NPCToNPCAggroTimerMax)));
|
||||
|
||||
AI_check_signal_timer = std::unique_ptr<Timer>(new Timer(AI_check_signal_timer_delay));
|
||||
AI_check_signal_timer = std::make_unique<Timer>(AI_check_signal_timer_delay);
|
||||
|
||||
|
||||
if (GetAggroRange() == 0)
|
||||
@ -488,10 +488,10 @@ void NPC::AI_Start(uint32 iMoveDelay) {
|
||||
return;
|
||||
|
||||
if (AIspells.empty()) {
|
||||
AIautocastspell_timer = std::unique_ptr<Timer>(new Timer(1000));
|
||||
AIautocastspell_timer = std::make_unique<Timer>(1000);
|
||||
AIautocastspell_timer->Disable();
|
||||
} else {
|
||||
AIautocastspell_timer = std::unique_ptr<Timer>(new Timer(500));
|
||||
AIautocastspell_timer = std::make_unique<Timer>(500);
|
||||
AIautocastspell_timer->Start(RandomTimer(0, 300), false);
|
||||
}
|
||||
|
||||
|
||||
@ -679,7 +679,7 @@ struct MobMovementManager::Implementation {
|
||||
|
||||
MobMovementManager::MobMovementManager()
|
||||
{
|
||||
_impl.reset(new Implementation());
|
||||
_impl = std::make_unique<Implementation>();
|
||||
}
|
||||
|
||||
MobMovementManager::~MobMovementManager()
|
||||
|
||||
@ -20,7 +20,7 @@ struct PathfinderNavmesh::Implementation
|
||||
|
||||
PathfinderNavmesh::PathfinderNavmesh(const std::string &path)
|
||||
{
|
||||
m_impl.reset(new Implementation());
|
||||
m_impl = std::make_unique<Implementation>();
|
||||
m_impl->nav_mesh = nullptr;
|
||||
m_impl->query = nullptr;
|
||||
Load(path);
|
||||
|
||||
@ -80,14 +80,14 @@ WorldServer::~WorldServer() {
|
||||
|
||||
void WorldServer::Connect()
|
||||
{
|
||||
m_connection.reset(new EQ::Net::ServertalkClient(Config->WorldIP, Config->WorldTCPPort, false, "Zone", Config->SharedKey));
|
||||
m_connection = std::make_unique<EQ::Net::ServertalkClient>(Config->WorldIP, Config->WorldTCPPort, false, "Zone", Config->SharedKey);
|
||||
m_connection->OnConnect([this](EQ::Net::ServertalkClient *client) {
|
||||
OnConnected();
|
||||
});
|
||||
|
||||
m_connection->OnMessage(std::bind(&WorldServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
m_keepalive.reset(new EQ::Timer(2500, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1)));
|
||||
m_keepalive = std::make_unique<EQ::Timer>(2500, true, std::bind(&WorldServer::OnKeepAlive, this, std::placeholders::_1));
|
||||
}
|
||||
|
||||
bool WorldServer::SendPacket(ServerPacket *pack)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user