diff --git a/AI/Nullkiller/AIGateway.cpp b/AI/Nullkiller/AIGateway.cpp index 8153a95dc..36df5eaeb 100644 --- a/AI/Nullkiller/AIGateway.cpp +++ b/AI/Nullkiller/AIGateway.cpp @@ -535,7 +535,7 @@ void AIGateway::yourTurn() LOG_TRACE(logAi); NET_EVENT_HANDLER; status.startedTurn(); - makingTurn = make_unique(&AIGateway::makeTurn, this); + makingTurn = std::make_unique(&AIGateway::makeTurn, this); } void AIGateway::heroGotLevel(const CGHeroInstance * hero, PrimarySkill::PrimarySkill pskill, std::vector & skills, QueryID queryID) diff --git a/AI/Nullkiller/Engine/Nullkiller.cpp b/AI/Nullkiller/Engine/Nullkiller.cpp index 9c0dcd132..f415ea1a2 100644 --- a/AI/Nullkiller/Engine/Nullkiller.cpp +++ b/AI/Nullkiller/Engine/Nullkiller.cpp @@ -50,7 +50,7 @@ void Nullkiller::init(std::shared_ptr cb, PlayerColor playerID) new SharedPool( [&]()->std::unique_ptr { - return make_unique(this); + return std::make_unique(this); })); dangerHitMap.reset(new DangerHitMapAnalyzer(this)); diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index bd47a7438..f80f18a10 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -608,7 +608,7 @@ void VCAI::yourTurn() LOG_TRACE(logAi); NET_EVENT_HANDLER; status.startedTurn(); - makingTurn = make_unique(&VCAI::makeTurn, this); + makingTurn = std::make_unique(&VCAI::makeTurn, this); } void VCAI::heroGotLevel(const CGHeroInstance * hero, PrimarySkill::PrimarySkill pskill, std::vector & skills, QueryID queryID) diff --git a/Global.h b/Global.h index 456363444..371ece6ca 100644 --- a/Global.h +++ b/Global.h @@ -505,36 +505,6 @@ namespace vstd ptr = nullptr; } -#if _MSC_VER >= 1800 - using std::make_unique; -#else - template - std::unique_ptr make_unique() - { - return std::unique_ptr(new T()); - } - template - std::unique_ptr make_unique(Arg1 &&arg1) - { - return std::unique_ptr(new T(std::forward(arg1))); - } - template - std::unique_ptr make_unique(Arg1 &&arg1, Arg2 &&arg2) - { - return std::unique_ptr(new T(std::forward(arg1), std::forward(arg2))); - } - template - std::unique_ptr make_unique(Arg1 &&arg1, Arg2 &&arg2, Arg3 &&arg3) - { - return std::unique_ptr(new T(std::forward(arg1), std::forward(arg2), std::forward(arg3))); - } - template - std::unique_ptr make_unique(Arg1 &&arg1, Arg2 &&arg2, Arg3 &&arg3, Arg4 &&arg4) - { - return std::unique_ptr(new T(std::forward(arg1), std::forward(arg2), std::forward(arg3), std::forward(arg4))); - } -#endif - template typename Container::const_reference circularAt(const Container &r, size_t index) { @@ -765,7 +735,6 @@ namespace vstd using boost::math::round; } using vstd::operator-=; -using vstd::make_unique; #ifdef NO_STD_TOSTRING namespace std diff --git a/client/CMT.cpp b/client/CMT.cpp index f18d522d7..8d61ed2ad 100644 --- a/client/CMT.cpp +++ b/client/CMT.cpp @@ -878,7 +878,7 @@ void processCommand(const std::string &message) { std::string URI; readed >> URI; - std::unique_ptr anim = make_unique(URI); + std::unique_ptr anim = std::make_unique(URI); anim->preload(); anim->exportBitmaps(VCMIDirs::get().userExtractedPath()); } diff --git a/client/CMessage.cpp b/client/CMessage.cpp index fcd29b93b..0ce4affb0 100644 --- a/client/CMessage.cpp +++ b/client/CMessage.cpp @@ -71,7 +71,7 @@ void CMessage::init() { for(int i=0; i("DIALGBOX"); + dialogBorders[i] = std::make_unique("DIALGBOX"); dialogBorders[i]->preload(); for(int j=0; j < dialogBorders[i]->size(0); j++) diff --git a/client/CMusicHandler.cpp b/client/CMusicHandler.cpp index 60bd71adb..8dcf53dbf 100644 --- a/client/CMusicHandler.cpp +++ b/client/CMusicHandler.cpp @@ -456,7 +456,7 @@ void CMusicHandler::queueNext(CMusicHandler *owner, const std::string & setName, { try { - queueNext(make_unique(owner, setName, musicURI, looped, fromStart)); + queueNext(std::make_unique(owner, setName, musicURI, looped, fromStart)); } catch(std::exception &e) { diff --git a/client/CServerHandler.cpp b/client/CServerHandler.cpp index a6183f299..780828606 100644 --- a/client/CServerHandler.cpp +++ b/client/CServerHandler.cpp @@ -129,7 +129,7 @@ void CServerHandler::resetStateForLobby(const StartInfo::EMode mode, const std:: { hostClientId = -1; state = EClientState::NONE; - th = make_unique(); + th = std::make_unique(); packsForLobbyScreen.clear(); c.reset(); si = std::make_shared(); diff --git a/client/Client.cpp b/client/Client.cpp index 8d26c2ccf..63e685c0e 100644 --- a/client/Client.cpp +++ b/client/Client.cpp @@ -764,7 +764,7 @@ scripting::Pool * CClient::getContextPool() const void CClient::reinitScripting() { - clientEventBus = make_unique(); + clientEventBus = std::make_unique(); #if SCRIPTING_ENABLED clientScripts.reset(new scripting::PoolImpl(this)); #endif diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index f73a35211..f52721f9b 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -2824,7 +2824,7 @@ void CBattleInterface::requestAutofightingAIToTakeAction() boost::thread aiThread([&]() { - auto ba = make_unique(curInt->autofightingAI->activeStack(activeStack)); + auto ba = std::make_unique(curInt->autofightingAI->activeStack(activeStack)); if(curInt->cb->battleIsFinished()) { diff --git a/client/gui/CCursorHandler.cpp b/client/gui/CCursorHandler.cpp index 43e5999ad..663625949 100644 --- a/client/gui/CCursorHandler.cpp +++ b/client/gui/CCursorHandler.cpp @@ -49,10 +49,10 @@ void CCursorHandler::initCursor() cursors = { - make_unique("CRADVNTR", 0), - make_unique("CRCOMBAT", 0), - make_unique("CRDEFLT", 0), - make_unique("CRSPELL", 0) + std::make_unique("CRADVNTR", 0), + std::make_unique("CRCOMBAT", 0), + std::make_unique("CRDEFLT", 0), + std::make_unique("CRSPELL", 0) }; currentCursor = cursors.at(int(ECursor::DEFAULT)).get(); diff --git a/client/lobby/RandomMapTab.cpp b/client/lobby/RandomMapTab.cpp index d945388cf..c8e314a1e 100644 --- a/client/lobby/RandomMapTab.cpp +++ b/client/lobby/RandomMapTab.cpp @@ -169,7 +169,7 @@ void RandomMapTab::updateMapInfoByHost() // Generate header info mapInfo = std::make_shared(); mapInfo->isRandomMap = true; - mapInfo->mapHeader = make_unique(); + mapInfo->mapHeader = std::make_unique(); mapInfo->mapHeader->version = EMapFormat::SOD; mapInfo->mapHeader->name = CGI->generaltexth->allTexts[740]; mapInfo->mapHeader->description = CGI->generaltexth->allTexts[741]; diff --git a/client/mapHandler.cpp b/client/mapHandler.cpp index 8f17fdc8a..05fb0d797 100644 --- a/client/mapHandler.cpp +++ b/client/mapHandler.cpp @@ -140,7 +140,7 @@ void CMapHandler::initTerrainGraphics() //no rotation and basic setup for(auto & type : files) { - animation[type.first][0] = make_unique(type.second); + animation[type.first][0] = std::make_unique(type.second); animation[type.first][0]->preload(); const size_t views = animation[type.first][0]->size(0); cache[type.first].resize(views); @@ -153,7 +153,7 @@ void CMapHandler::initTerrainGraphics() { for(auto & type : files) { - animation[type.first][rotation] = make_unique(type.second); + animation[type.first][rotation] = std::make_unique(type.second); animation[type.first][rotation]->preload(); const size_t views = animation[type.first][rotation]->size(0); @@ -1347,7 +1347,7 @@ CMapHandler::CMapHandler() tilesW = tilesH = 0; offsetX = offsetY = 0; - egdeAnimation = make_unique("EDG"); + egdeAnimation = std::make_unique("EDG"); egdeAnimation->preload(); } diff --git a/client/widgets/CArtifactHolder.cpp b/client/widgets/CArtifactHolder.cpp index 814fc3c07..92c3a33f1 100644 --- a/client/widgets/CArtifactHolder.cpp +++ b/client/widgets/CArtifactHolder.cpp @@ -274,7 +274,7 @@ void CHeroArtPlace::select () } } - CCS->curh->dragAndDropCursor(make_unique("artifact", ourArt->artType->getIconIndex())); + CCS->curh->dragAndDropCursor(std::make_unique("artifact", ourArt->artType->getIconIndex())); ourOwner->commonInfo->src.setTo(this, false); ourOwner->markPossibleSlots(ourArt); @@ -749,7 +749,7 @@ void CArtifactsOfHero::artifactMoved(const ArtifactLocation &src, const Artifact commonInfo->src.art = dst.getArt(); commonInfo->src.slotID = dst.slot; assert(commonInfo->src.AOH); - CCS->curh->dragAndDropCursor(make_unique("artifact", dst.getArt()->artType->getIconIndex())); + CCS->curh->dragAndDropCursor(std::make_unique("artifact", dst.getArt()->artType->getIconIndex())); markPossibleSlots(dst.getArt()); } } diff --git a/client/windows/CTradeWindow.cpp b/client/windows/CTradeWindow.cpp index 0efefeacb..8735233ef 100644 --- a/client/windows/CTradeWindow.cpp +++ b/client/windows/CTradeWindow.cpp @@ -188,7 +188,7 @@ void CTradeWindow::CTradeableItem::clickLeft(tribool down, bool previousState) aw->arts->markPossibleSlots(art); //aw->arts->commonInfo->dst.AOH = aw->arts; - CCS->curh->dragAndDropCursor(make_unique("artifact", art->artType->iconIndex)); + CCS->curh->dragAndDropCursor(std::make_unique("artifact", art->artType->iconIndex)); aw->arts->artifactsOnAltar.erase(art); setID(-1); diff --git a/include/vcmi/events/SubscriptionRegistry.h b/include/vcmi/events/SubscriptionRegistry.h index 0e273d79c..2849386b5 100644 --- a/include/vcmi/events/SubscriptionRegistry.h +++ b/include/vcmi/events/SubscriptionRegistry.h @@ -40,7 +40,7 @@ public: auto storage = std::make_shared(std::move(handler)); preHandlers[tag].push_back(storage); - return make_unique(tag, storage); + return std::make_unique(tag, storage); } std::unique_ptr subscribeAfter(BusTag tag, PostHandler && handler) @@ -49,7 +49,7 @@ public: auto storage = std::make_shared(std::move(handler)); postHandlers[tag].push_back(storage); - return make_unique(tag, storage); + return std::make_unique(tag, storage); } void executeEvent(const EventBus * bus, E & event, const ExecHandler & execHandler) diff --git a/include/vstd/CLoggerBase.h b/include/vstd/CLoggerBase.h index 24df8a0a7..37c9e5b94 100644 --- a/include/vstd/CLoggerBase.h +++ b/include/vstd/CLoggerBase.h @@ -175,7 +175,7 @@ private: #define RAII_TRACE(logger, onEntry, onLeave) \ std::unique_ptr ctl00; \ if(logger->isTraceEnabled()) \ - ctl00 = make_unique(logger, onEntry, onLeave); + ctl00 = std::make_unique(logger, onEntry, onLeave); #define LOG_TRACE(logger) RAII_TRACE(logger, \ boost::str(boost::format("Entering %s.") % BOOST_CURRENT_FUNCTION), \ diff --git a/launcher/modManager/cmodlistview_moc.cpp b/launcher/modManager/cmodlistview_moc.cpp index 00f115633..e4c731127 100644 --- a/launcher/modManager/cmodlistview_moc.cpp +++ b/launcher/modManager/cmodlistview_moc.cpp @@ -28,7 +28,7 @@ void CModListView::setupModModel() { modModel = new CModListModel(this); - manager = vstd::make_unique(modModel); + manager = std::make_unique(modModel); connect(manager.get(), &CModManager::extraResolutionsEnabledChanged, this, &CModListView::extraResolutionsEnabledChanged); diff --git a/lib/CPathfinder.cpp b/lib/CPathfinder.cpp index 7af2aa2c3..12024696c 100644 --- a/lib/CPathfinder.cpp +++ b/lib/CPathfinder.cpp @@ -1018,7 +1018,7 @@ TurnInfo::TurnInfo(const CGHeroInstance * Hero, const int turn) : hero(Hero), maxMovePointsLand(-1), maxMovePointsWater(-1) { bonuses = hero->getAllBonuses(Selector::days(turn), Selector::all, nullptr, ""); - bonusCache = make_unique(bonuses); + bonusCache = std::make_unique(bonuses); nativeTerrain = hero->getNativeTerrain(); } diff --git a/lib/events/ApplyDamage.cpp b/lib/events/ApplyDamage.cpp index b0466da64..15106a9da 100644 --- a/lib/events/ApplyDamage.cpp +++ b/lib/events/ApplyDamage.cpp @@ -22,7 +22,7 @@ namespace events SubscriptionRegistry * ApplyDamage::getRegistry() { - static std::unique_ptr> Instance = make_unique>(); + static std::unique_ptr> Instance = std::make_unique>(); return Instance.get(); } diff --git a/lib/events/GameResumed.cpp b/lib/events/GameResumed.cpp index b2e493900..eb7105c7c 100644 --- a/lib/events/GameResumed.cpp +++ b/lib/events/GameResumed.cpp @@ -20,7 +20,7 @@ namespace events SubscriptionRegistry * GameResumed::getRegistry() { - static std::unique_ptr> Instance = make_unique>(); + static std::unique_ptr> Instance = std::make_unique>(); return Instance.get(); } diff --git a/lib/events/ObjectVisitEnded.cpp b/lib/events/ObjectVisitEnded.cpp index 61d4d801f..3bde4c19d 100644 --- a/lib/events/ObjectVisitEnded.cpp +++ b/lib/events/ObjectVisitEnded.cpp @@ -21,7 +21,7 @@ namespace events SubscriptionRegistry * ObjectVisitEnded::getRegistry() { - static std::unique_ptr Instance = make_unique(); + static std::unique_ptr Instance = std::make_unique(); return Instance.get(); } diff --git a/lib/events/ObjectVisitStarted.cpp b/lib/events/ObjectVisitStarted.cpp index d535bd263..c97c5f7df 100644 --- a/lib/events/ObjectVisitStarted.cpp +++ b/lib/events/ObjectVisitStarted.cpp @@ -21,7 +21,7 @@ namespace events SubscriptionRegistry * ObjectVisitStarted::getRegistry() { - static std::unique_ptr Instance = make_unique(); + static std::unique_ptr Instance = std::make_unique(); return Instance.get(); } diff --git a/lib/events/PlayerGotTurn.cpp b/lib/events/PlayerGotTurn.cpp index cbe7f7c2d..123853d31 100644 --- a/lib/events/PlayerGotTurn.cpp +++ b/lib/events/PlayerGotTurn.cpp @@ -20,7 +20,7 @@ namespace events SubscriptionRegistry * PlayerGotTurn::getRegistry() { - static std::unique_ptr> Instance = make_unique>(); + static std::unique_ptr> Instance = std::make_unique>(); return Instance.get(); } diff --git a/lib/events/TurnStarted.cpp b/lib/events/TurnStarted.cpp index 655c32532..b3888d699 100644 --- a/lib/events/TurnStarted.cpp +++ b/lib/events/TurnStarted.cpp @@ -20,7 +20,7 @@ namespace events SubscriptionRegistry * TurnStarted::getRegistry() { - static std::unique_ptr> Instance = make_unique>(); + static std::unique_ptr> Instance = std::make_unique>(); return Instance.get(); } diff --git a/lib/filesystem/CArchiveLoader.cpp b/lib/filesystem/CArchiveLoader.cpp index b66d36627..62b16656d 100644 --- a/lib/filesystem/CArchiveLoader.cpp +++ b/lib/filesystem/CArchiveLoader.cpp @@ -177,13 +177,13 @@ std::unique_ptr CArchiveLoader::load(const ResourceID & resourceNa if (entry.compressedSize != 0) //compressed data { - auto fileStream = make_unique(archive, entry.offset, entry.compressedSize); + auto fileStream = std::make_unique(archive, entry.offset, entry.compressedSize); - return make_unique(std::move(fileStream), false, entry.fullSize); + return std::make_unique(std::move(fileStream), false, entry.fullSize); } else { - return make_unique(archive, entry.offset, entry.fullSize); + return std::make_unique(archive, entry.offset, entry.fullSize); } } diff --git a/lib/filesystem/CFilesystemLoader.cpp b/lib/filesystem/CFilesystemLoader.cpp index 122d22bf8..ed462bfa9 100644 --- a/lib/filesystem/CFilesystemLoader.cpp +++ b/lib/filesystem/CFilesystemLoader.cpp @@ -31,7 +31,7 @@ std::unique_ptr CFilesystemLoader::load(const ResourceID & resourc assert(fileList.count(resourceName)); bfs::path file = baseDirectory / fileList.at(resourceName); logGlobal->trace("loading %s", file.string()); - return make_unique(file); + return std::make_unique(file); } bool CFilesystemLoader::existsResource(const ResourceID & resourceName) const diff --git a/lib/filesystem/Filesystem.cpp b/lib/filesystem/Filesystem.cpp index 5796c4bc9..dbadaa9d0 100644 --- a/lib/filesystem/Filesystem.cpp +++ b/lib/filesystem/Filesystem.cpp @@ -177,7 +177,7 @@ void CResourceHandler::initialize() if (globalResourceHandler.rootLoader) return; - globalResourceHandler.rootLoader = vstd::make_unique(); + globalResourceHandler.rootLoader = std::make_unique(); knownLoaders["root"] = globalResourceHandler.rootLoader.get(); knownLoaders["saves"] = new CFilesystemLoader("SAVES/", VCMIDirs::get().userSavePath()); knownLoaders["config"] = new CFilesystemLoader("CONFIG/", VCMIDirs::get().userConfigPath()); diff --git a/lib/logging/CBasicLogConfigurator.cpp b/lib/logging/CBasicLogConfigurator.cpp index 727386bf0..b0d0f78f8 100644 --- a/lib/logging/CBasicLogConfigurator.cpp +++ b/lib/logging/CBasicLogConfigurator.cpp @@ -20,8 +20,8 @@ CBasicLogConfigurator::CBasicLogConfigurator(boost::filesystem::path filePath, C void CBasicLogConfigurator::configureDefault() { - CLogger::getGlobalLogger()->addTarget(make_unique(console)); - CLogger::getGlobalLogger()->addTarget(make_unique(filePath, appendToLogFile)); + CLogger::getGlobalLogger()->addTarget(std::make_unique(console)); + CLogger::getGlobalLogger()->addTarget(std::make_unique(filePath, appendToLogFile)); appendToLogFile = true; } @@ -52,7 +52,7 @@ void CBasicLogConfigurator::configure() CLogger::getGlobalLogger()->clearTargets(); // Add console target - auto consoleTarget = make_unique(console); + auto consoleTarget = std::make_unique(console); const JsonNode & consoleNode = loggingNode["console"]; if(!consoleNode.isNull()) { @@ -80,7 +80,7 @@ void CBasicLogConfigurator::configure() CLogger::getGlobalLogger()->addTarget(std::move(consoleTarget)); // Add file target - auto fileTarget = make_unique(filePath, appendToLogFile); + auto fileTarget = std::make_unique(filePath, appendToLogFile); const JsonNode & fileNode = loggingNode["file"]; if(!fileNode.isNull()) { diff --git a/lib/mapping/CCampaignHandler.cpp b/lib/mapping/CCampaignHandler.cpp index 60918e0b3..bf37f812a 100644 --- a/lib/mapping/CCampaignHandler.cpp +++ b/lib/mapping/CCampaignHandler.cpp @@ -70,7 +70,7 @@ CCampaignHeader CCampaignHandler::getHeader( const std::string & name) std::unique_ptr CCampaignHandler::getCampaign( const std::string & name ) { - auto ret = make_unique(); + auto ret = std::make_unique(); std::vector> file = getFile(name, false); diff --git a/lib/mapping/CMap.cpp b/lib/mapping/CMap.cpp index 4d55bc0b7..490653924 100644 --- a/lib/mapping/CMap.cpp +++ b/lib/mapping/CMap.cpp @@ -712,7 +712,7 @@ void CMap::initTerrain() CMapEditManager * CMap::getEditManager() { - if(!editManager) editManager = make_unique(this); + if(!editManager) editManager = std::make_unique(this); return editManager.get(); } diff --git a/lib/mapping/CMapEditManager.cpp b/lib/mapping/CMapEditManager.cpp index 1935ca6b8..07b3313a3 100644 --- a/lib/mapping/CMapEditManager.cpp +++ b/lib/mapping/CMapEditManager.cpp @@ -123,24 +123,24 @@ CMap * CMapEditManager::getMap() void CMapEditManager::clearTerrain(CRandomGenerator * gen) { - execute(make_unique(map, gen ? gen : &(this->gen))); + execute(std::make_unique(map, gen ? gen : &(this->gen))); } void CMapEditManager::drawTerrain(TerrainId terType, CRandomGenerator * gen) { - execute(make_unique(map, terrainSel, terType, gen ? gen : &(this->gen))); + execute(std::make_unique(map, terrainSel, terType, gen ? gen : &(this->gen))); terrainSel.clearSelection(); } void CMapEditManager::drawRoad(RoadId roadType, CRandomGenerator* gen) { - execute(make_unique(map, terrainSel, roadType, gen ? gen : &(this->gen))); + execute(std::make_unique(map, terrainSel, roadType, gen ? gen : &(this->gen))); terrainSel.clearSelection(); } void CMapEditManager::drawRiver(RiverId riverType, CRandomGenerator* gen) { - execute(make_unique(map, terrainSel, riverType, gen ? gen : &(this->gen))); + execute(std::make_unique(map, terrainSel, riverType, gen ? gen : &(this->gen))); terrainSel.clearSelection(); } @@ -148,35 +148,35 @@ void CMapEditManager::drawRiver(RiverId riverType, CRandomGenerator* gen) void CMapEditManager::insertObject(CGObjectInstance * obj) { - execute(make_unique(map, obj)); + execute(std::make_unique(map, obj)); } void CMapEditManager::insertObjects(std::set& objects) { - auto composedOperation = make_unique(map); + auto composedOperation = std::make_unique(map); for (auto obj : objects) { - composedOperation->addOperation(make_unique(map, obj)); + composedOperation->addOperation(std::make_unique(map, obj)); } execute(std::move(composedOperation)); } void CMapEditManager::moveObject(CGObjectInstance * obj, const int3 & pos) { - execute(make_unique(map, obj, pos)); + execute(std::make_unique(map, obj, pos)); } void CMapEditManager::removeObject(CGObjectInstance * obj) { - execute(make_unique(map, obj)); + execute(std::make_unique(map, obj)); } void CMapEditManager::removeObjects(std::set & objects) { - auto composedOperation = make_unique(map); + auto composedOperation = std::make_unique(map); for (auto obj : objects) { - composedOperation->addOperation(make_unique(map, obj)); + composedOperation->addOperation(std::make_unique(map, obj)); } execute(std::move(composedOperation)); } diff --git a/lib/mapping/CMapInfo.cpp b/lib/mapping/CMapInfo.cpp index 3756ae580..be52a4bbc 100644 --- a/lib/mapping/CMapInfo.cpp +++ b/lib/mapping/CMapInfo.cpp @@ -49,7 +49,7 @@ void CMapInfo::saveInit(ResourceID file) CLoadFile lf(*CResourceHandler::get()->getResourceName(file), MINIMAL_SERIALIZATION_VERSION); lf.checkMagicBytes(SAVEGAME_MAGIC); - mapHeader = make_unique(); + mapHeader = std::make_unique(); lf >> *(mapHeader.get()) >> scenarioOptionsOfSave; fileURI = file.getName(); countPlayers(); diff --git a/lib/mapping/CMapOperation.cpp b/lib/mapping/CMapOperation.cpp index b7a6872cb..6f7798741 100644 --- a/lib/mapping/CMapOperation.cpp +++ b/lib/mapping/CMapOperation.cpp @@ -551,12 +551,12 @@ CClearTerrainOperation::CClearTerrainOperation(CMap* map, CRandomGenerator* gen) { CTerrainSelection terrainSel(map); terrainSel.selectRange(MapRect(int3(0, 0, 0), map->width, map->height)); - addOperation(make_unique(map, terrainSel, Terrain::WATER, gen)); + addOperation(std::make_unique(map, terrainSel, Terrain::WATER, gen)); if(map->twoLevel) { terrainSel.clearSelection(); terrainSel.selectRange(MapRect(int3(0, 0, 1), map->width, map->height)); - addOperation(make_unique(map, terrainSel, Terrain::ROCK, gen)); + addOperation(std::make_unique(map, terrainSel, Terrain::ROCK, gen)); } } diff --git a/lib/mapping/MapFormatH3M.cpp b/lib/mapping/MapFormatH3M.cpp index 77df2727c..66b984acd 100644 --- a/lib/mapping/MapFormatH3M.cpp +++ b/lib/mapping/MapFormatH3M.cpp @@ -52,7 +52,7 @@ std::unique_ptr CMapLoaderH3M::loadMap() std::unique_ptr CMapLoaderH3M::loadMapHeader() { // Read header - mapHeader = make_unique(); + mapHeader = std::make_unique(); readHeader(); return std::move(mapHeader); diff --git a/lib/mapping/MapFormatJson.cpp b/lib/mapping/MapFormatJson.cpp index 2a3e78a81..34fbe339e 100644 --- a/lib/mapping/MapFormatJson.cpp +++ b/lib/mapping/MapFormatJson.cpp @@ -340,7 +340,7 @@ const std::string CMapFormatJson::OBJECTS_FILE_NAME = "objects.json"; CMapFormatJson::CMapFormatJson(): fileVersionMajor(0), fileVersionMinor(0), - mapObjectResolver(make_unique(this)), + mapObjectResolver(std::make_unique(this)), map(nullptr), mapHeader(nullptr) { @@ -1191,7 +1191,7 @@ void CMapLoaderJson::readObjects() //get raw data for(auto & p : data.Struct()) - loaders.push_back(vstd::make_unique(this, p)); + loaders.push_back(std::make_unique(this, p)); for(auto & ptr : loaders) ptr->construct(); diff --git a/lib/serializer/BinaryDeserializer.cpp b/lib/serializer/BinaryDeserializer.cpp index d1773b434..a83e9f662 100644 --- a/lib/serializer/BinaryDeserializer.cpp +++ b/lib/serializer/BinaryDeserializer.cpp @@ -42,7 +42,7 @@ void CLoadFile::openNextFile(const boost::filesystem::path & fname, int minimalV try { fName = fname.string(); - sfile = make_unique(fname, std::ios::in | std::ios::binary); + sfile = std::make_unique(fname, std::ios::in | std::ios::binary); sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway if(!(*sfile)) diff --git a/lib/serializer/BinarySerializer.cpp b/lib/serializer/BinarySerializer.cpp index 0e3870920..793dd568f 100644 --- a/lib/serializer/BinarySerializer.cpp +++ b/lib/serializer/BinarySerializer.cpp @@ -39,7 +39,7 @@ void CSaveFile::openNextFile(const boost::filesystem::path &fname) fName = fname; try { - sfile = make_unique(fname, std::ios::out | std::ios::binary); + sfile = std::make_unique(fname, std::ios::out | std::ios::binary); sfile->exceptions(std::ifstream::failbit | std::ifstream::badbit); //we throw a lot anyway if(!(*sfile)) diff --git a/lib/serializer/CLoadIntegrityValidator.cpp b/lib/serializer/CLoadIntegrityValidator.cpp index e04e4fbff..22259bb98 100644 --- a/lib/serializer/CLoadIntegrityValidator.cpp +++ b/lib/serializer/CLoadIntegrityValidator.cpp @@ -19,8 +19,8 @@ CLoadIntegrityValidator::CLoadIntegrityValidator(const boost::filesystem::path & : serializer(this), foundDesync(false) { registerTypes(serializer); - primaryFile = make_unique(primaryFileName, minimalVersion); - controlFile = make_unique(controlFileName, minimalVersion); + primaryFile = std::make_unique(primaryFileName, minimalVersion); + controlFile = std::make_unique(controlFileName, minimalVersion); assert(primaryFile->serializer.fileVersion == controlFile->serializer.fileVersion); serializer.fileVersion = primaryFile->serializer.fileVersion; diff --git a/lib/serializer/CTypeList.h b/lib/serializer/CTypeList.h index 38ba68975..fc25adf5d 100644 --- a/lib/serializer/CTypeList.h +++ b/lib/serializer/CTypeList.h @@ -138,8 +138,8 @@ public: // register the relation between classes bti->children.push_back(dti); dti->parents.push_back(bti); - casters[std::make_pair(bti, dti)] = make_unique>(); - casters[std::make_pair(dti, bti)] = make_unique>(); + casters[std::make_pair(bti, dti)] = std::make_unique>(); + casters[std::make_pair(dti, bti)] = std::make_unique>(); } ui16 getTypeID(const std::type_info *type, bool throws = false) const; diff --git a/lib/spells/ISpellMechanics.cpp b/lib/spells/ISpellMechanics.cpp index a30b66233..5709ef6d1 100644 --- a/lib/spells/ISpellMechanics.cpp +++ b/lib/spells/ISpellMechanics.cpp @@ -405,9 +405,9 @@ ISpellMechanicsFactory::~ISpellMechanicsFactory() std::unique_ptr ISpellMechanicsFactory::get(const CSpell * s) { if(s->hasBattleEffects()) - return make_unique(s); + return std::make_unique(s); else - return make_unique(s); + return std::make_unique(s); } ///Mechanics @@ -759,24 +759,24 @@ std::unique_ptr IAdventureSpellMechanics::createMechan switch (s->id) { case SpellID::SUMMON_BOAT: - return make_unique(s); + return std::make_unique(s); case SpellID::SCUTTLE_BOAT: - return make_unique(s); + return std::make_unique(s); case SpellID::DIMENSION_DOOR: - return make_unique(s); + return std::make_unique(s); case SpellID::FLY: case SpellID::WATER_WALK: case SpellID::VISIONS: case SpellID::DISGUISE: - return make_unique(s); //implemented using bonus system + return std::make_unique(s); //implemented using bonus system case SpellID::TOWN_PORTAL: - return make_unique(s); + return std::make_unique(s); case SpellID::VIEW_EARTH: - return make_unique(s); + return std::make_unique(s); case SpellID::VIEW_AIR: - return make_unique(s); + return std::make_unique(s); default: - return s->combat ? std::unique_ptr() : make_unique(s); + return s->combat ? std::unique_ptr() : std::make_unique(s); } } diff --git a/lib/spells/TargetCondition.cpp b/lib/spells/TargetCondition.cpp index cdcc2086e..a222abf4d 100644 --- a/lib/spells/TargetCondition.cpp +++ b/lib/spells/TargetCondition.cpp @@ -400,7 +400,7 @@ const TargetConditionItemFactory * TargetConditionItemFactory::getDefault() static std::unique_ptr singleton; if(!singleton) - singleton = make_unique(); + singleton = std::make_unique(); return singleton.get(); } diff --git a/lib/spells/effects/Registry.cpp b/lib/spells/effects/Registry.cpp index 09cecd826..3940f0ae8 100644 --- a/lib/spells/effects/Registry.cpp +++ b/lib/spells/effects/Registry.cpp @@ -52,7 +52,7 @@ Registry::~Registry() = default; Registry * GlobalRegistry::get() { - static std::unique_ptr Instance = make_unique(); + static std::unique_ptr Instance = std::make_unique(); return Instance.get(); } diff --git a/mapeditor/maphandler.cpp b/mapeditor/maphandler.cpp index 3120da59e..1a49915ba 100644 --- a/mapeditor/maphandler.cpp +++ b/mapeditor/maphandler.cpp @@ -65,7 +65,7 @@ void MapHandler::initTerrainGraphics() { for(auto & type : files) { - animation[type.first] = make_unique(type.second); + animation[type.first] = std::make_unique(type.second); animation[type.first]->preload(); const size_t views = animation[type.first]->size(0); cache[type.first].resize(views); diff --git a/mapeditor/resourceExtractor/ResourceConverter.cpp b/mapeditor/resourceExtractor/ResourceConverter.cpp index d2be795b1..99f3beba2 100644 --- a/mapeditor/resourceExtractor/ResourceConverter.cpp +++ b/mapeditor/resourceExtractor/ResourceConverter.cpp @@ -71,7 +71,7 @@ void ResourceConverter::splitDefFile(const std::string & fileName, const bfs::pa { if(CResourceHandler::get()->existsResource(ResourceID("SPRITES/" + fileName))) { - std::unique_ptr anim = make_unique(fileName); + std::unique_ptr anim = std::make_unique(fileName); anim->preload(); anim->exportBitmaps(pathToQString(VCMIDirs::get().userExtractedPath())); @@ -88,4 +88,4 @@ void ResourceConverter::splitDefFiles(bool deleteOriginals) for(std::string defFilename : {"TwCrPort.def", "CPRSMALL.def", "FlagPort.def", "ITPA.def", "ITPt.def", "Un32.def", "Un44.def"}) splitDefFile(defFilename, spritesPath, deleteOriginals); -} \ No newline at end of file +} diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index a8fe51cda..ad06813ae 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -731,7 +731,7 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance * heroAttacker, con //Check how many battle queries were created (number of players blocked by battle) const int queriedPlayers = battleQuery ? (int)boost::count(queries.allQueries(), battleQuery) : 0; - finishingBattle = make_unique(battleQuery, queriedPlayers); + finishingBattle = std::make_unique(battleQuery, queriedPlayers); CasualtiesAfterBattle cab1(bEndArmy1, gs->curB), cab2(bEndArmy2, gs->curB); //calculate casualties before deleting battle ChangeSpells cs; //for Eagle Eye @@ -1669,7 +1669,7 @@ CGameHandler::~CGameHandler() void CGameHandler::reinitScripting() { - serverEventBus = make_unique(); + serverEventBus = std::make_unique(); #if SCRIPTING_ENABLED serverScripts.reset(new scripting::PoolImpl(this, spellEnv)); #endif @@ -1929,7 +1929,7 @@ void CGameHandler::newTurn() NewTurn::Hero hth; hth.id = h->id; - auto ti = make_unique(h, 1); + auto ti = std::make_unique(h, 1); // TODO: this code executed when bonuses of previous day not yet updated (this happen in NewTurn::applyGs). See issue 2356 hth.move = h->maxMovePointsCached(gs->map->getTile(h->visitablePos()).terType->isLand(), ti.get()); hth.mana = h->getManaNewTurn(); @@ -2349,7 +2349,7 @@ bool CGameHandler::moveHero(ObjectInstanceID hid, int3 dst, ui8 teleporting, boo tmh.movePoints = h->movement; //check if destination tile is available - auto pathfinderHelper = make_unique(gs, h, PathfinderOptions()); + auto pathfinderHelper = std::make_unique(gs, h, PathfinderOptions()); pathfinderHelper->updateTurnInfo(0); auto ti = pathfinderHelper->getTurnInfo(); diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index 43a44dba6..8b4665b89 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -156,7 +156,7 @@ void CVCMIServer::run() { if(!restartGameplay) { - this->announceLobbyThread = vstd::make_unique(&CVCMIServer::threadAnnounceLobby, this); + this->announceLobbyThread = std::make_unique(&CVCMIServer::threadAnnounceLobby, this); #if !defined(VCMI_ANDROID) && !defined(VCMI_IOS) if(cmdLineOptions.count("enable-shm")) { @@ -172,7 +172,7 @@ void CVCMIServer::run() startAsyncAccept(); if(!remoteConnectionsThread && cmdLineOptions.count("lobby")) { - remoteConnectionsThread = vstd::make_unique(&CVCMIServer::establishRemoteConnections, this); + remoteConnectionsThread = std::make_unique(&CVCMIServer::establishRemoteConnections, this); } #if defined(VCMI_ANDROID) @@ -418,7 +418,7 @@ void CVCMIServer::threadHandleClient(std::shared_ptr c) // if(state != ENDING_AND_STARTING_GAME) if(c->connected) { - auto lcd = vstd::make_unique(); + auto lcd = std::make_unique(); lcd->c = c; lcd->clientId = c->connectionID; handleReceivedPack(std::move(lcd)); @@ -453,7 +453,7 @@ void CVCMIServer::announcePack(std::unique_ptr pack) void CVCMIServer::announceMessage(const std::string & txt) { logNetwork->info("Show message: %s", txt); - auto cm = vstd::make_unique(); + auto cm = std::make_unique(); cm->message = txt; addToAnnounceQueue(std::move(cm)); } @@ -461,7 +461,7 @@ void CVCMIServer::announceMessage(const std::string & txt) void CVCMIServer::announceTxt(const std::string & txt, const std::string & playerName) { logNetwork->info("%s says: %s", playerName, txt); - auto cm = vstd::make_unique(); + auto cm = std::make_unique(); cm->playerName = playerName; cm->message = txt; addToAnnounceQueue(std::move(cm)); @@ -709,7 +709,7 @@ void CVCMIServer::updateAndPropagateLobbyState() } } - auto lus = vstd::make_unique(); + auto lus = std::make_unique(); lus->state = *this; addToAnnounceQueue(std::move(lus)); } diff --git a/server/NetPacksLobbyServer.cpp b/server/NetPacksLobbyServer.cpp index a87d0717f..d86685f49 100644 --- a/server/NetPacksLobbyServer.cpp +++ b/server/NetPacksLobbyServer.cpp @@ -158,7 +158,7 @@ void LobbyClientDisconnected::applyOnServerAfterAnnounce(CVCMIServer * srv) } else if(c == srv->hostClient) { - auto ph = vstd::make_unique(); + auto ph = std::make_unique(); auto newHost = *RandomGeneratorUtil::nextItem(srv->connections, CRandomGenerator::getDefault()); ph->newHostConnectionId = newHost->connectionID; srv->addToAnnounceQueue(std::move(ph));