diff --git a/.travis.yml b/.travis.yml index ee195722a..aba38727c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ os: - linux # - osx -osx_image: xcode8.2 +osx_image: xcode8.3 language: cpp sudo: required dist: trusty @@ -13,7 +13,7 @@ branches: env: global: - secure: NZmvVuA0O9NJXVQ12tXQZHDJC2mbFgYNFcsicw0DgW1It2Nk5hxIkF0pfu4/Z59mhQuOPgRVjl5b0FKy2Axh0gkWc1DJEXGwNaiW5lpTMNWR1LJG5rxa8LrDUpFkycpbzfAFuTUZu5z3iYVv64XzELvBuqNGhPMu1LeBnrlech0jFNjkR9p5qtJGWb8zYcPMCC57rig8a9g1ABoVYS6UXjrKpx0946ZLRsE5ukc9pXsypGwPmOMyfzZkxxzIqFaxoE5JIEdaJTWba/6Za315ozYYIi/N35ROI1YAv5GHRe/Iw9XAa4vQpbDzjM7ZSsZdTvvQsSU598gD2xC6jFUKSrpW6GZKwM2x236fZLGnOk5Uw7DUbG+AwpcEmxBwoy9PjBl9ZF3tJykI0gROewCy8MODhdsVMKr1HGIMVBIJySm/RnNqtoDbYV8mYnSl5b8rwJiCajoiR8Zuv4CIfGneeH1a3DOQDPH/qkDsU6ilzF4ANsBlMUUpgY653KBMBmTlNuVZSH527tnD7Fg6JgHVuSQkTbRa1vSkR7Zcre604RZcAoaEdbX3bhVDasPPghU/I742L0RH3oQNlR09pPBDZ8kG7ydl4aPHwpCWnvXNM1vgxtGvnYLztwrse7IoaRXRYiMFmrso78WhMWUDKgvY4wV9aeUu0DtnMezZVIQwCKg= - - macos_qt_formula=qt@5.5 + - macos_qt_formula=qt@5.7 addons: apt: sources: @@ -27,7 +27,7 @@ addons: # Tests libgtest-dev, google-mock, # Boost - libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, libboost-thread-dev, + libboost-filesystem-dev, libboost-program-options-dev, libboost-system-dev, # FFmpeg libavcodec-dev, libavformat-dev, libavutil-dev, libswscale-dev, # Audio & Video diff --git a/AUTHORS.md b/AUTHORS.md index d119c9b1a..a75c475be 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -133,6 +133,7 @@ Programmers Sebastian Wick (swick) Sergey Shambir ShadowRadiance + Siimacore sir_herrbatka smbas Stefan Galowicz (bogglez) diff --git a/CI/before_install.osx.sh b/CI/before_install.osx.sh index d7ef405bb..ee2cc9cc9 100755 --- a/CI/before_install.osx.sh +++ b/CI/before_install.osx.sh @@ -6,5 +6,5 @@ brew outdated cmake || brew upgrade cmake brew outdated pkgconfig || brew upgrade pkgconfig brew install $macos_qt_formula -curl https://downloads.openmw.org/osx/dependencies/openmw-deps-c79172d.zip -o ~/openmw-deps.zip +curl https://downloads.openmw.org/osx/dependencies/openmw-deps-eaf8112.zip -o ~/openmw-deps.zip unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null diff --git a/CI/before_script.osx.sh b/CI/before_script.osx.sh index bec26caf1..806b545e3 100755 --- a/CI/before_script.osx.sh +++ b/CI/before_script.osx.sh @@ -5,13 +5,12 @@ export CC=clang DEPENDENCIES_ROOT="/private/tmp/openmw-deps/openmw-deps" QT_PATH=`brew --prefix $macos_qt_formula` - mkdir build cd build cmake \ -D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \ --D CMAKE_OSX_DEPLOYMENT_TARGET="10.8" \ +-D CMAKE_OSX_DEPLOYMENT_TARGET="10.9" \ -D CMAKE_OSX_SYSROOT="macosx10.12" \ -D CMAKE_BUILD_TYPE=Release \ -D OPENMW_OSX_DEPLOYMENT=TRUE \ diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a4a50067..1b3a7f557 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -363,7 +363,13 @@ endif() # CXX Compiler settings if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++98 -pedantic -Wno-long-long -Wno-variadic-macros") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -std=c++11 -pedantic -Wno-long-long") + add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) + + if (APPLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") + endif() if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.6 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 3.6) @@ -761,7 +767,7 @@ if (WIN32) endif() # Apple bundling -if (APPLE) +if (APPLE AND DESIRED_QT_VERSION MATCHES 5) get_property(QT_COCOA_PLUGIN_PATH TARGET Qt5::QCocoaIntegrationPlugin PROPERTY LOCATION_RELEASE) get_filename_component(QT_COCOA_PLUGIN_DIR "${QT_COCOA_PLUGIN_PATH}" DIRECTORY) get_filename_component(QT_COCOA_PLUGIN_GROUP "${QT_COCOA_PLUGIN_DIR}" NAME) @@ -846,7 +852,7 @@ if (APPLE) fixup_bundle(\"${INSTALLED_OPENCS_APP}\" \"${OPENCS_PLUGINS}\" \"\") " COMPONENT Runtime) include(CPack) -endif (APPLE) +endif (APPLE AND DESIRED_QT_VERSION MATCHES 5) # Doxygen Target -- simply run 'make doc' or 'make doc_pages' # output directory for 'make doc' is "${OpenMW_BINARY_DIR}/docs/Doxygen" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a9cd6a690..466910ca3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,35 @@ -Description -=========== +How to contribute to OpenMW +======================= -Your pull request description should include (if applicable): +Not sure what to do with all your free time? Pick out a task from here: + +http://bugs.openmw.org/ + +Currently, we are focused on completing the MW game experience and general polishing. Features out of this scope may be approved in some cases, but you should probably start a discussion first. + +Note: +- Tasks set to 'openmw-future' are usually out of the current scope of the project and can't be started yet. +- Bugs that are not 'Confirmed' should be confirmed first. +- Larger Features should have a discussion before you start implementing. +- In many cases, it's best to have a discussion about possible solutions before you jump into coding. + +Aside from coding, you can also help by triaging the issues list. Check for bugs that are 'Unconfirmed' and try to confirm them on your end, working out any details that may be necessary. Check for bugs that do not conform to [Bug reporting guidelines](https://wiki.openmw.org/index.php?title=Bug_Reporting_Guidelines) and improve them to do so! + +There are various [Tools](https://wiki.openmw.org/index.php?title=Tools) to facilitate testing/development. + +Pull Request Guidelines +======================= + +Thought of a change? Great! To facilitate the review process, your pull request description should include the following (if applicable): * A link back to the bug report or forum discussion that prompted the change * Summary of the changes made * Reasoning / motivation behind the change * What testing you have carried out to verify the change -Other notes -=========== +Furthermore, we advise to: * Separate your work into multiple pull requests whenever possible. As a rule of thumb, each feature and each bugfix should go into a separate PR, unless they are closely related or dependent upon each other. Small pull requests are easier to review, and are less likely to require further changes before we can merge them. A "mega" pull request with lots of unrelated commits in it is likely to get held up in review for a long time. * Feel free to submit incomplete pull requests. Even if the work can not be merged yet, pull requests are a great place to collect early feedback. Just make sure to mark it as *[Incomplete]* or *[Do not merge yet]* in the title. * If you plan on contributing often, please read the [Developer Reference](https://wiki.openmw.org/index.php?title=Developer_Reference) on our wiki, especially the [Policies and Standards](https://wiki.openmw.org/index.php?title=Policies_and_Standards). +* Make sure each of your changes has a clear objective. Unnecessary changes may lead to merge conflicts, clutter the commit history and slow down review. Code formatting 'fixes' should be avoided, unless you were already changing that particular line anyway. diff --git a/apps/bsatool/bsatool.cpp b/apps/bsatool/bsatool.cpp index 7f305052b..54e946cbc 100644 --- a/apps/bsatool/bsatool.cpp +++ b/apps/bsatool/bsatool.cpp @@ -1,7 +1,6 @@ #include #include #include -#include #include #include diff --git a/apps/esmtool/labels.cpp b/apps/esmtool/labels.cpp index 883a9e728..ea7b50129 100644 --- a/apps/esmtool/labels.cpp +++ b/apps/esmtool/labels.cpp @@ -11,7 +11,6 @@ #include #include #include -#include #include diff --git a/apps/essimporter/importer.cpp b/apps/essimporter/importer.cpp index c27e15a3e..d38069d89 100644 --- a/apps/essimporter/importer.cpp +++ b/apps/essimporter/importer.cpp @@ -2,7 +2,7 @@ #include -#include +#include #include #include @@ -272,37 +272,37 @@ namespace ESSImport const unsigned int recGAME = ESM::FourCC<'G','A','M','E'>::value; const unsigned int recJOUR = ESM::FourCC<'J','O','U','R'>::value; - std::map > converters; - converters[ESM::REC_GLOB] = boost::shared_ptr(new ConvertGlobal()); - converters[ESM::REC_BOOK] = boost::shared_ptr(new ConvertBook()); - converters[ESM::REC_NPC_] = boost::shared_ptr(new ConvertNPC()); - converters[ESM::REC_CREA] = boost::shared_ptr(new ConvertCREA()); - converters[ESM::REC_NPCC] = boost::shared_ptr(new ConvertNPCC()); - converters[ESM::REC_CREC] = boost::shared_ptr(new ConvertCREC()); - converters[recREFR ] = boost::shared_ptr(new ConvertREFR()); - converters[recPCDT ] = boost::shared_ptr(new ConvertPCDT()); - converters[recFMAP ] = boost::shared_ptr(new ConvertFMAP()); - converters[recKLST ] = boost::shared_ptr(new ConvertKLST()); - converters[recSTLN ] = boost::shared_ptr(new ConvertSTLN()); - converters[recGAME ] = boost::shared_ptr(new ConvertGAME()); - converters[ESM::REC_CELL] = boost::shared_ptr(new ConvertCell()); - converters[ESM::REC_ALCH] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_CLAS] = boost::shared_ptr(new ConvertClass()); - converters[ESM::REC_SPEL] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_ARMO] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_WEAP] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_CLOT] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_ENCH] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_WEAP] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_LEVC] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_LEVI] = boost::shared_ptr(new DefaultConverter()); - converters[ESM::REC_CNTC] = boost::shared_ptr(new ConvertCNTC()); - converters[ESM::REC_FACT] = boost::shared_ptr(new ConvertFACT()); - converters[ESM::REC_INFO] = boost::shared_ptr(new ConvertINFO()); - converters[ESM::REC_DIAL] = boost::shared_ptr(new ConvertDIAL()); - converters[ESM::REC_QUES] = boost::shared_ptr(new ConvertQUES()); - converters[recJOUR ] = boost::shared_ptr(new ConvertJOUR()); - converters[ESM::REC_SCPT] = boost::shared_ptr(new ConvertSCPT()); + std::map > converters; + converters[ESM::REC_GLOB] = std::shared_ptr(new ConvertGlobal()); + converters[ESM::REC_BOOK] = std::shared_ptr(new ConvertBook()); + converters[ESM::REC_NPC_] = std::shared_ptr(new ConvertNPC()); + converters[ESM::REC_CREA] = std::shared_ptr(new ConvertCREA()); + converters[ESM::REC_NPCC] = std::shared_ptr(new ConvertNPCC()); + converters[ESM::REC_CREC] = std::shared_ptr(new ConvertCREC()); + converters[recREFR ] = std::shared_ptr(new ConvertREFR()); + converters[recPCDT ] = std::shared_ptr(new ConvertPCDT()); + converters[recFMAP ] = std::shared_ptr(new ConvertFMAP()); + converters[recKLST ] = std::shared_ptr(new ConvertKLST()); + converters[recSTLN ] = std::shared_ptr(new ConvertSTLN()); + converters[recGAME ] = std::shared_ptr(new ConvertGAME()); + converters[ESM::REC_CELL] = std::shared_ptr(new ConvertCell()); + converters[ESM::REC_ALCH] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_CLAS] = std::shared_ptr(new ConvertClass()); + converters[ESM::REC_SPEL] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_ARMO] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_WEAP] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_CLOT] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_ENCH] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_WEAP] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_LEVC] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_LEVI] = std::shared_ptr(new DefaultConverter()); + converters[ESM::REC_CNTC] = std::shared_ptr(new ConvertCNTC()); + converters[ESM::REC_FACT] = std::shared_ptr(new ConvertFACT()); + converters[ESM::REC_INFO] = std::shared_ptr(new ConvertINFO()); + converters[ESM::REC_DIAL] = std::shared_ptr(new ConvertDIAL()); + converters[ESM::REC_QUES] = std::shared_ptr(new ConvertQUES()); + converters[recJOUR ] = std::shared_ptr(new ConvertJOUR()); + converters[ESM::REC_SCPT] = std::shared_ptr(new ConvertSCPT()); // TODO: // - REGN (weather in certain regions?) @@ -312,7 +312,7 @@ namespace ESSImport std::set unknownRecords; - for (std::map >::const_iterator it = converters.begin(); + for (std::map >::const_iterator it = converters.begin(); it != converters.end(); ++it) { it->second->setContext(context); @@ -323,7 +323,7 @@ namespace ESSImport ESM::NAME n = esm.getRecName(); esm.getRecHeader(); - std::map >::iterator it = converters.find(n.intval); + std::map >::iterator it = converters.find(n.intval); if (it != converters.end()) { it->second->read(esm); @@ -386,7 +386,7 @@ namespace ESSImport // Writing order should be Dynamic Store -> Cells -> Player, // so that references to dynamic records can be recognized when loading - for (std::map >::const_iterator it = converters.begin(); + for (std::map >::const_iterator it = converters.begin(); it != converters.end(); ++it) { if (it->second->getStage() != 0) @@ -399,7 +399,7 @@ namespace ESSImport context.mPlayerBase.save(writer); writer.endRecord(ESM::REC_NPC_); - for (std::map >::const_iterator it = converters.begin(); + for (std::map >::const_iterator it = converters.begin(); it != converters.end(); ++it) { if (it->second->getStage() != 1) diff --git a/apps/essimporter/main.cpp b/apps/essimporter/main.cpp index a4ad114ec..d593669c3 100644 --- a/apps/essimporter/main.cpp +++ b/apps/essimporter/main.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include #include diff --git a/apps/launcher/graphicspage.cpp b/apps/launcher/graphicspage.cpp index 622db4da4..d3dbfa559 100644 --- a/apps/launcher/graphicspage.cpp +++ b/apps/launcher/graphicspage.cpp @@ -1,5 +1,6 @@ #include "graphicspage.hpp" +#include #include #include #include @@ -12,14 +13,8 @@ #include -#include - #include -#include - -#include - QString getAspect(int x, int y) { int gcd = boost::math::gcd (x, y); diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp index 1c1d57016..6a30de7ae 100644 --- a/apps/launcher/maindialog.cpp +++ b/apps/launcher/maindialog.cpp @@ -172,6 +172,9 @@ Launcher::FirstRunDialogResult Launcher::MainDialog::showFirstRunDialog() } } + if(!setupGameData()) + return FirstRunDialogResultFailure; + return setup() ? FirstRunDialogResultContinue : FirstRunDialogResultFailure; } @@ -344,6 +347,10 @@ bool Launcher::MainDialog::setupGameSettings() file.close(); } + return true; +} + +bool Launcher::MainDialog::setupGameData() { QStringList dataDirs; // Check if the paths actually contain data files @@ -379,7 +386,6 @@ bool Launcher::MainDialog::setupGameSettings() } } } - return true; } diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 96b5c0b97..8d0d61b8f 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -72,6 +72,7 @@ namespace Launcher bool setupLauncherSettings(); bool setupGameSettings(); bool setupGraphicsSettings(); + bool setupGameData(); void setVersionLabel(); diff --git a/apps/mwiniimporter/importer.cpp b/apps/mwiniimporter/importer.cpp index fb3144814..24646b844 100644 --- a/apps/mwiniimporter/importer.cpp +++ b/apps/mwiniimporter/importer.cpp @@ -1,17 +1,12 @@ #include "importer.hpp" -#include #include -#include -#include -#include -#include #include #include -#include #include #include +#include namespace bfs = boost::filesystem; diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index a3f115fcf..8a2aeb603 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -1,11 +1,9 @@ #include "importer.hpp" -#include #include #include #include -#include #include namespace bpo = boost::program_options; diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index b088e9a44..ff670ba1b 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -47,7 +47,7 @@ namespace CS Q_OBJECT // FIXME: should be moved to document, so we can have different resources for each opened project - std::auto_ptr mVFS; + std::unique_ptr mVFS; Files::ConfigurationManager mCfgMgr; CSMPrefs::State mSettingsState; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 87fbccb3f..ef984c0ca 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "../world/defaultgmsts.hpp" @@ -415,9 +416,9 @@ void CSMDoc::Document::runSearch (const CSMWorld::UniversalId& searchId, const C emit stateChanged (getState(), this); } -void CSMDoc::Document::runMerge (std::auto_ptr target) +void CSMDoc::Document::runMerge (std::unique_ptr target) { - mTools.runMerge (target); + mTools.runMerge (std::move(target)); emit stateChanged (getState(), this); } diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 41640f66d..030a0174e 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -3,7 +3,6 @@ #include -#include #include #include @@ -137,7 +136,7 @@ namespace CSMDoc void runSearch (const CSMWorld::UniversalId& searchId, const CSMTools::Search& search); - void runMerge (std::auto_ptr target); + void runMerge (std::unique_ptr target); void abortOperation (int type); diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index 87fb960c1..098d7bad5 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -1,8 +1,5 @@ #include "documentmanager.hpp" -#include -#include - #include #ifndef Q_MOC_RUN diff --git a/apps/opencs/model/doc/savingstages.cpp b/apps/opencs/model/doc/savingstages.cpp index 82a965ae4..f9c028e29 100644 --- a/apps/opencs/model/doc/savingstages.cpp +++ b/apps/opencs/model/doc/savingstages.cpp @@ -1,20 +1,15 @@ #include "savingstages.hpp" -#include - #include #include #include -#include - #include "../world/infocollection.hpp" #include "../world/cellcoordinates.hpp" #include "document.hpp" -#include "savingstate.hpp" CSMDoc::OpenSaveStage::OpenSaveStage (Document& document, SavingState& state, bool projectFile) : mDocument (document), mState (state), mProjectFile (projectFile) diff --git a/apps/opencs/model/doc/savingstate.cpp b/apps/opencs/model/doc/savingstate.cpp index 10539c1b5..7214735f0 100644 --- a/apps/opencs/model/doc/savingstate.cpp +++ b/apps/opencs/model/doc/savingstate.cpp @@ -1,5 +1,7 @@ #include "savingstate.hpp" +#include + #include "operation.hpp" #include "document.hpp" diff --git a/apps/opencs/model/filter/andnode.cpp b/apps/opencs/model/filter/andnode.cpp index 908662799..757865717 100644 --- a/apps/opencs/model/filter/andnode.cpp +++ b/apps/opencs/model/filter/andnode.cpp @@ -2,7 +2,7 @@ #include -CSMFilter::AndNode::AndNode (const std::vector >& nodes) +CSMFilter::AndNode::AndNode (const std::vector >& nodes) : NAryNode (nodes, "and") {} diff --git a/apps/opencs/model/filter/andnode.hpp b/apps/opencs/model/filter/andnode.hpp index 3838b451d..56d1d7948 100644 --- a/apps/opencs/model/filter/andnode.hpp +++ b/apps/opencs/model/filter/andnode.hpp @@ -9,7 +9,7 @@ namespace CSMFilter { public: - AndNode (const std::vector >& nodes); + AndNode (const std::vector >& nodes); virtual bool test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const; diff --git a/apps/opencs/model/filter/narynode.cpp b/apps/opencs/model/filter/narynode.cpp index f2e0e5cb2..2fa9ac6cc 100644 --- a/apps/opencs/model/filter/narynode.cpp +++ b/apps/opencs/model/filter/narynode.cpp @@ -2,7 +2,7 @@ #include -CSMFilter::NAryNode::NAryNode (const std::vector >& nodes, +CSMFilter::NAryNode::NAryNode (const std::vector >& nodes, const std::string& name) : mNodes (nodes), mName (name) {} @@ -21,7 +21,7 @@ std::vector CSMFilter::NAryNode::getReferencedColumns() const { std::vector columns; - for (std::vector >::const_iterator iter (mNodes.begin()); + for (std::vector >::const_iterator iter (mNodes.begin()); iter!=mNodes.end(); ++iter) { std::vector columns2 = (*iter)->getReferencedColumns(); diff --git a/apps/opencs/model/filter/narynode.hpp b/apps/opencs/model/filter/narynode.hpp index aa501d009..1cd93e62e 100644 --- a/apps/opencs/model/filter/narynode.hpp +++ b/apps/opencs/model/filter/narynode.hpp @@ -4,20 +4,18 @@ #include #include -#include - #include "node.hpp" namespace CSMFilter { class NAryNode : public Node { - std::vector > mNodes; + std::vector > mNodes; std::string mName; public: - NAryNode (const std::vector >& nodes, const std::string& name); + NAryNode (const std::vector >& nodes, const std::string& name); int getSize() const; diff --git a/apps/opencs/model/filter/node.hpp b/apps/opencs/model/filter/node.hpp index 58588bdc5..7295b9018 100644 --- a/apps/opencs/model/filter/node.hpp +++ b/apps/opencs/model/filter/node.hpp @@ -3,10 +3,9 @@ #include #include +#include #include -#include - #include namespace CSMWorld @@ -48,6 +47,6 @@ namespace CSMFilter }; } -Q_DECLARE_METATYPE (boost::shared_ptr) +Q_DECLARE_METATYPE (std::shared_ptr) #endif diff --git a/apps/opencs/model/filter/notnode.cpp b/apps/opencs/model/filter/notnode.cpp index ba5302bbe..81588c754 100644 --- a/apps/opencs/model/filter/notnode.cpp +++ b/apps/opencs/model/filter/notnode.cpp @@ -1,6 +1,6 @@ #include "notnode.hpp" -CSMFilter::NotNode::NotNode (boost::shared_ptr child) : UnaryNode (child, "not") {} +CSMFilter::NotNode::NotNode (std::shared_ptr child) : UnaryNode (child, "not") {} bool CSMFilter::NotNode::test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const diff --git a/apps/opencs/model/filter/notnode.hpp b/apps/opencs/model/filter/notnode.hpp index 0281d99da..e3c57cede 100644 --- a/apps/opencs/model/filter/notnode.hpp +++ b/apps/opencs/model/filter/notnode.hpp @@ -9,7 +9,7 @@ namespace CSMFilter { public: - NotNode (boost::shared_ptr child); + NotNode (std::shared_ptr child); virtual bool test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const; diff --git a/apps/opencs/model/filter/ornode.cpp b/apps/opencs/model/filter/ornode.cpp index 41ec7b5cf..9e6d8b2c4 100644 --- a/apps/opencs/model/filter/ornode.cpp +++ b/apps/opencs/model/filter/ornode.cpp @@ -2,7 +2,7 @@ #include -CSMFilter::OrNode::OrNode (const std::vector >& nodes) +CSMFilter::OrNode::OrNode (const std::vector >& nodes) : NAryNode (nodes, "or") {} diff --git a/apps/opencs/model/filter/ornode.hpp b/apps/opencs/model/filter/ornode.hpp index 07ab51a6a..b89da4e75 100644 --- a/apps/opencs/model/filter/ornode.hpp +++ b/apps/opencs/model/filter/ornode.hpp @@ -9,7 +9,7 @@ namespace CSMFilter { public: - OrNode (const std::vector >& nodes); + OrNode (const std::vector >& nodes); virtual bool test (const CSMWorld::IdTableBase& table, int row, const std::map& columns) const; diff --git a/apps/opencs/model/filter/parser.cpp b/apps/opencs/model/filter/parser.cpp index c0c089169..d2bedc666 100644 --- a/apps/opencs/model/filter/parser.cpp +++ b/apps/opencs/model/filter/parser.cpp @@ -235,7 +235,7 @@ CSMFilter::Token CSMFilter::Parser::getNextToken() return Token (Token::Type_None); } -boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot) +std::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot) { if (Token token = getNextToken()) { @@ -247,11 +247,11 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, { case Token::Type_Keyword_True: - return boost::shared_ptr (new BooleanNode (true)); + return std::shared_ptr (new BooleanNode (true)); case Token::Type_Keyword_False: - return boost::shared_ptr (new BooleanNode (false)); + return std::shared_ptr (new BooleanNode (false)); case Token::Type_Keyword_And: case Token::Type_Keyword_Or: @@ -260,12 +260,12 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, case Token::Type_Keyword_Not: { - boost::shared_ptr node = parseImp(); + std::shared_ptr node = parseImp(); if (mError) - return boost::shared_ptr(); + return std::shared_ptr(); - return boost::shared_ptr (new NotNode (node)); + return std::shared_ptr (new NotNode (node)); } case Token::Type_Keyword_Text: @@ -281,7 +281,7 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, if (!allowEmpty) error(); - return boost::shared_ptr(); + return std::shared_ptr(); default: @@ -289,27 +289,27 @@ boost::shared_ptr CSMFilter::Parser::parseImp (bool allowEmpty, } } - return boost::shared_ptr(); + return std::shared_ptr(); } -boost::shared_ptr CSMFilter::Parser::parseNAry (const Token& keyword) +std::shared_ptr CSMFilter::Parser::parseNAry (const Token& keyword) { - std::vector > nodes; + std::vector > nodes; Token token = getNextToken(); if (token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } for (;;) { - boost::shared_ptr node = parseImp(); + std::shared_ptr node = parseImp(); if (mError) - return boost::shared_ptr(); + return std::shared_ptr(); nodes.push_back (node); @@ -318,7 +318,7 @@ boost::shared_ptr CSMFilter::Parser::parseNAry (const Token& ke if (!token || (token.mType!=Token::Type_Close && token.mType!=Token::Type_Comma)) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } if (token.mType==Token::Type_Close) @@ -328,31 +328,31 @@ boost::shared_ptr CSMFilter::Parser::parseNAry (const Token& ke if (nodes.empty()) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } switch (keyword.mType) { - case Token::Type_Keyword_And: return boost::shared_ptr (new AndNode (nodes)); - case Token::Type_Keyword_Or: return boost::shared_ptr (new OrNode (nodes)); - default: error(); return boost::shared_ptr(); + case Token::Type_Keyword_And: return std::shared_ptr (new AndNode (nodes)); + case Token::Type_Keyword_Or: return std::shared_ptr (new OrNode (nodes)); + default: error(); return std::shared_ptr(); } } -boost::shared_ptr CSMFilter::Parser::parseText() +std::shared_ptr CSMFilter::Parser::parseText() { Token token = getNextToken(); if (token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); if (!token) - return boost::shared_ptr(); + return std::shared_ptr(); // parse column ID int columnId = -1; @@ -370,7 +370,7 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (columnId<0) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -378,7 +378,7 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (token.mType!=Token::Type_Comma) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } // parse text pattern @@ -387,7 +387,7 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (!token.isString()) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } std::string text = token.mString; @@ -397,26 +397,26 @@ boost::shared_ptr CSMFilter::Parser::parseText() if (token.mType!=Token::Type_Close) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } - return boost::shared_ptr (new TextNode (columnId, text)); + return std::shared_ptr (new TextNode (columnId, text)); } -boost::shared_ptr CSMFilter::Parser::parseValue() +std::shared_ptr CSMFilter::Parser::parseValue() { Token token = getNextToken(); if (token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); if (!token) - return boost::shared_ptr(); + return std::shared_ptr(); // parse column ID int columnId = -1; @@ -434,7 +434,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (columnId<0) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -442,7 +442,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (token.mType!=Token::Type_Comma) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } // parse value @@ -467,7 +467,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() else if (token.mType!=Token::Type_CloseSquare && token.mType!=Token::Type_Open) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -481,7 +481,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (token.mType!=Token::Type_Comma) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } } else if (token.mType==Token::Type_Comma) @@ -491,7 +491,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() else { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } token = getNextToken(); @@ -513,7 +513,7 @@ boost::shared_ptr CSMFilter::Parser::parseValue() else if (token.mType!=Token::Type_OpenSquare && token.mType!=Token::Type_Close) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } } @@ -522,10 +522,10 @@ boost::shared_ptr CSMFilter::Parser::parseValue() if (token.mType!=Token::Type_Close) { error(); - return boost::shared_ptr(); + return std::shared_ptr(); } - return boost::shared_ptr (new ValueNode (columnId, lowerType, upperType, lower, upper)); + return std::shared_ptr (new ValueNode (columnId, lowerType, upperType, lower, upper)); } void CSMFilter::Parser::error() @@ -556,7 +556,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined) } else if (!allowPredefined || token==Token (Token::Type_OneShot)) { - boost::shared_ptr node = parseImp (true, token!=Token (Token::Type_OneShot)); + std::shared_ptr node = parseImp (true, token!=Token (Token::Type_OneShot)); if (mError) return false; @@ -612,7 +612,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined) } } -boost::shared_ptr CSMFilter::Parser::getFilter() const +std::shared_ptr CSMFilter::Parser::getFilter() const { if (mError) throw std::logic_error ("No filter available"); diff --git a/apps/opencs/model/filter/parser.hpp b/apps/opencs/model/filter/parser.hpp index 5700102cf..344c552ef 100644 --- a/apps/opencs/model/filter/parser.hpp +++ b/apps/opencs/model/filter/parser.hpp @@ -1,8 +1,6 @@ #ifndef CSM_FILTER_PARSER_H #define CSM_FILTER_PARSER_H -#include - #include "node.hpp" namespace CSMWorld @@ -16,7 +14,7 @@ namespace CSMFilter class Parser { - boost::shared_ptr mFilter; + std::shared_ptr mFilter; std::string mInput; int mIndex; bool mError; @@ -31,14 +29,14 @@ namespace CSMFilter Token checkKeywords (const Token& token); ///< Turn string token into keyword token, if possible. - boost::shared_ptr parseImp (bool allowEmpty = false, bool ignoreOneShot = false); + std::shared_ptr parseImp (bool allowEmpty = false, bool ignoreOneShot = false); ///< Will return a null-pointer, if there is nothing more to parse. - boost::shared_ptr parseNAry (const Token& keyword); + std::shared_ptr parseNAry (const Token& keyword); - boost::shared_ptr parseText(); + std::shared_ptr parseText(); - boost::shared_ptr parseValue(); + std::shared_ptr parseValue(); void error(); @@ -51,7 +49,7 @@ namespace CSMFilter /// /// \return Success? - boost::shared_ptr getFilter() const; + std::shared_ptr getFilter() const; ///< Throws an exception if the last call to parse did not return true. }; } diff --git a/apps/opencs/model/filter/unarynode.cpp b/apps/opencs/model/filter/unarynode.cpp index cbdadf6fc..7211f78b0 100644 --- a/apps/opencs/model/filter/unarynode.cpp +++ b/apps/opencs/model/filter/unarynode.cpp @@ -1,6 +1,6 @@ #include "unarynode.hpp" -CSMFilter::UnaryNode::UnaryNode (boost::shared_ptr child, const std::string& name) +CSMFilter::UnaryNode::UnaryNode (std::shared_ptr child, const std::string& name) : mChild (child), mName (name) {} diff --git a/apps/opencs/model/filter/unarynode.hpp b/apps/opencs/model/filter/unarynode.hpp index 6bbc96092..cbee4e0ba 100644 --- a/apps/opencs/model/filter/unarynode.hpp +++ b/apps/opencs/model/filter/unarynode.hpp @@ -1,20 +1,18 @@ #ifndef CSM_FILTER_UNARYNODE_H #define CSM_FILTER_UNARYNODE_H -#include - #include "node.hpp" namespace CSMFilter { class UnaryNode : public Node { - boost::shared_ptr mChild; + std::shared_ptr mChild; std::string mName; public: - UnaryNode (boost::shared_ptr child, const std::string& name); + UnaryNode (std::shared_ptr child, const std::string& name); const Node& getChild() const; diff --git a/apps/opencs/model/tools/mergeoperation.cpp b/apps/opencs/model/tools/mergeoperation.cpp index 907d742ed..9b595046a 100644 --- a/apps/opencs/model/tools/mergeoperation.cpp +++ b/apps/opencs/model/tools/mergeoperation.cpp @@ -45,9 +45,9 @@ CSMTools::MergeOperation::MergeOperation (CSMDoc::Document& document, ToUTF8::Fr appendStage (new FinishMergedDocumentStage (mState, encoding)); } -void CSMTools::MergeOperation::setTarget (std::auto_ptr document) +void CSMTools::MergeOperation::setTarget (std::unique_ptr document) { - mState.mTarget = document; + mState.mTarget = std::move(document); } void CSMTools::MergeOperation::operationDone() diff --git a/apps/opencs/model/tools/mergeoperation.hpp b/apps/opencs/model/tools/mergeoperation.hpp index bdaeb2ccd..733fc8eba 100644 --- a/apps/opencs/model/tools/mergeoperation.hpp +++ b/apps/opencs/model/tools/mergeoperation.hpp @@ -27,7 +27,7 @@ namespace CSMTools MergeOperation (CSMDoc::Document& document, ToUTF8::FromType encoding); /// \attention Do not call this function while a merge is running. - void setTarget (std::auto_ptr document); + void setTarget (std::unique_ptr document); protected slots: diff --git a/apps/opencs/model/tools/mergestate.hpp b/apps/opencs/model/tools/mergestate.hpp index 29e1bbda7..96e6752e2 100644 --- a/apps/opencs/model/tools/mergestate.hpp +++ b/apps/opencs/model/tools/mergestate.hpp @@ -12,7 +12,7 @@ namespace CSMTools { struct MergeState { - std::auto_ptr mTarget; + std::unique_ptr mTarget; CSMDoc::Document& mSource; bool mCompleted; std::map, int> mTextureIndices; // (texture, content file) -> new texture diff --git a/apps/opencs/model/tools/referencecheck.cpp b/apps/opencs/model/tools/referencecheck.cpp index be9663e7a..7f247741c 100644 --- a/apps/opencs/model/tools/referencecheck.cpp +++ b/apps/opencs/model/tools/referencecheck.cpp @@ -1,7 +1,5 @@ #include "referencecheck.hpp" -#include - CSMTools::ReferenceCheckStage::ReferenceCheckStage( const CSMWorld::RefCollection& references, const CSMWorld::RefIdCollection& referencables, @@ -40,9 +38,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if ((isLight && cellRef.mChargeFloat < -1) || (!isLight && cellRef.mChargeInt < -1)) { std::string str = " has invalid charge "; if (localIndex.second == CSMWorld::UniversalId::Type_Light) - str += boost::lexical_cast(cellRef.mChargeFloat); + str += std::to_string(cellRef.mChargeFloat); else - str += boost::lexical_cast(cellRef.mChargeInt); + str += std::to_string(cellRef.mChargeInt); messages.push_back(std::make_pair(id, id.getId() + str)); } } @@ -66,9 +64,9 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message // Check item's faction rank if (hasFaction && cellRef.mFactionRank < -1) - messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + boost::lexical_cast(cellRef.mFactionRank))); + messages.push_back(std::make_pair(id, " has faction set but has invalid faction rank " + std::to_string(cellRef.mFactionRank))); else if (!hasFaction && cellRef.mFactionRank != -2) - messages.push_back(std::make_pair(id, " has invalid faction rank " + boost::lexical_cast(cellRef.mFactionRank))); + messages.push_back(std::make_pair(id, " has invalid faction rank " + std::to_string(cellRef.mFactionRank))); // If door have destination cell, check if that reference is valid if (!cellRef.mDestCell.empty()) @@ -79,7 +77,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if (cellRef.mScale < 0) { std::string str = " has negative scale "; - str += boost::lexical_cast(cellRef.mScale); + str += std::to_string(cellRef.mScale); messages.push_back(std::make_pair(id, id.getId() + str)); } @@ -87,7 +85,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message if (cellRef.mEnchantmentCharge < 0 && cellRef.mEnchantmentCharge != -1) { std::string str = " has negative enchantment points "; - str += boost::lexical_cast(cellRef.mEnchantmentCharge); + str += std::to_string(cellRef.mEnchantmentCharge); messages.push_back(std::make_pair(id, id.getId() + str)); } diff --git a/apps/opencs/model/tools/tools.cpp b/apps/opencs/model/tools/tools.cpp index f538a716e..3b2c80263 100644 --- a/apps/opencs/model/tools/tools.cpp +++ b/apps/opencs/model/tools/tools.cpp @@ -216,7 +216,7 @@ void CSMTools::Tools::runSearch (const CSMWorld::UniversalId& searchId, const Se mSearch.start(); } -void CSMTools::Tools::runMerge (std::auto_ptr target) +void CSMTools::Tools::runMerge (std::unique_ptr target) { // not setting an active report, because merge does not produce messages @@ -230,7 +230,7 @@ void CSMTools::Tools::runMerge (std::auto_ptr target) target->flagAsDirty(); - mMergeOperation->setTarget (target); + mMergeOperation->setTarget (std::move(target)); mMerge.start(); } diff --git a/apps/opencs/model/tools/tools.hpp b/apps/opencs/model/tools/tools.hpp index e16a3854c..f544c8312 100644 --- a/apps/opencs/model/tools/tools.hpp +++ b/apps/opencs/model/tools/tools.hpp @@ -77,7 +77,7 @@ namespace CSMTools void runSearch (const CSMWorld::UniversalId& searchId, const Search& search); - void runMerge (std::auto_ptr target); + void runMerge (std::unique_ptr target); void abortOperation (int type); ///< \attention The operation is not aborted immediately. diff --git a/apps/opencs/model/world/columnimp.hpp b/apps/opencs/model/world/columnimp.hpp index 33a71e97a..154bdab82 100644 --- a/apps/opencs/model/world/columnimp.hpp +++ b/apps/opencs/model/world/columnimp.hpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include diff --git a/apps/opencs/model/world/commanddispatcher.cpp b/apps/opencs/model/world/commanddispatcher.cpp index ffbaa3dec..5d6a35cc5 100644 --- a/apps/opencs/model/world/commanddispatcher.cpp +++ b/apps/opencs/model/world/commanddispatcher.cpp @@ -138,7 +138,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons if (mLocked) return; - std::auto_ptr modifyCell; + std::unique_ptr modifyCell; int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt(); @@ -167,7 +167,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons } } - std::auto_ptr modifyData ( + std::unique_ptr modifyData ( new CSMWorld::ModifyCommand (*model, index, new_)); if (modifyCell.get()) diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 5a59f19f7..8b7faf2ed 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -554,12 +554,12 @@ CSMWorld::Data::~Data() delete mReader; } -boost::shared_ptr CSMWorld::Data::getResourceSystem() +std::shared_ptr CSMWorld::Data::getResourceSystem() { return mResourceSystem; } -boost::shared_ptr CSMWorld::Data::getResourceSystem() const +std::shared_ptr CSMWorld::Data::getResourceSystem() const { return mResourceSystem; } @@ -891,7 +891,7 @@ void CSMWorld::Data::merge() int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base, bool project) { // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading - boost::shared_ptr ptr(mReader); + std::shared_ptr ptr(mReader); mReaders.push_back(ptr); mReader = 0; @@ -945,7 +945,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages) // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading. // We don't store non-base reader, because everything going into modified will be // fully loaded during the initial loading process. - boost::shared_ptr ptr(mReader); + std::shared_ptr ptr(mReader); mReaders.push_back(ptr); } else diff --git a/apps/opencs/model/world/data.hpp b/apps/opencs/model/world/data.hpp index dc00a33d2..f96003e44 100644 --- a/apps/opencs/model/world/data.hpp +++ b/apps/opencs/model/world/data.hpp @@ -119,9 +119,9 @@ namespace CSMWorld std::map > mRefLoadCache; int mReaderIndex; - boost::shared_ptr mResourceSystem; + std::shared_ptr mResourceSystem; - std::vector > mReaders; + std::vector > mReaders; std::map mContentFileNames; @@ -148,9 +148,9 @@ namespace CSMWorld const Fallback::Map* getFallbackMap() const; - boost::shared_ptr getResourceSystem(); + std::shared_ptr getResourceSystem(); - boost::shared_ptr getResourceSystem() const; + std::shared_ptr getResourceSystem() const; const IdCollection& getGlobals() const; diff --git a/apps/opencs/model/world/idcompletionmanager.cpp b/apps/opencs/model/world/idcompletionmanager.cpp index 7f3221342..9fa6e3add 100644 --- a/apps/opencs/model/world/idcompletionmanager.cpp +++ b/apps/opencs/model/world/idcompletionmanager.cpp @@ -1,7 +1,5 @@ #include "idcompletionmanager.hpp" -#include - #include #include "../../view/widget/completerpopup.hpp" @@ -77,7 +75,7 @@ bool CSMWorld::IdCompletionManager::hasCompleterFor(CSMWorld::ColumnBase::Displa return mCompleters.find(display) != mCompleters.end(); } -boost::shared_ptr CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display) +std::shared_ptr CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display) { if (!hasCompleterFor(display)) { @@ -99,7 +97,7 @@ void CSMWorld::IdCompletionManager::generateCompleters(CSMWorld::Data &data) int idColumn = table->searchColumnIndex(CSMWorld::Columns::ColumnId_Id); if (idColumn != -1) { - boost::shared_ptr completer = boost::make_shared(table); + std::shared_ptr completer = std::make_shared(table); completer->setCompletionColumn(idColumn); // The completion role must be Qt::DisplayRole to get the ID values from the model completer->setCompletionRole(Qt::DisplayRole); diff --git a/apps/opencs/model/world/idcompletionmanager.hpp b/apps/opencs/model/world/idcompletionmanager.hpp index 7944e6777..e48360432 100644 --- a/apps/opencs/model/world/idcompletionmanager.hpp +++ b/apps/opencs/model/world/idcompletionmanager.hpp @@ -3,8 +3,7 @@ #include #include - -#include +#include #include "columnbase.hpp" #include "universalid.hpp" @@ -20,7 +19,7 @@ namespace CSMWorld { static const std::map sCompleterModelTypes; - std::map > mCompleters; + std::map > mCompleters; // Don't allow copying IdCompletionManager(const IdCompletionManager &); @@ -34,7 +33,7 @@ namespace CSMWorld IdCompletionManager(Data &data); bool hasCompleterFor(ColumnBase::Display display) const; - boost::shared_ptr getCompleter(ColumnBase::Display display); + std::shared_ptr getCompleter(ColumnBase::Display display); }; } diff --git a/apps/opencs/model/world/idtableproxymodel.cpp b/apps/opencs/model/world/idtableproxymodel.cpp index fbf7b6cf3..6d50e9edb 100644 --- a/apps/opencs/model/world/idtableproxymodel.cpp +++ b/apps/opencs/model/world/idtableproxymodel.cpp @@ -82,7 +82,7 @@ void CSMWorld::IdTableProxyModel::setSourceModel(QAbstractItemModel *model) SLOT(sourceDataChanged(const QModelIndex &, const QModelIndex &))); } -void CSMWorld::IdTableProxyModel::setFilter (const boost::shared_ptr& filter) +void CSMWorld::IdTableProxyModel::setFilter (const std::shared_ptr& filter) { beginResetModel(); mFilter = filter; diff --git a/apps/opencs/model/world/idtableproxymodel.hpp b/apps/opencs/model/world/idtableproxymodel.hpp index cf31b5c11..dd7ab41eb 100644 --- a/apps/opencs/model/world/idtableproxymodel.hpp +++ b/apps/opencs/model/world/idtableproxymodel.hpp @@ -3,8 +3,6 @@ #include -#include - #include #include @@ -19,7 +17,7 @@ namespace CSMWorld { Q_OBJECT - boost::shared_ptr mFilter; + std::shared_ptr mFilter; std::map mColumnMap; // column ID, column index in this model (or -1) // Cache of enum values for enum columns (e.g. Modified, Record Type). @@ -43,7 +41,7 @@ namespace CSMWorld virtual void setSourceModel(QAbstractItemModel *model); - void setFilter (const boost::shared_ptr& filter); + void setFilter (const std::shared_ptr& filter); void refreshFilter(); diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index c0ce575b7..31dae256e 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -808,7 +808,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin, const std::string& destination, const CSMWorld::UniversalId::Type type) { - std::auto_ptr newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy()); + std::unique_ptr newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy()); mAdapters.find(type)->second->setId(*newRecord, destination); mData.insertRecord(*newRecord, type, destination); } diff --git a/apps/opencs/model/world/refiddata.cpp b/apps/opencs/model/world/refiddata.cpp index 2d8c9ac10..e2ffbcca6 100644 --- a/apps/opencs/model/world/refiddata.cpp +++ b/apps/opencs/model/world/refiddata.cpp @@ -389,7 +389,7 @@ void CSMWorld::RefIdData::copyTo (int index, RefIdData& target) const std::string id = source->getId (localIndex.first); - std::auto_ptr newRecord (source->getRecord (localIndex.first).modifiedCopy()); + std::unique_ptr newRecord (source->getRecord (localIndex.first).modifiedCopy()); target.insertRecord (*newRecord, localIndex.second, id); } diff --git a/apps/opencs/view/doc/adjusterwidget.cpp b/apps/opencs/view/doc/adjusterwidget.cpp index 620d853ac..06da68ed8 100644 --- a/apps/opencs/view/doc/adjusterwidget.cpp +++ b/apps/opencs/view/doc/adjusterwidget.cpp @@ -1,8 +1,5 @@ #include "adjusterwidget.hpp" -#include -#include - #include #include diff --git a/apps/opencs/view/filter/editwidget.hpp b/apps/opencs/view/filter/editwidget.hpp index f672877d9..51a36969a 100644 --- a/apps/opencs/view/filter/editwidget.hpp +++ b/apps/opencs/view/filter/editwidget.hpp @@ -1,8 +1,6 @@ #ifndef CSV_FILTER_EDITWIDGET_H #define CSV_FILTER_EDITWIDGET_H -#include - #include #include #include @@ -38,7 +36,7 @@ namespace CSVFilter signals: - void filterChanged (boost::shared_ptr filter); + void filterChanged (std::shared_ptr filter); private: std::string generateFilter(std::pair >& seekedString) const; diff --git a/apps/opencs/view/filter/filterbox.cpp b/apps/opencs/view/filter/filterbox.cpp index 4c252e7d9..461b131db 100644 --- a/apps/opencs/view/filter/filterbox.cpp +++ b/apps/opencs/view/filter/filterbox.cpp @@ -21,8 +21,8 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent) setLayout (layout); connect (mRecordFilterBox, - SIGNAL (filterChanged (boost::shared_ptr)), - this, SIGNAL (recordFilterChanged (boost::shared_ptr))); + SIGNAL (filterChanged (std::shared_ptr)), + this, SIGNAL (recordFilterChanged (std::shared_ptr))); setAcceptDrops(true); } diff --git a/apps/opencs/view/filter/filterbox.hpp b/apps/opencs/view/filter/filterbox.hpp index c765164e7..e794a9880 100644 --- a/apps/opencs/view/filter/filterbox.hpp +++ b/apps/opencs/view/filter/filterbox.hpp @@ -41,7 +41,7 @@ namespace CSVFilter void dragMoveEvent(QDragMoveEvent *event); signals: - void recordFilterChanged (boost::shared_ptr filter); + void recordFilterChanged (std::shared_ptr filter); void recordDropped (std::vector& types, Qt::DropAction action); }; diff --git a/apps/opencs/view/filter/recordfilterbox.cpp b/apps/opencs/view/filter/recordfilterbox.cpp index 2bf589215..d24465897 100644 --- a/apps/opencs/view/filter/recordfilterbox.cpp +++ b/apps/opencs/view/filter/recordfilterbox.cpp @@ -23,8 +23,8 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare setLayout (layout); connect ( - mEdit, SIGNAL (filterChanged (boost::shared_ptr)), - this, SIGNAL (filterChanged (boost::shared_ptr))); + mEdit, SIGNAL (filterChanged (std::shared_ptr)), + this, SIGNAL (filterChanged (std::shared_ptr))); } void CSVFilter::RecordFilterBox::setFilter (const std::string& filter) diff --git a/apps/opencs/view/filter/recordfilterbox.hpp b/apps/opencs/view/filter/recordfilterbox.hpp index 29d12529a..77a07c92b 100644 --- a/apps/opencs/view/filter/recordfilterbox.hpp +++ b/apps/opencs/view/filter/recordfilterbox.hpp @@ -1,8 +1,6 @@ #ifndef CSV_FILTER_RECORDFILTERBOX_H #define CSV_FILTER_RECORDFILTERBOX_H -#include - #include #include @@ -38,7 +36,7 @@ namespace CSVFilter signals: - void filterChanged (boost::shared_ptr filter); + void filterChanged (std::shared_ptr filter); }; } diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 7cf542835..48156359f 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -62,7 +62,7 @@ bool CSVRender::Cell::addObjects (int start, int end) { std::string id = Misc::StringUtils::lowerCase (collection.getRecord (i).get().mId); - std::auto_ptr object (new Object (mData, mCellNode, id, false)); + std::unique_ptr object (new Object (mData, mCellNode, id, false)); if (mSubModeElementMask & Mask_Reference) object->setSubMode (mSubMode); diff --git a/apps/opencs/view/render/cell.hpp b/apps/opencs/view/render/cell.hpp index e8e0d2c63..ca82dd580 100644 --- a/apps/opencs/view/render/cell.hpp +++ b/apps/opencs/view/render/cell.hpp @@ -47,13 +47,13 @@ namespace CSVRender std::string mId; osg::ref_ptr mCellNode; std::map mObjects; - std::auto_ptr mTerrain; + std::unique_ptr mTerrain; CSMWorld::CellCoordinates mCoordinates; - std::auto_ptr mCellArrows[4]; - std::auto_ptr mCellMarker; - std::auto_ptr mCellBorder; - std::auto_ptr mCellWater; - std::auto_ptr mPathgrid; + std::unique_ptr mCellArrows[4]; + std::unique_ptr mCellMarker; + std::unique_ptr mCellBorder; + std::unique_ptr mCellWater; + std::unique_ptr mPathgrid; bool mDeleted; int mSubMode; unsigned int mSubModeElementMask; diff --git a/apps/opencs/view/render/cellmarker.cpp b/apps/opencs/view/render/cellmarker.cpp index 980ed305a..d0521a7b7 100644 --- a/apps/opencs/view/render/cellmarker.cpp +++ b/apps/opencs/view/render/cellmarker.cpp @@ -1,15 +1,10 @@ #include "cellmarker.hpp" -#include - #include #include #include -#include #include -#include "mask.hpp" - CSVRender::CellMarkerTag::CellMarkerTag(CellMarker *marker) : TagBase(Mask_CellMarker), mMarker(marker) {} @@ -42,8 +37,8 @@ void CSVRender::CellMarker::buildMarker() // Add text containing cell's coordinates. std::string coordinatesText = - boost::lexical_cast(mCoordinates.getX()) + "," + - boost::lexical_cast(mCoordinates.getY()); + std::to_string(mCoordinates.getX()) + "," + + std::to_string(mCoordinates.getY()); markerText->setText(coordinatesText); // Add text to marker node. diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp index 3373daa4a..fae609af5 100644 --- a/apps/opencs/view/render/instancemode.cpp +++ b/apps/opencs/view/render/instancemode.cpp @@ -559,7 +559,7 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event) if (mode=="Create cell and insert") { - std::auto_ptr createCommand ( + std::unique_ptr createCommand ( new CSMWorld::CreateCommand (cellTable, cellId)); int parentIndex = cellTable.findColumnIndex (CSMWorld::Columns::ColumnId_Cell); @@ -610,7 +610,7 @@ void CSVRender::InstanceMode::dropEvent (QDropEvent* event) if (mime->isReferencable (iter->getType())) { // create reference - std::auto_ptr createCommand ( + std::unique_ptr createCommand ( new CSMWorld::CreateCommand ( referencesTable, document.getData().getReferences().getNewId())); diff --git a/apps/opencs/view/render/object.hpp b/apps/opencs/view/render/object.hpp index d3cba6c55..e28e2562c 100644 --- a/apps/opencs/view/render/object.hpp +++ b/apps/opencs/view/render/object.hpp @@ -3,8 +3,6 @@ #include -#include - #include #include diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index e855f7e41..b5497558a 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -54,7 +54,7 @@ bool CSVRender::PagedWorldspaceWidget::adjustCells() { modified = true; - std::auto_ptr cell (new Cell (mDocument.getData(), mRootNode, + std::unique_ptr cell (new Cell (mDocument.getData(), mRootNode, iter->first.getId (mWorldspace), deleted)); delete iter->second; @@ -378,7 +378,7 @@ void CSVRender::PagedWorldspaceWidget::addCellToScene ( bool deleted = index==-1 || cells.getRecord (index).mState==CSMWorld::RecordBase::State_Deleted; - std::auto_ptr cell ( + std::unique_ptr cell ( new Cell (mDocument.getData(), mRootNode, coordinates.getId (mWorldspace), deleted)); EditMode *editMode = getEditMode(); diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index a072cd0aa..82eebf127 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -172,7 +172,7 @@ void CompositeViewer::update() // --------------------------------------------------- -SceneWidget::SceneWidget(boost::shared_ptr resourceSystem, QWidget *parent, Qt::WindowFlags f, +SceneWidget::SceneWidget(std::shared_ptr resourceSystem, QWidget *parent, Qt::WindowFlags f, bool retrieveInput) : RenderWidget(parent, f) , mResourceSystem(resourceSystem) diff --git a/apps/opencs/view/render/scenewidget.hpp b/apps/opencs/view/render/scenewidget.hpp index c5d9cdfce..cc3191c81 100644 --- a/apps/opencs/view/render/scenewidget.hpp +++ b/apps/opencs/view/render/scenewidget.hpp @@ -10,8 +10,6 @@ #include #include -#include - #include "lightingday.hpp" #include "lightingnight.hpp" #include "lightingbright.hpp" @@ -78,7 +76,7 @@ namespace CSVRender { Q_OBJECT public: - SceneWidget(boost::shared_ptr resourceSystem, QWidget* parent = 0, + SceneWidget(std::shared_ptr resourceSystem, QWidget* parent = 0, Qt::WindowFlags f = 0, bool retrieveInput = true); virtual ~SceneWidget(); @@ -98,7 +96,7 @@ namespace CSVRender virtual void mouseMoveEvent (QMouseEvent *event); virtual void wheelEvent (QWheelEvent *event); - boost::shared_ptr mResourceSystem; + std::shared_ptr mResourceSystem; Lighting* mLighting; diff --git a/apps/opencs/view/render/unpagedworldspacewidget.hpp b/apps/opencs/view/render/unpagedworldspacewidget.hpp index 57e8d1a19..5283b3a97 100644 --- a/apps/opencs/view/render/unpagedworldspacewidget.hpp +++ b/apps/opencs/view/render/unpagedworldspacewidget.hpp @@ -29,7 +29,7 @@ namespace CSVRender std::string mCellId; CSMWorld::IdTable *mCellsModel; CSMWorld::IdTable *mReferenceablesModel; - std::auto_ptr mCell; + std::unique_ptr mCell; void update(); diff --git a/apps/opencs/view/render/worldspacewidget.hpp b/apps/opencs/view/render/worldspacewidget.hpp index b30d7de8a..08b97e1be 100644 --- a/apps/opencs/view/render/worldspacewidget.hpp +++ b/apps/opencs/view/render/worldspacewidget.hpp @@ -1,8 +1,6 @@ #ifndef OPENCS_VIEW_WORLDSPACEWIDGET_H #define OPENCS_VIEW_WORLDSPACEWIDGET_H -#include - #include #include diff --git a/apps/opencs/view/tools/merge.cpp b/apps/opencs/view/tools/merge.cpp index 566a5ee06..c49044ccd 100644 --- a/apps/opencs/view/tools/merge.cpp +++ b/apps/opencs/view/tools/merge.cpp @@ -127,10 +127,10 @@ void CSVTools::Merge::accept() { std::vector< boost::filesystem::path > files (1, mAdjuster->getPath()); - std::auto_ptr target ( + std::unique_ptr target ( mDocumentManager.makeDocument (files, files[0], true)); - mDocument->runMerge (target); + mDocument->runMerge (std::move(target)); hide(); } diff --git a/apps/opencs/view/world/creator.hpp b/apps/opencs/view/world/creator.hpp index b76348199..320bbf6ae 100644 --- a/apps/opencs/view/world/creator.hpp +++ b/apps/opencs/view/world/creator.hpp @@ -91,7 +91,7 @@ namespace CSVWorld Creator *CreatorFactory::makeCreator (CSMDoc::Document& document, const CSMWorld::UniversalId& id) const { - std::auto_ptr creator (new CreatorT (document.getData(), document.getUndoStack(), id)); + std::unique_ptr creator (new CreatorT (document.getData(), document.getUndoStack(), id)); creator->setScope (scope); diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index 87d5b3d7f..7b198056c 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -120,7 +120,7 @@ mIndex(index) CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display) : mEditor(editor), mDisplay(display), -mIndexWrapper(NULL) +mIndexWrapper(nullptr) { } diff --git a/apps/opencs/view/world/dialoguesubview.hpp b/apps/opencs/view/world/dialoguesubview.hpp index bd7116ba2..cbcb9b210 100644 --- a/apps/opencs/view/world/dialoguesubview.hpp +++ b/apps/opencs/view/world/dialoguesubview.hpp @@ -84,7 +84,7 @@ namespace CSVWorld CSMWorld::ColumnBase::Display mDisplay; - std::auto_ptr mIndexWrapper; + std::unique_ptr mIndexWrapper; public: DialogueDelegateDispatcherProxy(QWidget* editor, diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index dd2bd82df..bf4c4967f 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -63,7 +63,7 @@ std::string CSVWorld::GenericCreator::getIdValidatorResult() const void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {} -void CSVWorld::GenericCreator::pushCommand (std::auto_ptr command, +void CSVWorld::GenericCreator::pushCommand (std::unique_ptr command, const std::string& id) { mUndoStack.push (command.release()); @@ -224,7 +224,7 @@ void CSVWorld::GenericCreator::create() { std::string id = getId(); - std::auto_ptr command; + std::unique_ptr command; if (mCloneMode) { @@ -239,7 +239,7 @@ void CSVWorld::GenericCreator::create() } configureCreateCommand (*command); - pushCommand (command, id); + pushCommand (std::move(command), id); emit done(); emit requestFocus(id); diff --git a/apps/opencs/view/world/genericcreator.hpp b/apps/opencs/view/world/genericcreator.hpp index f3fc82ec1..60d487bc1 100644 --- a/apps/opencs/view/world/genericcreator.hpp +++ b/apps/opencs/view/world/genericcreator.hpp @@ -71,7 +71,7 @@ namespace CSVWorld /// Allow subclasses to wrap the create command together with additional commands /// into a macro. - virtual void pushCommand (std::auto_ptr command, + virtual void pushCommand (std::unique_ptr command, const std::string& id); CSMWorld::Data& getData() const; diff --git a/apps/opencs/view/world/table.cpp b/apps/opencs/view/world/table.cpp index 07db5b477..30dba4241 100644 --- a/apps/opencs/view/world/table.cpp +++ b/apps/opencs/view/world/table.cpp @@ -692,7 +692,7 @@ void CSVWorld::Table::requestFocus (const std::string& id) scrollTo (index, QAbstractItemView::PositionAtTop); } -void CSVWorld::Table::recordFilterChanged (boost::shared_ptr filter) +void CSVWorld::Table::recordFilterChanged (std::shared_ptr filter) { mProxyModel->setFilter (filter); tableSizeUpdate(); diff --git a/apps/opencs/view/world/table.hpp b/apps/opencs/view/world/table.hpp index 768ff185d..26f6e7899 100644 --- a/apps/opencs/view/world/table.hpp +++ b/apps/opencs/view/world/table.hpp @@ -151,7 +151,7 @@ namespace CSVWorld void requestFocus (const std::string& id); - void recordFilterChanged (boost::shared_ptr filter); + void recordFilterChanged (std::shared_ptr filter); void rowAdded(const std::string &id); }; diff --git a/apps/opencs/view/world/tablesubview.cpp b/apps/opencs/view/world/tablesubview.cpp index fcf66ed81..6664a3771 100644 --- a/apps/opencs/view/world/tablesubview.cpp +++ b/apps/opencs/view/world/tablesubview.cpp @@ -78,8 +78,8 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D mTable, SLOT (requestFocus (const std::string&))); connect (mFilterBox, - SIGNAL (recordFilterChanged (boost::shared_ptr)), - mTable, SLOT (recordFilterChanged (boost::shared_ptr))); + SIGNAL (recordFilterChanged (std::shared_ptr)), + mTable, SLOT (recordFilterChanged (std::shared_ptr))); connect(mFilterBox, SIGNAL(recordDropped(std::vector&, Qt::DropAction)), this, SLOT(createFilterRequest(std::vector&, Qt::DropAction))); diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index c095ad5fb..15ecd6362 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -1,6 +1,5 @@ #include "engine.hpp" -#include #include #include @@ -28,7 +27,6 @@ #include #include -#include #include #include diff --git a/apps/openmw/engine.hpp b/apps/openmw/engine.hpp index d06ca594d..29419a4c2 100644 --- a/apps/openmw/engine.hpp +++ b/apps/openmw/engine.hpp @@ -71,8 +71,8 @@ namespace OMW class Engine { SDL_Window* mWindow; - std::auto_ptr mVFS; - std::auto_ptr mResourceSystem; + std::unique_ptr mVFS; + std::unique_ptr mResourceSystem; osg::ref_ptr mWorkQueue; MWBase::Environment mEnvironment; ToUTF8::FromType mEncoding; diff --git a/apps/openmw/main.cpp b/apps/openmw/main.cpp index df26780a9..23c3cda3b 100644 --- a/apps/openmw/main.cpp +++ b/apps/openmw/main.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -7,11 +6,8 @@ #include #include -#include #include "engine.hpp" -#include -#include #include #include "mwmp/Main.hpp" @@ -38,8 +34,8 @@ extern int cc_install_handlers(int argc, char **argv, int num_signals, int *sigs extern int is_debugger_attached(void); #endif -#include #include + /** * Workaround for problems with whitespaces in paths in older versions of Boost library */ @@ -316,7 +312,7 @@ int main(int argc, char**argv) boost::filesystem::ofstream logfile; - std::auto_ptr engine; + std::unique_ptr engine; int ret = 0; try diff --git a/apps/openmw/mwbase/soundmanager.hpp b/apps/openmw/mwbase/soundmanager.hpp index 22582c2b1..9aa4bafdf 100644 --- a/apps/openmw/mwbase/soundmanager.hpp +++ b/apps/openmw/mwbase/soundmanager.hpp @@ -1,9 +1,9 @@ #ifndef GAME_MWBASE_SOUNDMANAGER_H #define GAME_MWBASE_SOUNDMANAGER_H +#include #include #include -#include #include "../mwworld/ptr.hpp" @@ -17,13 +17,13 @@ namespace MWSound class Sound; class Stream; struct Sound_Decoder; - typedef boost::shared_ptr DecoderPtr; + typedef std::shared_ptr DecoderPtr; } namespace MWBase { - typedef boost::shared_ptr SoundPtr; - typedef boost::shared_ptr SoundStreamPtr; + typedef std::shared_ptr SoundPtr; + typedef std::shared_ptr SoundStreamPtr; /// \brief Interface for sound manager (implemented in MWSound) class SoundManager diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index c484af81f..13f88243d 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -388,6 +388,7 @@ namespace MWBase ///Is the head of the creature underwater? virtual bool isSubmerged(const MWWorld::ConstPtr &object) const = 0; virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const = 0; + virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const = 0; virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const = 0; virtual bool isOnGround(const MWWorld::Ptr &ptr) const = 0; diff --git a/apps/openmw/mwclass/activator.cpp b/apps/openmw/mwclass/activator.cpp index 3e0ec366f..4910ab932 100644 --- a/apps/openmw/mwclass/activator.cpp +++ b/apps/openmw/mwclass/activator.cpp @@ -73,7 +73,7 @@ namespace MWClass void Activator::registerSelf() { - boost::shared_ptr instance (new Activator); + std::shared_ptr instance (new Activator); registerClass (typeid (ESM::Activator).name(), instance); } @@ -107,19 +107,19 @@ namespace MWClass return info; } - boost::shared_ptr Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const + std::shared_ptr Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const { if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfActivator"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } - return boost::shared_ptr(new MWWorld::NullAction); + return std::shared_ptr(new MWWorld::NullAction); } diff --git a/apps/openmw/mwclass/activator.hpp b/apps/openmw/mwclass/activator.hpp index 4fe4dda7e..21afa7b8e 100644 --- a/apps/openmw/mwclass/activator.hpp +++ b/apps/openmw/mwclass/activator.hpp @@ -33,7 +33,7 @@ namespace MWClass virtual std::string getScript (const MWWorld::ConstPtr& ptr) const; ///< Return name of the script attached to ptr - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation static void registerSelf(); diff --git a/apps/openmw/mwclass/apparatus.cpp b/apps/openmw/mwclass/apparatus.cpp index 3642a22ed..a271dc5e9 100644 --- a/apps/openmw/mwclass/apparatus.cpp +++ b/apps/openmw/mwclass/apparatus.cpp @@ -51,7 +51,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Apparatus::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Apparatus::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -73,7 +73,7 @@ namespace MWClass void Apparatus::registerSelf() { - boost::shared_ptr instance (new Apparatus); + std::shared_ptr instance (new Apparatus); registerClass (typeid (ESM::Apparatus).name(), instance); } @@ -125,9 +125,9 @@ namespace MWClass } - boost::shared_ptr Apparatus::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Apparatus::use (const MWWorld::Ptr& ptr) const { - return boost::shared_ptr(new MWWorld::ActionAlchemy()); + return std::shared_ptr(new MWWorld::ActionAlchemy()); } MWWorld::Ptr Apparatus::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const diff --git a/apps/openmw/mwclass/apparatus.hpp b/apps/openmw/mwclass/apparatus.hpp index d669b9c2d..539c1068b 100644 --- a/apps/openmw/mwclass/apparatus.hpp +++ b/apps/openmw/mwclass/apparatus.hpp @@ -23,7 +23,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -50,7 +50,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/armor.cpp b/apps/openmw/mwclass/armor.cpp index f652cbd04..460cd517a 100644 --- a/apps/openmw/mwclass/armor.cpp +++ b/apps/openmw/mwclass/armor.cpp @@ -57,7 +57,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Armor::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Armor::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -165,7 +165,7 @@ namespace MWClass void Armor::registerSelf() { - boost::shared_ptr instance (new Armor); + std::shared_ptr instance (new Armor); registerClass (typeid (ESM::Armor).name(), instance); } @@ -354,9 +354,9 @@ namespace MWClass return std::make_pair(1,""); } - boost::shared_ptr Armor::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Armor::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/armor.hpp b/apps/openmw/mwclass/armor.hpp index 025bc8af1..628ac1b88 100644 --- a/apps/openmw/mwclass/armor.hpp +++ b/apps/openmw/mwclass/armor.hpp @@ -22,7 +22,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -73,7 +73,7 @@ namespace MWClass ///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. \n /// Second item in the pair specifies the error message - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/bodypart.cpp b/apps/openmw/mwclass/bodypart.cpp index be2b927cc..41a9d998e 100644 --- a/apps/openmw/mwclass/bodypart.cpp +++ b/apps/openmw/mwclass/bodypart.cpp @@ -33,7 +33,7 @@ namespace MWClass void BodyPart::registerSelf() { - boost::shared_ptr instance (new BodyPart); + std::shared_ptr instance (new BodyPart); registerClass (typeid (ESM::BodyPart).name(), instance); } diff --git a/apps/openmw/mwclass/book.cpp b/apps/openmw/mwclass/book.cpp index f2c97d770..3d6455dc6 100644 --- a/apps/openmw/mwclass/book.cpp +++ b/apps/openmw/mwclass/book.cpp @@ -54,7 +54,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Book::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Book::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) @@ -62,13 +62,13 @@ namespace MWClass const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfItem"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } - return boost::shared_ptr(new MWWorld::ActionRead(ptr)); + return std::shared_ptr(new MWWorld::ActionRead(ptr)); } std::string Book::getScript (const MWWorld::ConstPtr& ptr) const @@ -87,7 +87,7 @@ namespace MWClass void Book::registerSelf() { - boost::shared_ptr instance (new Book); + std::shared_ptr instance (new Book); registerClass (typeid (ESM::Book).name(), instance); } @@ -162,9 +162,9 @@ namespace MWClass return record->mId; } - boost::shared_ptr Book::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Book::use (const MWWorld::Ptr& ptr) const { - return boost::shared_ptr(new MWWorld::ActionRead(ptr)); + return std::shared_ptr(new MWWorld::ActionRead(ptr)); } MWWorld::Ptr Book::copyToCellImpl(const MWWorld::ConstPtr &ptr, MWWorld::CellStore &cell) const diff --git a/apps/openmw/mwclass/book.hpp b/apps/openmw/mwclass/book.hpp index 73bfecacd..82ca08a4d 100644 --- a/apps/openmw/mwclass/book.hpp +++ b/apps/openmw/mwclass/book.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -53,7 +53,7 @@ namespace MWClass virtual std::string applyEnchantment(const MWWorld::ConstPtr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) const; + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; diff --git a/apps/openmw/mwclass/clothing.cpp b/apps/openmw/mwclass/clothing.cpp index 1d99ee8e2..b37d1e90b 100644 --- a/apps/openmw/mwclass/clothing.cpp +++ b/apps/openmw/mwclass/clothing.cpp @@ -53,7 +53,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Clothing::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Clothing::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -124,7 +124,7 @@ namespace MWClass void Clothing::registerSelf() { - boost::shared_ptr instance (new Clothing); + std::shared_ptr instance (new Clothing); registerClass (typeid (ESM::Clothing).name(), instance); } @@ -243,9 +243,9 @@ namespace MWClass return std::make_pair (1, ""); } - boost::shared_ptr Clothing::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Clothing::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/clothing.hpp b/apps/openmw/mwclass/clothing.hpp index e1c0f63f7..202b6596e 100644 --- a/apps/openmw/mwclass/clothing.hpp +++ b/apps/openmw/mwclass/clothing.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -65,7 +65,7 @@ namespace MWClass ///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. /// Second item in the pair specifies the error message - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/container.cpp b/apps/openmw/mwclass/container.cpp index 24502f621..234e72664 100644 --- a/apps/openmw/mwclass/container.cpp +++ b/apps/openmw/mwclass/container.cpp @@ -64,7 +64,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data (new ContainerCustomData); + std::unique_ptr data (new ContainerCustomData); MWWorld::LiveCellRef *ref = ptr.get(); @@ -130,18 +130,18 @@ namespace MWClass return true; } - boost::shared_ptr Container::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Container::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) - return boost::shared_ptr (new MWWorld::NullAction ()); + return std::shared_ptr (new MWWorld::NullAction ()); if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfContainer"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; @@ -222,20 +222,20 @@ namespace MWClass { if(!isTrapped) { - boost::shared_ptr action (new MWWorld::ActionOpen(ptr)); + std::shared_ptr action (new MWWorld::ActionOpen(ptr)); return action; } else { // Activate trap - boost::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); + std::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); action->setSound(trapActivationSound); return action; } } else { - boost::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); + std::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); action->setSound(lockedSound); return action; } @@ -265,7 +265,7 @@ namespace MWClass void Container::registerSelf() { - boost::shared_ptr instance (new Container); + std::shared_ptr instance (new Container); registerClass (typeid (ESM::Container).name(), instance); } @@ -349,7 +349,7 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) { // Create a CustomData, but don't fill it from ESM records (not needed) - std::auto_ptr data (new ContainerCustomData); + std::unique_ptr data (new ContainerCustomData); ptr.getRefData().setCustomData (data.release()); } diff --git a/apps/openmw/mwclass/container.hpp b/apps/openmw/mwclass/container.hpp index 04223f264..e38d98b5c 100644 --- a/apps/openmw/mwclass/container.hpp +++ b/apps/openmw/mwclass/container.hpp @@ -23,7 +23,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index 79c9d9bb1..cc76c7e28 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -123,7 +123,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data (new CreatureCustomData); + std::unique_ptr data (new CreatureCustomData); MWWorld::LiveCellRef *ref = ptr.get(); @@ -544,7 +544,7 @@ namespace MWClass */ } - boost::shared_ptr Creature::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Creature::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) @@ -552,17 +552,17 @@ namespace MWClass const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfCreature"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } if(getCreatureStats(ptr).isDead()) - return boost::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) - return boost::shared_ptr(new MWWorld::FailedAction("")); - return boost::shared_ptr(new MWWorld::ActionTalk(ptr)); + return std::shared_ptr(new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } MWWorld::ContainerStore& Creature::getContainerStore (const MWWorld::Ptr& ptr) const @@ -599,7 +599,7 @@ namespace MWClass void Creature::registerSelf() { - boost::shared_ptr instance (new Creature); + std::shared_ptr instance (new Creature); registerClass (typeid (ESM::Creature).name(), instance); } @@ -852,7 +852,7 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) { // Create a CustomData, but don't fill it from ESM records (not needed) - std::auto_ptr data (new CreatureCustomData); + std::unique_ptr data (new CreatureCustomData); if (hasInventoryStore(ptr)) data->mContainerStore = new MWWorld::InventoryStore(); diff --git a/apps/openmw/mwclass/creature.hpp b/apps/openmw/mwclass/creature.hpp index 076bc8572..e3689204a 100644 --- a/apps/openmw/mwclass/creature.hpp +++ b/apps/openmw/mwclass/creature.hpp @@ -60,7 +60,7 @@ namespace MWClass virtual void onHit(const MWWorld::Ptr &ptr, float damage, bool ishealth, const MWWorld::Ptr &object, const MWWorld::Ptr &attacker, const osg::Vec3f &hitPosition, bool successful) const; - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/creaturelevlist.cpp b/apps/openmw/mwclass/creaturelevlist.cpp index 0db02a8d6..4af505e9e 100644 --- a/apps/openmw/mwclass/creaturelevlist.cpp +++ b/apps/openmw/mwclass/creaturelevlist.cpp @@ -70,7 +70,7 @@ namespace MWClass void CreatureLevList::registerSelf() { - boost::shared_ptr instance (new CreatureLevList); + std::shared_ptr instance (new CreatureLevList); registerClass (typeid (ESM::CreatureLevList).name(), instance); } @@ -141,7 +141,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data (new CreatureLevListCustomData); + std::unique_ptr data (new CreatureLevListCustomData); data->mSpawnActorId = -1; data->mSpawn = true; diff --git a/apps/openmw/mwclass/door.cpp b/apps/openmw/mwclass/door.cpp index 943360cda..056833731 100644 --- a/apps/openmw/mwclass/door.cpp +++ b/apps/openmw/mwclass/door.cpp @@ -111,7 +111,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Door::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Door::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { MWWorld::LiveCellRef *ref = ptr.get(); @@ -144,15 +144,19 @@ namespace MWClass // make key id lowercase std::string keyId = ptr.getCellRef().getKey(); - Misc::StringUtils::lowerCaseInPlace(keyId); - for (MWWorld::ConstContainerStoreIterator it = invStore.cbegin(); it != invStore.cend(); ++it) + if (!keyId.empty()) { - std::string refId = it->getCellRef().getRefId(); - Misc::StringUtils::lowerCaseInPlace(refId); - if (refId == keyId) + Misc::StringUtils::lowerCaseInPlace(keyId); + for (MWWorld::ConstContainerStoreIterator it = invStore.cbegin(); it != invStore.cend(); ++it) { - hasKey = true; - keyName = it->getClass().getName(*it); + std::string refId = it->getCellRef().getRefId(); + Misc::StringUtils::lowerCaseInPlace(refId); + if (refId == keyId) + { + hasKey = true; + keyName = it->getClass().getName(*it); + break; + } } } @@ -207,7 +211,7 @@ namespace MWClass if(isTrapped) { // Trap activation - boost::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); + std::shared_ptr action(new MWWorld::ActionTrap(ptr.getCellRef().getTrap(), ptr)); action->setSound(trapActivationSound); return action; } @@ -217,12 +221,12 @@ namespace MWClass if (actor == MWMechanics::getPlayer() && MWBase::Environment::get().getWorld()->getDistanceToFacedObject() > MWBase::Environment::get().getWorld()->getMaxActivationDistance()) { // player activated teleport door with telekinesis - boost::shared_ptr action(new MWWorld::FailedAction); + std::shared_ptr action(new MWWorld::FailedAction); return action; } else { - boost::shared_ptr action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true)); + std::shared_ptr action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true)); action->setSound(openSound); return action; } @@ -230,7 +234,7 @@ namespace MWClass else { // animated door - boost::shared_ptr action(new MWWorld::ActionDoor(ptr)); + std::shared_ptr action(new MWWorld::ActionDoor(ptr)); int doorstate = getDoorState(ptr); bool opening = true; float doorRot = ptr.getRefData().getPosition().rot[2] - ptr.getCellRef().getPosition().rot[2]; @@ -264,7 +268,7 @@ namespace MWClass else { // locked, and we can't open. - boost::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); + std::shared_ptr action(new MWWorld::FailedAction(std::string(), ptr)); action->setSound(lockedSound); return action; } @@ -305,7 +309,7 @@ namespace MWClass void Door::registerSelf() { - boost::shared_ptr instance (new Door); + std::shared_ptr instance (new Door); registerClass (typeid (ESM::Door).name(), instance); } @@ -391,7 +395,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data(new DoorCustomData); + std::unique_ptr data(new DoorCustomData); data->mDoorState = 0; ptr.getRefData().setCustomData(data.release()); diff --git a/apps/openmw/mwclass/door.hpp b/apps/openmw/mwclass/door.hpp index 3760f59c4..a2d129522 100644 --- a/apps/openmw/mwclass/door.hpp +++ b/apps/openmw/mwclass/door.hpp @@ -26,7 +26,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/ingredient.cpp b/apps/openmw/mwclass/ingredient.cpp index a9a995f2f..09d149331 100644 --- a/apps/openmw/mwclass/ingredient.cpp +++ b/apps/openmw/mwclass/ingredient.cpp @@ -54,7 +54,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Ingredient::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Ingredient::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -75,9 +75,9 @@ namespace MWClass } - boost::shared_ptr Ingredient::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Ingredient::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action (new MWWorld::ActionEat (ptr)); + std::shared_ptr action (new MWWorld::ActionEat (ptr)); action->setSound ("Swallow"); @@ -86,7 +86,7 @@ namespace MWClass void Ingredient::registerSelf() { - boost::shared_ptr instance (new Ingredient); + std::shared_ptr instance (new Ingredient); registerClass (typeid (ESM::Ingredient).name(), instance); } diff --git a/apps/openmw/mwclass/ingredient.hpp b/apps/openmw/mwclass/ingredient.hpp index 9a8bdacfb..1136eb50f 100644 --- a/apps/openmw/mwclass/ingredient.hpp +++ b/apps/openmw/mwclass/ingredient.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -36,7 +36,7 @@ namespace MWClass virtual int getValue (const MWWorld::ConstPtr& ptr) const; ///< Return trade value of the object. Throws an exception, if the object can't be traded. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/itemlevlist.cpp b/apps/openmw/mwclass/itemlevlist.cpp index 290ac4c26..d2c246a85 100644 --- a/apps/openmw/mwclass/itemlevlist.cpp +++ b/apps/openmw/mwclass/itemlevlist.cpp @@ -12,7 +12,7 @@ namespace MWClass void ItemLevList::registerSelf() { - boost::shared_ptr instance (new ItemLevList); + std::shared_ptr instance (new ItemLevList); registerClass (typeid (ESM::ItemLevList).name(), instance); } diff --git a/apps/openmw/mwclass/light.cpp b/apps/openmw/mwclass/light.cpp index ed69ee3ac..172c16c83 100644 --- a/apps/openmw/mwclass/light.cpp +++ b/apps/openmw/mwclass/light.cpp @@ -79,15 +79,15 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Light::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Light::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) - return boost::shared_ptr(new MWWorld::NullAction()); + return std::shared_ptr(new MWWorld::NullAction()); MWWorld::LiveCellRef *ref = ptr.get(); if(!(ref->mBase->mData.mFlags&ESM::Light::Carry)) - return boost::shared_ptr(new MWWorld::FailedAction()); + return std::shared_ptr(new MWWorld::FailedAction()); return defaultItemActivate(ptr, actor); } @@ -120,7 +120,7 @@ namespace MWClass void Light::registerSelf() { - boost::shared_ptr instance (new Light); + std::shared_ptr instance (new Light); registerClass (typeid (ESM::Light).name(), instance); } @@ -186,9 +186,9 @@ namespace MWClass return Class::showsInInventory(ptr); } - boost::shared_ptr Light::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Light::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/light.hpp b/apps/openmw/mwclass/light.hpp index 284a7d817..59085d97e 100644 --- a/apps/openmw/mwclass/light.hpp +++ b/apps/openmw/mwclass/light.hpp @@ -30,7 +30,7 @@ namespace MWClass virtual bool showsInInventory (const MWWorld::ConstPtr& ptr) const; - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -55,7 +55,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/lockpick.cpp b/apps/openmw/mwclass/lockpick.cpp index a335415ac..b8f6f5ecb 100644 --- a/apps/openmw/mwclass/lockpick.cpp +++ b/apps/openmw/mwclass/lockpick.cpp @@ -52,7 +52,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Lockpick::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Lockpick::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -83,7 +83,7 @@ namespace MWClass void Lockpick::registerSelf() { - boost::shared_ptr instance (new Lockpick); + std::shared_ptr instance (new Lockpick); registerClass (typeid (ESM::Lockpick).name(), instance); } @@ -139,9 +139,9 @@ namespace MWClass return info; } - boost::shared_ptr Lockpick::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Lockpick::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/lockpick.hpp b/apps/openmw/mwclass/lockpick.hpp index f04674f5c..efa675c95 100644 --- a/apps/openmw/mwclass/lockpick.hpp +++ b/apps/openmw/mwclass/lockpick.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -51,7 +51,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/misc.cpp b/apps/openmw/mwclass/misc.cpp index 3e1d750ad..a68176226 100644 --- a/apps/openmw/mwclass/misc.cpp +++ b/apps/openmw/mwclass/misc.cpp @@ -1,14 +1,11 @@ #include "misc.hpp" -#include - #include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwworld/ptr.hpp" #include "../mwworld/actiontake.hpp" #include "../mwworld/cellstore.hpp" #include "../mwworld/esmstore.hpp" @@ -22,8 +19,6 @@ #include "../mwrender/objects.hpp" #include "../mwrender/renderinginterface.hpp" -#include - namespace MWClass { bool Miscellaneous::isGold (const MWWorld::ConstPtr& ptr) const @@ -65,7 +60,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Miscellaneous::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Miscellaneous::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -97,7 +92,7 @@ namespace MWClass void Miscellaneous::registerSelf() { - boost::shared_ptr instance (new Miscellaneous); + std::shared_ptr instance (new Miscellaneous); registerClass (typeid (ESM::Miscellaneous).name(), instance); } @@ -146,7 +141,7 @@ namespace MWClass if (!gold) countString = MWGui::ToolTips::getCountString(count); else // gold displays its count also if it's 1. - countString = " (" + boost::lexical_cast(count) + ")"; + countString = " (" + std::to_string(count) + ")"; info.caption = ref->mBase->mName + countString; info.icon = ref->mBase->mIcon; @@ -213,12 +208,12 @@ namespace MWClass return newPtr; } - boost::shared_ptr Miscellaneous::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Miscellaneous::use (const MWWorld::Ptr& ptr) const { if (ptr.getCellRef().getSoul().empty()) - return boost::shared_ptr(new MWWorld::NullAction()); + return std::shared_ptr(new MWWorld::NullAction()); else - return boost::shared_ptr(new MWWorld::ActionSoulgem(ptr)); + return std::shared_ptr(new MWWorld::ActionSoulgem(ptr)); } bool Miscellaneous::canSell (const MWWorld::ConstPtr& item, int npcServices) const diff --git a/apps/openmw/mwclass/misc.hpp b/apps/openmw/mwclass/misc.hpp index 2a534f058..37e77860b 100644 --- a/apps/openmw/mwclass/misc.hpp +++ b/apps/openmw/mwclass/misc.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -49,7 +49,7 @@ namespace MWClass virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/npc.cpp b/apps/openmw/mwclass/npc.cpp index a71ea38a1..40b98b331 100644 --- a/apps/openmw/mwclass/npc.cpp +++ b/apps/openmw/mwclass/npc.cpp @@ -318,7 +318,7 @@ namespace MWClass { if (!ptr.getRefData().getCustomData()) { - std::auto_ptr data(new NpcCustomData); + std::unique_ptr data(new NpcCustomData); MWWorld::LiveCellRef *ref = ptr.get(); @@ -969,7 +969,7 @@ namespace MWClass */ } - boost::shared_ptr Npc::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Npc::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { /* @@ -985,7 +985,7 @@ namespace MWClass // player got activated by another NPC if(ptr == MWMechanics::getPlayer()) - return boost::shared_ptr(new MWWorld::ActionTalk(actor)); + return std::shared_ptr(new MWWorld::ActionTalk(actor)); // Werewolfs can't activate NPCs if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) @@ -993,23 +993,23 @@ namespace MWClass const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfNPC"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } if(getCreatureStats(ptr).isDead()) - return boost::shared_ptr(new MWWorld::ActionOpen(ptr, true)); + return std::shared_ptr(new MWWorld::ActionOpen(ptr, true)); if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) - return boost::shared_ptr(new MWWorld::FailedAction("#{sActorInCombat}")); + return std::shared_ptr(new MWWorld::FailedAction("#{sActorInCombat}")); if(getCreatureStats(actor).getStance(MWMechanics::CreatureStats::Stance_Sneak) || ptr.getClass().getCreatureStats(ptr).getKnockedDown()) - return boost::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing + return std::shared_ptr(new MWWorld::ActionOpen(ptr)); // stealing // Can't talk to werewolfs if(ptr.getClass().isNpc() && ptr.getClass().getNpcStats(ptr).isWerewolf()) - return boost::shared_ptr (new MWWorld::FailedAction("")); - return boost::shared_ptr(new MWWorld::ActionTalk(ptr)); + return std::shared_ptr (new MWWorld::FailedAction("")); + return std::shared_ptr(new MWWorld::ActionTalk(ptr)); } MWWorld::ContainerStore& Npc::getContainerStore (const MWWorld::Ptr& ptr) @@ -1145,7 +1145,7 @@ namespace MWClass void Npc::registerSelf() { - boost::shared_ptr instance (new Npc); + std::shared_ptr instance (new Npc); registerClass (typeid (ESM::NPC).name(), instance); } @@ -1395,7 +1395,7 @@ namespace MWClass if (!ptr.getRefData().getCustomData()) { // Create a CustomData, but don't fill it from ESM records (not needed) - std::auto_ptr data (new NpcCustomData); + std::unique_ptr data (new NpcCustomData); ptr.getRefData().setCustomData (data.release()); } } diff --git a/apps/openmw/mwclass/npc.hpp b/apps/openmw/mwclass/npc.hpp index 3120c498c..e91dc7113 100644 --- a/apps/openmw/mwclass/npc.hpp +++ b/apps/openmw/mwclass/npc.hpp @@ -78,7 +78,7 @@ namespace MWClass virtual void getModelsToPreload(const MWWorld::Ptr& ptr, std::vector& models) const; ///< Get a list of models to preload that this object may use (directly or indirectly). default implementation: list getModel(). - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation diff --git a/apps/openmw/mwclass/potion.cpp b/apps/openmw/mwclass/potion.cpp index 225175979..ffdccf438 100644 --- a/apps/openmw/mwclass/potion.cpp +++ b/apps/openmw/mwclass/potion.cpp @@ -55,7 +55,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Potion::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Potion::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -78,7 +78,7 @@ namespace MWClass void Potion::registerSelf() { - boost::shared_ptr instance (new Potion); + std::shared_ptr instance (new Potion); registerClass (typeid (ESM::Potion).name(), instance); } @@ -139,12 +139,12 @@ namespace MWClass return info; } - boost::shared_ptr Potion::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Potion::use (const MWWorld::Ptr& ptr) const { MWWorld::LiveCellRef *ref = ptr.get(); - boost::shared_ptr action ( + std::shared_ptr action ( new MWWorld::ActionApply (ptr, ref->mBase->mId)); action->setSound ("Drink"); diff --git a/apps/openmw/mwclass/potion.hpp b/apps/openmw/mwclass/potion.hpp index 9cdd58058..ad9a329c0 100644 --- a/apps/openmw/mwclass/potion.hpp +++ b/apps/openmw/mwclass/potion.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -36,7 +36,7 @@ namespace MWClass virtual int getValue (const MWWorld::ConstPtr& ptr) const; ///< Return trade value of the object. Throws an exception, if the object can't be traded. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) const; + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu static void registerSelf(); diff --git a/apps/openmw/mwclass/probe.cpp b/apps/openmw/mwclass/probe.cpp index 185aa66cb..ecaa056f9 100644 --- a/apps/openmw/mwclass/probe.cpp +++ b/apps/openmw/mwclass/probe.cpp @@ -51,7 +51,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Probe::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Probe::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -83,7 +83,7 @@ namespace MWClass void Probe::registerSelf() { - boost::shared_ptr instance (new Probe); + std::shared_ptr instance (new Probe); registerClass (typeid (ESM::Probe).name(), instance); } @@ -139,9 +139,9 @@ namespace MWClass return info; } - boost::shared_ptr Probe::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Probe::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/probe.hpp b/apps/openmw/mwclass/probe.hpp index 4fc991a5f..f67d8af86 100644 --- a/apps/openmw/mwclass/probe.hpp +++ b/apps/openmw/mwclass/probe.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -51,7 +51,7 @@ namespace MWClass virtual std::string getInventoryIcon (const MWWorld::ConstPtr& ptr) const; ///< Return name of inventory icon. - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwclass/repair.cpp b/apps/openmw/mwclass/repair.cpp index cbdfade2b..566d16106 100644 --- a/apps/openmw/mwclass/repair.cpp +++ b/apps/openmw/mwclass/repair.cpp @@ -51,7 +51,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Repair::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Repair::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -74,7 +74,7 @@ namespace MWClass void Repair::registerSelf() { - boost::shared_ptr instance (new Repair); + std::shared_ptr instance (new Repair); registerClass (typeid (ESM::Repair).name(), instance); } @@ -149,9 +149,9 @@ namespace MWClass return MWWorld::Ptr(cell.insert(ref), &cell); } - boost::shared_ptr Repair::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Repair::use (const MWWorld::Ptr& ptr) const { - return boost::shared_ptr(new MWWorld::ActionRepair(ptr)); + return std::shared_ptr(new MWWorld::ActionRepair(ptr)); } bool Repair::canSell (const MWWorld::ConstPtr& item, int npcServices) const diff --git a/apps/openmw/mwclass/repair.hpp b/apps/openmw/mwclass/repair.hpp index f0d1292f4..34ba4035b 100644 --- a/apps/openmw/mwclass/repair.hpp +++ b/apps/openmw/mwclass/repair.hpp @@ -20,7 +20,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -49,7 +49,7 @@ namespace MWClass virtual std::string getModel(const MWWorld::ConstPtr &ptr) const; - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu (default implementation: return a /// null action). diff --git a/apps/openmw/mwclass/static.cpp b/apps/openmw/mwclass/static.cpp index 65e69ea90..40a6b998c 100644 --- a/apps/openmw/mwclass/static.cpp +++ b/apps/openmw/mwclass/static.cpp @@ -43,7 +43,7 @@ namespace MWClass void Static::registerSelf() { - boost::shared_ptr instance (new Static); + std::shared_ptr instance (new Static); registerClass (typeid (ESM::Static).name(), instance); } diff --git a/apps/openmw/mwclass/weapon.cpp b/apps/openmw/mwclass/weapon.cpp index 575accaba..efb6248af 100644 --- a/apps/openmw/mwclass/weapon.cpp +++ b/apps/openmw/mwclass/weapon.cpp @@ -54,7 +54,7 @@ namespace MWClass return ref->mBase->mName; } - boost::shared_ptr Weapon::activate (const MWWorld::Ptr& ptr, + std::shared_ptr Weapon::activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const { return defaultItemActivate(ptr, actor); @@ -143,7 +143,7 @@ namespace MWClass void Weapon::registerSelf() { - boost::shared_ptr instance (new Weapon); + std::shared_ptr instance (new Weapon); registerClass (typeid (ESM::Weapon).name(), instance); } @@ -392,9 +392,9 @@ namespace MWClass return std::make_pair(1, ""); } - boost::shared_ptr Weapon::use (const MWWorld::Ptr& ptr) const + std::shared_ptr Weapon::use (const MWWorld::Ptr& ptr) const { - boost::shared_ptr action(new MWWorld::ActionEquip(ptr)); + std::shared_ptr action(new MWWorld::ActionEquip(ptr)); action->setSound(getUpSoundId(ptr)); diff --git a/apps/openmw/mwclass/weapon.hpp b/apps/openmw/mwclass/weapon.hpp index 5fc3983f2..c14847363 100644 --- a/apps/openmw/mwclass/weapon.hpp +++ b/apps/openmw/mwclass/weapon.hpp @@ -21,7 +21,7 @@ namespace MWClass ///< \return name (the one that is to be presented to the user; not the internal one); /// can return an empty string. - virtual boost::shared_ptr activate (const MWWorld::Ptr& ptr, + virtual std::shared_ptr activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; ///< Generate action for activation @@ -72,7 +72,7 @@ namespace MWClass ///< Return 0 if player cannot equip item. 1 if can equip. 2 if it's twohanded weapon. 3 if twohanded weapon conflicts with that. /// Second item in the pair specifies the error message - virtual boost::shared_ptr use (const MWWorld::Ptr& ptr) + virtual std::shared_ptr use (const MWWorld::Ptr& ptr) const; ///< Generate action for using via inventory menu diff --git a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp index 5a4c548b3..7578bd9d7 100644 --- a/apps/openmw/mwdialogue/dialoguemanagerimp.cpp +++ b/apps/openmw/mwdialogue/dialoguemanagerimp.cpp @@ -194,7 +194,7 @@ namespace MWDialogue parseText (info->mResponse); MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(),mActor); - win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext)); + win->addResponse (Interpreter::fixDefinesDialog(info->mResponse, interpreterContext), "", false); executeScript (info->mResultScript, mActor); mLastTopic = Misc::StringUtils::lowerCase(it->mId); diff --git a/apps/openmw/mwgui/alchemywindow.hpp b/apps/openmw/mwgui/alchemywindow.hpp index 69fff8c67..e1f48d4a3 100644 --- a/apps/openmw/mwgui/alchemywindow.hpp +++ b/apps/openmw/mwgui/alchemywindow.hpp @@ -3,6 +3,8 @@ #include +#include "../mwmechanics/alchemy.hpp" + #include "widgets.hpp" #include "windowbase.hpp" @@ -48,7 +50,7 @@ namespace MWGui void update(); - std::auto_ptr mAlchemy; + std::unique_ptr mAlchemy; std::vector mApparatus; std::vector mIngredients; diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index c5c4e8d03..5def91eb8 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -6,11 +6,6 @@ #include "MyGUI_TextureUtility.h" #include "MyGUI_FactoryManager.h" -#include -#include -#include -#include - #include namespace MWGui @@ -235,7 +230,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter }; typedef TypesetBookImpl Book; - typedef boost::shared_ptr BookPtr; + typedef std::shared_ptr BookPtr; typedef std::vector::const_iterator PartialTextConstIterator; int mPageWidth; @@ -259,7 +254,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter mCurrentContent (NULL), mCurrentAlignment (AlignLeft) { - mBook = boost::make_shared (); + mBook = std::make_shared (); } virtual ~Typesetter () @@ -628,7 +623,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter BookTypesetter::Ptr BookTypesetter::create (int pageWidth, int pageHeight) { - return boost::make_shared (pageWidth, pageHeight); + return std::make_shared (pageWidth, pageHeight); } namespace @@ -897,10 +892,10 @@ public: Style* mFocusItem; bool mItemActive; MyGUI::MouseButton mLastDown; - boost::function mLinkClicked; + std::function mLinkClicked; - boost::shared_ptr mBook; + std::shared_ptr mBook; MyGUI::ILayerNode* mNode; ActiveTextFormats mActiveTextFormats; @@ -1034,7 +1029,7 @@ public: void showPage (TypesetBook::Ptr book, size_t newPage) { - boost::shared_ptr newBook = boost::dynamic_pointer_cast (book); + std::shared_ptr newBook = std::dynamic_pointer_cast (book); if (mBook != newBook) { @@ -1050,7 +1045,7 @@ public: mActiveTextFormats.clear (); - if (newBook != NULL) + if (newBook != nullptr) { createActiveFormats (newBook); @@ -1123,7 +1118,7 @@ public: } }; - void createActiveFormats (boost::shared_ptr newBook) + void createActiveFormats (std::shared_ptr newBook) { newBook->visitRuns (0, 0x7FFFFFFF, CreateActiveFormat (this)); @@ -1265,14 +1260,14 @@ public: mPageDisplay->showPage (book, page); } - void adviseLinkClicked (boost::function linkClicked) + void adviseLinkClicked (std::function linkClicked) { mPageDisplay->mLinkClicked = linkClicked; } void unadviseLinkClicked () { - mPageDisplay->mLinkClicked = boost::function (); + mPageDisplay->mLinkClicked = std::function (); } protected: diff --git a/apps/openmw/mwgui/bookpage.hpp b/apps/openmw/mwgui/bookpage.hpp index c7340ec7c..e75e1e1d3 100644 --- a/apps/openmw/mwgui/bookpage.hpp +++ b/apps/openmw/mwgui/bookpage.hpp @@ -6,8 +6,6 @@ #include #include -#include -#include namespace MWGui { @@ -15,7 +13,7 @@ namespace MWGui /// the book page widget. struct TypesetBook { - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; typedef intptr_t InteractiveId; /// Returns the number of pages in the document. @@ -33,7 +31,7 @@ namespace MWGui /// A factory class for creating a typeset book instance. struct BookTypesetter { - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; typedef TypesetBook::InteractiveId InteractiveId; typedef MyGUI::Colour Colour; typedef uint8_t const * Utf8Point; @@ -102,7 +100,7 @@ namespace MWGui public: typedef TypesetBook::InteractiveId InteractiveId; - typedef boost::function ClickCallback; + typedef std::function ClickCallback; /// Make the widget display the specified page from the specified book. virtual void showPage (TypesetBook::Ptr Book, size_t Page) = 0; diff --git a/apps/openmw/mwgui/containeritemmodel.cpp b/apps/openmw/mwgui/containeritemmodel.cpp index 1e4749695..d62cd16b0 100644 --- a/apps/openmw/mwgui/containeritemmodel.cpp +++ b/apps/openmw/mwgui/containeritemmodel.cpp @@ -1,5 +1,7 @@ #include "containeritemmodel.hpp" +#include + #include "../mwworld/containerstore.hpp" #include "../mwworld/class.hpp" diff --git a/apps/openmw/mwgui/dialogue.cpp b/apps/openmw/mwgui/dialogue.cpp index c03673b90..96cf6a2c9 100644 --- a/apps/openmw/mwgui/dialogue.cpp +++ b/apps/openmw/mwgui/dialogue.cpp @@ -1,7 +1,5 @@ #include "dialogue.hpp" -#include - #include #include #include @@ -107,24 +105,23 @@ namespace MWGui // -------------------------------------------------------------------------------------------------- - Response::Response(const std::string &text, const std::string &title) - : mTitle(title) + Response::Response(const std::string &text, const std::string &title, bool needMargin) + : mTitle(title), mNeedMargin(needMargin) { mText = text; } void Response::write(BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map& topicLinks) const { - BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header")); + typesetter->sectionBreak(mNeedMargin ? 9 : 0); if (mTitle != "") { - typesetter->sectionBreak(9); + BookTypesetter::Style* title = typesetter->createStyle("", getDialogueTextColour("header")); typesetter->write(title, to_utf8_span(mTitle.c_str())); + typesetter->sectionBreak(); } - typesetter->sectionBreak(); - typedef std::pair Range; std::map hyperLinks; @@ -281,7 +278,7 @@ namespace MWGui mScrollBar->eventScrollChangePosition += MyGUI::newDelegate(this, &DialogueWindow::onScrollbarMoved); mHistory->eventMouseWheel += MyGUI::newDelegate(this, &DialogueWindow::onMouseWheel); - BookPage::ClickCallback callback = boost::bind (&DialogueWindow::notifyLinkClicked, this, _1); + BookPage::ClickCallback callback = std::bind (&DialogueWindow::notifyLinkClicked, this, std::placeholders::_1); mHistory->adviseLinkClicked(callback); mMainWidget->castType()->eventWindowChangeCoord += MyGUI::newDelegate(this, &DialogueWindow::onWindowResize); @@ -554,7 +551,7 @@ namespace MWGui mHistory->setPosition(0, static_cast(pos) * -1); } - void DialogueWindow::addResponse(const std::string &text, const std::string &title) + void DialogueWindow::addResponse(const std::string &text, const std::string &title, bool needMargin) { // This is called from the dialogue manager, so text is // case-smashed - thus we have to retrieve the correct case @@ -573,7 +570,7 @@ namespace MWGui } } - mHistoryContents.push_back(new Response(text, realTitle)); + mHistoryContents.push_back(new Response(text, realTitle, needMargin)); updateHistory(); } diff --git a/apps/openmw/mwgui/dialogue.hpp b/apps/openmw/mwgui/dialogue.hpp index d34574e89..e1e427b3f 100644 --- a/apps/openmw/mwgui/dialogue.hpp +++ b/apps/openmw/mwgui/dialogue.hpp @@ -82,10 +82,11 @@ namespace MWGui struct Response : DialogueText { - Response(const std::string& text, const std::string& title = ""); + Response(const std::string& text, const std::string& title = "", bool needMargin = true); virtual void write (BookTypesetter::Ptr typesetter, KeywordSearchT* keywordSearch, std::map& topicLinks) const; void addTopicLink (BookTypesetter::Ptr typesetter, intptr_t topicId, size_t begin, size_t end) const; std::string mTitle; + bool mNeedMargin; }; struct Message : DialogueText @@ -109,7 +110,7 @@ namespace MWGui void startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory); void setKeywords(std::list keyWord); - void addResponse (const std::string& text, const std::string& title=""); + void addResponse (const std::string& text, const std::string& title="", bool needMargin = true); void addMessageBox(const std::string& text); diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index e44dc6fcc..a4728218a 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -2,16 +2,12 @@ #include -#include - #include #include #include #include -#include "../mwbase/environment.hpp" -#include "../mwbase/world.hpp" #include "../mwbase/soundmanager.hpp" #include "../mwbase/dialoguemanager.hpp" #include "../mwbase/mechanicsmanager.hpp" diff --git a/apps/openmw/mwgui/inventorywindow.cpp b/apps/openmw/mwgui/inventorywindow.cpp index 77521ebf9..f4ca9a6e2 100644 --- a/apps/openmw/mwgui/inventorywindow.cpp +++ b/apps/openmw/mwgui/inventorywindow.cpp @@ -507,7 +507,7 @@ namespace MWGui { if (script.empty() || ptr.getRefData().getLocals().getIntVar(script, "pcskipequip") == 0) { - boost::shared_ptr action = ptr.getClass().use(ptr); + std::shared_ptr action = ptr.getClass().use(ptr); action->execute (player); } diff --git a/apps/openmw/mwgui/inventorywindow.hpp b/apps/openmw/mwgui/inventorywindow.hpp index 11091c428..761464540 100644 --- a/apps/openmw/mwgui/inventorywindow.hpp +++ b/apps/openmw/mwgui/inventorywindow.hpp @@ -5,6 +5,7 @@ #include "mode.hpp" #include "../mwworld/ptr.hpp" +#include "../mwrender/characterpreview.hpp" namespace osg { @@ -16,11 +17,6 @@ namespace Resource class ResourceSystem; } -namespace MWRender -{ - class InventoryPreview; -} - namespace MWGui { namespace Widgets @@ -101,8 +97,8 @@ namespace MWGui int mLastXSize; int mLastYSize; - std::auto_ptr mPreviewTexture; - std::auto_ptr mPreview; + std::unique_ptr mPreviewTexture; + std::unique_ptr mPreview; bool mTrading; diff --git a/apps/openmw/mwgui/itemchargeview.hpp b/apps/openmw/mwgui/itemchargeview.hpp index 0988f655b..956272aec 100644 --- a/apps/openmw/mwgui/itemchargeview.hpp +++ b/apps/openmw/mwgui/itemchargeview.hpp @@ -69,7 +69,7 @@ namespace MWGui typedef std::vector Lines; Lines mLines; - std::auto_ptr mModel; + std::unique_ptr mModel; MyGUI::ScrollView* mScrollView; DisplayMode mDisplayMode; }; diff --git a/apps/openmw/mwgui/journalviewmodel.cpp b/apps/openmw/mwgui/journalviewmodel.cpp index 70f1305e0..b5d08eec6 100644 --- a/apps/openmw/mwgui/journalviewmodel.cpp +++ b/apps/openmw/mwgui/journalviewmodel.cpp @@ -2,12 +2,9 @@ #include #include -#include #include -#include - #include #include "../mwbase/world.hpp" @@ -15,7 +12,6 @@ #include "../mwbase/environment.hpp" #include "../mwbase/windowmanager.hpp" -#include "../mwdialogue/journalentry.hpp" #include "../mwdialogue/keywordsearch.hpp" namespace MWGui { @@ -151,7 +147,7 @@ struct JournalViewModelImpl : JournalViewModel return toUtf8Span (utf8text); } - void visitSpans (boost::function < void (TopicId, size_t, size_t)> visitor) const + void visitSpans (std::function < void (TopicId, size_t, size_t)> visitor) const { ensureLoaded (); mModel->ensureKeyWordSearchLoaded (); @@ -195,7 +191,7 @@ struct JournalViewModelImpl : JournalViewModel }; - void visitQuestNames (bool active_only, boost::function visitor) const + void visitQuestNames (bool active_only, std::function visitor) const { MWBase::Journal * journal = MWBase::Environment::get ().getJournal (); @@ -270,7 +266,7 @@ struct JournalViewModelImpl : JournalViewModel } }; - void visitJournalEntries (const std::string& questName, boost::function visitor) const + void visitJournalEntries (const std::string& questName, std::function visitor) const { MWBase::Journal * journal = MWBase::Environment::get().getJournal(); @@ -303,13 +299,13 @@ struct JournalViewModelImpl : JournalViewModel } } - void visitTopicName (TopicId topicId, boost::function visitor) const + void visitTopicName (TopicId topicId, std::function visitor) const { MWDialogue::Topic const & topic = * reinterpret_cast (topicId); visitor (toUtf8Span (topic.getName())); } - void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const + void visitTopicNamesStartingWith (char character, std::function < void (const std::string&) > visitor) const { MWBase::Journal * journal = MWBase::Environment::get().getJournal(); @@ -343,7 +339,7 @@ struct JournalViewModelImpl : JournalViewModel }; - void visitTopicEntries (TopicId topicId, boost::function visitor) const + void visitTopicEntries (TopicId topicId, std::function visitor) const { typedef MWDialogue::Topic::TEntryIter iterator_t; @@ -356,7 +352,7 @@ struct JournalViewModelImpl : JournalViewModel JournalViewModel::Ptr JournalViewModel::create () { - return boost::make_shared (); + return std::make_shared (); } } diff --git a/apps/openmw/mwgui/journalviewmodel.hpp b/apps/openmw/mwgui/journalviewmodel.hpp index b3c6b0183..3edde3d31 100644 --- a/apps/openmw/mwgui/journalviewmodel.hpp +++ b/apps/openmw/mwgui/journalviewmodel.hpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include namespace MWGui { @@ -18,7 +16,7 @@ namespace MWGui /// game data store. struct JournalViewModel { - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; typedef intptr_t QuestId; typedef intptr_t TopicId; @@ -38,7 +36,7 @@ namespace MWGui /// Visits each subset of text in the body, delivering the beginning /// and end of the span relative to the body, and a valid topic ID if /// the span represents a keyword, or zero if not. - virtual void visitSpans (boost::function visitor) const = 0; + virtual void visitSpans (std::function visitor) const = 0; }; /// An interface to topic data. @@ -68,20 +66,20 @@ namespace MWGui virtual bool isEmpty () const = 0; /// walks the active and optionally completed, quests providing the name and completed status - virtual void visitQuestNames (bool active_only, boost::function visitor) const = 0; + virtual void visitQuestNames (bool active_only, std::function visitor) const = 0; /// walks over the journal entries related to all quests with the given name /// If \a questName is empty, simply visits all journal entries - virtual void visitJournalEntries (const std::string& questName, boost::function visitor) const = 0; + virtual void visitJournalEntries (const std::string& questName, std::function visitor) const = 0; /// provides the name of the topic specified by its id - virtual void visitTopicName (TopicId topicId, boost::function visitor) const = 0; + virtual void visitTopicName (TopicId topicId, std::function visitor) const = 0; /// walks over the topics whose names start with the specified character providing the topics name - virtual void visitTopicNamesStartingWith (char character, boost::function < void (const std::string&) > visitor) const = 0; + virtual void visitTopicNamesStartingWith (char character, std::function < void (const std::string&) > visitor) const = 0; /// walks over the topic entries for the topic specified by its identifier - virtual void visitTopicEntries (TopicId topicId, boost::function visitor) const = 0; + virtual void visitTopicEntries (TopicId topicId, std::function visitor) const = 0; // create an instance of the default journal view model implementation static Ptr create (); diff --git a/apps/openmw/mwgui/journalwindow.cpp b/apps/openmw/mwgui/journalwindow.cpp index 9af87c7ae..879f1b417 100644 --- a/apps/openmw/mwgui/journalwindow.cpp +++ b/apps/openmw/mwgui/journalwindow.cpp @@ -9,9 +9,6 @@ #include #include -#include -#include - #include #include #include @@ -124,7 +121,7 @@ namespace { MWGui::BookPage::ClickCallback callback; - callback = boost::bind (&JournalWindowImpl::notifyTopicClicked, this, _1); + callback = std::bind (&JournalWindowImpl::notifyTopicClicked, this, std::placeholders::_1); getPage (LeftBookPage)->adviseLinkClicked (callback); getPage (RightBookPage)->adviseLinkClicked (callback); @@ -136,7 +133,7 @@ namespace { MWGui::BookPage::ClickCallback callback; - callback = boost::bind (&JournalWindowImpl::notifyIndexLinkClicked, this, _1); + callback = std::bind(&JournalWindowImpl::notifyIndexLinkClicked, this, std::placeholders::_1); getPage (LeftTopicIndex)->adviseLinkClicked (callback); getPage (RightTopicIndex)->adviseLinkClicked (callback); diff --git a/apps/openmw/mwgui/journalwindow.hpp b/apps/openmw/mwgui/journalwindow.hpp index 740284e20..cc645ca44 100644 --- a/apps/openmw/mwgui/journalwindow.hpp +++ b/apps/openmw/mwgui/journalwindow.hpp @@ -1,7 +1,7 @@ #ifndef MWGUI_JOURNAL_H #define MWGUI_JOURNAL_H -#include +#include namespace MWBase { class WindowManager; } @@ -12,7 +12,7 @@ namespace MWGui struct JournalWindow { /// construct a new instance of the one JournalWindow implementation - static JournalWindow * create (boost::shared_ptr Model, bool questList); + static JournalWindow * create (std::shared_ptr Model, bool questList); /// destroy this instance of the JournalWindow implementation virtual ~JournalWindow () {}; diff --git a/apps/openmw/mwgui/loadingscreen.hpp b/apps/openmw/mwgui/loadingscreen.hpp index 0b7edbc9e..100c17e11 100644 --- a/apps/openmw/mwgui/loadingscreen.hpp +++ b/apps/openmw/mwgui/loadingscreen.hpp @@ -76,7 +76,7 @@ namespace MWGui // TODO: add releaseGLObjects() for mTexture osg::ref_ptr mTexture; - std::auto_ptr mGuiTexture; + std::unique_ptr mGuiTexture; void changeWallpaper(); diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index c04439538..b3e6c5404 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -257,7 +257,7 @@ namespace MWGui osg::ref_ptr tex = mLocalMapRender->getFogOfWarTexture(x, y); if (tex) { - boost::shared_ptr myguitex (new osgMyGUI::OSGTexture(tex)); + std::shared_ptr myguitex (new osgMyGUI::OSGTexture(tex)); fog->setRenderItemTexture(myguitex.get()); fog->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 1.f, 1.f, 0.f)); fogTextures.push_back(myguitex); @@ -399,7 +399,7 @@ namespace MWGui osg::ref_ptr texture = mLocalMapRender->getMapTexture(mapX, mapY); if (texture) { - boost::shared_ptr guiTex (new osgMyGUI::OSGTexture(texture)); + std::shared_ptr guiTex (new osgMyGUI::OSGTexture(texture)); textures.push_back(guiTex); box->setRenderItemTexture(guiTex.get()); box->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f)); diff --git a/apps/openmw/mwgui/mapwindow.hpp b/apps/openmw/mwgui/mapwindow.hpp index 929f0f84b..8c89a34a3 100644 --- a/apps/openmw/mwgui/mapwindow.hpp +++ b/apps/openmw/mwgui/mapwindow.hpp @@ -3,8 +3,6 @@ #include -#include - #include "windowpinnablebase.hpp" #include @@ -136,7 +134,7 @@ namespace MWGui std::vector mMapWidgets; std::vector mFogWidgets; - typedef std::vector > TextureVector; + typedef std::vector > TextureVector; TextureVector mMapTextures; TextureVector mFogTextures; @@ -257,8 +255,8 @@ namespace MWGui void setGlobalMapMarkerTooltip(MyGUI::Widget* widget, int x, int y); MyGUI::ScrollView* mGlobalMap; - std::auto_ptr mGlobalMapTexture; - std::auto_ptr mGlobalMapOverlayTexture; + std::unique_ptr mGlobalMapTexture; + std::unique_ptr mGlobalMapOverlayTexture; MyGUI::ImageBox* mGlobalMapImage; MyGUI::ImageBox* mGlobalMapOverlay; MyGUI::ImageBox* mPlayerArrowLocal; diff --git a/apps/openmw/mwgui/race.cpp b/apps/openmw/mwgui/race.cpp index f39d75af1..187aeb408 100644 --- a/apps/openmw/mwgui/race.cpp +++ b/apps/openmw/mwgui/race.cpp @@ -2,13 +2,10 @@ #include #include -#include #include #include -#include - #include #include "../mwworld/esmstore.hpp" diff --git a/apps/openmw/mwgui/race.hpp b/apps/openmw/mwgui/race.hpp index 42e758983..b762745cd 100644 --- a/apps/openmw/mwgui/race.hpp +++ b/apps/openmw/mwgui/race.hpp @@ -2,6 +2,7 @@ #define MWGUI_RACE_H #include "windowbase.hpp" +#include namespace MWGui @@ -115,8 +116,8 @@ namespace MWGui float mCurrentAngle; - std::auto_ptr mPreview; - std::auto_ptr mPreviewTexture; + std::unique_ptr mPreview; + std::unique_ptr mPreviewTexture; bool mPreviewDirty; }; diff --git a/apps/openmw/mwgui/savegamedialog.hpp b/apps/openmw/mwgui/savegamedialog.hpp index 6a9e59cc6..be0e47cab 100644 --- a/apps/openmw/mwgui/savegamedialog.hpp +++ b/apps/openmw/mwgui/savegamedialog.hpp @@ -48,7 +48,7 @@ namespace MWGui void fillSaveList(); - std::auto_ptr mScreenshotTexture; + std::unique_ptr mScreenshotTexture; MyGUI::ImageBox* mScreenshot; bool mSaving; diff --git a/apps/openmw/mwgui/screenfader.hpp b/apps/openmw/mwgui/screenfader.hpp index f87fd8443..b510e133a 100644 --- a/apps/openmw/mwgui/screenfader.hpp +++ b/apps/openmw/mwgui/screenfader.hpp @@ -3,8 +3,6 @@ #include -#include - #include "windowbase.hpp" namespace MWGui @@ -14,7 +12,7 @@ namespace MWGui class FadeOp { public: - typedef boost::shared_ptr Ptr; + typedef std::shared_ptr Ptr; FadeOp(ScreenFader * fader, float time, float targetAlpha); diff --git a/apps/openmw/mwgui/settingswindow.cpp b/apps/openmw/mwgui/settingswindow.cpp index c167164d9..f46199c80 100644 --- a/apps/openmw/mwgui/settingswindow.cpp +++ b/apps/openmw/mwgui/settingswindow.cpp @@ -3,17 +3,15 @@ #include #include #include -#include #include #include #include #include -#include +#include #include -#include #include #include diff --git a/apps/openmw/mwgui/sortfilteritemmodel.cpp b/apps/openmw/mwgui/sortfilteritemmodel.cpp index 60111fb79..68d95fb88 100644 --- a/apps/openmw/mwgui/sortfilteritemmodel.cpp +++ b/apps/openmw/mwgui/sortfilteritemmodel.cpp @@ -143,7 +143,7 @@ namespace MWGui if ((mFilter & Filter_OnlyUsableItems) && base.getClass().getScript(base).empty()) { - boost::shared_ptr actionOnUse = base.getClass().use(base); + std::shared_ptr actionOnUse = base.getClass().use(base); if (!actionOnUse || actionOnUse->isNullAction()) return false; } diff --git a/apps/openmw/mwgui/spellmodel.cpp b/apps/openmw/mwgui/spellmodel.cpp index d4ab552ff..6953d682b 100644 --- a/apps/openmw/mwgui/spellmodel.cpp +++ b/apps/openmw/mwgui/spellmodel.cpp @@ -2,8 +2,6 @@ #include -#include - #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" #include "../mwbase/windowmanager.hpp" @@ -61,8 +59,8 @@ namespace MWGui if (spell->mData.mType == ESM::Spell::ST_Spell) { newSpell.mType = Spell::Type_Spell; - std::string cost = boost::lexical_cast(spell->mData.mCost); - std::string chance = boost::lexical_cast(int(MWMechanics::getSpellSuccessChance(spell, mActor))); + std::string cost = std::to_string(spell->mData.mCost); + std::string chance = std::to_string(int(MWMechanics::getSpellSuccessChance(spell, mActor))); newSpell.mCostColumn = cost + "/" + chance; } else @@ -112,11 +110,11 @@ namespace MWGui int castCost = MWMechanics::getEffectiveEnchantmentCastCost(static_cast(enchant->mData.mCost), mActor); - std::string cost = boost::lexical_cast(castCost); + std::string cost = std::to_string(castCost); int currentCharge = int(item.getCellRef().getEnchantmentCharge()); if (currentCharge == -1) currentCharge = enchant->mData.mCharge; - std::string charge = boost::lexical_cast(currentCharge); + std::string charge = std::to_string(currentCharge); newSpell.mCostColumn = cost + "/" + charge; newSpell.mActive = invStore.isEquipped(item); diff --git a/apps/openmw/mwgui/spellview.hpp b/apps/openmw/mwgui/spellview.hpp index a4f8ddf39..0eb69f6ba 100644 --- a/apps/openmw/mwgui/spellview.hpp +++ b/apps/openmw/mwgui/spellview.hpp @@ -1,7 +1,7 @@ #ifndef OPENMW_GUI_SPELLVIEW_H #define OPENMW_GUI_SPELLVIEW_H -#include +#include #include @@ -56,7 +56,7 @@ namespace MWGui private: MyGUI::ScrollView* mScrollView; - std::auto_ptr mModel; + std::unique_ptr mModel; /// tracks a row in the spell view struct LineInfo diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index e191c16bb..fbdda8395 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -1,5 +1,7 @@ #include "tradewindow.hpp" +#include + #include #include #include diff --git a/apps/openmw/mwgui/videowidget.hpp b/apps/openmw/mwgui/videowidget.hpp index 6b265628e..ac240e69d 100644 --- a/apps/openmw/mwgui/videowidget.hpp +++ b/apps/openmw/mwgui/videowidget.hpp @@ -51,8 +51,8 @@ namespace MWGui private: const VFS::Manager* mVFS; - std::auto_ptr mTexture; - std::auto_ptr mPlayer; + std::unique_ptr mTexture; + std::unique_ptr mPlayer; }; } diff --git a/apps/openmw/mwgui/windowmanagerimp.hpp b/apps/openmw/mwgui/windowmanagerimp.hpp index 787c88598..ea7b4c14c 100644 --- a/apps/openmw/mwgui/windowmanagerimp.hpp +++ b/apps/openmw/mwgui/windowmanagerimp.hpp @@ -397,7 +397,7 @@ namespace MWGui osgMyGUI::Platform* mGuiPlatform; osgViewer::Viewer* mViewer; - std::auto_ptr mFontLoader; + std::unique_ptr mFontLoader; bool mConsoleOnlyScripts; diff --git a/apps/openmw/mwinput/inputmanagerimp.cpp b/apps/openmw/mwinput/inputmanagerimp.cpp index 26d92be72..5502d7087 100644 --- a/apps/openmw/mwinput/inputmanagerimp.cpp +++ b/apps/openmw/mwinput/inputmanagerimp.cpp @@ -1,9 +1,5 @@ #include "inputmanagerimp.hpp" -#include - -#include - #include #include @@ -1203,7 +1199,7 @@ namespace MWInput bool controlExists = mInputBinder->getChannel(i)->getControlsCount () != 0; if (!controlExists) { - control = new ICS::Control(boost::lexical_cast(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX); + control = new ICS::Control(std::to_string(i), false, true, 0, ICS::ICS_MAX, ICS::ICS_MAX); mInputBinder->addControl(control); control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT); } @@ -1275,7 +1271,7 @@ namespace MWInput if (defaultButtonBindings.find(i) != defaultButtonBindings.end()) initial = 0.0f; else initial = 0.5f; - control = new ICS::Control(boost::lexical_cast(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); + control = new ICS::Control(std::to_string(i), false, true, initial, ICS::ICS_MAX, ICS::ICS_MAX); mInputBinder->addControl(control); control->attachChannel(mInputBinder->getChannel(i), ICS::Channel::DIRECT); } @@ -1364,7 +1360,7 @@ namespace MWInput if (key != SDL_SCANCODE_UNKNOWN) return MyGUI::TextIterator::toTagsString(mInputBinder->scancodeToString (key)); else if (mouse != ICS_MAX_DEVICE_BUTTONS) - return "#{sMouse} " + boost::lexical_cast(mouse); + return "#{sMouse} " + std::to_string(mouse); else return "#{sNone}"; } @@ -1419,7 +1415,7 @@ namespace MWInput case SDL_CONTROLLER_BUTTON_Y: return "Y Button"; default: - return "Button " + boost::lexical_cast(button); + return "Button " + std::to_string(button); } } std::string InputManager::sdlControllerAxisToString(int axis) @@ -1439,7 +1435,7 @@ namespace MWInput case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: return "Right Trigger"; default: - return "Axis " + boost::lexical_cast(axis); + return "Axis " + std::to_string(axis); } } diff --git a/apps/openmw/mwmechanics/actor.hpp b/apps/openmw/mwmechanics/actor.hpp index 846af1467..b8e114ead 100644 --- a/apps/openmw/mwmechanics/actor.hpp +++ b/apps/openmw/mwmechanics/actor.hpp @@ -32,7 +32,7 @@ namespace MWMechanics AiState& getAiState(); private: - std::auto_ptr mCharacterController; + std::unique_ptr mCharacterController; AiState mAiState; }; diff --git a/apps/openmw/mwmechanics/aiactivate.cpp b/apps/openmw/mwmechanics/aiactivate.cpp index b1426a4c1..d38a1299f 100644 --- a/apps/openmw/mwmechanics/aiactivate.cpp +++ b/apps/openmw/mwmechanics/aiactivate.cpp @@ -55,7 +55,7 @@ namespace MWMechanics void AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr activate(new ESM::AiSequence::AiActivate()); + std::unique_ptr activate(new ESM::AiSequence::AiActivate()); activate->mTargetId = mObjectId; ESM::AiSequence::AiPackageContainer package; diff --git a/apps/openmw/mwmechanics/aicombat.cpp b/apps/openmw/mwmechanics/aicombat.cpp index ebdcbe986..cf1818cf0 100644 --- a/apps/openmw/mwmechanics/aicombat.cpp +++ b/apps/openmw/mwmechanics/aicombat.cpp @@ -60,7 +60,7 @@ namespace MWMechanics bool mCombatMove; osg::Vec3f mLastTargetPos; const MWWorld::CellStore* mCell; - boost::shared_ptr mCurrentAction; + std::shared_ptr mCurrentAction; float mActionCooldown; float mStrength; bool mForceNoShortcut; @@ -317,7 +317,7 @@ namespace MWMechanics actorClass.getCreatureStats(actor).setMovementFlag(CreatureStats::Flag_Run, true); float& actionCooldown = storage.mActionCooldown; - boost::shared_ptr& currentAction = storage.mCurrentAction; + std::shared_ptr& currentAction = storage.mCurrentAction; if (!forceFlee) { @@ -547,7 +547,7 @@ namespace MWMechanics void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr combat(new ESM::AiSequence::AiCombat()); + std::unique_ptr combat(new ESM::AiSequence::AiCombat()); combat->mTargetActorId = mTargetActorId; ESM::AiSequence::AiPackageContainer package; @@ -580,7 +580,7 @@ namespace MWMechanics targetWeapon = *weaponSlot; } - boost::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); + std::shared_ptr targetWeaponAction (new ActionWeapon(targetWeapon)); if (targetWeaponAction.get()) { diff --git a/apps/openmw/mwmechanics/aicombat.hpp b/apps/openmw/mwmechanics/aicombat.hpp index fbe864ca0..e7d74248b 100644 --- a/apps/openmw/mwmechanics/aicombat.hpp +++ b/apps/openmw/mwmechanics/aicombat.hpp @@ -3,8 +3,6 @@ #include "aipackage.hpp" -#include - #include "../mwworld/cellstore.hpp" // for Doors #include "../mwbase/world.hpp" diff --git a/apps/openmw/mwmechanics/aicombataction.cpp b/apps/openmw/mwmechanics/aicombataction.cpp index 37b67c9b2..46d37eb3d 100644 --- a/apps/openmw/mwmechanics/aicombataction.cpp +++ b/apps/openmw/mwmechanics/aicombataction.cpp @@ -545,6 +545,19 @@ namespace MWMechanics const ESM::MagicEffect* magicEffect = MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); + // Underwater casting not possible + if (effect.mRange == ESM::RT_Target) + { + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(actor), 0.75f)) + return 0.f; + + if (enemy.isEmpty()) + return 0.f; + + if (MWBase::Environment::get().getWorld()->isUnderwater(MWWorld::ConstPtr(enemy), 0.75f)) + return 0.f; + } + rating *= magicEffect->mData.mBaseCost; if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful) @@ -709,14 +722,14 @@ namespace MWMechanics return mWeapon.get()->mBase; } - boost::shared_ptr prepareNextAction(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) + std::shared_ptr prepareNextAction(const MWWorld::Ptr &actor, const MWWorld::Ptr &enemy) { Spells& spells = actor.getClass().getCreatureStats(actor).getSpells(); float bestActionRating = 0.f; float antiFleeRating = 0.f; // Default to hand-to-hand combat - boost::shared_ptr bestAction (new ActionWeapon(MWWorld::Ptr())); + std::shared_ptr bestAction (new ActionWeapon(MWWorld::Ptr())); if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { bestAction->prepare(actor); @@ -876,7 +889,7 @@ namespace MWMechanics for (std::vector::const_iterator effectIt = spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt) { - if (effectIt->mArea == ESM::RT_Target) + if (effectIt->mRange == ESM::RT_Target) { const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().get().find(effectIt->mEffectID); dist = effect->mData.mSpeed; @@ -893,7 +906,7 @@ namespace MWMechanics for (std::vector::const_iterator effectIt = ench->mEffects.mList.begin(); effectIt != ench->mEffects.mList.end(); ++effectIt) { - if (effectIt->mArea == ESM::RT_Target) + if (effectIt->mRange == ESM::RT_Target) { const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().get().find(effectIt->mEffectID); dist = effect->mData.mSpeed; @@ -1016,7 +1029,7 @@ namespace MWMechanics for (std::vector::const_iterator effectIt = spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt) { - if (effectIt->mArea == ESM::RT_Target) + if (effectIt->mRange == ESM::RT_Target) { if (!MWBase::Environment::get().getWorld()->isSwimming(enemy)) mult = fAIRangeMagicSpellMult; diff --git a/apps/openmw/mwmechanics/aicombataction.hpp b/apps/openmw/mwmechanics/aicombataction.hpp index 0f1f7dd5b..3db88269b 100644 --- a/apps/openmw/mwmechanics/aicombataction.hpp +++ b/apps/openmw/mwmechanics/aicombataction.hpp @@ -1,7 +1,7 @@ #ifndef OPENMW_AICOMBAT_ACTION_H #define OPENMW_AICOMBAT_ACTION_H -#include +#include #include @@ -100,7 +100,7 @@ namespace MWMechanics /// @note target may be empty float rateEffects (const ESM::EffectList& list, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); - boost::shared_ptr prepareNextAction (const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); + std::shared_ptr prepareNextAction (const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy); float getDistanceMinusHalfExtents(const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy, bool minusZDist=false); float getMaxAttackDistance(const MWWorld::Ptr& actor); diff --git a/apps/openmw/mwmechanics/aiescort.cpp b/apps/openmw/mwmechanics/aiescort.cpp index 4c9b5fd4f..103ef32e1 100644 --- a/apps/openmw/mwmechanics/aiescort.cpp +++ b/apps/openmw/mwmechanics/aiescort.cpp @@ -126,7 +126,7 @@ namespace MWMechanics void AiEscort::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr escort(new ESM::AiSequence::AiEscort()); + std::unique_ptr escort(new ESM::AiSequence::AiEscort()); escort->mData.mX = mX; escort->mData.mY = mY; escort->mData.mZ = mZ; diff --git a/apps/openmw/mwmechanics/aifollow.cpp b/apps/openmw/mwmechanics/aifollow.cpp index fd3014298..fe94246c4 100644 --- a/apps/openmw/mwmechanics/aifollow.cpp +++ b/apps/openmw/mwmechanics/aifollow.cpp @@ -188,7 +188,7 @@ bool AiFollow::isCommanded() const void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr follow(new ESM::AiSequence::AiFollow()); + std::unique_ptr follow(new ESM::AiSequence::AiFollow()); follow->mData.mX = mX; follow->mData.mY = mY; follow->mData.mZ = mZ; diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index abdc57042..529e7ca41 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -12,6 +12,7 @@ #include "../mwworld/action.hpp" #include "../mwworld/class.hpp" #include "../mwworld/cellstore.hpp" +#include "../mwworld/inventorystore.hpp" #include "creaturestats.hpp" #include "movement.hpp" @@ -179,10 +180,36 @@ void MWMechanics::AiPackage::evadeObstacles(const MWWorld::Ptr& actor, float dur if (door != MWWorld::Ptr()) { // note: AiWander currently does not open doors - if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getCellRef().getTrap().empty() - && door.getCellRef().getLockLevel() <= 0 && door.getClass().getDoorState(door) == 0) + if (getTypeId() != TypeIdWander && !door.getCellRef().getTeleport() && door.getClass().getDoorState(door) == 0) { - MWBase::Environment::get().getWorld()->activateDoor(door, 1); + if ((door.getCellRef().getTrap().empty() && door.getCellRef().getLockLevel() <= 0 )) + { + MWBase::Environment::get().getWorld()->activate(door, actor); + return; + } + + std::string keyId = door.getCellRef().getKey(); + if (keyId.empty()) + return; + + bool hasKey = false; + const MWWorld::ContainerStore &invStore = actor.getClass().getContainerStore(actor); + + // make key id lowercase + Misc::StringUtils::lowerCaseInPlace(keyId); + for (MWWorld::ConstContainerStoreIterator it = invStore.cbegin(); it != invStore.cend(); ++it) + { + std::string refId = it->getCellRef().getRefId(); + Misc::StringUtils::lowerCaseInPlace(refId); + if (refId == keyId) + { + hasKey = true; + break; + } + } + + if (hasKey) + MWBase::Environment::get().getWorld()->activate(door, actor); } } else // any other obstacle (NPC, crate, etc.) diff --git a/apps/openmw/mwmechanics/aipursue.cpp b/apps/openmw/mwmechanics/aipursue.cpp index 817a5b41d..2a375534e 100644 --- a/apps/openmw/mwmechanics/aipursue.cpp +++ b/apps/openmw/mwmechanics/aipursue.cpp @@ -101,7 +101,7 @@ MWWorld::Ptr AiPursue::getTarget() const void AiPursue::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr pursue(new ESM::AiSequence::AiPursue()); + std::unique_ptr pursue(new ESM::AiSequence::AiPursue()); pursue->mTargetActorId = mTargetActorId; ESM::AiSequence::AiPackageContainer package; diff --git a/apps/openmw/mwmechanics/aisequence.cpp b/apps/openmw/mwmechanics/aisequence.cpp index 125805507..82a2e2c3d 100644 --- a/apps/openmw/mwmechanics/aisequence.cpp +++ b/apps/openmw/mwmechanics/aisequence.cpp @@ -121,6 +121,16 @@ bool AiSequence::isInCombat() const return false; } +bool AiSequence::hasPackage(int typeId) const +{ + for (std::list::const_iterator it = mPackages.begin(); it != mPackages.end(); ++it) + { + if ((*it)->getTypeId() == typeId) + return true; + } + return false; +} + bool AiSequence::isInCombat(const MWWorld::Ptr &actor) const { for(std::list::const_iterator it = mPackages.begin(); it != mPackages.end(); ++it) @@ -412,7 +422,7 @@ void AiSequence::readState(const ESM::AiSequence::AiSequence &sequence) for (std::vector::const_iterator it = sequence.mPackages.begin(); it != sequence.mPackages.end(); ++it) { - std::auto_ptr package (NULL); + std::unique_ptr package (nullptr); switch (it->mType) { case ESM::AiSequence::Ai_Wander: diff --git a/apps/openmw/mwmechanics/aisequence.hpp b/apps/openmw/mwmechanics/aisequence.hpp index 4b6ec156a..41d204ee2 100644 --- a/apps/openmw/mwmechanics/aisequence.hpp +++ b/apps/openmw/mwmechanics/aisequence.hpp @@ -85,6 +85,9 @@ namespace MWMechanics /// Is there any combat package? bool isInCombat () const; + /// Does this AI sequence have the given package type? + bool hasPackage(int typeId) const; + /// Are we in combat with this particular actor? bool isInCombat (const MWWorld::Ptr& actor) const; diff --git a/apps/openmw/mwmechanics/aitravel.cpp b/apps/openmw/mwmechanics/aitravel.cpp index 7cef7aff1..36b96101f 100644 --- a/apps/openmw/mwmechanics/aitravel.cpp +++ b/apps/openmw/mwmechanics/aitravel.cpp @@ -79,7 +79,7 @@ namespace MWMechanics void AiTravel::writeState(ESM::AiSequence::AiSequence &sequence) const { - std::auto_ptr travel(new ESM::AiSequence::AiTravel()); + std::unique_ptr travel(new ESM::AiSequence::AiTravel()); travel->mData.mX = mX; travel->mData.mY = mY; travel->mData.mZ = mZ; diff --git a/apps/openmw/mwmechanics/aiwander.cpp b/apps/openmw/mwmechanics/aiwander.cpp index eba37d7a7..a992bc8d4 100644 --- a/apps/openmw/mwmechanics/aiwander.cpp +++ b/apps/openmw/mwmechanics/aiwander.cpp @@ -919,7 +919,7 @@ namespace MWMechanics else remainingDuration = mDuration; - std::auto_ptr wander(new ESM::AiSequence::AiWander()); + std::unique_ptr wander(new ESM::AiSequence::AiWander()); wander->mData.mDistance = mDistance; wander->mData.mDuration = mDuration; wander->mData.mTimeOfDay = mTimeOfDay; diff --git a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp index 5a280416e..733f0d2c3 100644 --- a/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp +++ b/apps/openmw/mwmechanics/mechanicsmanagerimp.cpp @@ -1079,7 +1079,13 @@ namespace MWMechanics if (crimeSeen) reportCrime(player, victim, type, arg); else if (type == OT_Assault && !victim.isEmpty()) - startCombat(victim, player); // TODO: combat should be started with an "unaware" flag, which makes the victim flee? + { + if (victim.getClass().isClass(victim, "guard") + && !victim.getClass().getCreatureStats(victim).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + reportCrime(player, victim, type, arg); + else + startCombat(victim, player); // TODO: combat should be started with an "unaware" flag, which makes the victim flee? + } return crimeSeen; } @@ -1182,7 +1188,8 @@ namespace MWMechanics // once the bounty has been paid. it->getClass().getNpcStats(*it).setCrimeId(id); - it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it); + if (!it->getClass().getCreatureStats(*it).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + it->getClass().getCreatureStats(*it).getAiSequence().stack(AiPursue(player), *it); } else { @@ -1260,7 +1267,8 @@ namespace MWMechanics { // Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back. // Note: accidental or collateral damage attacks are ignored. - startCombat(victim, player); + if (!victim.getClass().getCreatureStats(victim).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + startCombat(victim, player); // Set the crime ID, which we will use to calm down participants // once the bounty has been paid. @@ -1303,7 +1311,8 @@ namespace MWMechanics } if (target.getClass().isNpc() && !attacker.isEmpty() && !seq.isInCombat(attacker) - && !isAggressive(target, attacker) && !isFightingNpc) + && !isAggressive(target, attacker) && !isFightingNpc + && !target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) commitCrime(attacker, target, MWBase::MechanicsManager::OT_Assault); /* @@ -1322,7 +1331,8 @@ namespace MWMechanics { // Attacker is in combat with us, but we are not in combat with the attacker yet. Time to fight back. // Note: accidental or collateral damage attacks are ignored. - startCombat(target, attacker); + if (!target.getClass().getCreatureStats(target).getAiSequence().hasPackage(AiPackage::TypeIdPursue)) + startCombat(target, attacker); } return true; diff --git a/apps/openmw/mwmechanics/npcstats.cpp b/apps/openmw/mwmechanics/npcstats.cpp index 003055316..d0cb45163 100644 --- a/apps/openmw/mwmechanics/npcstats.cpp +++ b/apps/openmw/mwmechanics/npcstats.cpp @@ -1,15 +1,9 @@ #include "npcstats.hpp" -#include -#include -#include -#include - #include #include -#include #include #include #include diff --git a/apps/openmw/mwphysics/actor.cpp b/apps/openmw/mwphysics/actor.cpp index 2730bf4f0..e5e36def8 100644 --- a/apps/openmw/mwphysics/actor.cpp +++ b/apps/openmw/mwphysics/actor.cpp @@ -18,7 +18,7 @@ namespace MWPhysics Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr shape, btCollisionWorld* world) : mCanWaterWalk(false), mWalkingOnWater(false) - , mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(true), mOnSlope(false) + , mCollisionObject(nullptr), mForce(0.f, 0.f, 0.f), mOnGround(false), mOnSlope(false) , mInternalCollisionMode(true) , mExternalCollisionMode(true) , mCollisionWorld(world) diff --git a/apps/openmw/mwphysics/actor.hpp b/apps/openmw/mwphysics/actor.hpp index 88f7f5537..8ec94200f 100644 --- a/apps/openmw/mwphysics/actor.hpp +++ b/apps/openmw/mwphysics/actor.hpp @@ -162,10 +162,10 @@ namespace MWPhysics bool mRotationallyInvariant; - std::auto_ptr mShape; + std::unique_ptr mShape; btConvexShape* mConvexShape; - std::auto_ptr mCollisionObject; + std::unique_ptr mCollisionObject; osg::Vec3f mMeshTranslation; osg::Vec3f mHalfExtents; diff --git a/apps/openmw/mwphysics/physicssystem.cpp b/apps/openmw/mwphysics/physicssystem.cpp index d209d0d95..790ae2099 100644 --- a/apps/openmw/mwphysics/physicssystem.cpp +++ b/apps/openmw/mwphysics/physicssystem.cpp @@ -667,7 +667,7 @@ namespace MWPhysics } private: - std::auto_ptr mCollisionObject; + std::unique_ptr mCollisionObject; osg::ref_ptr mShapeInstance; std::map mRecIndexToNodePath; bool mSolid; diff --git a/apps/openmw/mwphysics/physicssystem.hpp b/apps/openmw/mwphysics/physicssystem.hpp index 5351d99dd..aaf55e2b6 100644 --- a/apps/openmw/mwphysics/physicssystem.hpp +++ b/apps/openmw/mwphysics/physicssystem.hpp @@ -181,7 +181,7 @@ namespace MWPhysics btCollisionDispatcher* mDispatcher; btCollisionWorld* mCollisionWorld; - std::auto_ptr mShapeManager; + std::unique_ptr mShapeManager; Resource::ResourceSystem* mResourceSystem; typedef std::map ObjectMap; @@ -213,10 +213,10 @@ namespace MWPhysics float mWaterHeight; bool mWaterEnabled; - std::auto_ptr mWaterCollisionObject; - std::auto_ptr mWaterCollisionShape; + std::unique_ptr mWaterCollisionObject; + std::unique_ptr mWaterCollisionShape; - std::auto_ptr mDebugDrawer; + std::unique_ptr mDebugDrawer; osg::ref_ptr mParentNode; diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index c825e74f2..98d29bfc9 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -546,7 +546,7 @@ namespace MWRender if(!mResourceSystem->getVFS()->exists(kfname)) return; - boost::shared_ptr animsrc; + std::shared_ptr animsrc; animsrc.reset(new AnimSource); animsrc->mKeyframes = mResourceSystem->getKeyframeManager()->get(kfname); @@ -598,7 +598,7 @@ namespace MWRender mStates.clear(); for(size_t i = 0;i < sNumBlendMasks;i++) - mAnimationTimePtr[i]->setTimePtr(boost::shared_ptr()); + mAnimationTimePtr[i]->setTimePtr(std::shared_ptr()); mAccumCtrl = NULL; @@ -881,12 +881,12 @@ namespace MWRender active = state; } - mAnimationTimePtr[blendMask]->setTimePtr(active == mStates.end() ? boost::shared_ptr() : active->second.mTime); + mAnimationTimePtr[blendMask]->setTimePtr(active == mStates.end() ? std::shared_ptr() : active->second.mTime); // add external controllers for the AnimSource active in this blend mask if (active != mStates.end()) { - boost::shared_ptr animsrc = active->second.mSource; + std::shared_ptr animsrc = active->second.mSource; for (AnimSource::ControllerMap::iterator it = animsrc->mControllerMap[blendMask].begin(); it != animsrc->mControllerMap[blendMask].end(); ++it) { @@ -1406,9 +1406,9 @@ namespace MWRender params.mEffectId = effectId; params.mBoneName = bonename; - params.mAnimTime = boost::shared_ptr(new EffectAnimationTime); + params.mAnimTime = std::shared_ptr(new EffectAnimationTime); - SceneUtil::AssignControllerSourcesVisitor assignVisitor(boost::shared_ptr(params.mAnimTime)); + SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr(params.mAnimTime)); node->accept(assignVisitor); overrideFirstRootTexture(texture, mResourceSystem, node); diff --git a/apps/openmw/mwrender/animation.hpp b/apps/openmw/mwrender/animation.hpp index 202595182..5aec80f5d 100644 --- a/apps/openmw/mwrender/animation.hpp +++ b/apps/openmw/mwrender/animation.hpp @@ -69,7 +69,7 @@ private: void operator= (const PartHolder&); PartHolder(const PartHolder&); }; -typedef boost::shared_ptr PartHolderPtr; +typedef std::shared_ptr PartHolderPtr; class Animation : public osg::Referenced { @@ -146,13 +146,13 @@ protected: class AnimationTime : public SceneUtil::ControllerSource { private: - boost::shared_ptr mTimePtr; + std::shared_ptr mTimePtr; public: - void setTimePtr(boost::shared_ptr time) + void setTimePtr(std::shared_ptr time) { mTimePtr = time; } - boost::shared_ptr getTimePtr() const + std::shared_ptr getTimePtr() const { return mTimePtr; } virtual float getValue(osg::NodeVisitor* nv); @@ -170,13 +170,13 @@ protected: struct AnimSource; struct AnimState { - boost::shared_ptr mSource; + std::shared_ptr mSource; float mStartTime; float mLoopStartTime; float mLoopStopTime; float mStopTime; - typedef boost::shared_ptr TimePtr; + typedef std::shared_ptr TimePtr; TimePtr mTime; float mSpeedMult; @@ -212,7 +212,7 @@ protected: typedef std::map AnimStateMap; AnimStateMap mStates; - typedef std::vector > AnimSourceList; + typedef std::vector > AnimSourceList; AnimSourceList mAnimSources; osg::ref_ptr mInsert; @@ -234,7 +234,7 @@ protected: typedef std::multimap, osg::ref_ptr > ControllerMap; ControllerMap mActiveControllers; - boost::shared_ptr mAnimationTimePtr[sNumBlendMasks]; + std::shared_ptr mAnimationTimePtr[sNumBlendMasks]; // Stored in all lowercase for a case-insensitive lookup typedef std::map > NodeMap; @@ -251,7 +251,7 @@ protected: { std::string mModelName; // Just here so we don't add the same effect twice PartHolderPtr mObjects; - boost::shared_ptr mAnimTime; + std::shared_ptr mAnimTime; float mMaxControllerLength; int mEffectId; bool mLoop; diff --git a/apps/openmw/mwrender/characterpreview.cpp b/apps/openmw/mwrender/characterpreview.cpp index db778e88d..b0899f47e 100644 --- a/apps/openmw/mwrender/characterpreview.cpp +++ b/apps/openmw/mwrender/characterpreview.cpp @@ -111,7 +111,7 @@ namespace MWRender , mPosition(position) , mLookAt(lookAt) , mCharacter(character) - , mAnimation(NULL) + , mAnimation(nullptr) , mSizeX(sizeX) , mSizeY(sizeY) { @@ -188,7 +188,7 @@ namespace MWRender mParent->addChild(mCamera); - mCharacter.mCell = NULL; + mCharacter.mCell = nullptr; } CharacterPreview::~CharacterPreview () diff --git a/apps/openmw/mwrender/creatureanimation.cpp b/apps/openmw/mwrender/creatureanimation.cpp index cb6489ef4..2ad362b33 100644 --- a/apps/openmw/mwrender/creatureanimation.cpp +++ b/apps/openmw/mwrender/creatureanimation.cpp @@ -59,7 +59,7 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const updateParts(); } - mWeaponAnimationTime = boost::shared_ptr(new WeaponAnimationTime(this)); + mWeaponAnimationTime = std::shared_ptr(new WeaponAnimationTime(this)); } void CreatureWeaponAnimation::showWeapons(bool showWeapon) @@ -143,7 +143,7 @@ void CreatureWeaponAnimation::updatePart(PartHolderPtr& scene, int slot) else mAmmunition.reset(); - boost::shared_ptr source; + std::shared_ptr source; if (slot == MWWorld::InventoryStore::Slot_CarriedRight) source = mWeaponAnimationTime; diff --git a/apps/openmw/mwrender/creatureanimation.hpp b/apps/openmw/mwrender/creatureanimation.hpp index bf813075e..ff959a551 100644 --- a/apps/openmw/mwrender/creatureanimation.hpp +++ b/apps/openmw/mwrender/creatureanimation.hpp @@ -61,7 +61,7 @@ namespace MWRender bool mShowWeapons; bool mShowCarriedLeft; - boost::shared_ptr mWeaponAnimationTime; + std::shared_ptr mWeaponAnimationTime; }; } diff --git a/apps/openmw/mwrender/effectmanager.hpp b/apps/openmw/mwrender/effectmanager.hpp index 83acc4c60..5873c00dd 100644 --- a/apps/openmw/mwrender/effectmanager.hpp +++ b/apps/openmw/mwrender/effectmanager.hpp @@ -1,13 +1,12 @@ #ifndef OPENMW_MWRENDER_EFFECTMANAGER_H #define OPENMW_MWRENDER_EFFECTMANAGER_H -#include #include +#include +#include #include -#include - namespace osg { class Group; @@ -44,7 +43,7 @@ namespace MWRender struct Effect { float mMaxControllerLength; - boost::shared_ptr mAnimTime; + std::shared_ptr mAnimTime; }; typedef std::map, Effect> EffectMap; diff --git a/apps/openmw/mwrender/localmap.cpp b/apps/openmw/mwrender/localmap.cpp index 02bc5d01f..b78c4dcd2 100644 --- a/apps/openmw/mwrender/localmap.cpp +++ b/apps/openmw/mwrender/localmap.cpp @@ -109,7 +109,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) if (segment.mFogOfWarImage && segment.mHasFogState) { - std::auto_ptr fog (new ESM::FogState()); + std::unique_ptr fog (new ESM::FogState()); fog->mFogTextures.push_back(ESM::FogTexture()); segment.saveFogOfWar(fog->mFogTextures.back()); @@ -126,7 +126,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell) const int segsX = static_cast(std::ceil(length.x() / mMapWorldSize)); const int segsY = static_cast(std::ceil(length.y() / mMapWorldSize)); - std::auto_ptr fog (new ESM::FogState()); + std::unique_ptr fog (new ESM::FogState()); fog->mBounds.mMinX = mBounds.xMin(); fog->mBounds.mMaxX = mBounds.xMax(); diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index 8805b0e95..73927e0ab 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -286,8 +286,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr par { mNpc = mPtr.get()->mBase; - mHeadAnimationTime = boost::shared_ptr(new HeadAnimationTime(mPtr)); - mWeaponAnimationTime = boost::shared_ptr(new WeaponAnimationTime(this)); + mHeadAnimationTime = std::shared_ptr(new HeadAnimationTime(mPtr)); + mWeaponAnimationTime = std::shared_ptr(new WeaponAnimationTime(this)); for(size_t i = 0;i < ESM::PRT_Count;i++) { @@ -778,7 +778,7 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g osg::Node* node = mObjectParts[type]->getNode(); if (node->getNumChildrenRequiringUpdateTraversal() > 0) { - boost::shared_ptr src; + std::shared_ptr src; if (type == ESM::PRT_Head) { src = mHeadAnimationTime; diff --git a/apps/openmw/mwrender/npcanimation.hpp b/apps/openmw/mwrender/npcanimation.hpp index ad4d692c9..7f3a8da2d 100644 --- a/apps/openmw/mwrender/npcanimation.hpp +++ b/apps/openmw/mwrender/npcanimation.hpp @@ -64,8 +64,8 @@ private: // Field of view to use when rendering first person meshes float mFirstPersonFieldOfView; - boost::shared_ptr mHeadAnimationTime; - boost::shared_ptr mWeaponAnimationTime; + std::shared_ptr mHeadAnimationTime; + std::shared_ptr mWeaponAnimationTime; bool mSoundsDisabled; diff --git a/apps/openmw/mwrender/renderingmanager.hpp b/apps/openmw/mwrender/renderingmanager.hpp index 075357335..e575456d9 100644 --- a/apps/openmw/mwrender/renderingmanager.hpp +++ b/apps/openmw/mwrender/renderingmanager.hpp @@ -224,16 +224,16 @@ namespace MWRender osg::ref_ptr mSunLight; - std::auto_ptr mPathgrid; - std::auto_ptr mObjects; - std::auto_ptr mWater; - std::auto_ptr mTerrain; + std::unique_ptr mPathgrid; + std::unique_ptr mObjects; + std::unique_ptr mWater; + std::unique_ptr mTerrain; TerrainStorage* mTerrainStorage; - std::auto_ptr mSky; - std::auto_ptr mEffectManager; + std::unique_ptr mSky; + std::unique_ptr mEffectManager; osg::ref_ptr mPlayerAnimation; osg::ref_ptr mPlayerNode; - std::auto_ptr mCamera; + std::unique_ptr mCamera; osg::Vec3f mCurrentCameraPos; osg::ref_ptr mStateUpdater; diff --git a/apps/openmw/mwrender/ripplesimulation.cpp b/apps/openmw/mwrender/ripplesimulation.cpp index 00082f033..141a3eb87 100644 --- a/apps/openmw/mwrender/ripplesimulation.cpp +++ b/apps/openmw/mwrender/ripplesimulation.cpp @@ -47,7 +47,7 @@ namespace } osg::ref_ptr controller (new NifOsg::FlipController(0, 0.3f/rippleFrameCount, textures)); - controller->setSource(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + controller->setSource(std::shared_ptr(new SceneUtil::FrameTimeSource)); node->addUpdateCallback(controller); osg::ref_ptr stateset (new osg::StateSet); diff --git a/apps/openmw/mwrender/sky.cpp b/apps/openmw/mwrender/sky.cpp index 09c7af6a2..e6aa013ec 100644 --- a/apps/openmw/mwrender/sky.cpp +++ b/apps/openmw/mwrender/sky.cpp @@ -1525,7 +1525,7 @@ void SkyManager::setWeather(const WeatherResult& weather) } mParticleEffect = mSceneManager->getInstance(mCurrentParticleEffect, mParticleNode); - SceneUtil::AssignControllerSourcesVisitor assignVisitor(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr(new SceneUtil::FrameTimeSource)); mParticleEffect->accept(assignVisitor); AlphaFader::SetupVisitor alphaFaderSetupVisitor; diff --git a/apps/openmw/mwrender/sky.hpp b/apps/openmw/mwrender/sky.hpp index e047a9832..863ecc77d 100644 --- a/apps/openmw/mwrender/sky.hpp +++ b/apps/openmw/mwrender/sky.hpp @@ -189,9 +189,9 @@ namespace MWRender osg::ref_ptr mAtmosphereUpdater; - std::auto_ptr mSun; - std::auto_ptr mMasser; - std::auto_ptr mSecunda; + std::unique_ptr mSun; + std::unique_ptr mMasser; + std::unique_ptr mSecunda; osg::ref_ptr mRainNode; osg::ref_ptr mRainParticleSystem; diff --git a/apps/openmw/mwrender/terrainstorage.hpp b/apps/openmw/mwrender/terrainstorage.hpp index cf4011d45..6f716e752 100644 --- a/apps/openmw/mwrender/terrainstorage.hpp +++ b/apps/openmw/mwrender/terrainstorage.hpp @@ -29,7 +29,7 @@ namespace MWRender LandManager* getLandManager() const; private: - std::auto_ptr mLandManager; + std::unique_ptr mLandManager; Resource::ResourceSystem* mResourceSystem; }; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index d2ad1f9b5..0ed389bdf 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -10,8 +10,6 @@ #include #include #include -#include -#include #include @@ -28,11 +26,9 @@ #include #include -#include #include -#include #include @@ -488,7 +484,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha) float fps = mFallback->getFallbackFloat("Water_SurfaceFPS"); osg::ref_ptr controller (new NifOsg::FlipController(0, 1.f/fps, textures)); - controller->setSource(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + controller->setSource(std::shared_ptr(new SceneUtil::FrameTimeSource)); node->setUpdateCallback(controller); stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON); diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index 29e78cf52..33b314c51 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -58,7 +58,7 @@ namespace MWRender const Fallback::Map* mFallback; osg::ref_ptr mIncrementalCompileOperation; - std::auto_ptr mSimulation; + std::unique_ptr mSimulation; osg::ref_ptr mRefraction; osg::ref_ptr mReflection; diff --git a/apps/openmw/mwscript/containerextensions.cpp b/apps/openmw/mwscript/containerextensions.cpp index 71d22b9ac..0c2e38db6 100644 --- a/apps/openmw/mwscript/containerextensions.cpp +++ b/apps/openmw/mwscript/containerextensions.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include @@ -221,7 +220,7 @@ namespace MWScript MWBase::Environment::get().getWindowManager()->useItem(*it); else { - boost::shared_ptr action = it->getClass().use(*it); + std::shared_ptr action = it->getClass().use(*it); // No equip sound for actors other than the player action->execute(ptr, true); } diff --git a/apps/openmw/mwscript/interpretercontext.cpp b/apps/openmw/mwscript/interpretercontext.cpp index 1e0973115..35fd9e63c 100644 --- a/apps/openmw/mwscript/interpretercontext.cpp +++ b/apps/openmw/mwscript/interpretercontext.cpp @@ -559,7 +559,7 @@ namespace MWScript void InterpreterContext::executeActivation(MWWorld::Ptr ptr, MWWorld::Ptr actor) { - boost::shared_ptr action = (ptr.getClass().activate(ptr, actor)); + std::shared_ptr action = (ptr.getClass().activate(ptr, actor)); action->execute (actor); if (action->getTarget() != MWWorld::Ptr() && action->getTarget() != ptr) { diff --git a/apps/openmw/mwscript/interpretercontext.hpp b/apps/openmw/mwscript/interpretercontext.hpp index 6d50b9ffb..9219789eb 100644 --- a/apps/openmw/mwscript/interpretercontext.hpp +++ b/apps/openmw/mwscript/interpretercontext.hpp @@ -1,8 +1,6 @@ #ifndef GAME_SCRIPT_INTERPRETERCONTEXT_H #define GAME_SCRIPT_INTERPRETERCONTEXT_H -#include - #include #include "../mwworld/ptr.hpp" diff --git a/apps/openmw/mwscript/skyextensions.cpp b/apps/openmw/mwscript/skyextensions.cpp index e0fccd16d..479c9d70c 100644 --- a/apps/openmw/mwscript/skyextensions.cpp +++ b/apps/openmw/mwscript/skyextensions.cpp @@ -1,5 +1,7 @@ #include "skyextensions.hpp" +#include + #include #include diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 038b2338b..1f1834761 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -1,10 +1,10 @@ #include "ffmpeg_decoder.hpp" -// auto_ptr #include #include #include +#include #include diff --git a/apps/openmw/mwsound/loudness.cpp b/apps/openmw/mwsound/loudness.cpp index 19e5cd586..ae31d6094 100644 --- a/apps/openmw/mwsound/loudness.cpp +++ b/apps/openmw/mwsound/loudness.cpp @@ -2,6 +2,7 @@ #include #include +#include #include "soundmanagerimp.hpp" diff --git a/apps/openmw/mwsound/movieaudiofactory.cpp b/apps/openmw/mwsound/movieaudiofactory.cpp index af9932f74..2d7f3a969 100644 --- a/apps/openmw/mwsound/movieaudiofactory.cpp +++ b/apps/openmw/mwsound/movieaudiofactory.cpp @@ -92,7 +92,7 @@ namespace MWSound } MWBase::SoundStreamPtr mAudioTrack; - boost::shared_ptr mDecoderBridge; + std::shared_ptr mDecoderBridge; }; @@ -156,9 +156,9 @@ namespace MWSound - boost::shared_ptr MovieAudioFactory::createDecoder(Video::VideoState* videoState) + std::shared_ptr MovieAudioFactory::createDecoder(Video::VideoState* videoState) { - boost::shared_ptr decoder(new MWSound::MovieAudioDecoder(videoState)); + std::shared_ptr decoder(new MWSound::MovieAudioDecoder(videoState)); decoder->setupFormat(); MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager(); diff --git a/apps/openmw/mwsound/movieaudiofactory.hpp b/apps/openmw/mwsound/movieaudiofactory.hpp index 1391a0012..6ec49a4d3 100644 --- a/apps/openmw/mwsound/movieaudiofactory.hpp +++ b/apps/openmw/mwsound/movieaudiofactory.hpp @@ -8,7 +8,7 @@ namespace MWSound class MovieAudioFactory : public Video::MovieAudioFactory { - virtual boost::shared_ptr createDecoder(Video::VideoState* videoState); + virtual std::shared_ptr createDecoder(Video::VideoState* videoState); }; } diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index fb259ff5f..042795a8c 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -217,7 +217,7 @@ private: DecoderPtr mDecoder; - std::auto_ptr mLoudnessAnalyzer; + std::unique_ptr mLoudnessAnalyzer; volatile bool mIsFinished; diff --git a/apps/openmw/mwsound/openal_output.hpp b/apps/openmw/mwsound/openal_output.hpp index 24c8609d6..ea3f393ff 100644 --- a/apps/openmw/mwsound/openal_output.hpp +++ b/apps/openmw/mwsound/openal_output.hpp @@ -33,7 +33,7 @@ namespace MWSound Environment mListenerEnv; struct StreamThread; - std::auto_ptr mStreamThread; + std::unique_ptr mStreamThread; void initCommon2D(ALuint source, const osg::Vec3f &pos, ALfloat gain, ALfloat pitch, bool loop, bool useenv); void initCommon3D(ALuint source, const osg::Vec3f &pos, ALfloat mindist, ALfloat maxdist, ALfloat gain, ALfloat pitch, bool loop, bool useenv); diff --git a/apps/openmw/mwsound/sound.hpp b/apps/openmw/mwsound/sound.hpp index a59027fc1..8c663fb1e 100644 --- a/apps/openmw/mwsound/sound.hpp +++ b/apps/openmw/mwsound/sound.hpp @@ -1,6 +1,8 @@ #ifndef GAME_SOUND_SOUND_H #define GAME_SOUND_SOUND_H +#include + #include "sound_output.hpp" namespace MWSound diff --git a/apps/openmw/mwsound/soundmanagerimp.hpp b/apps/openmw/mwsound/soundmanagerimp.hpp index abf5edb97..bf628b102 100644 --- a/apps/openmw/mwsound/soundmanagerimp.hpp +++ b/apps/openmw/mwsound/soundmanagerimp.hpp @@ -7,8 +7,6 @@ #include #include -#include - #include #include @@ -47,8 +45,7 @@ namespace MWSound const VFS::Manager* mVFS; Fallback::Map mFallback; - - std::auto_ptr mOutput; + std::unique_ptr mOutput; // Caches available music tracks by std::map > mMusicFiles; @@ -66,8 +63,7 @@ namespace MWSound float mNearWaterOutdoorTolerance; std::string mNearWaterIndoorID; std::string mNearWaterOutdoorID; - - typedef std::auto_ptr > SoundBufferList; + typedef std::unique_ptr > SoundBufferList; // List of sound buffers, grown as needed. New enties are added to the // back, allowing existing Sound_Buffer references/pointers to remain // valid. diff --git a/apps/openmw/mwstate/character.cpp b/apps/openmw/mwstate/character.cpp index 733ac1171..4f7d365b4 100644 --- a/apps/openmw/mwstate/character.cpp +++ b/apps/openmw/mwstate/character.cpp @@ -1,18 +1,12 @@ #include "character.hpp" -#include - #include -#include -#include #include #include #include -#include - bool MWState::operator< (const Slot& left, const Slot& right) { return left.mTimeStamp -#include -#include // std::isalnum #include @@ -60,7 +58,7 @@ MWState::Character* MWState::CharacterManager::createCharacter(const std::string // The character name is user-supplied, so we need to escape the path for (std::string::const_iterator it = name.begin(); it != name.end(); ++it) { - if (std::isalnum(*it)) // Ignores multibyte characters and non alphanumeric characters + if (isalnum(*it)) // Ignores multibyte characters and non alphanumeric characters stream << *it; else stream << "_"; diff --git a/apps/openmw/mwstate/statemanagerimp.cpp b/apps/openmw/mwstate/statemanagerimp.cpp index 64c543fb1..68b0e4ecb 100644 --- a/apps/openmw/mwstate/statemanagerimp.cpp +++ b/apps/openmw/mwstate/statemanagerimp.cpp @@ -7,8 +7,6 @@ #include -#include - #include #include @@ -35,7 +33,6 @@ #include "../mwworld/inventorystore.hpp" #include "../mwmechanics/npcstats.hpp" -#include "../mwmechanics/creaturestats.hpp" #include "../mwmechanics/actorutil.hpp" #include "../mwscript/globalscripts.hpp" diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 11a34bff3..ddc8db67d 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -6,8 +6,7 @@ #include #include #include - -#include +#include #include "livecellref.hpp" #include "cellreflist.hpp" @@ -67,7 +66,7 @@ namespace MWWorld // Even though fog actually belongs to the player and not cells, // it makes sense to store it here since we need it once for each cell. // Note this is NULL until the cell is explored to save some memory - boost::shared_ptr mFogState; + std::shared_ptr mFogState; const ESM::Cell *mCell; State mState; diff --git a/apps/openmw/mwworld/class.cpp b/apps/openmw/mwworld/class.cpp index 72696e209..e59dde7b1 100644 --- a/apps/openmw/mwworld/class.cpp +++ b/apps/openmw/mwworld/class.cpp @@ -24,7 +24,7 @@ namespace MWWorld { - std::map > Class::sClasses; + std::map > Class::sClasses; Class::Class() {} @@ -108,14 +108,14 @@ namespace MWWorld throw std::runtime_error("class cannot be hit"); } - boost::shared_ptr Class::activate (const Ptr& ptr, const Ptr& actor) const + std::shared_ptr Class::activate (const Ptr& ptr, const Ptr& actor) const { - return boost::shared_ptr (new NullAction); + return std::shared_ptr (new NullAction); } - boost::shared_ptr Class::use (const Ptr& ptr) const + std::shared_ptr Class::use (const Ptr& ptr) const { - return boost::shared_ptr (new NullAction); + return std::shared_ptr (new NullAction); } ContainerStore& Class::getContainerStore (const Ptr& ptr) const @@ -233,7 +233,7 @@ namespace MWWorld if (key.empty()) throw std::logic_error ("Class::get(): attempting to get an empty key"); - std::map >::const_iterator iter = sClasses.find (key); + std::map >::const_iterator iter = sClasses.find (key); if (iter==sClasses.end()) throw std::logic_error ("Class::get(): unknown class key: " + key); @@ -246,7 +246,7 @@ namespace MWWorld throw std::runtime_error ("class does not support persistence"); } - void Class::registerClass(const std::string& key, boost::shared_ptr instance) + void Class::registerClass(const std::string& key, std::shared_ptr instance) { instance->mTypeName = key; sClasses.insert(std::make_pair(key, instance)); @@ -330,23 +330,23 @@ namespace MWWorld { } - boost::shared_ptr Class::defaultItemActivate(const Ptr &ptr, const Ptr &actor) const + std::shared_ptr Class::defaultItemActivate(const Ptr &ptr, const Ptr &actor) const { if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) - return boost::shared_ptr(new NullAction()); + return std::shared_ptr(new NullAction()); if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) { const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const ESM::Sound *sound = store.get().searchRandom("WolfItem"); - boost::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); + std::shared_ptr action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); if(sound) action->setSound(sound->mId); return action; } - boost::shared_ptr action(new ActionTake(ptr)); + std::shared_ptr action(new ActionTake(ptr)); action->setSound(getUpSoundId(ptr)); return action; diff --git a/apps/openmw/mwworld/class.hpp b/apps/openmw/mwworld/class.hpp index 3b1ddb647..42d57ffab 100644 --- a/apps/openmw/mwworld/class.hpp +++ b/apps/openmw/mwworld/class.hpp @@ -2,11 +2,10 @@ #define GAME_MWWORLD_CLASS_H #include +#include #include #include -#include - #include "ptr.hpp" namespace ESM @@ -51,7 +50,7 @@ namespace MWWorld /// \brief Base class for referenceable esm records class Class { - static std::map > sClasses; + static std::map > sClasses; std::string mTypeName; @@ -63,7 +62,7 @@ namespace MWWorld Class(); - boost::shared_ptr defaultItemActivate(const Ptr &ptr, const Ptr &actor) const; + std::shared_ptr defaultItemActivate(const Ptr &ptr, const Ptr &actor) const; ///< Generate default action for activating inventory items virtual Ptr copyToCellImpl(const ConstPtr &ptr, CellStore &cell) const; @@ -139,10 +138,10 @@ namespace MWWorld ///< \return Can the player activate this object? /// (default implementation: true if object's user-readable name is not empty, false otherwise) - virtual boost::shared_ptr activate (const Ptr& ptr, const Ptr& actor) const; + virtual std::shared_ptr activate (const Ptr& ptr, const Ptr& actor) const; ///< Generate action for activation (default implementation: return a null action). - virtual boost::shared_ptr use (const Ptr& ptr) + virtual std::shared_ptr use (const Ptr& ptr) const; ///< Generate action for using via inventory menu (default implementation: return a /// null action). @@ -332,7 +331,7 @@ namespace MWWorld static const Class& get (const std::string& key); ///< If there is no class for this \a key, an exception is thrown. - static void registerClass (const std::string& key, boost::shared_ptr instance); + static void registerClass (const std::string& key, std::shared_ptr instance); virtual int getBaseGold(const MWWorld::ConstPtr& ptr) const; diff --git a/apps/openmw/mwworld/projectilemanager.hpp b/apps/openmw/mwworld/projectilemanager.hpp index 2289706d3..bfa4980e9 100644 --- a/apps/openmw/mwworld/projectilemanager.hpp +++ b/apps/openmw/mwworld/projectilemanager.hpp @@ -73,7 +73,7 @@ namespace MWWorld struct State { osg::ref_ptr mNode; - boost::shared_ptr mEffectAnimationTime; + std::shared_ptr mEffectAnimationTime; int mActorId; diff --git a/apps/openmw/mwworld/scene.hpp b/apps/openmw/mwworld/scene.hpp index f3c2d31ca..586ac4f67 100644 --- a/apps/openmw/mwworld/scene.hpp +++ b/apps/openmw/mwworld/scene.hpp @@ -57,7 +57,7 @@ namespace MWWorld bool mCellChanged; MWPhysics::PhysicsSystem *mPhysics; MWRender::RenderingManager& mRendering; - std::auto_ptr mPreloader; + std::unique_ptr mPreloader; float mPreloadTimer; int mHalfGridSize; float mCellLoadingThreshold; diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 224927f58..705a4e247 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -3546,7 +3546,7 @@ namespace MWWorld if (object.getRefData().activate()) { - boost::shared_ptr action = (object.getClass().activate(object, actor)); + std::shared_ptr action = (object.getClass().activate(object, actor)); action->execute (actor); } } diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 48e71f76f..7490cb224 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -1,8 +1,6 @@ #ifndef GAME_MWWORLD_WORLDIMP_H #define GAME_MWWORLD_WORLDIMP_H -#include - #include #include @@ -100,7 +98,7 @@ namespace MWWorld std::string mCurrentWorldSpace; - boost::shared_ptr mProjectileManager; + std::shared_ptr mProjectileManager; bool mGodMode; bool mScriptsEnabled; @@ -168,9 +166,6 @@ namespace MWWorld float mDistanceToFacedObject; - bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const; - ///< helper function for implementing isSwimming(), isSubmerged(), isWading() - bool mTeleportEnabled; bool mLevitationEnabled; bool mGoToJail; @@ -494,6 +489,7 @@ namespace MWWorld virtual bool isSubmerged(const MWWorld::ConstPtr &object) const; virtual bool isSwimming(const MWWorld::ConstPtr &object) const; virtual bool isUnderwater(const MWWorld::CellStore* cell, const osg::Vec3f &pos) const; + virtual bool isUnderwater(const MWWorld::ConstPtr &object, const float heightRatio) const; virtual bool isWading(const MWWorld::ConstPtr &object) const; virtual bool isWaterWalkingCastableOnTarget(const MWWorld::ConstPtr &target) const; virtual bool isOnGround(const MWWorld::Ptr &ptr) const; diff --git a/apps/wizard/unshield/unshieldworker.cpp b/apps/wizard/unshield/unshieldworker.cpp index d3ccfe03a..020de9f80 100644 --- a/apps/wizard/unshield/unshieldworker.cpp +++ b/apps/wizard/unshield/unshieldworker.cpp @@ -46,6 +46,7 @@ Wizard::UnshieldWorker::~UnshieldWorker() void Wizard::UnshieldWorker::stopWorker() { mStopped = true; + mWait.wakeOne(); } void Wizard::UnshieldWorker::setInstallComponent(Wizard::Component component, bool install) @@ -448,6 +449,10 @@ bool Wizard::UnshieldWorker::setupComponent(Component component) QReadLocker readLock(&mLock); emit requestFileDialog(component); mWait.wait(&mLock); + if(mStopped) { + qDebug() << "We are asked to stop !!"; + break; + } disk.setPath(getDiskPath()); } else { disk.setPath(getDiskPath()); diff --git a/components/bsa/bsa_file.cpp b/components/bsa/bsa_file.cpp index 2b9a3f632..c4be428b3 100644 --- a/components/bsa/bsa_file.cpp +++ b/components/bsa/bsa_file.cpp @@ -23,7 +23,7 @@ #include "bsa_file.hpp" -#include +#include #include #include diff --git a/components/compiler/lineparser.cpp b/components/compiler/lineparser.cpp index a5b67f58b..c7f82a3d0 100644 --- a/components/compiler/lineparser.cpp +++ b/components/compiler/lineparser.cpp @@ -294,7 +294,7 @@ namespace Compiler { // workaround for broken positioncell instructions. /// \todo add option to disable this - std::auto_ptr errorDowngrade (0); + std::unique_ptr errorDowngrade (nullptr); if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell") errorDowngrade.reset (new ErrorDowngrade (getErrorHandler())); diff --git a/components/contentselector/model/loadordererror.cpp b/components/contentselector/model/loadordererror.cpp index aa69f330e..7177e8ec1 100644 --- a/components/contentselector/model/loadordererror.cpp +++ b/components/contentselector/model/loadordererror.cpp @@ -1,5 +1,5 @@ #include "loadordererror.hpp" -#include +#include QString ContentSelectorModel::LoadOrderError::sErrorToolTips[ErrorCode_LoadOrder] = { diff --git a/components/contentselector/view/contentselector.cpp b/components/contentselector/view/contentselector.cpp index 514a0444a..f4da7e6ad 100644 --- a/components/contentselector/view/contentselector.cpp +++ b/components/contentselector/view/contentselector.cpp @@ -11,7 +11,6 @@ #include #include #include -#include ContentSelectorView::ContentSelector::ContentSelector(QWidget *parent) : QObject(parent) diff --git a/components/esm/aisequence.cpp b/components/esm/aisequence.cpp index 71f87b170..c39ef8269 100644 --- a/components/esm/aisequence.cpp +++ b/components/esm/aisequence.cpp @@ -170,49 +170,49 @@ namespace AiSequence { case Ai_Wander: { - std::auto_ptr ptr (new AiWander()); + std::unique_ptr ptr (new AiWander()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Travel: { - std::auto_ptr ptr (new AiTravel()); + std::unique_ptr ptr (new AiTravel()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Escort: { - std::auto_ptr ptr (new AiEscort()); + std::unique_ptr ptr (new AiEscort()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Follow: { - std::auto_ptr ptr (new AiFollow()); + std::unique_ptr ptr (new AiFollow()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Activate: { - std::auto_ptr ptr (new AiActivate()); + std::unique_ptr ptr (new AiActivate()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Combat: { - std::auto_ptr ptr (new AiCombat()); + std::unique_ptr ptr (new AiCombat()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; } case Ai_Pursue: { - std::auto_ptr ptr (new AiPursue()); + std::unique_ptr ptr (new AiPursue()); ptr->load(esm); mPackages.back().mPackage = ptr.release(); break; diff --git a/components/esm/loadmgef.cpp b/components/esm/loadmgef.cpp index dc8266132..3a918cf19 100644 --- a/components/esm/loadmgef.cpp +++ b/components/esm/loadmgef.cpp @@ -1,10 +1,7 @@ #include "loadmgef.hpp" -#include #include -#include - #include "esmreader.hpp" #include "esmwriter.hpp" #include "defs.hpp" @@ -524,7 +521,7 @@ const std::string &MagicEffect::effectIdToString(short effectID) { std::map::const_iterator name = sNames.find(effectID); if(name == sNames.end()) - throw std::runtime_error(std::string("Unimplemented effect ID ")+boost::lexical_cast(effectID)); + throw std::runtime_error(std::string("Unimplemented effect ID ")+std::to_string(effectID)); return name->second; } diff --git a/components/esm/npcstats.cpp b/components/esm/npcstats.cpp index 4c1095b6e..a12879109 100644 --- a/components/esm/npcstats.cpp +++ b/components/esm/npcstats.cpp @@ -1,3 +1,5 @@ +#include + #include "npcstats.hpp" #include "esmreader.hpp" diff --git a/components/fallback/fallback.cpp b/components/fallback/fallback.cpp index 354595660..11a577a45 100644 --- a/components/fallback/fallback.cpp +++ b/components/fallback/fallback.cpp @@ -2,8 +2,13 @@ #include + namespace Fallback { + bool stob(std::string const& s) { + return s != "0"; + } + Map::Map(const std::map& fallback):mFallbackMap(fallback) {} @@ -16,6 +21,7 @@ namespace Fallback } return it->second; } + float Map::getFallbackFloat(const std::string& fall) const { std::string fallback=getFallbackString(fall); @@ -24,13 +30,14 @@ namespace Fallback else return boost::lexical_cast(fallback); } + int Map::getFallbackInt(const std::string& fall) const { std::string fallback=getFallbackString(fall); if(fallback.empty()) return 0; else - return boost::lexical_cast(fallback); + return std::stoi(fallback); } bool Map::getFallbackBool(const std::string& fall) const @@ -39,8 +46,9 @@ namespace Fallback if(fallback.empty()) return false; else - return boost::lexical_cast(fallback); + return stob(fallback); } + osg::Vec4f Map::getFallbackColour(const std::string& fall) const { std::string sum=getFallbackString(fall); @@ -55,7 +63,7 @@ namespace Fallback else if (sum[i] != ' ') ret[j]+=sum[i]; } - return osg::Vec4f(boost::lexical_cast(ret[0])/255.f,boost::lexical_cast(ret[1])/255.f,boost::lexical_cast(ret[2])/255.f, 1.f); + return osg::Vec4f(std::stoi(ret[0])/255.f,std::stoi(ret[1])/255.f,std::stoi(ret[2])/255.f, 1.f); } } diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index b53e3834a..5316255ad 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -1,18 +1,12 @@ #include "configurationmanager.hpp" -#include #include -#include -#include #include -#include #include #include #include -#include - /** * \namespace Files */ @@ -130,7 +124,7 @@ void ConfigurationManager::processPaths(Files::PathContainer& dataDirs, bool cre } dataDirs.erase(std::remove_if(dataDirs.begin(), dataDirs.end(), - boost::bind(&boost::filesystem::path::empty, _1)), dataDirs.end()); + std::bind(&boost::filesystem::path::empty, std::placeholders::_1)), dataDirs.end()); } bool ConfigurationManager::loadConfig(const boost::filesystem::path& path, diff --git a/components/files/constrainedfilestream.cpp b/components/files/constrainedfilestream.cpp index cd9a3c8f5..4f76139d9 100644 --- a/components/files/constrainedfilestream.cpp +++ b/components/files/constrainedfilestream.cpp @@ -1,6 +1,7 @@ #include "constrainedfilestream.hpp" #include +#include #include "lowlevelfile.hpp" diff --git a/components/files/constrainedfilestream.hpp b/components/files/constrainedfilestream.hpp index 069ceec58..05ae0fbec 100644 --- a/components/files/constrainedfilestream.hpp +++ b/components/files/constrainedfilestream.hpp @@ -2,8 +2,7 @@ #define OPENMW_CONSTRAINEDFILESTREAM_H #include - -#include +#include namespace Files { @@ -17,7 +16,7 @@ public: virtual ~ConstrainedFileStream(); }; -typedef boost::shared_ptr IStreamPtr; +typedef std::shared_ptr IStreamPtr; IStreamPtr openConstrainedFileStream(const char *filename, size_t start=0, size_t length=0xFFFFFFFF); diff --git a/components/files/escape.cpp b/components/files/escape.cpp index c5d2c041e..f28870c70 100644 --- a/components/files/escape.cpp +++ b/components/files/escape.cpp @@ -1,7 +1,6 @@ #include "escape.hpp" #include -#include namespace Files { diff --git a/components/files/linuxpath.cpp b/components/files/linuxpath.cpp index 89b4bf45a..1f6a3d913 100644 --- a/components/files/linuxpath.cpp +++ b/components/files/linuxpath.cpp @@ -2,8 +2,6 @@ #if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) -#include -#include #include #include #include diff --git a/components/files/multidircollection.cpp b/components/files/multidircollection.cpp index b37a95b2f..93db6834d 100644 --- a/components/files/multidircollection.cpp +++ b/components/files/multidircollection.cpp @@ -1,15 +1,9 @@ #include "multidircollection.hpp" -#include - -#include -#include #include #include -#include - namespace Files { struct NameEqual diff --git a/components/misc/utf8stream.hpp b/components/misc/utf8stream.hpp index 4856d6503..760015902 100644 --- a/components/misc/utf8stream.hpp +++ b/components/misc/utf8stream.hpp @@ -1,7 +1,7 @@ #ifndef MISC_UTF8ITER_HPP #define MISC_UTF8ITER_HPP -#include +#include class Utf8Stream { @@ -60,7 +60,7 @@ public: int octets; UnicodeChar chr; - boost::tie (octets, chr) = octet_count (*cur++); + std::tie (octets, chr) = octet_count (*cur++); if (octets > 5) return std::make_pair (sBadChar(), cur); @@ -104,7 +104,7 @@ private: void next () { - boost::tie (val, nxt) = decode (nxt, end); + std::tie (val, nxt) = decode (nxt, end); } Point cur; diff --git a/components/myguiplatform/myguidatamanager.cpp b/components/myguiplatform/myguidatamanager.cpp index 69bc3878d..485a87ba7 100644 --- a/components/myguiplatform/myguidatamanager.cpp +++ b/components/myguiplatform/myguidatamanager.cpp @@ -18,7 +18,7 @@ void DataManager::setResourcePath(const std::string &path) MyGUI::IDataStream *DataManager::getData(const std::string &name) { std::string fullpath = getDataPath(name); - std::auto_ptr stream; + std::unique_ptr stream; stream.reset(new boost::filesystem::ifstream); stream->open(fullpath, std::ios::binary); if (stream->fail()) diff --git a/components/myguiplatform/myguiloglistener.cpp b/components/myguiplatform/myguiloglistener.cpp index b36e0d852..a22ac8fc5 100644 --- a/components/myguiplatform/myguiloglistener.cpp +++ b/components/myguiplatform/myguiloglistener.cpp @@ -1,9 +1,6 @@ #include "myguiloglistener.hpp" #include -#include - -#include namespace osgMyGUI { diff --git a/components/nif/niffile.hpp b/components/nif/niffile.hpp index 9a2acbb9f..9e39a37ab 100644 --- a/components/nif/niffile.hpp +++ b/components/nif/niffile.hpp @@ -92,7 +92,7 @@ public: /// Get the name of the file std::string getFilename() const { return filename; } }; -typedef boost::shared_ptr NIFFilePtr; +typedef std::shared_ptr NIFFilePtr; diff --git a/components/nif/nifkey.hpp b/components/nif/nifkey.hpp index 75353044d..9238a6548 100644 --- a/components/nif/nifkey.hpp +++ b/components/nif/nifkey.hpp @@ -8,8 +8,6 @@ #include #include -#include - #include "niffile.hpp" namespace Nif @@ -156,10 +154,10 @@ typedef KeyMapT Vector3KeyMap; typedef KeyMapT Vector4KeyMap; typedef KeyMapT QuaternionKeyMap; -typedef boost::shared_ptr FloatKeyMapPtr; -typedef boost::shared_ptr Vector3KeyMapPtr; -typedef boost::shared_ptr Vector4KeyMapPtr; -typedef boost::shared_ptr QuaternionKeyMapPtr; +typedef std::shared_ptr FloatKeyMapPtr; +typedef std::shared_ptr Vector3KeyMapPtr; +typedef std::shared_ptr Vector4KeyMapPtr; +typedef std::shared_ptr QuaternionKeyMapPtr; } // Namespace #endif //#ifndef OPENMW_COMPONENTS_NIF_NIFKEY_HPP diff --git a/components/nif/nifstream.hpp b/components/nif/nifstream.hpp index f4163ce47..860c62e64 100644 --- a/components/nif/nifstream.hpp +++ b/components/nif/nifstream.hpp @@ -3,6 +3,7 @@ #ifndef OPENMW_COMPONENTS_NIF_NIFSTREAM_HPP #define OPENMW_COMPONENTS_NIF_NIFSTREAM_HPP +#include #include #include #include diff --git a/components/nifbullet/bulletnifloader.cpp b/components/nifbullet/bulletnifloader.cpp index 1cfac15eb..e17c96b79 100644 --- a/components/nifbullet/bulletnifloader.cpp +++ b/components/nifbullet/bulletnifloader.cpp @@ -75,7 +75,7 @@ osg::ref_ptr BulletNifLoader::load(const Nif::NIFFilePtr if (findBoundingBox(node)) { - std::auto_ptr compound (new btCompoundShape); + std::unique_ptr compound (new btCompoundShape); btBoxShape* boxShape = new btBoxShape(getbtVector(mShape->mCollisionBoxHalfExtents)); btTransform transform = btTransform::getIdentity(); diff --git a/components/nifosg/controller.hpp b/components/nifosg/controller.hpp index e517f9189..5fbb172f9 100644 --- a/components/nifosg/controller.hpp +++ b/components/nifosg/controller.hpp @@ -9,8 +9,6 @@ #include #include -#include - #include //UVController // FlipController @@ -53,7 +51,7 @@ namespace NifOsg { } - ValueInterpolator(boost::shared_ptr keys, ValueT defaultVal = ValueT()) + ValueInterpolator(std::shared_ptr keys, ValueT defaultVal = ValueT()) : mKeys(keys) , mDefaultVal(defaultVal) { @@ -101,8 +99,6 @@ namespace NifOsg // cache for next time mLastHighKey = it; - assert (it != keys.begin()); // Shouldn't happen, was checked at beginning of this function - typename MapT::MapType::const_iterator last = --it; mLastLowKey = last; float aLastTime = last->first; @@ -125,7 +121,7 @@ namespace NifOsg mutable typename MapT::MapType::const_iterator mLastLowKey; mutable typename MapT::MapType::const_iterator mLastHighKey; - boost::shared_ptr mKeys; + std::shared_ptr mKeys; ValueT mDefaultVal; }; diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index 2e591619e..05f6263b7 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -334,7 +334,7 @@ namespace NifOsg continue; osg::ref_ptr callback(new NifOsg::KeyframeController(key->data.getPtr())); - callback->setFunction(boost::shared_ptr(new NifOsg::ControllerFunction(key))); + callback->setFunction(std::shared_ptr(new NifOsg::ControllerFunction(key))); if (target.mKeyframeControllers.find(strdata->string) != target.mKeyframeControllers.end()) std::cerr << "Warning: controller " << strdata->string << " present more than once in " << nif->getFilename() << ", ignoring later version" << std::endl; @@ -411,9 +411,9 @@ namespace NifOsg { bool autoPlay = animflags & Nif::NiNode::AnimFlag_AutoPlay; if (autoPlay) - toSetup->setSource(boost::shared_ptr(new SceneUtil::FrameTimeSource)); + toSetup->setSource(std::shared_ptr(new SceneUtil::FrameTimeSource)); - toSetup->setFunction(boost::shared_ptr(new ControllerFunction(ctrl))); + toSetup->setFunction(std::shared_ptr(new ControllerFunction(ctrl))); } osg::ref_ptr handleLodNode(const Nif::NiLODNode* niLodNode) diff --git a/components/resource/imagemanager.cpp b/components/resource/imagemanager.cpp index db47324fb..441fd8212 100644 --- a/components/resource/imagemanager.cpp +++ b/components/resource/imagemanager.cpp @@ -1,7 +1,7 @@ #include "imagemanager.hpp" +#include #include -#include #include diff --git a/components/resource/resourcesystem.cpp b/components/resource/resourcesystem.cpp index 19b280ff1..8d05a1b4e 100644 --- a/components/resource/resourcesystem.cpp +++ b/components/resource/resourcesystem.cpp @@ -1,5 +1,7 @@ #include "resourcesystem.hpp" +#include + #include "scenemanager.hpp" #include "imagemanager.hpp" #include "niffilemanager.hpp" @@ -28,8 +30,6 @@ namespace Resource // this has to be defined in the .cpp file as we can't delete incomplete types mResourceManagers.clear(); - - // no delete, all handled by auto_ptr } SceneManager* ResourceSystem::getSceneManager() diff --git a/components/resource/resourcesystem.hpp b/components/resource/resourcesystem.hpp index 6e308fd9b..dc608b875 100644 --- a/components/resource/resourcesystem.hpp +++ b/components/resource/resourcesystem.hpp @@ -57,10 +57,10 @@ namespace Resource void reportStats(unsigned int frameNumber, osg::Stats* stats) const; private: - std::auto_ptr mSceneManager; - std::auto_ptr mImageManager; - std::auto_ptr mNifFileManager; - std::auto_ptr mKeyframeManager; + std::unique_ptr mSceneManager; + std::unique_ptr mImageManager; + std::unique_ptr mNifFileManager; + std::unique_ptr mKeyframeManager; // Store the base classes separately to get convenient access to the common interface // Here users can register their own resourcemanager as well diff --git a/components/resource/scenemanager.hpp b/components/resource/scenemanager.hpp index 2da28eaf4..c6ff02acf 100644 --- a/components/resource/scenemanager.hpp +++ b/components/resource/scenemanager.hpp @@ -147,7 +147,7 @@ namespace Resource private: - std::auto_ptr mShaderManager; + std::unique_ptr mShaderManager; bool mForceShaders; bool mClampLighting; bool mForcePerPixelLighting; diff --git a/components/sceneutil/controller.cpp b/components/sceneutil/controller.cpp index 6cd0cb036..8fef00333 100644 --- a/components/sceneutil/controller.cpp +++ b/components/sceneutil/controller.cpp @@ -1,5 +1,7 @@ #include "controller.hpp" +#include + #include "statesetupdater.hpp" #include @@ -28,22 +30,22 @@ namespace SceneUtil return mSource->getValue(nv); } - void Controller::setSource(boost::shared_ptr source) + void Controller::setSource(std::shared_ptr source) { mSource = source; } - void Controller::setFunction(boost::shared_ptr function) + void Controller::setFunction(std::shared_ptr function) { mFunction = function; } - boost::shared_ptr Controller::getSource() const + std::shared_ptr Controller::getSource() const { return mSource; } - boost::shared_ptr Controller::getFunction() const + std::shared_ptr Controller::getFunction() const { return mFunction; } @@ -107,7 +109,7 @@ namespace SceneUtil { } - AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(boost::shared_ptr toAssign) + AssignControllerSourcesVisitor::AssignControllerSourcesVisitor(std::shared_ptr toAssign) : ControllerVisitor() , mToAssign(toAssign) { diff --git a/components/sceneutil/controller.hpp b/components/sceneutil/controller.hpp index fd8964ae1..775cb23b0 100644 --- a/components/sceneutil/controller.hpp +++ b/components/sceneutil/controller.hpp @@ -1,8 +1,7 @@ #ifndef OPENMW_COMPONENTS_SCENEUTIL_CONTROLLER_H #define OPENMW_COMPONENTS_SCENEUTIL_CONTROLLER_H -#include - +#include #include namespace SceneUtil @@ -43,17 +42,17 @@ namespace SceneUtil float getInputValue(osg::NodeVisitor* nv); - void setSource(boost::shared_ptr source); - void setFunction(boost::shared_ptr function); + void setSource(std::shared_ptr source); + void setFunction(std::shared_ptr function); - boost::shared_ptr getSource() const; - boost::shared_ptr getFunction() const; + std::shared_ptr getSource() const; + std::shared_ptr getFunction() const; private: - boost::shared_ptr mSource; + std::shared_ptr mSource; // The source value gets passed through this function before it's passed on to the DestValue. - boost::shared_ptr mFunction; + std::shared_ptr mFunction; }; /// Pure virtual base class - visit() all controllers that are attached as UpdateCallbacks in a scene graph. @@ -78,14 +77,14 @@ namespace SceneUtil { public: AssignControllerSourcesVisitor(); - AssignControllerSourcesVisitor(boost::shared_ptr toAssign); + AssignControllerSourcesVisitor(std::shared_ptr toAssign); /// Assign the wanted ControllerSource. May be overridden in derived classes. /// By default assigns the ControllerSource passed to the constructor of this class if no ControllerSource is assigned to that controller yet. virtual void visit(osg::Node& node, Controller& ctrl); private: - boost::shared_ptr mToAssign; + std::shared_ptr mToAssign; }; /// Finds the maximum of all controller functions in the given scene graph diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 341bc8034..018abeefc 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -1,15 +1,9 @@ #include "lightmanager.hpp" -#include - -#include - #include #include -#include - namespace SceneUtil { @@ -215,12 +209,21 @@ namespace SceneUtil mLights.push_back(l); } + /* similar to the boost::hash_combine */ + template + inline void hash_combine(std::size_t& seed, const T& v) + { + std::hash hasher; + seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2); + } + osg::ref_ptr LightManager::getLightListStateSet(const LightList &lightList, unsigned int frameNum) { + // possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists) size_t hash = 0; for (unsigned int i=0; imLightSource->getId()); + hash_combine(hash, lightList[i]->mLightSource->getId()); LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2]; diff --git a/components/sceneutil/skeleton.hpp b/components/sceneutil/skeleton.hpp index 24dcc6b3f..542471ff1 100644 --- a/components/sceneutil/skeleton.hpp +++ b/components/sceneutil/skeleton.hpp @@ -63,7 +63,7 @@ namespace SceneUtil private: // The root bone is not a "real" bone, it has no corresponding node in the scene graph. // As far as the scene graph goes we support multiple root bones. - std::auto_ptr mRootBone; + std::unique_ptr mRootBone; typedef std::map > BoneCache; BoneCache mBoneCache; diff --git a/components/settings/settings.cpp b/components/settings/settings.cpp index 0c0600cc0..e93642ee2 100644 --- a/components/settings/settings.cpp +++ b/components/settings/settings.cpp @@ -1,13 +1,11 @@ #include "settings.hpp" -#include #include #include #include #include -#include #include namespace diff --git a/components/shader/shadermanager.cpp b/components/shader/shadermanager.cpp index ce77f46dc..2bfb17b5c 100644 --- a/components/shader/shadermanager.cpp +++ b/components/shader/shadermanager.cpp @@ -3,16 +3,14 @@ #include #include #include +#include #include -#include #include #include #include -#include - namespace Shader { @@ -139,7 +137,7 @@ namespace Shader shader->setShaderSource(shaderSource); // Assign a unique name to allow the SharedStateManager to compare shaders efficiently static unsigned int counter = 0; - shader->setName(boost::lexical_cast(counter++)); + shader->setName(std::to_string(counter++)); shaderIt = mShaders.insert(std::make_pair(std::make_pair(shaderTemplate, defines), shader)).first; } diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index b68d419a3..d85b72203 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -5,11 +5,9 @@ #include #include #include -#include #include -#include #include #include @@ -263,7 +261,7 @@ namespace Shader for (std::map::const_iterator texIt = reqs.mTextures.begin(); texIt != reqs.mTextures.end(); ++texIt) { defineMap[texIt->second] = "1"; - defineMap[texIt->second + std::string("UV")] = boost::lexical_cast(texIt->first); + defineMap[texIt->second + std::string("UV")] = std::to_string(texIt->first); } if (!reqs.mColorMaterial) diff --git a/components/terrain/world.hpp b/components/terrain/world.hpp index 6aac963ce..1eafc8bd7 100644 --- a/components/terrain/world.hpp +++ b/components/terrain/world.hpp @@ -100,8 +100,8 @@ namespace Terrain Resource::ResourceSystem* mResourceSystem; - std::auto_ptr mTextureManager; - std::auto_ptr mChunkManager; + std::unique_ptr mTextureManager; + std::unique_ptr mChunkManager; }; } diff --git a/components/translation/translation.cpp b/components/translation/translation.cpp index 83dfdaecc..32e7fa6a4 100644 --- a/components/translation/translation.cpp +++ b/components/translation/translation.cpp @@ -2,8 +2,6 @@ #include -#include - namespace Translation { Storage::Storage() diff --git a/components/widgets/numericeditbox.cpp b/components/widgets/numericeditbox.cpp index 5361b3127..828a84589 100644 --- a/components/widgets/numericeditbox.cpp +++ b/components/widgets/numericeditbox.cpp @@ -1,6 +1,6 @@ -#include "numericeditbox.hpp" +#include -#include +#include "numericeditbox.hpp" namespace Gui { @@ -30,7 +30,7 @@ namespace Gui try { - mValue = boost::lexical_cast(newCaption); + mValue = std::stoi(newCaption); int capped = std::min(mMaxValue, std::max(mValue, mMinValue)); if (capped != mValue) { @@ -38,7 +38,11 @@ namespace Gui setCaption(MyGUI::utility::toString(mValue)); } } - catch (boost::bad_lexical_cast&) + catch (std::invalid_argument) + { + setCaption(MyGUI::utility::toString(mValue)); + } + catch (std::out_of_range) { setCaption(MyGUI::utility::toString(mValue)); } diff --git a/extern/oics/ICSInputControlSystem.h b/extern/oics/ICSInputControlSystem.h index 691a93725..308b54c3b 100644 --- a/extern/oics/ICSInputControlSystem.h +++ b/extern/oics/ICSInputControlSystem.h @@ -32,8 +32,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "ICSControl.h" #include "ICSChannel.h" -#include "boost/lexical_cast.hpp" - #define ICS_LOG(text) if(mLog) mLog->logMessage( ("ICS: " + std::string(text)).c_str() ); #define ICS_MAX_JOYSTICK_AXIS 16 #define ICS_MOUSE_BINDING_MARGIN 30 diff --git a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp index 096a17a64..ee6400177 100644 --- a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp +++ b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp @@ -1,6 +1,8 @@ #include "audiodecoder.hpp" +#include #include +#include extern "C" { diff --git a/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp b/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp index a592b02d3..95644ea69 100644 --- a/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp +++ b/extern/osg-ffmpeg-videoplayer/audiodecoder.hpp @@ -55,7 +55,7 @@ private: }; - std::auto_ptr mAudioResampler; + std::unique_ptr mAudioResampler; uint8_t *mDataBuf; uint8_t **mFrameData; diff --git a/extern/osg-ffmpeg-videoplayer/audiofactory.hpp b/extern/osg-ffmpeg-videoplayer/audiofactory.hpp index 06abd6a74..023d536e2 100644 --- a/extern/osg-ffmpeg-videoplayer/audiofactory.hpp +++ b/extern/osg-ffmpeg-videoplayer/audiofactory.hpp @@ -3,7 +3,6 @@ #include "audiodecoder.hpp" -#include namespace Video { @@ -11,7 +10,7 @@ namespace Video class MovieAudioFactory { public: - virtual boost::shared_ptr createDecoder(VideoState* videoState) = 0; + virtual std::shared_ptr createDecoder(VideoState* videoState) = 0; virtual ~MovieAudioFactory() {} }; diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.cpp b/extern/osg-ffmpeg-videoplayer/videoplayer.cpp index 9ec815130..c6544de9c 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.cpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.cpp @@ -27,7 +27,7 @@ void VideoPlayer::setAudioFactory(MovieAudioFactory *factory) mAudioFactory.reset(factory); } -void VideoPlayer::playVideo(boost::shared_ptr inputstream, const std::string& name) +void VideoPlayer::playVideo(std::shared_ptr inputstream, const std::string& name) { if(mState) close(); diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp index c118ddb7f..97ef13032 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.hpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.hpp @@ -10,8 +10,6 @@ #include -#include - namespace osg { class Texture2D; @@ -44,7 +42,7 @@ namespace Video /// Play the given video. If a video is already playing, the old video is closed first. /// @note The video will be unpaused by default. Use the pause() and play() methods to control pausing. /// @param name A name for the video stream - only used for logging purposes. - void playVideo (boost::shared_ptr inputstream, const std::string& name); + void playVideo (std::shared_ptr inputstream, const std::string& name); /// Get the current playback time position in the video, in seconds double getCurrentTime(); @@ -78,7 +76,7 @@ namespace Video private: VideoState* mState; - std::auto_ptr mAudioFactory; + std::unique_ptr mAudioFactory; }; } diff --git a/extern/osg-ffmpeg-videoplayer/videostate.cpp b/extern/osg-ffmpeg-videoplayer/videostate.cpp index 6779f2472..9fd209d56 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.cpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.cpp @@ -1,7 +1,8 @@ #include "videostate.hpp" +#include +#include #include -#include #include @@ -19,8 +20,6 @@ extern "C" #include #endif - #include - #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1) #define av_frame_alloc avcodec_alloc_frame #endif @@ -626,7 +625,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx) return 0; } -void VideoState::init(boost::shared_ptr inputstream, const std::string &name) +void VideoState::init(std::shared_ptr inputstream, const std::string &name) { int video_index = -1; int audio_index = -1; diff --git a/extern/osg-ffmpeg-videoplayer/videostate.hpp b/extern/osg-ffmpeg-videoplayer/videostate.hpp index 2f0e8f30a..e61f4feb7 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.hpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.hpp @@ -5,8 +5,6 @@ #include #include -#include - #include #include #include @@ -94,7 +92,7 @@ struct VideoState { void setAudioFactory(MovieAudioFactory* factory); - void init(boost::shared_ptr inputstream, const std::string& name); + void init(std::shared_ptr inputstream, const std::string& name); void deinit(); void setPaused(bool isPaused); @@ -127,11 +125,11 @@ struct VideoState { osg::ref_ptr mTexture; MovieAudioFactory* mAudioFactory; - boost::shared_ptr mAudioDecoder; + std::shared_ptr mAudioDecoder; ExternalClock mExternalClock; - boost::shared_ptr stream; + std::shared_ptr stream; AVFormatContext* format_ctx; int av_sync_type; @@ -152,8 +150,8 @@ struct VideoState { OpenThreads::Mutex pictq_mutex; OpenThreads::Condition pictq_cond; - std::auto_ptr parse_thread; - std::auto_ptr video_thread; + std::unique_ptr parse_thread; + std::unique_ptr video_thread; volatile bool mSeekRequested; uint64_t mSeekPos;