aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Keresztes Schmidt <carbenium@outlook.com>2020-06-23 08:54:12 +0200
committerPeter Keresztes Schmidt <carbenium@outlook.com>2020-06-23 18:03:16 +0200
commitb210bb37130087d9a25a61dfb1b8baa60540c12c (patch)
tree2bd93f0a254f0d16a78c497817c9badb5d4b36b0
parentdc41aae0427faecef57b831f3a2ed735a9369dd7 (diff)
Core/Misc: Replace Trinity::make_unique with std (#24869)
(cherry picked from commit bab5fd87a34d92737e92d0850be05890a5ce8e24)
-rw-r--r--src/common/Common.h5
-rw-r--r--src/common/Logging/Log.cpp6
-rw-r--r--src/common/Metric/Metric.cpp6
-rw-r--r--src/server/database/Database/DatabaseWorkerPool.cpp6
-rw-r--r--src/server/database/Database/MySQLConnection.cpp4
-rw-r--r--src/server/database/Updater/UpdateFetcher.cpp2
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp2
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp14
-rw-r--r--src/server/game/Maps/Map.cpp2
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp2
-rw-r--r--src/server/game/Scripting/ScriptReloadMgr.cpp2
-rw-r--r--src/server/game/Spells/Spell.cpp4
-rw-r--r--src/server/shared/DataStores/DBCDatabaseLoader.cpp4
-rw-r--r--src/server/shared/Realm/RealmList.cpp10
-rw-r--r--src/server/worldserver/Main.cpp6
15 files changed, 35 insertions, 40 deletions
diff --git a/src/common/Common.h b/src/common/Common.h
index 3f881039dda..2d497b213f7 100644
--- a/src/common/Common.h
+++ b/src/common/Common.h
@@ -121,9 +121,4 @@ TC_COMMON_API LocaleConstant GetLocaleByName(std::string const& name);
#define MAX_QUERY_LEN 32*1024
-namespace Trinity
-{
- using std::make_unique;
-}
-
#endif
diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp
index 77820929a66..13720c4ba41 100644
--- a/src/common/Logging/Log.cpp
+++ b/src/common/Logging/Log.cpp
@@ -152,7 +152,7 @@ void Log::CreateLoggerFromConfig(std::string const& appenderName)
if (level < lowestLogLevel)
lowestLogLevel = level;
- logger = Trinity::make_unique<Logger>(name, level);
+ logger = std::make_unique<Logger>(name, level);
//fprintf(stdout, "Log::CreateLoggerFromConfig: Created Logger %s, Level %u\n", name.c_str(), level);
std::istringstream ss(*iter);
@@ -215,12 +215,12 @@ void Log::RegisterAppender(uint8 index, AppenderCreatorFn appenderCreateFn)
void Log::outMessage(std::string const& filter, LogLevel level, std::string&& message)
{
- write(Trinity::make_unique<LogMessage>(level, filter, std::move(message)));
+ write(std::make_unique<LogMessage>(level, filter, std::move(message)));
}
void Log::outCommand(std::string&& message, std::string&& param1)
{
- write(Trinity::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm", std::move(message), std::move(param1)));
+ write(std::make_unique<LogMessage>(LOG_LEVEL_INFO, "commands.gm", std::move(message), std::move(param1)));
}
void Log::write(std::unique_ptr<LogMessage>&& msg) const
diff --git a/src/common/Metric/Metric.cpp b/src/common/Metric/Metric.cpp
index 02fa87d8d96..b1302aacb5a 100644
--- a/src/common/Metric/Metric.cpp
+++ b/src/common/Metric/Metric.cpp
@@ -27,10 +27,10 @@
void Metric::Initialize(std::string const& realmName, Trinity::Asio::IoContext& ioContext, std::function<void()> overallStatusLogger)
{
- _dataStream = Trinity::make_unique<boost::asio::ip::tcp::iostream>();
+ _dataStream = std::make_unique<boost::asio::ip::tcp::iostream>();
_realmName = FormatInfluxDBTagValue(realmName);
- _batchTimer = Trinity::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
- _overallStatusTimer = Trinity::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
+ _batchTimer = std::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
+ _overallStatusTimer = std::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
_overallStatusLogger = overallStatusLogger;
LoadFromConfigs();
}
diff --git a/src/server/database/Database/DatabaseWorkerPool.cpp b/src/server/database/Database/DatabaseWorkerPool.cpp
index bf70289bd1c..c6a7ac1778c 100644
--- a/src/server/database/Database/DatabaseWorkerPool.cpp
+++ b/src/server/database/Database/DatabaseWorkerPool.cpp
@@ -68,7 +68,7 @@ template <class T>
void DatabaseWorkerPool<T>::SetConnectionInfo(std::string const& infoString,
uint8 const asyncThreads, uint8 const synchThreads)
{
- _connectionInfo = Trinity::make_unique<MySQLConnectionInfo>(infoString);
+ _connectionInfo = std::make_unique<MySQLConnectionInfo>(infoString);
_async_threads = asyncThreads;
_synch_threads = synchThreads;
@@ -365,9 +365,9 @@ uint32 DatabaseWorkerPool<T>::OpenConnections(InternalIndex type, uint8 numConne
switch (type)
{
case IDX_ASYNC:
- return Trinity::make_unique<T>(_queue.get(), *_connectionInfo);
+ return std::make_unique<T>(_queue.get(), *_connectionInfo);
case IDX_SYNCH:
- return Trinity::make_unique<T>(*_connectionInfo);
+ return std::make_unique<T>(*_connectionInfo);
default:
ABORT();
}
diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp
index f1e02d73765..60596a17c5c 100644
--- a/src/server/database/Database/MySQLConnection.cpp
+++ b/src/server/database/Database/MySQLConnection.cpp
@@ -65,7 +65,7 @@ m_Mysql(nullptr),
m_connectionInfo(connInfo),
m_connectionFlags(CONNECTION_ASYNC)
{
- m_worker = Trinity::make_unique<DatabaseWorker>(m_queue, this);
+ m_worker = std::make_unique<DatabaseWorker>(m_queue, this);
}
MySQLConnection::~MySQLConnection()
@@ -509,7 +509,7 @@ void MySQLConnection::PrepareStatement(uint32 index, std::string const& sql, Con
m_prepareError = true;
}
else
- m_stmts[index] = Trinity::make_unique<MySQLPreparedStatement>(reinterpret_cast<MySQLStmt*>(stmt), sql);
+ m_stmts[index] = std::make_unique<MySQLPreparedStatement>(reinterpret_cast<MySQLStmt*>(stmt), sql);
}
}
diff --git a/src/server/database/Updater/UpdateFetcher.cpp b/src/server/database/Updater/UpdateFetcher.cpp
index 8a35ae7d571..b6387e2d31a 100644
--- a/src/server/database/Updater/UpdateFetcher.cpp
+++ b/src/server/database/Updater/UpdateFetcher.cpp
@@ -41,7 +41,7 @@ UpdateFetcher::UpdateFetcher(Path const& sourceDirectory,
std::function<void(std::string const&)> const& apply,
std::function<void(Path const& path)> const& applyFile,
std::function<QueryResult(std::string const&)> const& retrieve) :
- _sourceDirectory(Trinity::make_unique<Path>(sourceDirectory)), _apply(apply), _applyFile(applyFile),
+ _sourceDirectory(std::make_unique<Path>(sourceDirectory)), _apply(apply), _applyFile(applyFile),
_retrieve(retrieve)
{
}
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 7a5fd4106c7..f15780362d1 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -2676,7 +2676,7 @@ private:
GameObjectModel* GameObject::CreateModel()
{
- return GameObjectModel::Create(Trinity::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
+ return GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath());
}
std::string GameObject::GetDebugInfo() const
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index eab78dd6d77..5ad1751f0a2 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -3713,7 +3713,7 @@ void ObjectMgr::LoadPetLevelInfo()
auto& pInfoMapEntry = _petInfoStore[creature_id];
if (!pInfoMapEntry)
- pInfoMapEntry = Trinity::make_unique<PetLevelInfo[]>(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
+ pInfoMapEntry = std::make_unique<PetLevelInfo[]>(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
// data for level 1 stored in [0] array element, ...
PetLevelInfo* pLevelInfo = &pInfoMapEntry[current_level - 1];
@@ -3871,7 +3871,7 @@ void ObjectMgr::LoadPlayerInfo()
continue;
}
- std::unique_ptr<PlayerInfo> info = Trinity::make_unique<PlayerInfo>();
+ std::unique_ptr<PlayerInfo> info = std::make_unique<PlayerInfo>();
info->mapId = mapId;
info->areaId = areaId;
info->positionX = positionX;
@@ -4235,8 +4235,8 @@ void ObjectMgr::LoadPlayerInfo()
auto& info = _playerClassInfo[current_class];
if (!info)
{
- info = Trinity::make_unique<PlayerClassInfo>();
- info->levelInfo = Trinity::make_unique<PlayerClassLevelInfo[]>(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
+ info = std::make_unique<PlayerClassInfo>();
+ info->levelInfo = std::make_unique<PlayerClassLevelInfo[]>(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
}
PlayerClassLevelInfo& levelInfo = info->levelInfo[current_level - 1];
@@ -4327,7 +4327,7 @@ void ObjectMgr::LoadPlayerInfo()
if (auto& info = _playerInfo[current_race][current_class])
{
if (!info->levelInfo)
- info->levelInfo = Trinity::make_unique<PlayerLevelInfo[]>(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
+ info->levelInfo = std::make_unique<PlayerLevelInfo[]>(sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL));
PlayerLevelInfo& levelInfo = info->levelInfo[current_level - 1];
for (uint8 i = 0; i < MAX_STATS; ++i)
@@ -6091,7 +6091,7 @@ void ObjectMgr::LoadInstanceEncounters()
}
DungeonEncounterList& encounters = _dungeonEncounterStore[MAKE_PAIR32(dungeonEncounter->mapId, dungeonEncounter->difficulty)];
- encounters.emplace_back(Trinity::make_unique<DungeonEncounter>(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));
+ encounters.emplace_back(std::make_unique<DungeonEncounter>(dungeonEncounter, EncounterCreditType(creditType), creditEntry, lastEncounterDungeon));
++count;
} while (result->NextRow());
@@ -7169,7 +7169,7 @@ void ObjectMgr::LoadAccessRequirements()
uint32 requirement_ID = MAKE_PAIR32(mapid, difficulty);
auto& ar = _accessRequirementStore[requirement_ID];
- ar = Trinity::make_unique<AccessRequirement>();
+ ar = std::make_unique<AccessRequirement>();
ar->levelMin = fields[2].GetUInt8();
ar->levelMax = fields[3].GetUInt8();
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 07298fe02e0..ced799a9c16 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -4639,7 +4639,7 @@ Weather* Map::GetOrGenerateZoneDefaultWeather(uint32 zoneId)
ZoneDynamicInfo& info = _zoneDynamicInfo[zoneId];
if (!info.DefaultWeather)
{
- info.DefaultWeather = Trinity::make_unique<Weather>(zoneId, weatherData);
+ info.DefaultWeather = std::make_unique<Weather>(zoneId, weatherData);
info.DefaultWeather->ReGenerate();
info.DefaultWeather->UpdateWeather();
}
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 97bb772adc3..e23cf372732 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -223,7 +223,7 @@ public:
void QueueForDelayedDelete(T&& any)
{
_delayed_delete_queue.push_back(
- Trinity::make_unique<
+ std::make_unique<
DeleteableObject<typename std::decay<T>::type>
>(std::forward<T>(any))
);
diff --git a/src/server/game/Scripting/ScriptReloadMgr.cpp b/src/server/game/Scripting/ScriptReloadMgr.cpp
index 4484ba0bf34..85aac8551a3 100644
--- a/src/server/game/Scripting/ScriptReloadMgr.cpp
+++ b/src/server/game/Scripting/ScriptReloadMgr.cpp
@@ -936,7 +936,7 @@ private:
}
// Create the source listener
- auto listener = Trinity::make_unique<SourceUpdateListener>(
+ auto listener = std::make_unique<SourceUpdateListener>(
sScriptReloadMgr->GetSourceDirectory() / module_name,
module_name);
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index b6c7a94aa68..a03600a0d74 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5505,7 +5505,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint
float objSize = target->GetCombatReach();
float range = m_spellInfo->GetMaxRange(true, unitCaster, this) * 1.5f + objSize; // can't be overly strict
- m_preGeneratedPath = Trinity::make_unique<PathGenerator>(unitCaster);
+ m_preGeneratedPath = std::make_unique<PathGenerator>(unitCaster);
m_preGeneratedPath->SetPathLengthLimit(range);
// first try with raycast, if it fails fall back to normal path
@@ -8090,7 +8090,7 @@ WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(WorldObject* caster, Wo
_targetSelectionType(selectionType), _condSrcInfo(nullptr), _condList(condList)
{
if (condList)
- _condSrcInfo = Trinity::make_unique<ConditionSourceInfo>(nullptr, caster);
+ _condSrcInfo = std::make_unique<ConditionSourceInfo>(nullptr, caster);
}
WorldObjectSpellTargetCheck::~WorldObjectSpellTargetCheck()
diff --git a/src/server/shared/DataStores/DBCDatabaseLoader.cpp b/src/server/shared/DataStores/DBCDatabaseLoader.cpp
index 0a721adf411..be57d76dc59 100644
--- a/src/server/shared/DataStores/DBCDatabaseLoader.cpp
+++ b/src/server/shared/DataStores/DBCDatabaseLoader.cpp
@@ -82,8 +82,8 @@ char* DBCDatabaseLoader::Load(uint32& records, char**& indexTable)
indexTable = tmpIdxTable;
}
- std::unique_ptr<char[]> dataTable = Trinity::make_unique<char[]>(result->GetRowCount() * _recordSize);
- std::unique_ptr<uint32[]> newIndexes = Trinity::make_unique<uint32[]>(result->GetRowCount());
+ std::unique_ptr<char[]> dataTable = std::make_unique<char[]>(result->GetRowCount() * _recordSize);
+ std::unique_ptr<uint32[]> newIndexes = std::make_unique<uint32[]>(result->GetRowCount());
uint32 newRecords = 0;
// Insert sql data into the data array
diff --git a/src/server/shared/Realm/RealmList.cpp b/src/server/shared/Realm/RealmList.cpp
index fc76710c35f..522c0faeebb 100644
--- a/src/server/shared/Realm/RealmList.cpp
+++ b/src/server/shared/Realm/RealmList.cpp
@@ -42,8 +42,8 @@ RealmList* RealmList::Instance()
void RealmList::Initialize(Trinity::Asio::IoContext& ioContext, uint32 updateInterval)
{
_updateInterval = updateInterval;
- _updateTimer = Trinity::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
- _resolver = Trinity::make_unique<boost::asio::ip::tcp::resolver>(ioContext);
+ _updateTimer = std::make_unique<Trinity::Asio::DeadlineTimer>(ioContext);
+ _resolver = std::make_unique<boost::asio::ip::tcp::resolver>(ioContext);
LoadBuildInfo();
// Get the content of the realmlist table in the database
@@ -103,11 +103,11 @@ void RealmList::UpdateRealm(RealmHandle const& id, uint32 build, std::string con
realm.AllowedSecurityLevel = allowedSecurityLevel;
realm.PopulationLevel = population;
if (!realm.ExternalAddress || *realm.ExternalAddress != address)
- realm.ExternalAddress = Trinity::make_unique<boost::asio::ip::address>(std::move(address));
+ realm.ExternalAddress = std::make_unique<boost::asio::ip::address>(std::move(address));
if (!realm.LocalAddress || *realm.LocalAddress != localAddr)
- realm.LocalAddress = Trinity::make_unique<boost::asio::ip::address>(std::move(localAddr));
+ realm.LocalAddress = std::make_unique<boost::asio::ip::address>(std::move(localAddr));
if (!realm.LocalSubnetMask || *realm.LocalSubnetMask != localSubmask)
- realm.LocalSubnetMask = Trinity::make_unique<boost::asio::ip::address>(std::move(localSubmask));
+ realm.LocalSubnetMask = std::make_unique<boost::asio::ip::address>(std::move(localSubmask));
realm.Port = port;
}
diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp
index 0db42d2b350..95f0326f028 100644
--- a/src/server/worldserver/Main.cpp
+++ b/src/server/worldserver/Main.cpp
@@ -520,7 +520,7 @@ bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext)
return false;
}
- realm.ExternalAddress = Trinity::make_unique<boost::asio::ip::address>(externalAddress->address());
+ realm.ExternalAddress = std::make_unique<boost::asio::ip::address>(externalAddress->address());
Optional<boost::asio::ip::tcp::endpoint> localAddress = Trinity::Net::Resolve(resolver, boost::asio::ip::tcp::v4(), fields[3].GetString(), "");
if (!localAddress)
@@ -529,7 +529,7 @@ bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext)
return false;
}
- realm.LocalAddress = Trinity::make_unique<boost::asio::ip::address>(localAddress->address());
+ realm.LocalAddress = std::make_unique<boost::asio::ip::address>(localAddress->address());
Optional<boost::asio::ip::tcp::endpoint> localSubmask = Trinity::Net::Resolve(resolver, boost::asio::ip::tcp::v4(), fields[4].GetString(), "");
if (!localSubmask)
@@ -538,7 +538,7 @@ bool LoadRealmInfo(Trinity::Asio::IoContext& ioContext)
return false;
}
- realm.LocalSubnetMask = Trinity::make_unique<boost::asio::ip::address>(localSubmask->address());
+ realm.LocalSubnetMask = std::make_unique<boost::asio::ip::address>(localSubmask->address());
realm.Port = fields[5].GetUInt16();
realm.Type = fields[6].GetUInt8();