Compare commits

...

14 commits
0.7.0 ... c++11

Author SHA1 Message Date
scrawl
44364edfcf Missing include 2015-07-10 17:47:45 +02:00
scrawl
95ae862ed1 Improve locking 2015-07-10 17:14:08 +02:00
scrawl
c2efafb313 Missing include 2015-07-10 17:14:08 +02:00
scrawl
366fb9f098 Build this for me please 2015-07-10 17:14:08 +02:00
scrawl
829b22b9de Replace boost::function with std::function 2015-07-10 17:14:08 +02:00
scrawl
fc17e47ecb Replace boost::array with c++11 2015-07-10 17:14:08 +02:00
scrawl
b2a1c940b0 Replace boost threading with c++11
Mostly straightforward port, some refactoring was needed in StreamThread to workaround thread::interrupt not being available.
2015-07-10 17:14:07 +02:00
Marc Zinnschlag
c5ae95aedd Merge branch 'master' into c++11
Conflicts:
	apps/openmw/mwworld/store.hpp
2015-07-10 09:23:12 +02:00
Marc Zinnschlag
91d1bab4ac replaced NULL with nullptr 2015-07-07 22:46:15 +02:00
Marc Zinnschlag
3c76764ef4 replaced auto_ptr with unique_ptr 2015-07-07 22:11:07 +02:00
Marc Zinnschlag
ff108b4c6b replaced boost::shared_ptr with std::shared_ptr 2015-07-07 20:20:08 +02:00
Marc Zinnschlag
35bbb7d552 trying to shut up travis 2015-07-07 11:25:42 +02:00
Marc Zinnschlag
17cea2676d improved boost workaround 2015-07-07 10:23:54 +02:00
Marc Zinnschlag
3fe4f44bdd configured compiler for c++11 2015-07-06 14:18:57 +02:00
321 changed files with 1284 additions and 1259 deletions

View file

@ -5,6 +5,7 @@ language: cpp
branches: branches:
only: only:
- master - master
- c++11
- coverity_scan - coverity_scan
- /openmw-.*$/ - /openmw-.*$/
env: env:

View file

@ -190,7 +190,7 @@ if (HAVE_UNORDERED_MAP)
endif () endif ()
set(BOOST_COMPONENTS system filesystem program_options thread) set(BOOST_COMPONENTS system filesystem program_options)
if(WIN32) if(WIN32)
set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale) set(BOOST_COMPONENTS ${BOOST_COMPONENTS} locale)
endif(WIN32) endif(WIN32)
@ -279,7 +279,7 @@ endif()
# CXX Compiler settings # CXX Compiler settings
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -std=c++98 -pedantic -Wno-long-long") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -std=c++0x -pedantic -Wno-long-long -DBOOST_NO_SCOPED_ENUMS -DBOOST_NO_CXX11_SCOPED_ENUMS")
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE) if (CMAKE_CXX_COMPILER_ID STREQUAL Clang AND NOT APPLE)
execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE CLANG_VERSION) execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE CLANG_VERSION)

View file

@ -2,6 +2,7 @@
#define OPENMW_ESSIMPORT_CONVERTER_H #define OPENMW_ESSIMPORT_CONVERTER_H
#include <limits> #include <limits>
#include <stdexcept>
#include <osg/Image> #include <osg/Image>
#include <osg/ref_ptr> #include <osg/ref_ptr>

View file

@ -2,7 +2,7 @@
#include <iomanip> #include <iomanip>
#include <boost/shared_ptr.hpp>
#include <osgDB/ReadFile> #include <osgDB/ReadFile>
#include <osg/ImageUtils> #include <osg/ImageUtils>
@ -260,37 +260,37 @@ namespace ESSImport
const unsigned int recGAME = ESM::FourCC<'G','A','M','E'>::value; const unsigned int recGAME = ESM::FourCC<'G','A','M','E'>::value;
const unsigned int recJOUR = ESM::FourCC<'J','O','U','R'>::value; const unsigned int recJOUR = ESM::FourCC<'J','O','U','R'>::value;
std::map<unsigned int, boost::shared_ptr<Converter> > converters; std::map<unsigned int, std::shared_ptr<Converter> > converters;
converters[ESM::REC_GLOB] = boost::shared_ptr<Converter>(new ConvertGlobal()); converters[ESM::REC_GLOB] = std::shared_ptr<Converter>(new ConvertGlobal());
converters[ESM::REC_BOOK] = boost::shared_ptr<Converter>(new ConvertBook()); converters[ESM::REC_BOOK] = std::shared_ptr<Converter>(new ConvertBook());
converters[ESM::REC_NPC_] = boost::shared_ptr<Converter>(new ConvertNPC()); converters[ESM::REC_NPC_] = std::shared_ptr<Converter>(new ConvertNPC());
converters[ESM::REC_CREA] = boost::shared_ptr<Converter>(new ConvertCREA()); converters[ESM::REC_CREA] = std::shared_ptr<Converter>(new ConvertCREA());
converters[ESM::REC_NPCC] = boost::shared_ptr<Converter>(new ConvertNPCC()); converters[ESM::REC_NPCC] = std::shared_ptr<Converter>(new ConvertNPCC());
converters[ESM::REC_CREC] = boost::shared_ptr<Converter>(new ConvertCREC()); converters[ESM::REC_CREC] = std::shared_ptr<Converter>(new ConvertCREC());
converters[recREFR ] = boost::shared_ptr<Converter>(new ConvertREFR()); converters[recREFR ] = std::shared_ptr<Converter>(new ConvertREFR());
converters[recPCDT ] = boost::shared_ptr<Converter>(new ConvertPCDT()); converters[recPCDT ] = std::shared_ptr<Converter>(new ConvertPCDT());
converters[recFMAP ] = boost::shared_ptr<Converter>(new ConvertFMAP()); converters[recFMAP ] = std::shared_ptr<Converter>(new ConvertFMAP());
converters[recKLST ] = boost::shared_ptr<Converter>(new ConvertKLST()); converters[recKLST ] = std::shared_ptr<Converter>(new ConvertKLST());
converters[recSTLN ] = boost::shared_ptr<Converter>(new ConvertSTLN()); converters[recSTLN ] = std::shared_ptr<Converter>(new ConvertSTLN());
converters[recGAME ] = boost::shared_ptr<Converter>(new ConvertGAME()); converters[recGAME ] = std::shared_ptr<Converter>(new ConvertGAME());
converters[ESM::REC_CELL] = boost::shared_ptr<Converter>(new ConvertCell()); converters[ESM::REC_CELL] = std::shared_ptr<Converter>(new ConvertCell());
converters[ESM::REC_ALCH] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Potion>()); converters[ESM::REC_ALCH] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Potion>());
converters[ESM::REC_CLAS] = boost::shared_ptr<Converter>(new ConvertClass()); converters[ESM::REC_CLAS] = std::shared_ptr<Converter>(new ConvertClass());
converters[ESM::REC_SPEL] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Spell>()); converters[ESM::REC_SPEL] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Spell>());
converters[ESM::REC_ARMO] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Armor>()); converters[ESM::REC_ARMO] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Armor>());
converters[ESM::REC_WEAP] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>()); converters[ESM::REC_WEAP] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>());
converters[ESM::REC_CLOT] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Clothing>()); converters[ESM::REC_CLOT] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Clothing>());
converters[ESM::REC_ENCH] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Enchantment>()); converters[ESM::REC_ENCH] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Enchantment>());
converters[ESM::REC_WEAP] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>()); converters[ESM::REC_WEAP] = std::shared_ptr<Converter>(new DefaultConverter<ESM::Weapon>());
converters[ESM::REC_LEVC] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::CreatureLevList>()); converters[ESM::REC_LEVC] = std::shared_ptr<Converter>(new DefaultConverter<ESM::CreatureLevList>());
converters[ESM::REC_LEVI] = boost::shared_ptr<Converter>(new DefaultConverter<ESM::ItemLevList>()); converters[ESM::REC_LEVI] = std::shared_ptr<Converter>(new DefaultConverter<ESM::ItemLevList>());
converters[ESM::REC_CNTC] = boost::shared_ptr<Converter>(new ConvertCNTC()); converters[ESM::REC_CNTC] = std::shared_ptr<Converter>(new ConvertCNTC());
converters[ESM::REC_FACT] = boost::shared_ptr<Converter>(new ConvertFACT()); converters[ESM::REC_FACT] = std::shared_ptr<Converter>(new ConvertFACT());
converters[ESM::REC_INFO] = boost::shared_ptr<Converter>(new ConvertINFO()); converters[ESM::REC_INFO] = std::shared_ptr<Converter>(new ConvertINFO());
converters[ESM::REC_DIAL] = boost::shared_ptr<Converter>(new ConvertDIAL()); converters[ESM::REC_DIAL] = std::shared_ptr<Converter>(new ConvertDIAL());
converters[ESM::REC_QUES] = boost::shared_ptr<Converter>(new ConvertQUES()); converters[ESM::REC_QUES] = std::shared_ptr<Converter>(new ConvertQUES());
converters[recJOUR ] = boost::shared_ptr<Converter>(new ConvertJOUR()); converters[recJOUR ] = std::shared_ptr<Converter>(new ConvertJOUR());
converters[ESM::REC_SCPT] = boost::shared_ptr<Converter>(new ConvertSCPT()); converters[ESM::REC_SCPT] = std::shared_ptr<Converter>(new ConvertSCPT());
// TODO: // TODO:
// - REGN (weather in certain regions?) // - REGN (weather in certain regions?)
@ -300,7 +300,7 @@ namespace ESSImport
std::set<unsigned int> unknownRecords; std::set<unsigned int> unknownRecords;
for (std::map<unsigned int, boost::shared_ptr<Converter> >::const_iterator it = converters.begin(); for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin();
it != converters.end(); ++it) it != converters.end(); ++it)
{ {
it->second->setContext(context); it->second->setContext(context);
@ -311,7 +311,7 @@ namespace ESSImport
ESM::NAME n = esm.getRecName(); ESM::NAME n = esm.getRecName();
esm.getRecHeader(); esm.getRecHeader();
std::map<unsigned int, boost::shared_ptr<Converter> >::iterator it = converters.find(n.val); std::map<unsigned int, std::shared_ptr<Converter> >::iterator it = converters.find(n.val);
if (it != converters.end()) if (it != converters.end())
{ {
it->second->read(esm); it->second->read(esm);
@ -370,7 +370,7 @@ namespace ESSImport
// Writing order should be Dynamic Store -> Cells -> Player, // Writing order should be Dynamic Store -> Cells -> Player,
// so that references to dynamic records can be recognized when loading // so that references to dynamic records can be recognized when loading
for (std::map<unsigned int, boost::shared_ptr<Converter> >::const_iterator it = converters.begin(); for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin();
it != converters.end(); ++it) it != converters.end(); ++it)
{ {
if (it->second->getStage() != 0) if (it->second->getStage() != 0)
@ -383,7 +383,7 @@ namespace ESSImport
context.mPlayerBase.save(writer); context.mPlayerBase.save(writer);
writer.endRecord(ESM::REC_NPC_); writer.endRecord(ESM::REC_NPC_);
for (std::map<unsigned int, boost::shared_ptr<Converter> >::const_iterator it = converters.begin(); for (std::map<unsigned int, std::shared_ptr<Converter> >::const_iterator it = converters.begin();
it != converters.end(); ++it) it != converters.end(); ++it)
{ {
if (it->second->getStage() != 1) if (it->second->getStage() != 1)

View file

@ -21,7 +21,7 @@
CS::Editor::Editor () CS::Editor::Editor ()
: mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr), : mUserSettings (mCfgMgr), mDocumentManager (mCfgMgr),
mViewManager (mDocumentManager), mPid(""), mViewManager (mDocumentManager), mPid(""),
mLock(), mIpcServerName ("org.openmw.OpenCS"), mServer(NULL), mClientSocket(NULL) mLock(), mIpcServerName ("org.openmw.OpenCS"), mServer(nullptr), mClientSocket(nullptr)
{ {
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig(); std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig();
@ -332,7 +332,7 @@ bool CS::Editor::makeIPCServer()
} }
mServer->close(); mServer->close();
mServer = NULL; mServer = nullptr;
return false; return false;
} }

View file

@ -39,7 +39,7 @@ namespace CS
Q_OBJECT Q_OBJECT
// FIXME: should be moved to document, so we can have different resources for each opened project // FIXME: should be moved to document, so we can have different resources for each opened project
std::auto_ptr<VFS::Manager> mVFS; std::unique_ptr<VFS::Manager> mVFS;
Files::ConfigurationManager mCfgMgr; Files::ConfigurationManager mCfgMgr;
CSMSettings::UserSettings mUserSettings; CSMSettings::UserSettings mUserSettings;

View file

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <boost/shared_ptr.hpp>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <QUndoStack> #include <QUndoStack>

View file

@ -13,7 +13,7 @@
#include "document.hpp" #include "document.hpp"
CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration) CSMDoc::DocumentManager::DocumentManager (const Files::ConfigurationManager& configuration)
: mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252), mVFS(NULL) : mConfiguration (configuration), mEncoding (ToUTF8::WINDOWS_1252), mVFS(nullptr)
{ {
boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects"; boost::filesystem::path projectPath = configuration.getUserDataPath() / "projects";

View file

@ -3,7 +3,7 @@
#include <sstream> #include <sstream>
CSMFilter::AndNode::AndNode (const std::vector<boost::shared_ptr<Node> >& nodes) CSMFilter::AndNode::AndNode (const std::vector<std::shared_ptr<Node> >& nodes)
: NAryNode (nodes, "and") : NAryNode (nodes, "and")
{} {}

View file

@ -9,7 +9,7 @@ namespace CSMFilter
{ {
public: public:
AndNode (const std::vector<boost::shared_ptr<Node> >& nodes); AndNode (const std::vector<std::shared_ptr<Node> >& nodes);
virtual bool test (const CSMWorld::IdTableBase& table, int row, virtual bool test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const; const std::map<int, int>& columns) const;

View file

@ -3,7 +3,7 @@
#include <sstream> #include <sstream>
CSMFilter::NAryNode::NAryNode (const std::vector<boost::shared_ptr<Node> >& nodes, CSMFilter::NAryNode::NAryNode (const std::vector<std::shared_ptr<Node> >& nodes,
const std::string& name) const std::string& name)
: mNodes (nodes), mName (name) : mNodes (nodes), mName (name)
{} {}
@ -22,7 +22,7 @@ std::vector<int> CSMFilter::NAryNode::getReferencedColumns() const
{ {
std::vector<int> columns; std::vector<int> columns;
for (std::vector<boost::shared_ptr<Node> >::const_iterator iter (mNodes.begin()); for (std::vector<std::shared_ptr<Node> >::const_iterator iter (mNodes.begin());
iter!=mNodes.end(); ++iter) iter!=mNodes.end(); ++iter)
{ {
std::vector<int> columns2 = (*iter)->getReferencedColumns(); std::vector<int> columns2 = (*iter)->getReferencedColumns();

View file

@ -4,7 +4,7 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include <boost/shared_ptr.hpp>
#include "node.hpp" #include "node.hpp"
@ -12,12 +12,12 @@ namespace CSMFilter
{ {
class NAryNode : public Node class NAryNode : public Node
{ {
std::vector<boost::shared_ptr<Node> > mNodes; std::vector<std::shared_ptr<Node> > mNodes;
std::string mName; std::string mName;
public: public:
NAryNode (const std::vector<boost::shared_ptr<Node> >& nodes, const std::string& name); NAryNode (const std::vector<std::shared_ptr<Node> >& nodes, const std::string& name);
int getSize() const; int getSize() const;

View file

@ -4,8 +4,7 @@
#include <string> #include <string>
#include <map> #include <map>
#include <vector> #include <vector>
#include <memory>
#include <boost/shared_ptr.hpp>
#include <QMetaType> #include <QMetaType>
@ -48,6 +47,6 @@ namespace CSMFilter
}; };
} }
Q_DECLARE_METATYPE (boost::shared_ptr<CSMFilter::Node>) Q_DECLARE_METATYPE (std::shared_ptr<CSMFilter::Node>)
#endif #endif

View file

@ -1,7 +1,7 @@
#include "notnode.hpp" #include "notnode.hpp"
CSMFilter::NotNode::NotNode (boost::shared_ptr<Node> child) : UnaryNode (child, "not") {} CSMFilter::NotNode::NotNode (std::shared_ptr<Node> child) : UnaryNode (child, "not") {}
bool CSMFilter::NotNode::test (const CSMWorld::IdTableBase& table, int row, bool CSMFilter::NotNode::test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const const std::map<int, int>& columns) const

View file

@ -9,7 +9,7 @@ namespace CSMFilter
{ {
public: public:
NotNode (boost::shared_ptr<Node> child); NotNode (std::shared_ptr<Node> child);
virtual bool test (const CSMWorld::IdTableBase& table, int row, virtual bool test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const; const std::map<int, int>& columns) const;

View file

@ -3,7 +3,7 @@
#include <sstream> #include <sstream>
CSMFilter::OrNode::OrNode (const std::vector<boost::shared_ptr<Node> >& nodes) CSMFilter::OrNode::OrNode (const std::vector<std::shared_ptr<Node> >& nodes)
: NAryNode (nodes, "or") : NAryNode (nodes, "or")
{} {}

View file

@ -9,7 +9,7 @@ namespace CSMFilter
{ {
public: public:
OrNode (const std::vector<boost::shared_ptr<Node> >& nodes); OrNode (const std::vector<std::shared_ptr<Node> >& nodes);
virtual bool test (const CSMWorld::IdTableBase& table, int row, virtual bool test (const CSMWorld::IdTableBase& table, int row,
const std::map<int, int>& columns) const; const std::map<int, int>& columns) const;

View file

@ -236,7 +236,7 @@ CSMFilter::Token CSMFilter::Parser::getNextToken()
return Token (Token::Type_None); return Token (Token::Type_None);
} }
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot) std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, bool ignoreOneShot)
{ {
if (Token token = getNextToken()) if (Token token = getNextToken())
{ {
@ -248,11 +248,11 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
{ {
case Token::Type_Keyword_True: case Token::Type_Keyword_True:
return boost::shared_ptr<CSMFilter::Node> (new BooleanNode (true)); return std::shared_ptr<CSMFilter::Node> (new BooleanNode (true));
case Token::Type_Keyword_False: case Token::Type_Keyword_False:
return boost::shared_ptr<CSMFilter::Node> (new BooleanNode (false)); return std::shared_ptr<CSMFilter::Node> (new BooleanNode (false));
case Token::Type_Keyword_And: case Token::Type_Keyword_And:
case Token::Type_Keyword_Or: case Token::Type_Keyword_Or:
@ -261,12 +261,12 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
case Token::Type_Keyword_Not: case Token::Type_Keyword_Not:
{ {
boost::shared_ptr<CSMFilter::Node> node = parseImp(); std::shared_ptr<CSMFilter::Node> node = parseImp();
if (mError) if (mError)
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
return boost::shared_ptr<CSMFilter::Node> (new NotNode (node)); return std::shared_ptr<CSMFilter::Node> (new NotNode (node));
} }
case Token::Type_Keyword_Text: case Token::Type_Keyword_Text:
@ -282,7 +282,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
if (!allowEmpty) if (!allowEmpty)
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
default: default:
@ -290,27 +290,27 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty,
} }
} }
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& keyword) std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& keyword)
{ {
std::vector<boost::shared_ptr<Node> > nodes; std::vector<std::shared_ptr<Node> > nodes;
Token token = getNextToken(); Token token = getNextToken();
if (token.mType!=Token::Type_Open) if (token.mType!=Token::Type_Open)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
for (;;) for (;;)
{ {
boost::shared_ptr<Node> node = parseImp(); std::shared_ptr<Node> node = parseImp();
if (mError) if (mError)
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
nodes.push_back (node); nodes.push_back (node);
@ -319,7 +319,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& ke
if (!token || (token.mType!=Token::Type_Close && token.mType!=Token::Type_Comma)) if (!token || (token.mType!=Token::Type_Close && token.mType!=Token::Type_Comma))
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
if (token.mType==Token::Type_Close) if (token.mType==Token::Type_Close)
@ -329,31 +329,31 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& ke
if (nodes.empty()) if (nodes.empty())
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
switch (keyword.mType) switch (keyword.mType)
{ {
case Token::Type_Keyword_And: return boost::shared_ptr<CSMFilter::Node> (new AndNode (nodes)); case Token::Type_Keyword_And: return std::shared_ptr<CSMFilter::Node> (new AndNode (nodes));
case Token::Type_Keyword_Or: return boost::shared_ptr<CSMFilter::Node> (new OrNode (nodes)); case Token::Type_Keyword_Or: return std::shared_ptr<CSMFilter::Node> (new OrNode (nodes));
default: error(); return boost::shared_ptr<Node>(); default: error(); return std::shared_ptr<Node>();
} }
} }
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText() std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
{ {
Token token = getNextToken(); Token token = getNextToken();
if (token.mType!=Token::Type_Open) if (token.mType!=Token::Type_Open)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
token = getNextToken(); token = getNextToken();
if (!token) if (!token)
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
// parse column ID // parse column ID
int columnId = -1; int columnId = -1;
@ -371,7 +371,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (columnId<0) if (columnId<0)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
token = getNextToken(); token = getNextToken();
@ -379,7 +379,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (token.mType!=Token::Type_Comma) if (token.mType!=Token::Type_Comma)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
// parse text pattern // parse text pattern
@ -388,7 +388,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (!token.isString()) if (!token.isString())
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
std::string text = token.mString; std::string text = token.mString;
@ -398,26 +398,26 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
if (token.mType!=Token::Type_Close) if (token.mType!=Token::Type_Close)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
return boost::shared_ptr<Node> (new TextNode (columnId, text)); return std::shared_ptr<Node> (new TextNode (columnId, text));
} }
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue() std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
{ {
Token token = getNextToken(); Token token = getNextToken();
if (token.mType!=Token::Type_Open) if (token.mType!=Token::Type_Open)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
token = getNextToken(); token = getNextToken();
if (!token) if (!token)
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
// parse column ID // parse column ID
int columnId = -1; int columnId = -1;
@ -435,7 +435,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (columnId<0) if (columnId<0)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
token = getNextToken(); token = getNextToken();
@ -443,7 +443,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (token.mType!=Token::Type_Comma) if (token.mType!=Token::Type_Comma)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
// parse value // parse value
@ -468,7 +468,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
else if (token.mType!=Token::Type_CloseSquare && token.mType!=Token::Type_Open) else if (token.mType!=Token::Type_CloseSquare && token.mType!=Token::Type_Open)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
token = getNextToken(); token = getNextToken();
@ -482,7 +482,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (token.mType!=Token::Type_Comma) if (token.mType!=Token::Type_Comma)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
} }
else if (token.mType==Token::Type_Comma) else if (token.mType==Token::Type_Comma)
@ -492,7 +492,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
else else
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
token = getNextToken(); token = getNextToken();
@ -514,7 +514,7 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
else if (token.mType!=Token::Type_OpenSquare && token.mType!=Token::Type_Close) else if (token.mType!=Token::Type_OpenSquare && token.mType!=Token::Type_Close)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
} }
@ -523,10 +523,10 @@ boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
if (token.mType!=Token::Type_Close) if (token.mType!=Token::Type_Close)
{ {
error(); error();
return boost::shared_ptr<Node>(); return std::shared_ptr<Node>();
} }
return boost::shared_ptr<Node> (new ValueNode (columnId, lowerType, upperType, lower, upper)); return std::shared_ptr<Node> (new ValueNode (columnId, lowerType, upperType, lower, upper));
} }
void CSMFilter::Parser::error() void CSMFilter::Parser::error()
@ -557,7 +557,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined)
} }
else if (!allowPredefined || token==Token (Token::Type_OneShot)) else if (!allowPredefined || token==Token (Token::Type_OneShot))
{ {
boost::shared_ptr<Node> node = parseImp (true, token!=Token (Token::Type_OneShot)); std::shared_ptr<Node> node = parseImp (true, token!=Token (Token::Type_OneShot));
if (mError) if (mError)
return false; return false;
@ -613,7 +613,7 @@ bool CSMFilter::Parser::parse (const std::string& filter, bool allowPredefined)
} }
} }
boost::shared_ptr<CSMFilter::Node> CSMFilter::Parser::getFilter() const std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::getFilter() const
{ {
if (mError) if (mError)
throw std::logic_error ("No filter available"); throw std::logic_error ("No filter available");

View file

@ -1,7 +1,7 @@
#ifndef CSM_FILTER_PARSER_H #ifndef CSM_FILTER_PARSER_H
#define CSM_FILTER_PARSER_H #define CSM_FILTER_PARSER_H
#include <boost/shared_ptr.hpp>
#include "node.hpp" #include "node.hpp"
@ -16,7 +16,7 @@ namespace CSMFilter
class Parser class Parser
{ {
boost::shared_ptr<Node> mFilter; std::shared_ptr<Node> mFilter;
std::string mInput; std::string mInput;
int mIndex; int mIndex;
bool mError; bool mError;
@ -31,14 +31,14 @@ namespace CSMFilter
Token checkKeywords (const Token& token); Token checkKeywords (const Token& token);
///< Turn string token into keyword token, if possible. ///< Turn string token into keyword token, if possible.
boost::shared_ptr<Node> parseImp (bool allowEmpty = false, bool ignoreOneShot = false); std::shared_ptr<Node> parseImp (bool allowEmpty = false, bool ignoreOneShot = false);
///< Will return a null-pointer, if there is nothing more to parse. ///< Will return a null-pointer, if there is nothing more to parse.
boost::shared_ptr<Node> parseNAry (const Token& keyword); std::shared_ptr<Node> parseNAry (const Token& keyword);
boost::shared_ptr<Node> parseText(); std::shared_ptr<Node> parseText();
boost::shared_ptr<Node> parseValue(); std::shared_ptr<Node> parseValue();
void error(); void error();
@ -51,7 +51,7 @@ namespace CSMFilter
/// ///
/// \return Success? /// \return Success?
boost::shared_ptr<Node> getFilter() const; std::shared_ptr<Node> getFilter() const;
///< Throws an exception if the last call to parse did not return true. ///< Throws an exception if the last call to parse did not return true.
}; };
} }

View file

@ -1,7 +1,7 @@
#include "unarynode.hpp" #include "unarynode.hpp"
CSMFilter::UnaryNode::UnaryNode (boost::shared_ptr<Node> child, const std::string& name) CSMFilter::UnaryNode::UnaryNode (std::shared_ptr<Node> child, const std::string& name)
: mChild (child), mName (name) : mChild (child), mName (name)
{} {}

View file

@ -1,7 +1,7 @@
#ifndef CSM_FILTER_UNARYNODE_H #ifndef CSM_FILTER_UNARYNODE_H
#define CSM_FILTER_UNARYNODE_H #define CSM_FILTER_UNARYNODE_H
#include <boost/shared_ptr.hpp>
#include "node.hpp" #include "node.hpp"
@ -9,12 +9,12 @@ namespace CSMFilter
{ {
class UnaryNode : public Node class UnaryNode : public Node
{ {
boost::shared_ptr<Node> mChild; std::shared_ptr<Node> mChild;
std::string mName; std::string mName;
public: public:
UnaryNode (boost::shared_ptr<Node> child, const std::string& name); UnaryNode (std::shared_ptr<Node> child, const std::string& name);
const Node& getChild() const; const Node& getChild() const;

View file

@ -32,7 +32,7 @@ CSMSettings::UserSettings *CSMSettings::UserSettings::sUserSettingsInstance = 0;
CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& configurationManager) CSMSettings::UserSettings::UserSettings (const Files::ConfigurationManager& configurationManager)
: mCfgMgr (configurationManager) : mCfgMgr (configurationManager)
, mSettingDefinitions(NULL) , mSettingDefinitions(nullptr)
{ {
assert(!sUserSettingsInstance); assert(!sUserSettingsInstance);
sUserSettingsInstance = this; sUserSettingsInstance = this;

View file

@ -138,7 +138,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
if (mLocked) if (mLocked)
return; return;
std::auto_ptr<CSMWorld::UpdateCellCommand> modifyCell; std::unique_ptr<CSMWorld::UpdateCellCommand> modifyCell;
int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt(); int columnId = model->data (index, ColumnBase::Role_ColumnId).toInt();
@ -167,7 +167,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
} }
} }
std::auto_ptr<CSMWorld::ModifyCommand> modifyData ( std::unique_ptr<CSMWorld::ModifyCommand> modifyData (
new CSMWorld::ModifyCommand (*model, index, new_)); new CSMWorld::ModifyCommand (*model, index, new_));
if (modifyCell.get()) if (modifyCell.get())

View file

@ -62,7 +62,7 @@ void CSMWorld::CreateCommand::applyModifications()
if (!mNestedValues.empty()) if (!mNestedValues.empty())
{ {
CSMWorld::IdTree *tree = dynamic_cast<CSMWorld::IdTree *>(&mModel); CSMWorld::IdTree *tree = dynamic_cast<CSMWorld::IdTree *>(&mModel);
if (tree == NULL) if (tree == nullptr)
{ {
throw std::logic_error("CSMWorld::CreateCommand: Attempt to add nested values to the non-nested model"); throw std::logic_error("CSMWorld::CreateCommand: Attempt to add nested values to the non-nested model");
} }

View file

@ -858,7 +858,7 @@ void CSMWorld::Data::merge()
int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base, bool project) 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 // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading
boost::shared_ptr<ESM::ESMReader> ptr(mReader); std::shared_ptr<ESM::ESMReader> ptr(mReader);
mReaders.push_back(ptr); mReaders.push_back(ptr);
mReader = 0; mReader = 0;
@ -896,7 +896,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. // 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 // We don't store non-base reader, because everything going into modified will be
// fully loaded during the initial loading process. // fully loaded during the initial loading process.
boost::shared_ptr<ESM::ESMReader> ptr(mReader); std::shared_ptr<ESM::ESMReader> ptr(mReader);
mReaders.push_back(ptr); mReaders.push_back(ptr);
} }
else else

View file

@ -115,7 +115,7 @@ namespace CSMWorld
Resource::ResourceSystem mResourceSystem; Resource::ResourceSystem mResourceSystem;
std::vector<boost::shared_ptr<ESM::ESMReader> > mReaders; std::vector<std::shared_ptr<ESM::ESMReader> > mReaders;
// not implemented // not implemented
Data (const Data&); Data (const Data&);

View file

@ -1,7 +1,5 @@
#include "idcompletionmanager.hpp" #include "idcompletionmanager.hpp"
#include <boost/make_shared.hpp>
#include <QCompleter> #include <QCompleter>
#include "../../view/widget/completerpopup.hpp" #include "../../view/widget/completerpopup.hpp"
@ -73,7 +71,7 @@ bool CSMWorld::IdCompletionManager::hasCompleterFor(CSMWorld::ColumnBase::Displa
return mCompleters.find(display) != mCompleters.end(); return mCompleters.find(display) != mCompleters.end();
} }
boost::shared_ptr<QCompleter> CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display) std::shared_ptr<QCompleter> CSMWorld::IdCompletionManager::getCompleter(CSMWorld::ColumnBase::Display display)
{ {
if (!hasCompleterFor(display)) if (!hasCompleterFor(display))
{ {
@ -90,12 +88,12 @@ void CSMWorld::IdCompletionManager::generateCompleters(CSMWorld::Data &data)
{ {
QAbstractItemModel *model = data.getTableModel(current->second); QAbstractItemModel *model = data.getTableModel(current->second);
CSMWorld::IdTableBase *table = dynamic_cast<CSMWorld::IdTableBase *>(model); CSMWorld::IdTableBase *table = dynamic_cast<CSMWorld::IdTableBase *>(model);
if (table != NULL) if (table != nullptr)
{ {
int idColumn = table->searchColumnIndex(CSMWorld::Columns::ColumnId_Id); int idColumn = table->searchColumnIndex(CSMWorld::Columns::ColumnId_Id);
if (idColumn != -1) if (idColumn != -1)
{ {
boost::shared_ptr<QCompleter> completer = boost::make_shared<QCompleter>(table); std::shared_ptr<QCompleter> completer = std::make_shared<QCompleter>(table);
completer->setCompletionColumn(idColumn); completer->setCompletionColumn(idColumn);
// The completion role must be Qt::DisplayRole to get the ID values from the model // The completion role must be Qt::DisplayRole to get the ID values from the model
completer->setCompletionRole(Qt::DisplayRole); completer->setCompletionRole(Qt::DisplayRole);

View file

@ -3,8 +3,7 @@
#include <vector> #include <vector>
#include <map> #include <map>
#include <memory>
#include <boost/shared_ptr.hpp>
#include "columnbase.hpp" #include "columnbase.hpp"
#include "universalid.hpp" #include "universalid.hpp"
@ -20,7 +19,7 @@ namespace CSMWorld
{ {
static const std::map<ColumnBase::Display, UniversalId::Type> sCompleterModelTypes; static const std::map<ColumnBase::Display, UniversalId::Type> sCompleterModelTypes;
std::map<ColumnBase::Display, boost::shared_ptr<QCompleter> > mCompleters; std::map<ColumnBase::Display, std::shared_ptr<QCompleter> > mCompleters;
// Don't allow copying // Don't allow copying
IdCompletionManager(const IdCompletionManager &); IdCompletionManager(const IdCompletionManager &);
@ -34,7 +33,7 @@ namespace CSMWorld
IdCompletionManager(Data &data); IdCompletionManager(Data &data);
bool hasCompleterFor(ColumnBase::Display display) const; bool hasCompleterFor(ColumnBase::Display display) const;
boost::shared_ptr<QCompleter> getCompleter(ColumnBase::Display display); std::shared_ptr<QCompleter> getCompleter(ColumnBase::Display display);
}; };
} }

View file

@ -50,7 +50,7 @@ QModelIndex CSMWorld::IdTableProxyModel::getModelIndex (const std::string& id, i
return mapFromSource (dynamic_cast<IdTableBase&> (*sourceModel()).getModelIndex (id, column)); return mapFromSource (dynamic_cast<IdTableBase&> (*sourceModel()).getModelIndex (id, column));
} }
void CSMWorld::IdTableProxyModel::setFilter (const boost::shared_ptr<CSMFilter::Node>& filter) void CSMWorld::IdTableProxyModel::setFilter (const std::shared_ptr<CSMFilter::Node>& filter)
{ {
beginResetModel(); beginResetModel();
mFilter = filter; mFilter = filter;

View file

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <boost/shared_ptr.hpp>
#include <map> #include <map>
@ -17,7 +17,7 @@ namespace CSMWorld
{ {
Q_OBJECT Q_OBJECT
boost::shared_ptr<CSMFilter::Node> mFilter; std::shared_ptr<CSMFilter::Node> mFilter;
std::map<int, int> mColumnMap; // column ID, column index in this model (or -1) std::map<int, int> mColumnMap; // column ID, column index in this model (or -1)
private: private:
@ -30,7 +30,7 @@ namespace CSMWorld
virtual QModelIndex getModelIndex (const std::string& id, int column) const; virtual QModelIndex getModelIndex (const std::string& id, int column) const;
void setFilter (const boost::shared_ptr<CSMFilter::Node>& filter); void setFilter (const std::shared_ptr<CSMFilter::Node>& filter);
void refreshFilter(); void refreshFilter();

View file

@ -16,7 +16,7 @@ namespace
CSMWorld::InfoTableProxyModel::InfoTableProxyModel(CSMWorld::UniversalId::Type type, QObject *parent) CSMWorld::InfoTableProxyModel::InfoTableProxyModel(CSMWorld::UniversalId::Type type, QObject *parent)
: IdTableProxyModel(parent), : IdTableProxyModel(parent),
mType(type), mType(type),
mSourceModel(NULL), mSourceModel(nullptr),
mInfoColumnId(type == UniversalId::Type_TopicInfos ? Columns::ColumnId_Topic : mInfoColumnId(type == UniversalId::Type_TopicInfos ? Columns::ColumnId_Topic :
Columns::ColumnId_Journal) Columns::ColumnId_Journal)
{ {
@ -27,7 +27,7 @@ void CSMWorld::InfoTableProxyModel::setSourceModel(QAbstractItemModel *sourceMod
{ {
IdTableProxyModel::setSourceModel(sourceModel); IdTableProxyModel::setSourceModel(sourceModel);
mSourceModel = dynamic_cast<IdTableBase *>(sourceModel); mSourceModel = dynamic_cast<IdTableBase *>(sourceModel);
if (mSourceModel != NULL) if (mSourceModel != nullptr)
{ {
connect(mSourceModel, connect(mSourceModel,
SIGNAL(rowsInserted(const QModelIndex &, int, int)), SIGNAL(rowsInserted(const QModelIndex &, int, int)),

View file

@ -2,7 +2,8 @@
#define CSM_WORLD_LAND_H #define CSM_WORLD_LAND_H
#include <string> #include <string>
#include <boost/shared_ptr.hpp> #include <memory>
#include <components/esm/loadland.hpp> #include <components/esm/loadland.hpp>
namespace CSMWorld namespace CSMWorld
@ -15,7 +16,7 @@ namespace CSMWorld
{ {
Land(); Land();
boost::shared_ptr<ESM::Land> mLand; std::shared_ptr<ESM::Land> mLand;
std::string mId; std::string mId;

View file

@ -3,6 +3,8 @@
#include <QVariant> #include <QVariant>
#include <stdexcept>
#include <components/esm/loadpgrd.hpp> #include <components/esm/loadpgrd.hpp>
#include <components/esm/effectlist.hpp> #include <components/esm/effectlist.hpp>
#include <components/esm/loadmgef.hpp> // for converting magic effect id to string & back #include <components/esm/loadmgef.hpp> // for converting magic effect id to string & back

View file

@ -295,13 +295,13 @@ void CSMWorld::ContainerRefIdAdapter::setData (const RefIdColumn *column, RefIdD
CSMWorld::CreatureColumns::CreatureColumns (const ActorColumns& actorColumns) CSMWorld::CreatureColumns::CreatureColumns (const ActorColumns& actorColumns)
: ActorColumns (actorColumns), : ActorColumns (actorColumns),
mType(NULL), mType(nullptr),
mSoul(NULL), mSoul(nullptr),
mScale(NULL), mScale(nullptr),
mOriginal(NULL), mOriginal(nullptr),
mCombat(NULL), mCombat(nullptr),
mMagic(NULL), mMagic(nullptr),
mStealth(NULL) mStealth(nullptr)
{} {}
CSMWorld::CreatureRefIdAdapter::CreatureRefIdAdapter (const CreatureColumns& columns) CSMWorld::CreatureRefIdAdapter::CreatureRefIdAdapter (const CreatureColumns& columns)
@ -543,14 +543,14 @@ void CSMWorld::MiscRefIdAdapter::setData (const RefIdColumn *column, RefIdData&
CSMWorld::NpcColumns::NpcColumns (const ActorColumns& actorColumns) CSMWorld::NpcColumns::NpcColumns (const ActorColumns& actorColumns)
: ActorColumns (actorColumns), : ActorColumns (actorColumns),
mRace(NULL), mRace(nullptr),
mClass(NULL), mClass(nullptr),
mFaction(NULL), mFaction(nullptr),
mHair(NULL), mHair(nullptr),
mHead(NULL), mHead(nullptr),
mAttributes(NULL), mAttributes(nullptr),
mSkills(NULL), mSkills(nullptr),
mMisc(NULL) mMisc(nullptr)
{} {}
CSMWorld::NpcRefIdAdapter::NpcRefIdAdapter (const NpcColumns& columns) CSMWorld::NpcRefIdAdapter::NpcRefIdAdapter (const NpcColumns& columns)

View file

@ -738,7 +738,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
const std::string& destination, const std::string& destination,
const CSMWorld::UniversalId::Type type) const CSMWorld::UniversalId::Type type)
{ {
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy()); std::unique_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
mAdapters.find(type)->second->setId(*newRecord, destination); mAdapters.find(type)->second->setId(*newRecord, destination);
mData.insertRecord(*newRecord, type, destination); mData.insertRecord(*newRecord, type, destination);
} }

View file

@ -4,7 +4,7 @@
#include <stdexcept> #include <stdexcept>
CSMWorld::ResourcesManager::ResourcesManager() CSMWorld::ResourcesManager::ResourcesManager()
: mVFS(NULL) : mVFS(nullptr)
{ {
} }

View file

@ -184,7 +184,7 @@ void CSVDoc::FileDialog::slotRejected()
if(mFileWidget) if(mFileWidget)
{ {
delete mFileWidget; delete mFileWidget;
mFileWidget = NULL; mFileWidget = nullptr;
} }
close(); close();
} }
@ -195,7 +195,7 @@ void CSVDoc::FileDialog::slotNewFile()
if(mFileWidget) if(mFileWidget)
{ {
delete mFileWidget; delete mFileWidget;
mFileWidget = NULL; mFileWidget = nullptr;
} }
disconnect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotNewFile())); disconnect (ui.projectButtonBox, SIGNAL (accepted()), this, SLOT (slotNewFile()));
close(); close();

View file

@ -536,7 +536,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
return; return;
} }
SubView *view = NULL; SubView *view = nullptr;
if(isReferenceable) if(isReferenceable)
{ {
view = mSubViewFactory.makeSubView (CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Referenceable, id.getId()), *mDocument); view = mSubViewFactory.makeSubView (CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Referenceable, id.getId()), *mDocument);

View file

@ -1,7 +1,7 @@
#ifndef CSV_FILTER_EDITWIDGET_H #ifndef CSV_FILTER_EDITWIDGET_H
#define CSV_FILTER_EDITWIDGET_H #define CSV_FILTER_EDITWIDGET_H
#include <boost/shared_ptr.hpp>
#include <QLineEdit> #include <QLineEdit>
#include <QPalette> #include <QPalette>
@ -35,7 +35,7 @@ namespace CSVFilter
signals: signals:
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter); void filterChanged (std::shared_ptr<CSMFilter::Node> filter);
private: private:
std::string generateFilter(std::pair<std::string, std::vector<std::string> >& seekedString) const; std::string generateFilter(std::pair<std::string, std::vector<std::string> >& seekedString) const;

View file

@ -22,8 +22,8 @@ CSVFilter::FilterBox::FilterBox (CSMWorld::Data& data, QWidget *parent)
setLayout (layout); setLayout (layout);
connect (mRecordFilterBox, connect (mRecordFilterBox,
SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)), SIGNAL (filterChanged (std::shared_ptr<CSMFilter::Node>)),
this, SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>))); this, SIGNAL (recordFilterChanged (std::shared_ptr<CSMFilter::Node>)));
setAcceptDrops(true); setAcceptDrops(true);
} }

View file

@ -41,7 +41,7 @@ namespace CSVFilter
void dragMoveEvent(QDragMoveEvent *event); void dragMoveEvent(QDragMoveEvent *event);
signals: signals:
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter); void recordFilterChanged (std::shared_ptr<CSMFilter::Node> filter);
void recordDropped (std::vector<CSMWorld::UniversalId>& types, Qt::DropAction action); void recordDropped (std::vector<CSMWorld::UniversalId>& types, Qt::DropAction action);
}; };

View file

@ -24,8 +24,8 @@ CSVFilter::RecordFilterBox::RecordFilterBox (CSMWorld::Data& data, QWidget *pare
setLayout (layout); setLayout (layout);
connect ( connect (
mEdit, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>)), mEdit, SIGNAL (filterChanged (std::shared_ptr<CSMFilter::Node>)),
this, SIGNAL (filterChanged (boost::shared_ptr<CSMFilter::Node>))); this, SIGNAL (filterChanged (std::shared_ptr<CSMFilter::Node>)));
} }
void CSVFilter::RecordFilterBox::setFilter (const std::string& filter) void CSVFilter::RecordFilterBox::setFilter (const std::string& filter)

View file

@ -1,7 +1,7 @@
#ifndef CSV_FILTER_RECORDFILTERBOX_H #ifndef CSV_FILTER_RECORDFILTERBOX_H
#define CSV_FILTER_RECORDFILTERBOX_H #define CSV_FILTER_RECORDFILTERBOX_H
#include <boost/shared_ptr.hpp>
#include <QWidget> #include <QWidget>
#include <QtCore/qnamespace.h> #include <QtCore/qnamespace.h>
@ -38,7 +38,7 @@ namespace CSVFilter
signals: signals:
void filterChanged (boost::shared_ptr<CSMFilter::Node> filter); void filterChanged (std::shared_ptr<CSMFilter::Node> filter);
}; };
} }

View file

@ -71,7 +71,7 @@ CSVRender::Cell::Cell (CSMWorld::Data& data, osg::Group* rootNode, const std::st
const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get(); const ESM::Land* esmLand = land.getRecord(mId).get().mLand.get();
if(esmLand && esmLand->mDataTypes&ESM::Land::DATA_VHGT) if(esmLand && esmLand->mDataTypes&ESM::Land::DATA_VHGT)
{ {
mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem(), NULL, new TerrainStorage(mData), Element_Terrain<<1)); mTerrain.reset(new Terrain::TerrainGrid(mCellNode, data.getResourceSystem(), nullptr, new TerrainStorage(mData), Element_Terrain<<1));
mTerrain->loadCell(esmLand->mX, mTerrain->loadCell(esmLand->mX,
esmLand->mY); esmLand->mY);

View file

@ -5,7 +5,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include <boost/shared_ptr.hpp>
#include <osg/ref_ptr> #include <osg/ref_ptr>
@ -35,7 +35,7 @@ namespace CSVRender
std::string mId; std::string mId;
osg::ref_ptr<osg::Group> mCellNode; osg::ref_ptr<osg::Group> mCellNode;
std::map<std::string, Object *> mObjects; std::map<std::string, Object *> mObjects;
std::auto_ptr<Terrain::TerrainGrid> mTerrain; std::unique_ptr<Terrain::TerrainGrid> mTerrain;
int mX; int mX;
int mY; int mY;

View file

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <boost/shared_ptr.hpp>
#include <osg/ref_ptr> #include <osg/ref_ptr>

View file

@ -184,7 +184,7 @@ std::string CSVRender::PagedWorldspaceWidget::getStartupInstruction()
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document) CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)
: WorldspaceWidget (document, parent), mDocument (document), mWorldspace ("std::default"), : WorldspaceWidget (document, parent), mDocument (document), mWorldspace ("std::default"),
mControlElements(NULL), mDisplayCellCoord(true) mControlElements(nullptr), mDisplayCellCoord(true)
{ {
QAbstractItemModel *cells = QAbstractItemModel *cells =
document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells); document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells);

View file

@ -135,7 +135,7 @@ void CompositeViewer::update()
SceneWidget::SceneWidget(Resource::SceneManager* sceneManager, QWidget *parent, Qt::WindowFlags f) SceneWidget::SceneWidget(Resource::SceneManager* sceneManager, QWidget *parent, Qt::WindowFlags f)
: RenderWidget(parent, f) : RenderWidget(parent, f)
, mSceneManager(sceneManager) , mSceneManager(sceneManager)
, mLighting(NULL) , mLighting(nullptr)
, mHasDefaultAmbient(false) , mHasDefaultAmbient(false)
{ {
// we handle lighting manually // we handle lighting manually

View file

@ -18,7 +18,7 @@ namespace CSVRender
// has to wrap the vertices of the last row and column to the next cell, which may be a nonexisting cell // has to wrap the vertices of the last row and column to the next cell, which may be a nonexisting cell
int index = mData.getLand().searchId(stream.str()); int index = mData.getLand().searchId(stream.str());
if (index == -1) if (index == -1)
return NULL; return nullptr;
ESM::Land* land = mData.getLand().getRecord(index).get().mLand.get(); ESM::Land* land = mData.getLand().getRecord(index).get().mLand.get();
int mask = ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR | ESM::Land::DATA_VTEX; int mask = ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR | ESM::Land::DATA_VTEX;

View file

@ -28,7 +28,7 @@ namespace CSVRender
std::string mCellId; std::string mCellId;
CSMWorld::IdTable *mCellsModel; CSMWorld::IdTable *mCellsModel;
CSMWorld::IdTable *mReferenceablesModel; CSMWorld::IdTable *mReferenceablesModel;
std::auto_ptr<Cell> mCell; std::unique_ptr<Cell> mCell;
void update(); void update();

View file

@ -1,7 +1,7 @@
#ifndef OPENCS_VIEW_WORLDSPACEWIDGET_H #ifndef OPENCS_VIEW_WORLDSPACEWIDGET_H
#define OPENCS_VIEW_WORLDSPACEWIDGET_H #define OPENCS_VIEW_WORLDSPACEWIDGET_H
#include <boost/shared_ptr.hpp>
#include "scenewidget.hpp" #include "scenewidget.hpp"

View file

@ -9,7 +9,7 @@
#include "view.hpp" #include "view.hpp"
CSVSettings::SettingWindow::SettingWindow(QWidget *parent) CSVSettings::SettingWindow::SettingWindow(QWidget *parent)
: QMainWindow(parent), mModel(NULL) : QMainWindow(parent), mModel(nullptr)
{} {}
void CSVSettings::SettingWindow::createPages() void CSVSettings::SettingWindow::createPages()

View file

@ -46,7 +46,7 @@ void CSVWidget::ColorPickerPopup::showPicker(const QPoint &position, const QColo
void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent *event) void CSVWidget::ColorPickerPopup::mousePressEvent(QMouseEvent *event)
{ {
QPushButton *button = qobject_cast<QPushButton *>(parentWidget()); QPushButton *button = qobject_cast<QPushButton *>(parentWidget());
if (button != NULL) if (button != nullptr)
{ {
QStyleOptionButton option; QStyleOptionButton option;
option.init(button); option.init(button);

View file

@ -11,7 +11,7 @@ CSVWidget::CompleterPopup::CompleterPopup(QWidget *parent)
int CSVWidget::CompleterPopup::sizeHintForRow(int row) const int CSVWidget::CompleterPopup::sizeHintForRow(int row) const
{ {
if (model() == NULL) if (model() == nullptr)
{ {
return -1; return -1;
} }

View file

@ -26,7 +26,7 @@ std::string CSVWorld::CellCreator::getId() const
void CSVWorld::CellCreator::configureCreateCommand(CSMWorld::CreateCommand& command) const void CSVWorld::CellCreator::configureCreateCommand(CSMWorld::CreateCommand& command) const
{ {
CSMWorld::IdTree *model = dynamic_cast<CSMWorld::IdTree *>(getData().getTableModel(getCollectionId())); CSMWorld::IdTree *model = dynamic_cast<CSMWorld::IdTree *>(getData().getTableModel(getCollectionId()));
Q_ASSERT(model != NULL); Q_ASSERT(model != nullptr);
int parentIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Cell); int parentIndex = model->findColumnIndex(CSMWorld::Columns::ColumnId_Cell);
int index = model->findNestedColumnIndex(parentIndex, CSMWorld::Columns::ColumnId_Interior); int index = model->findNestedColumnIndex(parentIndex, CSMWorld::Columns::ColumnId_Interior);
command.addNestedValue(parentIndex, index, mType->currentIndex() == 0); command.addNestedValue(parentIndex, index, mType->currentIndex() == 0);

View file

@ -91,7 +91,7 @@ namespace CSVWorld
Creator *CreatorFactory<CreatorT, scope>::makeCreator (CSMDoc::Document& document, Creator *CreatorFactory<CreatorT, scope>::makeCreator (CSMDoc::Document& document,
const CSMWorld::UniversalId& id) const const CSMWorld::UniversalId& id) const
{ {
std::auto_ptr<CreatorT> creator (new CreatorT (document.getData(), document.getUndoStack(), id)); std::unique_ptr<CreatorT> creator (new CreatorT (document.getData(), document.getUndoStack(), id));
creator->setScope (scope); creator->setScope (scope);

View file

@ -66,7 +66,7 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QMo
CSMWorld::Columns::ColumnId columnId = static_cast<CSMWorld::Columns::ColumnId> ( CSMWorld::Columns::ColumnId columnId = static_cast<CSMWorld::Columns::ColumnId> (
mTable->getColumnId (index.column())); mTable->getColumnId (index.column()));
if (QVariant::String == v.type()) if (QVariant::String == v.type())
{ {
label->setText(v.toString()); label->setText(v.toString());
@ -75,7 +75,7 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QMo
{ {
int data = v.toInt(); int data = v.toInt();
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (columnId)); std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (columnId));
label->setText(QString::fromUtf8(enumNames.at(data).c_str())); label->setText(QString::fromUtf8(enumNames.at(data).c_str()));
} }
else else
@ -116,7 +116,7 @@ mIndex(index)
CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display) : CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display) :
mEditor(editor), mEditor(editor),
mDisplay(display), mDisplay(display),
mIndexWrapper(NULL) mIndexWrapper(nullptr)
{ {
} }
@ -154,7 +154,7 @@ mNotEditableDelegate(table, parent)
CSVWorld::CommandDelegate* CSVWorld::DialogueDelegateDispatcher::makeDelegate(CSMWorld::ColumnBase::Display display) CSVWorld::CommandDelegate* CSVWorld::DialogueDelegateDispatcher::makeDelegate(CSMWorld::ColumnBase::Display display)
{ {
CommandDelegate *delegate = NULL; CommandDelegate *delegate = nullptr;
std::map<int, CommandDelegate*>::const_iterator delegateIt(mDelegates.find(display)); std::map<int, CommandDelegate*>::const_iterator delegateIt(mDelegates.find(display));
if (delegateIt == mDelegates.end()) if (delegateIt == mDelegates.end())
{ {
@ -247,11 +247,11 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
variant = index.data(Qt::DisplayRole); variant = index.data(Qt::DisplayRole);
if (!variant.isValid()) if (!variant.isValid())
{ {
return NULL; return nullptr;
} }
} }
QWidget* editor = NULL; QWidget* editor = nullptr;
if (! (mTable->flags (index) & Qt::ItemIsEditable)) if (! (mTable->flags (index) & Qt::ItemIsEditable))
{ {
return mNotEditableDelegate.createEditor(qobject_cast<QWidget*>(mParent), return mNotEditableDelegate.createEditor(qobject_cast<QWidget*>(mParent),
@ -321,21 +321,21 @@ CSVWorld::IdContextMenu::IdContextMenu(QWidget *widget, CSMWorld::ColumnBase::Di
mWidget(widget), mWidget(widget),
mIdType(CSMWorld::TableMimeData::convertEnums(display)) mIdType(CSMWorld::TableMimeData::convertEnums(display))
{ {
Q_ASSERT(mWidget != NULL); Q_ASSERT(mWidget != nullptr);
Q_ASSERT(CSMWorld::ColumnBase::isId(display)); Q_ASSERT(CSMWorld::ColumnBase::isId(display));
Q_ASSERT(mIdType != CSMWorld::UniversalId::Type_None); Q_ASSERT(mIdType != CSMWorld::UniversalId::Type_None);
mWidget->setContextMenuPolicy(Qt::CustomContextMenu); mWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(mWidget, connect(mWidget,
SIGNAL(customContextMenuRequested(const QPoint &)), SIGNAL(customContextMenuRequested(const QPoint &)),
this, this,
SLOT(showContextMenu(const QPoint &))); SLOT(showContextMenu(const QPoint &)));
mEditIdAction = new QAction(this); mEditIdAction = new QAction(this);
connect(mEditIdAction, SIGNAL(triggered()), this, SLOT(editIdRequest())); connect(mEditIdAction, SIGNAL(triggered()), this, SLOT(editIdRequest()));
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(mWidget); QLineEdit *lineEdit = qobject_cast<QLineEdit *>(mWidget);
if (lineEdit != NULL) if (lineEdit != nullptr)
{ {
mContextMenu = lineEdit->createStandardContextMenu(); mContextMenu = lineEdit->createStandardContextMenu();
} }
@ -352,15 +352,15 @@ void CSVWorld::IdContextMenu::excludeId(const std::string &id)
QString CSVWorld::IdContextMenu::getWidgetValue() const QString CSVWorld::IdContextMenu::getWidgetValue() const
{ {
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(mWidget); QLineEdit *lineEdit = qobject_cast<QLineEdit *>(mWidget);
QLabel *label = qobject_cast<QLabel *>(mWidget); QLabel *label = qobject_cast<QLabel *>(mWidget);
QString value = ""; QString value = "";
if (lineEdit != NULL) if (lineEdit != nullptr)
{ {
value = lineEdit->text(); value = lineEdit->text();
} }
else if (label != NULL) else if (label != nullptr)
{ {
value = label->text(); value = label->text();
} }
@ -411,7 +411,7 @@ void CSVWorld::IdContextMenu::showContextMenu(const QPoint &pos)
{ {
removeEditIdActionFromMenu(); removeEditIdActionFromMenu();
} }
if (!mContextMenu->actions().isEmpty()) if (!mContextMenu->actions().isEmpty())
{ {
mContextMenu->exec(mWidget->mapToGlobal(pos)); mContextMenu->exec(mWidget->mapToGlobal(pos));
@ -432,7 +432,7 @@ void CSVWorld::EditWidget::createEditorContextMenu(QWidget *editor,
CSMWorld::ColumnBase::Display display, CSMWorld::ColumnBase::Display display,
int currentRow) const int currentRow) const
{ {
Q_ASSERT(editor != NULL); Q_ASSERT(editor != nullptr);
if (CSMWorld::ColumnBase::isId(display) && if (CSMWorld::ColumnBase::isId(display) &&
CSMWorld::TableMimeData::convertEnums(display) != CSMWorld::UniversalId::Type_None) CSMWorld::TableMimeData::convertEnums(display) != CSMWorld::UniversalId::Type_None)
@ -466,11 +466,11 @@ CSVWorld::EditWidget::EditWidget(QWidget *parent,
int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher, int row, CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher,
CSMDoc::Document& document, bool createAndDelete) : CSMDoc::Document& document, bool createAndDelete) :
QScrollArea(parent), QScrollArea(parent),
mWidgetMapper(NULL), mWidgetMapper(nullptr),
mNestedTableMapper(NULL), mNestedTableMapper(nullptr),
mDispatcher(NULL), mDispatcher(nullptr),
mNestedTableDispatcher(NULL), mNestedTableDispatcher(nullptr),
mMainWidget(NULL), mMainWidget(nullptr),
mTable(table), mTable(table),
mCommandDispatcher (commandDispatcher), mCommandDispatcher (commandDispatcher),
mDocument (document) mDocument (document)
@ -588,9 +588,9 @@ void CSVWorld::EditWidget::remake(int row)
tablesLayout->addWidget(label); tablesLayout->addWidget(label);
tablesLayout->addWidget(table); tablesLayout->addWidget(table);
connect(table, connect(table,
SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)), SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)),
this, this,
SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &))); SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &)));
} }
else if (!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List)) else if (!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List))
@ -725,7 +725,7 @@ bool CSVWorld::SimpleDialogueSubView::isLocked() const
CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) : CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) :
SubView (id), SubView (id),
mEditWidget(0), mEditWidget(0),
mMainLayout(NULL), mMainLayout(nullptr),
mTable(dynamic_cast<CSMWorld::IdTable*>(document.getData().getTableModel(id))), mTable(dynamic_cast<CSMWorld::IdTable*>(document.getData().getTableModel(id))),
mLocked(false), mLocked(false),
mDocument(document), mDocument(document),
@ -854,7 +854,7 @@ CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id,
connect (mButtons, SIGNAL (showPreview()), this, SLOT (showPreview())); connect (mButtons, SIGNAL (showPreview()), this, SLOT (showPreview()));
connect (mButtons, SIGNAL (viewRecord()), this, SLOT (viewRecord())); connect (mButtons, SIGNAL (viewRecord()), this, SLOT (viewRecord()));
connect (mButtons, SIGNAL (switchToRow (int)), this, SLOT (switchToRow (int))); connect (mButtons, SIGNAL (switchToRow (int)), this, SLOT (switchToRow (int)));
connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)), connect (this, SIGNAL (universalIdChanged (const CSMWorld::UniversalId&)),
mButtons, SLOT (universalIdChanged (const CSMWorld::UniversalId&))); mButtons, SLOT (universalIdChanged (const CSMWorld::UniversalId&)));
} }
@ -908,7 +908,7 @@ void CSVWorld::DialogueSubView::switchToRow (int row)
setUniversalId (CSMWorld::UniversalId (type, id)); setUniversalId (CSMWorld::UniversalId (type, id));
updateCurrentId(); updateCurrentId();
getEditWidget().remake (row); getEditWidget().remake (row);
int stateColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Modification); int stateColumn = getTable().findColumnIndex (CSMWorld::Columns::ColumnId_Modification);
@ -923,5 +923,5 @@ void CSVWorld::DialogueSubView::requestFocus (const std::string& id)
QModelIndex index = getTable().getModelIndex (id, 0); QModelIndex index = getTable().getModelIndex (id, 0);
if (index.isValid()) if (index.isValid())
switchToRow (index.row()); switchToRow (index.row());
} }

View file

@ -79,7 +79,7 @@ namespace CSVWorld
CSMWorld::ColumnBase::Display mDisplay; CSMWorld::ColumnBase::Display mDisplay;
std::auto_ptr<refWrapper> mIndexWrapper; std::unique_ptr<refWrapper> mIndexWrapper;
public: public:
DialogueDelegateDispatcherProxy(QWidget* editor, DialogueDelegateDispatcherProxy(QWidget* editor,

View file

@ -12,7 +12,7 @@ const CSMWorld::TableMimeData *CSVWorld::DragDropUtils::getTableMimeData(const Q
bool CSVWorld::DragDropUtils::canAcceptData(const QDropEvent &event, CSMWorld::ColumnBase::Display type) bool CSVWorld::DragDropUtils::canAcceptData(const QDropEvent &event, CSMWorld::ColumnBase::Display type)
{ {
const CSMWorld::TableMimeData *data = getTableMimeData(event); const CSMWorld::TableMimeData *data = getTableMimeData(event);
return data != NULL && data->holdsType(type); return data != nullptr && data->holdsType(type);
} }
CSMWorld::UniversalId CSVWorld::DragDropUtils::getAcceptedData(const QDropEvent &event, CSMWorld::UniversalId CSVWorld::DragDropUtils::getAcceptedData(const QDropEvent &event,

View file

@ -83,7 +83,7 @@ void CSVWorld::DragRecordTable::dropEvent(QDropEvent *event)
CSMWorld::ColumnBase::Display CSVWorld::DragRecordTable::getIndexDisplayType(const QModelIndex &index) const CSMWorld::ColumnBase::Display CSVWorld::DragRecordTable::getIndexDisplayType(const QModelIndex &index) const
{ {
Q_ASSERT(model() != NULL); Q_ASSERT(model() != nullptr);
if (index.isValid()) if (index.isValid())
{ {

View file

@ -28,7 +28,7 @@ namespace CSVWorld
bool mEditLock; bool mEditLock;
public: public:
DragRecordTable(CSMDoc::Document& document, QWidget* parent = NULL); DragRecordTable(CSMDoc::Document& document, QWidget* parent = nullptr);
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const = 0; virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const = 0;

View file

@ -50,7 +50,7 @@ std::string CSVWorld::GenericCreator::getId() const
void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {} void CSVWorld::GenericCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const {}
void CSVWorld::GenericCreator::pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command, void CSVWorld::GenericCreator::pushCommand (std::unique_ptr<CSMWorld::CreateCommand> command,
const std::string& id) const std::string& id)
{ {
mUndoStack.push (command.release()); mUndoStack.push (command.release());
@ -202,7 +202,7 @@ void CSVWorld::GenericCreator::create()
{ {
std::string id = getId(); std::string id = getId();
std::auto_ptr<CSMWorld::CreateCommand> command; std::unique_ptr<CSMWorld::CreateCommand> command;
if (mCloneMode) if (mCloneMode)
{ {
@ -217,7 +217,7 @@ void CSVWorld::GenericCreator::create()
} }
configureCreateCommand (*command); configureCreateCommand (*command);
pushCommand (command, id); pushCommand (std::move (command), id);
emit done(); emit done();
emit requestFocus(id); emit requestFocus(id);

View file

@ -65,7 +65,7 @@ namespace CSVWorld
/// Allow subclasses to wrap the create command together with additional commands /// Allow subclasses to wrap the create command together with additional commands
/// into a macro. /// into a macro.
virtual void pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command, virtual void pushCommand (std::unique_ptr<CSMWorld::CreateCommand> command,
const std::string& id); const std::string& id);
CSMWorld::Data& getData() const; CSMWorld::Data& getData() const;

View file

@ -24,7 +24,7 @@ QWidget *CSVWorld::IdCompletionDelegate::createEditor(QWidget *parent,
{ {
if (!index.data(Qt::EditRole).isValid() && !index.data(Qt::DisplayRole).isValid()) if (!index.data(Qt::EditRole).isValid() && !index.data(Qt::DisplayRole).isValid())
{ {
return NULL; return nullptr;
} }
CSMWorld::IdCompletionManager &completionManager = getDocument().getIdCompletionManager(); CSMWorld::IdCompletionManager &completionManager = getDocument().getIdCompletionManager();

View file

@ -38,7 +38,7 @@ namespace CSVWorld
NestedTable(CSMDoc::Document& document, NestedTable(CSMDoc::Document& document,
CSMWorld::UniversalId id, CSMWorld::UniversalId id,
CSMWorld::NestedTableProxyModel* model, CSMWorld::NestedTableProxyModel* model,
QWidget* parent = NULL); QWidget* parent = nullptr);
virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const; virtual std::vector<CSMWorld::UniversalId> getDraggedRecords() const;

View file

@ -35,7 +35,7 @@ void CSVWorld::ReferenceCreator::configureCreateCommand (CSMWorld::CreateCommand
command.addValue (refNumColumn, getRefNumCount()); command.addValue (refNumColumn, getRefNumCount());
} }
void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command, void CSVWorld::ReferenceCreator::pushCommand (std::unique_ptr<CSMWorld::CreateCommand> command,
const std::string& id) const std::string& id)
{ {
// get the old count // get the old count
@ -51,11 +51,11 @@ void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr<CSMWorld::CreateComm
int count = cellTable.data (countIndex).toInt(); int count = cellTable.data (countIndex).toInt();
// command for incrementing counter // command for incrementing counter
std::auto_ptr<CSMWorld::ModifyCommand> increment (new CSMWorld::ModifyCommand std::unique_ptr<CSMWorld::ModifyCommand> increment (new CSMWorld::ModifyCommand
(cellTable, countIndex, count+1)); (cellTable, countIndex, count+1));
getUndoStack().beginMacro (command->text()); getUndoStack().beginMacro (command->text());
GenericCreator::pushCommand (command, id); GenericCreator::pushCommand (std::move (command), id);
getUndoStack().push (increment.release()); getUndoStack().push (increment.release());
getUndoStack().endMacro(); getUndoStack().endMacro();
} }
@ -148,11 +148,11 @@ void CSVWorld::ReferenceCreator::cloneMode(const std::string& originId,
cellChanged(); //otherwise ok button will remain disabled cellChanged(); //otherwise ok button will remain disabled
} }
CSVWorld::Creator *CSVWorld::ReferenceCreatorFactory::makeCreator (CSMDoc::Document& document, CSVWorld::Creator *CSVWorld::ReferenceCreatorFactory::makeCreator (CSMDoc::Document& document,
const CSMWorld::UniversalId& id) const const CSMWorld::UniversalId& id) const
{ {
return new ReferenceCreator(document.getData(), return new ReferenceCreator(document.getData(),
document.getUndoStack(), document.getUndoStack(),
id, id,
document.getIdCompletionManager()); document.getIdCompletionManager());
} }

View file

@ -29,7 +29,7 @@ namespace CSVWorld
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const; virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const;
virtual void pushCommand (std::auto_ptr<CSMWorld::CreateCommand> command, virtual void pushCommand (std::unique_ptr<CSMWorld::CreateCommand> command,
const std::string& id); const std::string& id);
int getRefNumCount() const; int getRefNumCount() const;

View file

@ -27,7 +27,7 @@
#include "creator.hpp" #include "creator.hpp"
CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
: SubView (id), mScene(NULL), mLayout(new QHBoxLayout), mDocument(document), mToolbar(NULL) : SubView (id), mScene(nullptr), mLayout(new QHBoxLayout), mDocument(document), mToolbar(nullptr)
{ {
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
@ -37,7 +37,7 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
mLayout->setContentsMargins (QMargins (0, 0, 0, 0)); mLayout->setContentsMargins (QMargins (0, 0, 0, 0));
CSVRender::WorldspaceWidget* worldspaceWidget = NULL; CSVRender::WorldspaceWidget* worldspaceWidget = nullptr;
widgetType whatWidget; widgetType whatWidget;
if (id.getId()=="sys::default") if (id.getId()=="sys::default")
@ -197,9 +197,9 @@ void CSVWorld::SceneSubView::cellSelectionChanged (const CSMWorld::CellSelection
void CSVWorld::SceneSubView::handleDrop (const std::vector< CSMWorld::UniversalId >& data) void CSVWorld::SceneSubView::handleDrop (const std::vector< CSMWorld::UniversalId >& data)
{ {
CSVRender::PagedWorldspaceWidget* pagedNewWidget = NULL; CSVRender::PagedWorldspaceWidget* pagedNewWidget = nullptr;
CSVRender::UnpagedWorldspaceWidget* unPagedNewWidget = NULL; CSVRender::UnpagedWorldspaceWidget* unPagedNewWidget = nullptr;
CSVWidget::SceneToolbar* toolbar = NULL; CSVWidget::SceneToolbar* toolbar = nullptr;
CSVRender::WorldspaceWidget::DropType type = CSVRender::WorldspaceWidget::getDropType (data); CSVRender::WorldspaceWidget::DropType type = CSVRender::WorldspaceWidget::getDropType (data);

View file

@ -672,7 +672,7 @@ void CSVWorld::Table::requestFocus (const std::string& id)
scrollTo (index, QAbstractItemView::PositionAtTop); scrollTo (index, QAbstractItemView::PositionAtTop);
} }
void CSVWorld::Table::recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter) void CSVWorld::Table::recordFilterChanged (std::shared_ptr<CSMFilter::Node> filter)
{ {
mProxyModel->setFilter (filter); mProxyModel->setFilter (filter);
tableSizeUpdate(); tableSizeUpdate();

View file

@ -136,7 +136,7 @@ namespace CSVWorld
void requestFocus (const std::string& id); void requestFocus (const std::string& id);
void recordFilterChanged (boost::shared_ptr<CSMFilter::Node> filter); void recordFilterChanged (std::shared_ptr<CSMFilter::Node> filter);
void updateUserSetting (const QString &name, const QStringList &list); void updateUserSetting (const QString &name, const QStringList &list);

View file

@ -76,8 +76,8 @@ CSVWorld::TableSubView::TableSubView (const CSMWorld::UniversalId& id, CSMDoc::D
mTable, SLOT (requestFocus (const std::string&))); mTable, SLOT (requestFocus (const std::string&)));
connect (mFilterBox, connect (mFilterBox,
SIGNAL (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>)), SIGNAL (recordFilterChanged (std::shared_ptr<CSMFilter::Node>)),
mTable, SLOT (recordFilterChanged (boost::shared_ptr<CSMFilter::Node>))); mTable, SLOT (recordFilterChanged (std::shared_ptr<CSMFilter::Node>)));
connect(mFilterBox, SIGNAL(recordDropped(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)), connect(mFilterBox, SIGNAL(recordDropped(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)),
this, SLOT(createFilterRequest(std::vector<CSMWorld::UniversalId>&, Qt::DropAction))); this, SLOT(createFilterRequest(std::vector<CSMWorld::UniversalId>&, Qt::DropAction)));

View file

@ -130,7 +130,7 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM
QVariant new_; QVariant new_;
// Color columns use a custom editor, so we need explicitly extract a data from it // Color columns use a custom editor, so we need explicitly extract a data from it
CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor); CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor);
if (colorEditor != NULL) if (colorEditor != nullptr)
{ {
new_ = colorEditor->color(); new_ = colorEditor->color();
} }
@ -307,7 +307,7 @@ void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelInde
// Color columns use a custom editor, so we need explicitly set a data for it // Color columns use a custom editor, so we need explicitly set a data for it
CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor); CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor);
if (colorEditor != NULL) if (colorEditor != nullptr)
{ {
colorEditor->setColor(index.data().value<QColor>()); colorEditor->setColor(index.data().value<QColor>());
return; return;

View file

@ -117,7 +117,6 @@ include_directories(${SOUND_INPUT_INCLUDES})
target_link_libraries(openmw target_link_libraries(openmw
${OPENSCENEGRAPH_LIBRARIES} ${OPENSCENEGRAPH_LIBRARIES}
${Boost_SYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY}
${Boost_THREAD_LIBRARY}
${Boost_FILESYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY}
${OPENAL_LIBRARY} ${OPENAL_LIBRARY}

View file

@ -63,7 +63,7 @@ static const struct {
{ "Illegal instruction", SIGILL }, { "Illegal instruction", SIGILL },
{ "FPU exception", SIGFPE }, { "FPU exception", SIGFPE },
{ "System BUS error", SIGBUS }, { "System BUS error", SIGBUS },
{ NULL, 0 } { nullptr, 0 }
}; };
static const struct { static const struct {
@ -80,7 +80,7 @@ static const struct {
{ ILL_COPROC, "Coprocessor error" }, { ILL_COPROC, "Coprocessor error" },
{ ILL_BADSTK, "Internal stack error" }, { ILL_BADSTK, "Internal stack error" },
#endif #endif
{ 0, NULL } { 0, nullptr }
}; };
static const struct { static const struct {
@ -95,7 +95,7 @@ static const struct {
{ FPE_FLTRES, "Floating point inexact result" }, { FPE_FLTRES, "Floating point inexact result" },
{ FPE_FLTINV, "Floating point invalid operation" }, { FPE_FLTINV, "Floating point invalid operation" },
{ FPE_FLTSUB, "Subscript out of range" }, { FPE_FLTSUB, "Subscript out of range" },
{ 0, NULL } { 0, nullptr }
}; };
static const struct { static const struct {
@ -106,7 +106,7 @@ static const struct {
{ SEGV_MAPERR, "Address not mapped to object" }, { SEGV_MAPERR, "Address not mapped to object" },
{ SEGV_ACCERR, "Invalid permissions for mapped object" }, { SEGV_ACCERR, "Invalid permissions for mapped object" },
#endif #endif
{ 0, NULL } { 0, nullptr }
}; };
static const struct { static const struct {
@ -118,7 +118,7 @@ static const struct {
{ BUS_ADRERR, "Non-existent physical address" }, { BUS_ADRERR, "Non-existent physical address" },
{ BUS_OBJERR, "Object specific hardware error" }, { BUS_OBJERR, "Object specific hardware error" },
#endif #endif
{ 0, NULL } { 0, nullptr }
}; };
static int (*cc_user_info)(char*, char*); static int (*cc_user_info)(char*, char*);
@ -132,7 +132,7 @@ static void gdb_info(pid_t pid)
/* Create a temp file to put gdb commands into */ /* Create a temp file to put gdb commands into */
strcpy(respfile, "/tmp/gdb-respfile-XXXXXX"); strcpy(respfile, "/tmp/gdb-respfile-XXXXXX");
if((fd=mkstemp(respfile)) >= 0 && (f=fdopen(fd, "w")) != NULL) if((fd=mkstemp(respfile)) >= 0 && (f=fdopen(fd, "w")) != nullptr)
{ {
fprintf(f, "attach %d\n" fprintf(f, "attach %d\n"
"shell echo \"\"\n" "shell echo \"\"\n"
@ -255,7 +255,7 @@ static void crash_catcher(int signum, siginfo_t *siginfo, void *context)
close(fd[0]); close(fd[0]);
close(fd[1]); close(fd[1]);
execl(argv0, argv0, crash_switch, NULL); execl(argv0, argv0, crash_switch, nullptr);
safe_write(STDERR_FILENO, exec_err, sizeof(exec_err)-1); safe_write(STDERR_FILENO, exec_err, sizeof(exec_err)-1);
_exit(1); _exit(1);
@ -390,7 +390,7 @@ static void crash_handler(const char *logfile)
if(logfile) if(logfile)
{ {
std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '" + std::string(logfile) + "'.\n Please report this to https://bugs.openmw.org !"; std::string message = "OpenMW has encountered a fatal error.\nCrash log saved to '" + std::string(logfile) + "'.\n Please report this to https://bugs.openmw.org !";
SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), NULL); SDL_ShowSimpleMessageBox(0, "Fatal Error", message.c_str(), nullptr);
} }
exit(0); exit(0);
} }
@ -426,7 +426,7 @@ int cc_install_handlers(int argc, char **argv, int num_signals, int *signals, co
altss.ss_sp = altstack; altss.ss_sp = altstack;
altss.ss_flags = 0; altss.ss_flags = 0;
altss.ss_size = sizeof(altstack); altss.ss_size = sizeof(altstack);
sigaltstack(&altss, NULL); sigaltstack(&altss, nullptr);
memset(&sa, 0, sizeof(sa)); memset(&sa, 0, sizeof(sa));
sa.sa_sigaction = crash_catcher; sa.sa_sigaction = crash_catcher;
@ -437,7 +437,7 @@ int cc_install_handlers(int argc, char **argv, int num_signals, int *signals, co
while(num_signals--) while(num_signals--)
{ {
if((*signals != SIGSEGV && *signals != SIGILL && *signals != SIGFPE && *signals != SIGABRT && if((*signals != SIGSEGV && *signals != SIGILL && *signals != SIGFPE && *signals != SIGABRT &&
*signals != SIGBUS) || sigaction(*signals, &sa, NULL) == -1) *signals != SIGBUS) || sigaction(*signals, &sa, nullptr) == -1)
{ {
*signals = 0; *signals = 0;
retval = -1; retval = -1;

View file

@ -193,9 +193,9 @@ void OMW::Engine::frame(float frametime)
} }
OMW::Engine::Engine(Files::ConfigurationManager& configurationManager) OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
: mWindow(NULL) : mWindow(nullptr)
, mEncoding(ToUTF8::WINDOWS_1252) , mEncoding(ToUTF8::WINDOWS_1252)
, mEncoder(NULL) , mEncoder(nullptr)
, mVerboseScripts (false) , mVerboseScripts (false)
, mSkipMenu (false) , mSkipMenu (false)
, mUseSound (true) , mUseSound (true)
@ -233,16 +233,16 @@ OMW::Engine::~Engine()
mEnvironment.cleanup(); mEnvironment.cleanup();
delete mScriptContext; delete mScriptContext;
mScriptContext = NULL; mScriptContext = nullptr;
mResourceSystem.reset(); mResourceSystem.reset();
mViewer = NULL; mViewer = nullptr;
if (mWindow) if (mWindow)
{ {
SDL_DestroyWindow(mWindow); SDL_DestroyWindow(mWindow);
mWindow = NULL; mWindow = nullptr;
} }
SDL_Quit(); SDL_Quit();

View file

@ -66,8 +66,8 @@ namespace OMW
class Engine class Engine
{ {
SDL_Window* mWindow; SDL_Window* mWindow;
std::auto_ptr<VFS::Manager> mVFS; std::unique_ptr<VFS::Manager> mVFS;
std::auto_ptr<Resource::ResourceSystem> mResourceSystem; std::unique_ptr<Resource::ResourceSystem> mResourceSystem;
MWBase::Environment mEnvironment; MWBase::Environment mEnvironment;
ToUTF8::FromType mEncoding; ToUTF8::FromType mEncoding;
ToUTF8::Utf8Encoder* mEncoder; ToUTF8::Utf8Encoder* mEncoder;

View file

@ -340,7 +340,7 @@ int main(int argc, char**argv)
boost::filesystem::ofstream logfile; boost::filesystem::ofstream logfile;
std::auto_ptr<OMW::Engine> engine; std::unique_ptr<OMW::Engine> engine;
int ret = 0; int ret = 0;
try try
@ -370,7 +370,7 @@ int main(int argc, char**argv)
if ((argc == 2 && strcmp(argv[1], "--cc-handle-crash") == 0) || !is_debugger_attached()) if ((argc == 2 && strcmp(argv[1], "--cc-handle-crash") == 0) || !is_debugger_attached())
{ {
int s[5] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGABRT }; int s[5] = { SIGSEGV, SIGILL, SIGFPE, SIGBUS, SIGABRT };
cc_install_handlers(argc, argv, 5, s, (cfgMgr.getLogPath() / "crash.log").string().c_str(), NULL); cc_install_handlers(argc, argv, 5, s, (cfgMgr.getLogPath() / "crash.log").string().c_str(), nullptr);
std::cout << "Installing crash catcher" << std::endl; std::cout << "Installing crash catcher" << std::endl;
} }
else else
@ -395,7 +395,7 @@ int main(int argc, char**argv)
#if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix)) #if (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix))
if (!isatty(fileno(stdin))) if (!isatty(fileno(stdin)))
#endif #endif
SDL_ShowSimpleMessageBox(0, "OpenMW: Fatal error", e.what(), NULL); SDL_ShowSimpleMessageBox(0, "OpenMW: Fatal error", e.what(), nullptr);
std::cerr << "\nERROR: " << e.what() << std::endl; std::cerr << "\nERROR: " << e.what() << std::endl;

View file

@ -3,7 +3,7 @@
#include <string> #include <string>
#include <set> #include <set>
#include <boost/shared_ptr.hpp> #include <memory>
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
@ -16,12 +16,12 @@ namespace MWSound
{ {
class Sound; class Sound;
struct Sound_Decoder; struct Sound_Decoder;
typedef boost::shared_ptr<Sound_Decoder> DecoderPtr; typedef std::shared_ptr<Sound_Decoder> DecoderPtr;
} }
namespace MWBase namespace MWBase
{ {
typedef boost::shared_ptr<MWSound::Sound> SoundPtr; typedef std::shared_ptr<MWSound::Sound> SoundPtr;
/// \brief Interface for sound manager (implemented in MWSound) /// \brief Interface for sound manager (implemented in MWSound)
class SoundManager class SoundManager

View file

@ -50,7 +50,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Activator> *ref = MWWorld::LiveCellRef<ESM::Activator> *ref =
ptr.get<ESM::Activator>(); ptr.get<ESM::Activator>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -77,7 +77,7 @@ namespace MWClass
void Activator::registerSelf() void Activator::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Activator); std::shared_ptr<Class> instance (new Activator);
registerClass (typeid (ESM::Activator).name(), instance); registerClass (typeid (ESM::Activator).name(), instance);
} }
@ -109,19 +109,19 @@ namespace MWClass
return info; return info;
} }
boost::shared_ptr<MWWorld::Action> Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const std::shared_ptr<MWWorld::Action> Activator::activate(const MWWorld::Ptr &ptr, const MWWorld::Ptr &actor) const
{ {
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{ {
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfActivator"); const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfActivator");
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); std::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}"));
if(sound) action->setSound(sound->mId); if(sound) action->setSound(sound->mId);
return action; return action;
} }
return boost::shared_ptr<MWWorld::Action>(new MWWorld::NullAction); return std::shared_ptr<MWWorld::Action>(new MWWorld::NullAction);
} }

View file

@ -34,7 +34,7 @@ namespace MWClass
virtual std::string getScript (const MWWorld::Ptr& ptr) const; virtual std::string getScript (const MWWorld::Ptr& ptr) const;
///< Return name of the script attached to ptr ///< Return name of the script attached to ptr
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const; virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
static void registerSelf(); static void registerSelf();

View file

@ -42,7 +42,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Apparatus> *ref = MWWorld::LiveCellRef<ESM::Apparatus> *ref =
ptr.get<ESM::Apparatus>(); ptr.get<ESM::Apparatus>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -59,7 +59,7 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
@ -83,7 +83,7 @@ namespace MWClass
void Apparatus::registerSelf() void Apparatus::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Apparatus); std::shared_ptr<Class> instance (new Apparatus);
registerClass (typeid (ESM::Apparatus).name(), instance); registerClass (typeid (ESM::Apparatus).name(), instance);
} }
@ -138,9 +138,9 @@ namespace MWClass
} }
boost::shared_ptr<MWWorld::Action> Apparatus::use (const MWWorld::Ptr& ptr) const std::shared_ptr<MWWorld::Action> Apparatus::use (const MWWorld::Ptr& ptr) const
{ {
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionAlchemy()); return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionAlchemy());
} }
MWWorld::Ptr MWWorld::Ptr

View file

@ -27,7 +27,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
@ -54,7 +54,7 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual std::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu

View file

@ -47,7 +47,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Armor> *ref = MWWorld::LiveCellRef<ESM::Armor> *ref =
ptr.get<ESM::Armor>(); ptr.get<ESM::Armor>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -64,7 +64,7 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
@ -180,7 +180,7 @@ namespace MWClass
void Armor::registerSelf() void Armor::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Armor); std::shared_ptr<Class> instance (new Armor);
registerClass (typeid (ESM::Armor).name(), instance); registerClass (typeid (ESM::Armor).name(), instance);
} }
@ -367,9 +367,9 @@ namespace MWClass
return std::make_pair(1,""); return std::make_pair(1,"");
} }
boost::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const std::shared_ptr<MWWorld::Action> Armor::use (const MWWorld::Ptr& ptr) const
{ {
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
action->setSound(getUpSoundId(ptr)); action->setSound(getUpSoundId(ptr));

View file

@ -26,7 +26,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
@ -77,7 +77,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 ///< 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 /// Second item in the pair specifies the error message
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual std::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu

View file

@ -44,7 +44,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Book> *ref = MWWorld::LiveCellRef<ESM::Book> *ref =
ptr.get<ESM::Book>(); ptr.get<ESM::Book>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -61,7 +61,7 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
@ -69,13 +69,13 @@ namespace MWClass
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfItem"); const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfItem");
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); std::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}"));
if(sound) action->setSound(sound->mId); if(sound) action->setSound(sound->mId);
return action; return action;
} }
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr)); return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr));
} }
std::string Book::getScript (const MWWorld::Ptr& ptr) const std::string Book::getScript (const MWWorld::Ptr& ptr) const
@ -96,7 +96,7 @@ namespace MWClass
void Book::registerSelf() void Book::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Book); std::shared_ptr<Class> instance (new Book);
registerClass (typeid (ESM::Book).name(), instance); registerClass (typeid (ESM::Book).name(), instance);
} }
@ -176,9 +176,9 @@ namespace MWClass
return record->mId; return record->mId;
} }
boost::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const std::shared_ptr<MWWorld::Action> Book::use (const MWWorld::Ptr& ptr) const
{ {
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr)); return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionRead(ptr));
} }
MWWorld::Ptr MWWorld::Ptr

View file

@ -24,7 +24,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
@ -57,7 +57,7 @@ namespace MWClass
virtual std::string applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const; virtual std::string applyEnchantment(const MWWorld::Ptr &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. ///< Creates a new record using \a ptr as template, with the given name and the given enchantment applied to it.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const; virtual std::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu
virtual std::string getModel(const MWWorld::Ptr &ptr) const; virtual std::string getModel(const MWWorld::Ptr &ptr) const;

View file

@ -44,7 +44,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Clothing> *ref = MWWorld::LiveCellRef<ESM::Clothing> *ref =
ptr.get<ESM::Clothing>(); ptr.get<ESM::Clothing>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -61,7 +61,7 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
@ -136,7 +136,7 @@ namespace MWClass
void Clothing::registerSelf() void Clothing::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Clothing); std::shared_ptr<Class> instance (new Clothing);
registerClass (typeid (ESM::Clothing).name(), instance); registerClass (typeid (ESM::Clothing).name(), instance);
} }
@ -262,9 +262,9 @@ namespace MWClass
return std::make_pair (1, ""); return std::make_pair (1, "");
} }
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const std::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
{ {
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
action->setSound(getUpSoundId(ptr)); action->setSound(getUpSoundId(ptr));

View file

@ -24,7 +24,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
@ -69,7 +69,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. ///< 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 /// Second item in the pair specifies the error message
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual std::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu

View file

@ -54,7 +54,7 @@ namespace MWClass
{ {
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData); std::unique_ptr<ContainerCustomData> data (new ContainerCustomData);
MWWorld::LiveCellRef<ESM::Container> *ref = MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>(); ptr.get<ESM::Container>();
@ -75,7 +75,7 @@ namespace MWClass
ptr.get<ESM::Container>(); ptr.get<ESM::Container>();
if (ref->mBase->mFlags & ESM::Container::Respawn) if (ref->mBase->mFlags & ESM::Container::Respawn)
{ {
ptr.getRefData().setCustomData(NULL); ptr.getRefData().setCustomData(nullptr);
} }
} }
@ -108,7 +108,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Container> *ref = MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>(); ptr.get<ESM::Container>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -117,18 +117,18 @@ namespace MWClass
return ""; return "";
} }
boost::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Container::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) if (!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ()); return std::shared_ptr<MWWorld::Action> (new MWWorld::NullAction ());
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{ {
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfContainer"); const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfContainer");
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); std::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}"));
if(sound) action->setSound(sound->mId); if(sound) action->setSound(sound->mId);
return action; return action;
@ -171,20 +171,20 @@ namespace MWClass
{ {
if(ptr.getCellRef().getTrap().empty()) if(ptr.getCellRef().getTrap().empty())
{ {
boost::shared_ptr<MWWorld::Action> action (new MWWorld::ActionOpen(ptr)); std::shared_ptr<MWWorld::Action> action (new MWWorld::ActionOpen(ptr));
return action; return action;
} }
else else
{ {
// Activate trap // Activate trap
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().getTrap(), ptr)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().getTrap(), ptr));
action->setSound(trapActivationSound); action->setSound(trapActivationSound);
return action; return action;
} }
} }
else else
{ {
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction); std::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
action->setSound(lockedSound); action->setSound(lockedSound);
return action; return action;
} }
@ -216,7 +216,7 @@ namespace MWClass
void Container::registerSelf() void Container::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Container); std::shared_ptr<Class> instance (new Container);
registerClass (typeid (ESM::Container).name(), instance); registerClass (typeid (ESM::Container).name(), instance);
} }
@ -299,7 +299,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
// Create a CustomData, but don't fill it from ESM records (not needed) // Create a CustomData, but don't fill it from ESM records (not needed)
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData); std::unique_ptr<ContainerCustomData> data (new ContainerCustomData);
ptr.getRefData().setCustomData (data.release()); ptr.getRefData().setCustomData (data.release());
} }

View file

@ -27,7 +27,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation

View file

@ -92,7 +92,7 @@ namespace MWClass
{ {
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
std::auto_ptr<CreatureCustomData> data (new CreatureCustomData); std::unique_ptr<CreatureCustomData> data (new CreatureCustomData);
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>(); MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
@ -184,7 +184,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Creature> *ref = MWWorld::LiveCellRef<ESM::Creature> *ref =
ptr.get<ESM::Creature>(); ptr.get<ESM::Creature>();
assert (ref->mBase != NULL); assert (ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -280,7 +280,7 @@ namespace MWClass
bool healthdmg = true; bool healthdmg = true;
if (!weapon.isEmpty()) if (!weapon.isEmpty())
{ {
const unsigned char *attack = NULL; const unsigned char *attack = nullptr;
if(type == ESM::Weapon::AT_Chop) if(type == ESM::Weapon::AT_Chop)
attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop; attack = weapon.get<ESM::Weapon>()->mBase->mData.mChop;
else if(type == ESM::Weapon::AT_Slash) else if(type == ESM::Weapon::AT_Slash)
@ -450,7 +450,7 @@ namespace MWClass
} }
boost::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Creature::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf()) if(actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
@ -458,17 +458,17 @@ namespace MWClass
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfCreature"); const ESM::Sound *sound = store.get<ESM::Sound>().searchRandom("WolfCreature");
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}")); std::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction("#{sWerewolfRefusal}"));
if(sound) action->setSound(sound->mId); if(sound) action->setSound(sound->mId);
return action; return action;
} }
if(getCreatureStats(ptr).isDead()) if(getCreatureStats(ptr).isDead())
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true)); return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionOpen(ptr, true));
if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat()) if(ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat())
return boost::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction("")); return std::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction(""));
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(ptr)); return std::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(ptr));
} }
MWWorld::ContainerStore& Creature::getContainerStore (const MWWorld::Ptr& ptr) const MWWorld::ContainerStore& Creature::getContainerStore (const MWWorld::Ptr& ptr) const
@ -512,7 +512,7 @@ namespace MWClass
void Creature::registerSelf() void Creature::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Creature); std::shared_ptr<Class> instance (new Creature);
registerClass (typeid (ESM::Creature).name(), instance); registerClass (typeid (ESM::Creature).name(), instance);
} }
@ -803,7 +803,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
// Create a CustomData, but don't fill it from ESM records (not needed) // Create a CustomData, but don't fill it from ESM records (not needed)
std::auto_ptr<CreatureCustomData> data (new CreatureCustomData); std::unique_ptr<CreatureCustomData> data (new CreatureCustomData);
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>(); MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
@ -862,7 +862,7 @@ namespace MWClass
// Reset to original position // Reset to original position
ptr.getRefData().setPosition(ptr.getCellRef().getPosition()); ptr.getRefData().setPosition(ptr.getCellRef().getPosition());
ptr.getRefData().setCustomData(NULL); ptr.getRefData().setCustomData(nullptr);
} }
} }
} }

View file

@ -74,7 +74,7 @@ namespace MWClass
virtual void setActorHealth(const MWWorld::Ptr& ptr, float health, const MWWorld::Ptr& attacker) const; virtual void setActorHealth(const MWWorld::Ptr& ptr, float health, const MWWorld::Ptr& attacker) const;
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation

View file

@ -47,7 +47,7 @@ namespace MWClass
void CreatureLevList::registerSelf() void CreatureLevList::registerSelf()
{ {
boost::shared_ptr<Class> instance (new CreatureLevList); std::shared_ptr<Class> instance (new CreatureLevList);
registerClass (typeid (ESM::CreatureLevList).name(), instance); registerClass (typeid (ESM::CreatureLevList).name(), instance);
} }
@ -91,7 +91,7 @@ namespace MWClass
{ {
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
std::auto_ptr<CreatureLevListCustomData> data (new CreatureLevListCustomData); std::unique_ptr<CreatureLevListCustomData> data (new CreatureLevListCustomData);
data->mSpawnActorId = -1; data->mSpawnActorId = -1;
data->mSpawn = true; data->mSpawn = true;

View file

@ -78,7 +78,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Door> *ref = MWWorld::LiveCellRef<ESM::Door> *ref =
ptr.get<ESM::Door>(); ptr.get<ESM::Door>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -95,7 +95,7 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>(); MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
@ -139,14 +139,14 @@ namespace MWClass
if(!ptr.getCellRef().getTrap().empty()) if(!ptr.getCellRef().getTrap().empty())
{ {
// Trap activation // Trap activation
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().getTrap(), ptr)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTrap(actor, ptr.getCellRef().getTrap(), ptr));
action->setSound(trapActivationSound); action->setSound(trapActivationSound);
return action; return action;
} }
if (ptr.getCellRef().getTeleport()) if (ptr.getCellRef().getTeleport())
{ {
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionTeleport (ptr.getCellRef().getDestCell(), ptr.getCellRef().getDoorDest(), true));
action->setSound(openSound); action->setSound(openSound);
@ -155,7 +155,7 @@ namespace MWClass
else else
{ {
// animated door // animated door
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(ptr)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionDoor(ptr));
int doorstate = getDoorState(ptr); int doorstate = getDoorState(ptr);
bool opening = true; bool opening = true;
if (doorstate == 1) if (doorstate == 1)
@ -188,7 +188,7 @@ namespace MWClass
else else
{ {
// locked, and we can't open. // locked, and we can't open.
boost::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction); std::shared_ptr<MWWorld::Action> action(new MWWorld::FailedAction);
action->setSound(lockedSound); action->setSound(lockedSound);
return action; return action;
} }
@ -217,7 +217,7 @@ namespace MWClass
void Door::registerSelf() void Door::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Door); std::shared_ptr<Class> instance (new Door);
registerClass (typeid (ESM::Door).name(), instance); registerClass (typeid (ESM::Door).name(), instance);
} }
@ -307,7 +307,7 @@ namespace MWClass
{ {
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
std::auto_ptr<DoorCustomData> data(new DoorCustomData); std::unique_ptr<DoorCustomData> data(new DoorCustomData);
data->mDoorState = 0; data->mDoorState = 0;
ptr.getRefData().setCustomData(data.release()); ptr.getRefData().setCustomData(data.release());

View file

@ -28,7 +28,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation

View file

@ -48,7 +48,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Ingredient> *ref = MWWorld::LiveCellRef<ESM::Ingredient> *ref =
ptr.get<ESM::Ingredient>(); ptr.get<ESM::Ingredient>();
assert(ref->mBase != NULL); assert(ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -65,7 +65,7 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
@ -88,9 +88,9 @@ namespace MWClass
} }
boost::shared_ptr<MWWorld::Action> Ingredient::use (const MWWorld::Ptr& ptr) const std::shared_ptr<MWWorld::Action> Ingredient::use (const MWWorld::Ptr& ptr) const
{ {
boost::shared_ptr<MWWorld::Action> action (new MWWorld::ActionEat (ptr)); std::shared_ptr<MWWorld::Action> action (new MWWorld::ActionEat (ptr));
action->setSound ("Swallow"); action->setSound ("Swallow");
@ -99,7 +99,7 @@ namespace MWClass
void Ingredient::registerSelf() void Ingredient::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Ingredient); std::shared_ptr<Class> instance (new Ingredient);
registerClass (typeid (ESM::Ingredient).name(), instance); registerClass (typeid (ESM::Ingredient).name(), instance);
} }

View file

@ -24,7 +24,7 @@ namespace MWClass
///< \return name (the one that is to be presented to the user; not the internal one); ///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string. /// can return an empty string.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
@ -40,7 +40,7 @@ namespace MWClass
virtual int getValue (const MWWorld::Ptr& ptr) const; virtual int getValue (const MWWorld::Ptr& ptr) const;
///< Return trade value of the object. Throws an exception, if the object can't be traded. ///< Return trade value of the object. Throws an exception, if the object can't be traded.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual std::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu

View file

@ -17,7 +17,7 @@ namespace MWClass
void ItemLevList::registerSelf() void ItemLevList::registerSelf()
{ {
boost::shared_ptr<Class> instance (new ItemLevList); std::shared_ptr<Class> instance (new ItemLevList);
registerClass (typeid (ESM::ItemLevList).name(), instance); registerClass (typeid (ESM::ItemLevList).name(), instance);
} }

View file

@ -45,7 +45,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Light> *ref = MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>(); ptr.get<ESM::Light>();
assert (ref->mBase != NULL); assert (ref->mBase != nullptr);
// TODO: add option somewhere to enable collision for placeable objects // TODO: add option somewhere to enable collision for placeable objects
if (!model.empty() && (ref->mBase->mData.mFlags & ESM::Light::Carry) == 0) if (!model.empty() && (ref->mBase->mData.mFlags & ESM::Light::Carry) == 0)
@ -63,7 +63,7 @@ namespace MWClass
{ {
MWWorld::LiveCellRef<ESM::Light> *ref = MWWorld::LiveCellRef<ESM::Light> *ref =
ptr.get<ESM::Light>(); ptr.get<ESM::Light>();
assert (ref->mBase != NULL); assert (ref->mBase != nullptr);
const std::string &model = ref->mBase->mModel; const std::string &model = ref->mBase->mModel;
if (!model.empty()) { if (!model.empty()) {
@ -83,15 +83,15 @@ namespace MWClass
return ref->mBase->mName; return ref->mBase->mName;
} }
boost::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr, std::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const const MWWorld::Ptr& actor) const
{ {
if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory)) if(!MWBase::Environment::get().getWindowManager()->isAllowed(MWGui::GW_Inventory))
return boost::shared_ptr<MWWorld::Action>(new MWWorld::NullAction()); return std::shared_ptr<MWWorld::Action>(new MWWorld::NullAction());
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>(); MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
if(!(ref->mBase->mData.mFlags&ESM::Light::Carry)) if(!(ref->mBase->mData.mFlags&ESM::Light::Carry))
return boost::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction()); return std::shared_ptr<MWWorld::Action>(new MWWorld::FailedAction());
return defaultItemActivate(ptr, actor); return defaultItemActivate(ptr, actor);
} }
@ -127,7 +127,7 @@ namespace MWClass
void Light::registerSelf() void Light::registerSelf()
{ {
boost::shared_ptr<Class> instance (new Light); std::shared_ptr<Class> instance (new Light);
registerClass (typeid (ESM::Light).name(), instance); registerClass (typeid (ESM::Light).name(), instance);
} }
@ -186,9 +186,9 @@ namespace MWClass
return info; return info;
} }
boost::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const std::shared_ptr<MWWorld::Action> Light::use (const MWWorld::Ptr& ptr) const
{ {
boost::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr)); std::shared_ptr<MWWorld::Action> action(new MWWorld::ActionEquip(ptr));
action->setSound(getUpSoundId(ptr)); action->setSound(getUpSoundId(ptr));

View file

@ -30,7 +30,7 @@ namespace MWClass
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const; virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::Ptr& ptr) const;
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip. ///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
virtual boost::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr, virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
const MWWorld::Ptr& actor) const; const MWWorld::Ptr& actor) const;
///< Generate action for activation ///< Generate action for activation
@ -55,7 +55,7 @@ namespace MWClass
virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const; virtual std::string getInventoryIcon (const MWWorld::Ptr& ptr) const;
///< Return name of inventory icon. ///< Return name of inventory icon.
virtual boost::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr) virtual std::shared_ptr<MWWorld::Action> use (const MWWorld::Ptr& ptr)
const; const;
///< Generate action for using via inventory menu ///< Generate action for using via inventory menu

Some files were not shown because too many files have changed in this diff Show more