diff options
author | Peter Keresztes Schmidt <carbenium@outlook.com> | 2020-06-23 08:54:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 08:54:12 +0200 |
commit | bab5fd87a34d92737e92d0850be05890a5ce8e24 (patch) | |
tree | 6c83cf8a907dc04075b52f394e25a33985dc5b41 | |
parent | 01c8d03e2ec67d4d4660e7e229274e86ba41420e (diff) |
Core/Misc: Replace Trinity::make_unique with std (#24869)
26 files changed, 59 insertions, 64 deletions
diff --git a/src/common/Common.h b/src/common/Common.h index 7f76698c9c9..e97288996f8 100644 --- a/src/common/Common.h +++ b/src/common/Common.h @@ -125,9 +125,4 @@ struct TC_COMMON_API LocalizedString #define MAX_QUERY_LEN 32*1024 -namespace Trinity -{ - using std::make_unique; -} - #endif diff --git a/src/common/DataStores/DB2FileLoader.cpp b/src/common/DataStores/DB2FileLoader.cpp index 824f3e47945..46c3f3d6b9c 100644 --- a/src/common/DataStores/DB2FileLoader.cpp +++ b/src/common/DataStores/DB2FileLoader.cpp @@ -348,7 +348,7 @@ bool DB2FileLoaderRegularImpl::LoadTableData(DB2FileSource* source, uint32 secti { if (!_data) { - _data = Trinity::make_unique<uint8[]>(_header->RecordSize * _header->RecordCount + _header->StringTableSize + 8); + _data = std::make_unique<uint8[]>(_header->RecordSize * _header->RecordCount + _header->StringTableSize + 8); _stringTable = &_data[_header->RecordSize * _header->RecordCount]; } @@ -1002,7 +1002,7 @@ DB2FileLoaderSparseImpl::DB2FileLoaderSparseImpl(char const* fileName, DB2FileLo _source(source), _totalRecordSize(0), _maxRecordSize(0), - _fieldAndArrayOffsets(loadInfo ? (Trinity::make_unique<std::size_t[]>(loadInfo->Meta->FieldCount + loadInfo->FieldCount - (!loadInfo->Meta->HasIndexFieldInData() ? 1 : 0))) : nullptr) + _fieldAndArrayOffsets(loadInfo ? (std::make_unique<std::size_t[]>(loadInfo->Meta->FieldCount + loadInfo->FieldCount - (!loadInfo->Meta->HasIndexFieldInData() ? 1 : 0))) : nullptr) { } @@ -1057,7 +1057,7 @@ bool DB2FileLoaderSparseImpl::LoadCatalogData(DB2FileSource* source, uint32 sect void DB2FileLoaderSparseImpl::SetAdditionalData(std::vector<uint32> /*idTable*/, std::vector<DB2RecordCopy> /*copyTable*/, std::vector<std::vector<DB2IndexData>> parentIndexes) { _parentIndexes = std::move(parentIndexes); - _recordBuffer = Trinity::make_unique<uint8[]>(_maxRecordSize); + _recordBuffer = std::make_unique<uint8[]>(_maxRecordSize); } char* DB2FileLoaderSparseImpl::AutoProduceData(uint32& maxId, char**& indexTable, std::vector<char*>& stringPool) @@ -1777,7 +1777,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo if (loadInfo && (_header.ParentLookupCount && loadInfo->Meta->ParentIndexField == -1)) return false; - std::unique_ptr<DB2SectionHeader[]> sections = Trinity::make_unique<DB2SectionHeader[]>(_header.SectionCount); + std::unique_ptr<DB2SectionHeader[]> sections = std::make_unique<DB2SectionHeader[]>(_header.SectionCount); if (_header.SectionCount && !source->Read(sections.get(), sizeof(DB2SectionHeader) * _header.SectionCount)) return false; @@ -1808,7 +1808,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo return false; } - std::unique_ptr<DB2FieldEntry[]> fieldData = Trinity::make_unique<DB2FieldEntry[]>(_header.FieldCount); + std::unique_ptr<DB2FieldEntry[]> fieldData = std::make_unique<DB2FieldEntry[]>(_header.FieldCount); if (!source->Read(fieldData.get(), sizeof(DB2FieldEntry) * _header.FieldCount)) return false; @@ -1818,7 +1818,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo std::unique_ptr<std::unordered_map<uint32, uint32>[]> commonValues; if (_header.ColumnMetaSize) { - columnMeta = Trinity::make_unique<DB2ColumnMeta[]>(_header.TotalFieldCount); + columnMeta = std::make_unique<DB2ColumnMeta[]>(_header.TotalFieldCount); if (!source->Read(columnMeta.get(), _header.ColumnMetaSize)) return false; @@ -1830,30 +1830,30 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo columnMeta[loadInfo->Meta->IndexField].CompressionType == DB2ColumnCompression::SignedImmediate); } - palletValues = Trinity::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount); + palletValues = std::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount); for (uint32 i = 0; i < _header.TotalFieldCount; ++i) { if (columnMeta[i].CompressionType != DB2ColumnCompression::Pallet) continue; - palletValues[i] = Trinity::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue)); + palletValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue)); if (!source->Read(palletValues[i].get(), columnMeta[i].AdditionalDataSize)) return false; } - palletArrayValues = Trinity::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount); + palletArrayValues = std::make_unique<std::unique_ptr<DB2PalletValue[]>[]>(_header.TotalFieldCount); for (uint32 i = 0; i < _header.TotalFieldCount; ++i) { if (columnMeta[i].CompressionType != DB2ColumnCompression::PalletArray) continue; - palletArrayValues[i] = Trinity::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue)); + palletArrayValues[i] = std::make_unique<DB2PalletValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2PalletValue)); if (!source->Read(palletArrayValues[i].get(), columnMeta[i].AdditionalDataSize)) return false; } - std::unique_ptr<std::unique_ptr<DB2CommonValue[]>[]> commonData = Trinity::make_unique<std::unique_ptr<DB2CommonValue[]>[]>(_header.TotalFieldCount); - commonValues = Trinity::make_unique<std::unordered_map<uint32, uint32>[]>(_header.TotalFieldCount); + std::unique_ptr<std::unique_ptr<DB2CommonValue[]>[]> commonData = std::make_unique<std::unique_ptr<DB2CommonValue[]>[]>(_header.TotalFieldCount); + commonValues = std::make_unique<std::unordered_map<uint32, uint32>[]>(_header.TotalFieldCount); for (uint32 i = 0; i < _header.TotalFieldCount; ++i) { if (columnMeta[i].CompressionType != DB2ColumnCompression::CommonData) @@ -1862,7 +1862,7 @@ bool DB2FileLoader::LoadHeaders(DB2FileSource* source, DB2FileLoadInfo const* lo if (!columnMeta[i].AdditionalDataSize) continue; - commonData[i] = Trinity::make_unique<DB2CommonValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2CommonValue)); + commonData[i] = std::make_unique<DB2CommonValue[]>(columnMeta[i].AdditionalDataSize / sizeof(DB2CommonValue)); if (!source->Read(commonData[i].get(), columnMeta[i].AdditionalDataSize)) return false; diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index 89a971d3ffb..3ec5aeb421a 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 const 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 d5a642536dc..285a836a44a 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/bnetserver/REST/LoginRESTService.cpp b/src/server/bnetserver/REST/LoginRESTService.cpp index 9afaeb5df8c..c8fb91b163b 100644 --- a/src/server/bnetserver/REST/LoginRESTService.cpp +++ b/src/server/bnetserver/REST/LoginRESTService.cpp @@ -253,7 +253,7 @@ int32 LoginRESTService::HandleGetGameAccounts(std::shared_ptr<AsyncRequest> requ if (!request->GetClient()->userid) return 401; - request->SetCallback(Trinity::make_unique<QueryCallback>(LoginDatabase.AsyncQuery([&] { + request->SetCallback(std::make_unique<QueryCallback>(LoginDatabase.AsyncQuery([&] { LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_GAME_ACCOUNT_LIST); stmt->setString(0, request->GetClient()->userid); return stmt; @@ -345,7 +345,7 @@ int32 LoginRESTService::HandlePostLogin(std::shared_ptr<AsyncRequest> request) std::string sentPasswordHash = CalculateShaPassHash(login, password); - request->SetCallback(Trinity::make_unique<QueryCallback>(LoginDatabase.AsyncQuery(stmt) + request->SetCallback(std::make_unique<QueryCallback>(LoginDatabase.AsyncQuery(stmt) .WithChainingPreparedCallback([request, login, sentPasswordHash, this](QueryCallback& callback, PreparedQueryResult result) { if (result) @@ -444,7 +444,7 @@ int32 LoginRESTService::HandlePostRefreshLoginTicket(std::shared_ptr<AsyncReques if (!request->GetClient()->userid) return 401; - request->SetCallback(Trinity::make_unique<QueryCallback>(LoginDatabase.AsyncQuery([&] { + request->SetCallback(std::make_unique<QueryCallback>(LoginDatabase.AsyncQuery([&] { LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_BNET_EXISTING_AUTHENTICATION); stmt->setString(0, request->GetClient()->userid); return stmt; diff --git a/src/server/database/Database/DatabaseWorkerPool.cpp b/src/server/database/Database/DatabaseWorkerPool.cpp index 0cb755ce073..39330288a8d 100644 --- a/src/server/database/Database/DatabaseWorkerPool.cpp +++ b/src/server/database/Database/DatabaseWorkerPool.cpp @@ -69,7 +69,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 bde2004afdf..f141663b824 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -62,7 +62,7 @@ m_Mysql(NULL), 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() @@ -486,7 +486,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 3241d7feea6..b34cb9ff39c 100644 --- a/src/server/database/Updater/UpdateFetcher.cpp +++ b/src/server/database/Updater/UpdateFetcher.cpp @@ -42,7 +42,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/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index b1c386d2e51..a0c122f88b8 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -639,7 +639,7 @@ void AreaTrigger::InitSplines(std::vector<G3D::Vector3> splinePoints, uint32 tim _movementTime = 0; - _spline = Trinity::make_unique<::Movement::Spline<int32>>(); + _spline = std::make_unique<::Movement::Spline<int32>>(); _spline->init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear); _spline->initLengths(); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index cd3ebd306ea..12cdbe445fb 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -2730,5 +2730,5 @@ private: GameObjectModel* GameObject::CreateModel() { - return GameObjectModel::Create(Trinity::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath()); + return GameObjectModel::Create(std::make_unique<GameObjectModelOwnerImpl>(this), sWorld->GetDataPath()); } diff --git a/src/server/game/Entities/Player/CollectionMgr.cpp b/src/server/game/Entities/Player/CollectionMgr.cpp index a715ea37b6a..e1fc18eee9c 100644 --- a/src/server/game/Entities/Player/CollectionMgr.cpp +++ b/src/server/game/Entities/Player/CollectionMgr.cpp @@ -85,7 +85,7 @@ namespace } } -CollectionMgr::CollectionMgr(WorldSession* owner) : _owner(owner), _appearances(Trinity::make_unique<boost::dynamic_bitset<uint32>>()) +CollectionMgr::CollectionMgr(WorldSession* owner) : _owner(owner), _appearances(std::make_unique<boost::dynamic_bitset<uint32>>()) { } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 939d7e750d1..cbf315cf6a5 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -346,14 +346,14 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this) m_achievementMgr = new PlayerAchievementMgr(this); m_reputationMgr = new ReputationMgr(this); - m_questObjectiveCriteriaMgr = Trinity::make_unique<QuestObjectiveCriteriaMgr>(this); + m_questObjectiveCriteriaMgr = std::make_unique<QuestObjectiveCriteriaMgr>(this); for (uint8 i = 0; i < MAX_CUF_PROFILES; ++i) _CUFProfiles[i] = nullptr; _advancedCombatLoggingEnabled = false; - _restMgr = Trinity::make_unique<RestMgr>(this); + _restMgr = std::make_unique<RestMgr>(this); _usePvpItemLevels = false; } @@ -18645,7 +18645,7 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder* holder) _LoadCUFProfiles(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CUF_PROFILES)); - std::unique_ptr<Garrison> garrison = Trinity::make_unique<Garrison>(this); + std::unique_ptr<Garrison> garrison = std::make_unique<Garrison>(this); if (garrison->LoadFromDB(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GARRISON), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GARRISON_BLUEPRINTS), holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_GARRISON_BUILDINGS), @@ -18704,7 +18704,7 @@ void Player::_LoadCUFProfiles(PreparedQueryResult result) continue; } - _CUFProfiles[id] = Trinity::make_unique<CUFProfile>(name, frameHeight, frameWidth, sortBy, healthText, boolOptions, topPoint, bottomPoint, leftPoint, topOffset, bottomOffset, leftOffset); + _CUFProfiles[id] = std::make_unique<CUFProfile>(name, frameHeight, frameWidth, sortBy, healthText, boolOptions, topPoint, bottomPoint, leftPoint, topOffset, bottomOffset, leftOffset); } while (result->NextRow()); } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6d5b164f594..76a181ac0bf 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -14095,7 +14095,7 @@ void Unit::SendSetVehicleRecId(uint32 vehicleId) void Unit::ApplyMovementForce(ObjectGuid id, Position origin, float magnitude, uint8 type, Position direction /*= {}*/, ObjectGuid transportGuid /*= ObjectGuid::Empty*/) { if (!_movementForces) - _movementForces = Trinity::make_unique<MovementForces>(); + _movementForces = std::make_unique<MovementForces>(); MovementForce force; force.ID = id; @@ -14208,7 +14208,7 @@ void Unit::UpdateMovementForcesModMagnitude() } if (modMagnitude != 1.0f && !_movementForces) - _movementForces = Trinity::make_unique<MovementForces>(); + _movementForces = std::make_unique<MovementForces>(); if (_movementForces) { diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 22a65795177..1bcf58a452d 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -1635,7 +1635,7 @@ class TC_GAME_API ObjectMgr { auto itr = _guidGenerators.find(high); if (itr == _guidGenerators.end()) - itr = _guidGenerators.insert(std::make_pair(high, Trinity::make_unique<ObjectGuidGenerator<high>>())).first; + itr = _guidGenerators.insert(std::make_pair(high, std::make_unique<ObjectGuidGenerator<high>>())).first; return *itr->second; } diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index 0ce01460161..cca640eb97c 100644 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -2385,7 +2385,7 @@ void Group::AddRaidMarker(uint8 markerId, uint32 mapId, float positionX, float p return; m_activeMarkers |= (1 << markerId); - m_markers[markerId] = Trinity::make_unique<RaidMarker>(mapId, positionX, positionY, positionZ, transportGuid); + m_markers[markerId] = std::make_unique<RaidMarker>(mapId, positionX, positionY, positionZ, transportGuid); SendRaidMarkersChanged(); } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 5e00ed3b83e..1406014504f 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -4381,7 +4381,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/Maps/Map.h b/src/server/game/Maps/Map.h index 396867684f9..d1cf310262d 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -747,7 +747,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType> { auto itr = _guidGenerators.find(high); if (itr == _guidGenerators.end()) - itr = _guidGenerators.insert(std::make_pair(high, Trinity::make_unique<ObjectGuidGenerator<high>>())).first; + itr = _guidGenerators.insert(std::make_pair(high, std::make_unique<ObjectGuidGenerator<high>>())).first; return *itr->second; } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 72354f47b21..668f4bba387 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -243,7 +243,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 18f1135128e..b8cc437ecb7 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/Server/Packets/AuthenticationPackets.cpp b/src/server/game/Server/Packets/AuthenticationPackets.cpp index f0eb8b58dd0..b69f7b1c3ab 100644 --- a/src/server/game/Server/Packets/AuthenticationPackets.cpp +++ b/src/server/game/Server/Packets/AuthenticationPackets.cpp @@ -240,7 +240,7 @@ std::unique_ptr<Trinity::Crypto::RSA> ConnectToRSA; bool WorldPackets::Auth::ConnectTo::InitializeEncryption() { - std::unique_ptr<Trinity::Crypto::RSA> rsa = Trinity::make_unique<Trinity::Crypto::RSA>(); + std::unique_ptr<Trinity::Crypto::RSA> rsa = std::make_unique<Trinity::Crypto::RSA>(); if (!rsa->LoadFromString(RSAPrivateKey, Trinity::Crypto::RSA::PrivateKey{})) return false; diff --git a/src/server/game/Server/Packets/MiscPackets.cpp b/src/server/game/Server/Packets/MiscPackets.cpp index a1bd2a25598..48a1d4ac78a 100644 --- a/src/server/game/Server/Packets/MiscPackets.cpp +++ b/src/server/game/Server/Packets/MiscPackets.cpp @@ -502,7 +502,7 @@ void WorldPackets::Misc::SaveCUFProfiles::Read() CUFProfiles.resize(_worldPacket.read<uint32>()); for (std::unique_ptr<CUFProfile>& cufProfile : CUFProfiles) { - cufProfile = Trinity::make_unique<CUFProfile>(); + cufProfile = std::make_unique<CUFProfile>(); uint8 strLen = _worldPacket.ReadBits(7); diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 1c9f49df88b..5ca01aa520b 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -134,8 +134,8 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun expireTime(60000), // 1 min after socket loss, session is deleted forceExit(false), m_currentBankerGUID(), - _battlePetMgr(Trinity::make_unique<BattlePetMgr>(this)), - _collectionMgr(Trinity::make_unique<CollectionMgr>(this)) + _battlePetMgr(std::make_unique<BattlePetMgr>(this)), + _collectionMgr(std::make_unique<CollectionMgr>(this)) { memset(_tutorials, 0, sizeof(_tutorials)); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e9f01061f75..23ebb5314ff 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5382,7 +5382,7 @@ SpellCastResult Spell::CheckCast(bool strict, uint32* param1 /*= nullptr*/, uint float objSize = target->GetCombatReach(); float range = m_spellInfo->GetMaxRange(true, m_caster, this) * 1.5f + objSize; // can't be overly strict - m_preGeneratedPath = Trinity::make_unique<PathGenerator>(m_caster); + m_preGeneratedPath = std::make_unique<PathGenerator>(m_caster); m_preGeneratedPath->SetPathLengthLimit(range); // first try with raycast, if it fails fall back to normal path float targetObjectSize = std::min(target->GetCombatReach(), 4.0f); diff --git a/src/server/shared/Realm/RealmList.cpp b/src/server/shared/Realm/RealmList.cpp index 3ce8c8f2f4e..ca591e423f5 100644 --- a/src/server/shared/Realm/RealmList.cpp +++ b/src/server/shared/Realm/RealmList.cpp @@ -35,7 +35,7 @@ RealmList::RealmList() : _updateInterval(0) { - _realmsMutex = Trinity::make_unique<boost::shared_mutex>(); + _realmsMutex = std::make_unique<boost::shared_mutex>(); } RealmList::~RealmList() @@ -52,8 +52,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 @@ -112,11 +112,11 @@ void RealmList::UpdateRealm(Realm& realm, Battlenet::RealmHandle const& id, uint 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 65f30acce7a..a43663775ef 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -516,9 +516,9 @@ bool LoadRealmInfo() { realm.Id = realmListRealm->Id; realm.Build = realmListRealm->Build; - realm.ExternalAddress = Trinity::make_unique<boost::asio::ip::address>(*realmListRealm->ExternalAddress); - realm.LocalAddress = Trinity::make_unique<boost::asio::ip::address>(*realmListRealm->LocalAddress); - realm.LocalSubnetMask = Trinity::make_unique<boost::asio::ip::address>(*realmListRealm->LocalSubnetMask); + realm.ExternalAddress = std::make_unique<boost::asio::ip::address>(*realmListRealm->ExternalAddress); + realm.LocalAddress = std::make_unique<boost::asio::ip::address>(*realmListRealm->LocalAddress); + realm.LocalSubnetMask = std::make_unique<boost::asio::ip::address>(*realmListRealm->LocalSubnetMask); realm.Port = realmListRealm->Port; realm.Name = realmListRealm->Name; realm.NormalizedName = realmListRealm->NormalizedName; diff --git a/src/tools/vmap4_extractor/wdtfile.cpp b/src/tools/vmap4_extractor/wdtfile.cpp index b4ead466c22..aab94d75b61 100644 --- a/src/tools/vmap4_extractor/wdtfile.cpp +++ b/src/tools/vmap4_extractor/wdtfile.cpp @@ -32,7 +32,7 @@ WDTFile::WDTFile(uint32 fileDataId, std::string const& description, std::string memset(&_adtInfo, 0, sizeof(WDT::MAIN)); if (cache) { - _adtCache = Trinity::make_unique<ADTCache>(); + _adtCache = std::make_unique<ADTCache>(); memset(_adtCache->file, 0, sizeof(_adtCache->file)); } else @@ -80,7 +80,7 @@ bool WDTFile::init(uint32 mapId) else if (!strcmp(fourcc, "MAID")) { ASSERT(size == sizeof(WDT::MAID)); - _adtFileDataIds = Trinity::make_unique<WDT::MAID>(); + _adtFileDataIds = std::make_unique<WDT::MAID>(); _file.read(_adtFileDataIds.get(), sizeof(WDT::MAID)); } else if (!strcmp(fourcc,"MWMO")) |