[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:
Michael Cook (mackal)
2021-02-23 19:30:46 -05:00
committed by GitHub
parent fa9478ac44
commit 7a46a6595c
31 changed files with 109 additions and 109 deletions
+9 -9
View File
@@ -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)
+1 -1
View File
@@ -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;
+2 -2
View File
@@ -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();
+24 -24
View File
@@ -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;
+2 -2
View File
@@ -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) {
+9 -9
View File
@@ -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);
}
+1 -1
View File
@@ -679,7 +679,7 @@ struct MobMovementManager::Implementation {
MobMovementManager::MobMovementManager()
{
_impl.reset(new Implementation());
_impl = std::make_unique<Implementation>();
}
MobMovementManager::~MobMovementManager()
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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)