replaced auto_ptr with unique_ptr

c++11
Marc Zinnschlag 10 years ago
parent ff108b4c6b
commit 3c76764ef4

@ -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;

@ -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())

@ -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);
} }

@ -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;

@ -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();

@ -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);

@ -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)
{ {
} }
@ -324,11 +324,11 @@ CSVWorld::IdContextMenu::IdContextMenu(QWidget *widget, CSMWorld::ColumnBase::Di
Q_ASSERT(mWidget != NULL); Q_ASSERT(mWidget != NULL);
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);
@ -352,7 +352,7 @@ 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 = "";
@ -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));
@ -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))
@ -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());
} }

@ -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,

@ -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);

@ -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;

@ -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());
} }

@ -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;

@ -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;

@ -338,7 +338,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

@ -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>();
@ -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());
} }

@ -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>();
@ -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>();

@ -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;

@ -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());

@ -290,7 +290,7 @@ namespace MWClass
{ {
if (!ptr.getRefData().getCustomData()) if (!ptr.getRefData().getCustomData())
{ {
std::auto_ptr<NpcCustomData> data(new NpcCustomData); std::unique_ptr<NpcCustomData> data(new NpcCustomData);
MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>(); MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
@ -1238,7 +1238,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<NpcCustomData> data (new NpcCustomData); std::unique_ptr<NpcCustomData> data (new NpcCustomData);
ptr.getRefData().setCustomData (data.release()); ptr.getRefData().setCustomData (data.release());
} }
} }

@ -59,6 +59,8 @@ namespace MWGui
center(); center();
} }
AlchemyWindow::~AlchemyWindow() {}
void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender) void AlchemyWindow::onCancelButtonClicked(MyGUI::Widget* _sender)
{ {
exit(); exit();

@ -21,6 +21,7 @@ namespace MWGui
{ {
public: public:
AlchemyWindow(); AlchemyWindow();
~AlchemyWindow();
virtual void open(); virtual void open();
virtual void exit(); virtual void exit();
@ -48,7 +49,7 @@ namespace MWGui
void update(); void update();
std::auto_ptr<MWMechanics::Alchemy> mAlchemy; std::unique_ptr<MWMechanics::Alchemy> mAlchemy;
std::vector<ItemWidget*> mApparatus; std::vector<ItemWidget*> mApparatus;
std::vector<ItemWidget*> mIngredients; std::vector<ItemWidget*> mIngredients;

@ -102,6 +102,8 @@ namespace MWGui
adjustPanes(); adjustPanes();
} }
InventoryWindow::~InventoryWindow() {}
void InventoryWindow::adjustPanes() void InventoryWindow::adjustPanes()
{ {
const float aspect = 0.5; // fixed aspect ratio for the avatar image const float aspect = 0.5; // fixed aspect ratio for the avatar image

@ -39,6 +39,8 @@ namespace MWGui
public: public:
InventoryWindow(DragAndDrop* dragAndDrop, osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem); InventoryWindow(DragAndDrop* dragAndDrop, osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem);
~InventoryWindow();
virtual void open(); virtual void open();
/// start trading, disables item drag&drop /// start trading, disables item drag&drop
@ -99,8 +101,8 @@ namespace MWGui
int mLastXSize; int mLastXSize;
int mLastYSize; int mLastYSize;
std::auto_ptr<MyGUI::ITexture> mPreviewTexture; std::unique_ptr<MyGUI::ITexture> mPreviewTexture;
std::auto_ptr<MWRender::InventoryPreview> mPreview; std::unique_ptr<MWRender::InventoryPreview> mPreview;
bool mTrading; bool mTrading;

@ -76,7 +76,7 @@ namespace MWGui
// TODO: add releaseGLObjects() for mTexture // TODO: add releaseGLObjects() for mTexture
osg::ref_ptr<osg::Texture2D> mTexture; osg::ref_ptr<osg::Texture2D> mTexture;
std::auto_ptr<MyGUI::ITexture> mGuiTexture; std::unique_ptr<MyGUI::ITexture> mGuiTexture;
void changeWallpaper(); void changeWallpaper();

@ -217,8 +217,8 @@ namespace MWGui
void globalMapUpdatePlayer(); void globalMapUpdatePlayer();
MyGUI::ScrollView* mGlobalMap; MyGUI::ScrollView* mGlobalMap;
std::auto_ptr<MyGUI::ITexture> mGlobalMapTexture; std::unique_ptr<MyGUI::ITexture> mGlobalMapTexture;
std::auto_ptr<MyGUI::ITexture> mGlobalMapOverlayTexture; std::unique_ptr<MyGUI::ITexture> mGlobalMapOverlayTexture;
MyGUI::ImageBox* mGlobalMapImage; MyGUI::ImageBox* mGlobalMapImage;
MyGUI::ImageBox* mGlobalMapOverlay; MyGUI::ImageBox* mGlobalMapOverlay;
MyGUI::ImageBox* mPlayerArrowLocal; MyGUI::ImageBox* mPlayerArrowLocal;

@ -112,6 +112,8 @@ namespace MWGui
updateSpellPowers(); updateSpellPowers();
} }
RaceDialog::~RaceDialog() {}
void RaceDialog::setNextButtonShow(bool shown) void RaceDialog::setNextButtonShow(bool shown)
{ {
MyGUI::Button* okButton; MyGUI::Button* okButton;

@ -36,6 +36,8 @@ namespace MWGui
public: public:
RaceDialog(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem); RaceDialog(osgViewer::Viewer* viewer, Resource::ResourceSystem* resourceSystem);
~RaceDialog();
enum Gender enum Gender
{ {
GM_Male, GM_Male,
@ -115,8 +117,8 @@ namespace MWGui
float mCurrentAngle; float mCurrentAngle;
std::auto_ptr<MWRender::RaceSelectionPreview> mPreview; std::unique_ptr<MWRender::RaceSelectionPreview> mPreview;
std::auto_ptr<MyGUI::ITexture> mPreviewTexture; std::unique_ptr<MyGUI::ITexture> mPreviewTexture;
bool mPreviewDirty; bool mPreviewDirty;
}; };

@ -48,7 +48,7 @@ namespace MWGui
void fillSaveList(); void fillSaveList();
std::auto_ptr<MyGUI::ITexture> mScreenshotTexture; std::unique_ptr<MyGUI::ITexture> mScreenshotTexture;
MyGUI::ImageBox* mScreenshot; MyGUI::ImageBox* mScreenshot;
bool mSaving; bool mSaving;

@ -56,7 +56,7 @@ namespace MWGui
private: private:
MyGUI::ScrollView* mScrollView; MyGUI::ScrollView* mScrollView;
std::auto_ptr<SpellModel> mModel; std::unique_ptr<SpellModel> mModel;
/// tracks a row in the spell view /// tracks a row in the spell view
struct LineInfo struct LineInfo

@ -51,8 +51,8 @@ namespace MWGui
private: private:
const VFS::Manager* mVFS; const VFS::Manager* mVFS;
std::auto_ptr<MyGUI::ITexture> mTexture; std::unique_ptr<MyGUI::ITexture> mTexture;
std::auto_ptr<Video::VideoPlayer> mPlayer; std::unique_ptr<Video::VideoPlayer> mPlayer;
}; };
} }

@ -376,7 +376,7 @@ namespace MWGui
osgMyGUI::Platform* mGuiPlatform; osgMyGUI::Platform* mGuiPlatform;
osgViewer::Viewer* mViewer; osgViewer::Viewer* mViewer;
std::auto_ptr<Gui::FontLoader> mFontLoader; std::unique_ptr<Gui::FontLoader> mFontLoader;
bool mConsoleOnlyScripts; bool mConsoleOnlyScripts;

@ -32,7 +32,7 @@ namespace MWMechanics
AiState& getAiState(); AiState& getAiState();
private: private:
std::auto_ptr<CharacterController> mCharacterController; std::unique_ptr<CharacterController> mCharacterController;
AiState mAiState; AiState mAiState;
}; };

@ -59,7 +59,7 @@ int MWMechanics::AiActivate::getTypeId() const
void MWMechanics::AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const void MWMechanics::AiActivate::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiActivate> activate(new ESM::AiSequence::AiActivate()); std::unique_ptr<ESM::AiSequence::AiActivate> activate(new ESM::AiSequence::AiActivate());
activate->mTargetId = mObjectId; activate->mTargetId = mObjectId;
ESM::AiSequence::AiPackageContainer package; ESM::AiSequence::AiPackageContainer package;

@ -632,7 +632,7 @@ namespace MWMechanics
void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const void AiCombat::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiCombat> combat(new ESM::AiSequence::AiCombat()); std::unique_ptr<ESM::AiSequence::AiCombat> combat(new ESM::AiSequence::AiCombat());
combat->mTargetActorId = mTargetActorId; combat->mTargetActorId = mTargetActorId;
ESM::AiSequence::AiPackageContainer package; ESM::AiSequence::AiPackageContainer package;

@ -117,7 +117,7 @@ namespace MWMechanics
void AiEscort::writeState(ESM::AiSequence::AiSequence &sequence) const void AiEscort::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiEscort> escort(new ESM::AiSequence::AiEscort()); std::unique_ptr<ESM::AiSequence::AiEscort> escort(new ESM::AiSequence::AiEscort());
escort->mData.mX = mX; escort->mData.mX = mX;
escort->mData.mY = mY; escort->mData.mY = mY;
escort->mData.mZ = mZ; escort->mData.mZ = mZ;

@ -172,7 +172,7 @@ bool AiFollow::isCommanded() const
void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiFollow> follow(new ESM::AiSequence::AiFollow()); std::unique_ptr<ESM::AiSequence::AiFollow> follow(new ESM::AiSequence::AiFollow());
follow->mData.mX = mX; follow->mData.mX = mX;
follow->mData.mY = mY; follow->mData.mY = mY;
follow->mData.mZ = mZ; follow->mData.mZ = mZ;

@ -81,7 +81,7 @@ MWWorld::Ptr AiPursue::getTarget() const
void AiPursue::writeState(ESM::AiSequence::AiSequence &sequence) const void AiPursue::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiPursue> pursue(new ESM::AiSequence::AiPursue()); std::unique_ptr<ESM::AiSequence::AiPursue> pursue(new ESM::AiSequence::AiPursue());
pursue->mTargetActorId = mTargetActorId; pursue->mTargetActorId = mTargetActorId;
ESM::AiSequence::AiPackageContainer package; ESM::AiSequence::AiPackageContainer package;

@ -94,7 +94,7 @@ namespace MWMechanics
void AiTravel::writeState(ESM::AiSequence::AiSequence &sequence) const void AiTravel::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiTravel> travel(new ESM::AiSequence::AiTravel()); std::unique_ptr<ESM::AiSequence::AiTravel> travel(new ESM::AiSequence::AiTravel());
travel->mData.mX = mX; travel->mData.mX = mX;
travel->mData.mY = mY; travel->mData.mY = mY;
travel->mData.mZ = mZ; travel->mData.mZ = mZ;

@ -726,7 +726,7 @@ namespace MWMechanics
void AiWander::writeState(ESM::AiSequence::AiSequence &sequence) const void AiWander::writeState(ESM::AiSequence::AiSequence &sequence) const
{ {
std::auto_ptr<ESM::AiSequence::AiWander> wander(new ESM::AiSequence::AiWander()); std::unique_ptr<ESM::AiSequence::AiWander> wander(new ESM::AiSequence::AiWander());
wander->mData.mDistance = mDistance; wander->mData.mDistance = mDistance;
wander->mData.mDuration = mDuration; wander->mData.mDuration = mDuration;
wander->mData.mTimeOfDay = mTimeOfDay; wander->mData.mTimeOfDay = mTimeOfDay;

@ -19,7 +19,7 @@ namespace MWPhysics
Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<NifBullet::BulletShapeInstance> shape, btCollisionWorld* world) Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<NifBullet::BulletShapeInstance> shape, btCollisionWorld* world)
: mCanWaterWalk(false), mWalkingOnWater(false) : mCanWaterWalk(false), mWalkingOnWater(false)
, mCollisionObject(0), mForce(0.f, 0.f, 0.f), mOnGround(false) , mCollisionObject(nullptr), mForce(0.f, 0.f, 0.f), mOnGround(false)
, mInternalCollisionMode(true) , mInternalCollisionMode(true)
, mExternalCollisionMode(true) , mExternalCollisionMode(true)
, mCollisionWorld(world) , mCollisionWorld(world)

@ -109,9 +109,9 @@ namespace MWPhysics
bool mCanWaterWalk; bool mCanWaterWalk;
bool mWalkingOnWater; bool mWalkingOnWater;
std::auto_ptr<btCollisionShape> mShape; std::unique_ptr<btCollisionShape> mShape;
std::auto_ptr<btCollisionObject> mCollisionObject; std::unique_ptr<btCollisionObject> mCollisionObject;
osg::Vec3f mMeshTranslation; osg::Vec3f mMeshTranslation;
osg::Vec3f mHalfExtents; osg::Vec3f mHalfExtents;

@ -587,7 +587,7 @@ namespace MWPhysics
} }
private: private:
std::auto_ptr<btCollisionObject> mCollisionObject; std::unique_ptr<btCollisionObject> mCollisionObject;
osg::ref_ptr<NifBullet::BulletShapeInstance> mShapeInstance; osg::ref_ptr<NifBullet::BulletShapeInstance> mShapeInstance;
}; };

@ -145,7 +145,7 @@ namespace MWPhysics
btCollisionDispatcher* mDispatcher; btCollisionDispatcher* mDispatcher;
btCollisionWorld* mCollisionWorld; btCollisionWorld* mCollisionWorld;
std::auto_ptr<NifBullet::BulletShapeManager> mShapeManager; std::unique_ptr<NifBullet::BulletShapeManager> mShapeManager;
typedef std::map<MWWorld::Ptr, Object*> ObjectMap; typedef std::map<MWWorld::Ptr, Object*> ObjectMap;
ObjectMap mObjects; ObjectMap mObjects;
@ -176,10 +176,10 @@ namespace MWPhysics
float mWaterHeight; float mWaterHeight;
float mWaterEnabled; float mWaterEnabled;
std::auto_ptr<btCollisionObject> mWaterCollisionObject; std::unique_ptr<btCollisionObject> mWaterCollisionObject;
std::auto_ptr<btCollisionShape> mWaterCollisionShape; std::unique_ptr<btCollisionShape> mWaterCollisionShape;
std::auto_ptr<MWRender::DebugDrawer> mDebugDrawer; std::unique_ptr<MWRender::DebugDrawer> mDebugDrawer;
osg::ref_ptr<osg::Group> mParentNode; osg::ref_ptr<osg::Group> mParentNode;

@ -111,7 +111,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
if (segment.mFogOfWarImage && segment.mHasFogState) if (segment.mFogOfWarImage && segment.mHasFogState)
{ {
std::auto_ptr<ESM::FogState> fog (new ESM::FogState()); std::unique_ptr<ESM::FogState> fog (new ESM::FogState());
fog->mFogTextures.push_back(ESM::FogTexture()); fog->mFogTextures.push_back(ESM::FogTexture());
segment.saveFogOfWar(fog->mFogTextures.back()); segment.saveFogOfWar(fog->mFogTextures.back());
@ -128,7 +128,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
const int segsX = static_cast<int>(std::ceil(length.x() / mMapWorldSize)); const int segsX = static_cast<int>(std::ceil(length.x() / mMapWorldSize));
const int segsY = static_cast<int>(std::ceil(length.y() / mMapWorldSize)); const int segsY = static_cast<int>(std::ceil(length.y() / mMapWorldSize));
std::auto_ptr<ESM::FogState> fog (new ESM::FogState()); std::unique_ptr<ESM::FogState> fog (new ESM::FogState());
fog->mBounds.mMinX = mBounds.xMin(); fog->mBounds.mMinX = mBounds.xMin();
fog->mBounds.mMaxX = mBounds.xMax(); fog->mBounds.mMaxX = mBounds.xMax();

@ -123,7 +123,7 @@ void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool
{ {
insertBegin(ptr); insertBegin(ptr);
std::auto_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight)); std::unique_ptr<ObjectAnimation> anim (new ObjectAnimation(ptr, mesh, mResourceSystem, animated, allowLight));
if (!allowLight) if (!allowLight)
{ {
@ -141,7 +141,7 @@ void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, b
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor); ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
// CreatureAnimation // CreatureAnimation
std::auto_ptr<Animation> anim; std::unique_ptr<Animation> anim;
if (weaponsShields) if (weaponsShields)
anim.reset(new CreatureWeaponAnimation(ptr, mesh, mResourceSystem)); anim.reset(new CreatureWeaponAnimation(ptr, mesh, mResourceSystem));
@ -156,7 +156,7 @@ void Objects::insertNPC(const MWWorld::Ptr &ptr)
insertBegin(ptr); insertBegin(ptr);
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor); ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
std::auto_ptr<NpcAnimation> anim (new NpcAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), mResourceSystem)); std::unique_ptr<NpcAnimation> anim (new NpcAnimation(ptr, osg::ref_ptr<osg::Group>(ptr.getRefData().getBaseNode()), mResourceSystem));
mObjects.insert(std::make_pair(ptr, anim.release())); mObjects.insert(std::make_pair(ptr, anim.release()));
} }

@ -178,15 +178,15 @@ namespace MWRender
osg::ref_ptr<osg::Light> mSunLight; osg::ref_ptr<osg::Light> mSunLight;
std::auto_ptr<Pathgrid> mPathgrid; std::unique_ptr<Pathgrid> mPathgrid;
std::auto_ptr<Objects> mObjects; std::unique_ptr<Objects> mObjects;
std::auto_ptr<Water> mWater; std::unique_ptr<Water> mWater;
std::auto_ptr<Terrain::World> mTerrain; std::unique_ptr<Terrain::World> mTerrain;
std::auto_ptr<SkyManager> mSky; std::unique_ptr<SkyManager> mSky;
std::auto_ptr<EffectManager> mEffectManager; std::unique_ptr<EffectManager> mEffectManager;
std::auto_ptr<NpcAnimation> mPlayerAnimation; std::unique_ptr<NpcAnimation> mPlayerAnimation;
osg::ref_ptr<osg::PositionAttitudeTransform> mPlayerNode; osg::ref_ptr<osg::PositionAttitudeTransform> mPlayerNode;
std::auto_ptr<Camera> mCamera; std::unique_ptr<Camera> mCamera;
osg::ref_ptr<StateUpdater> mStateUpdater; osg::ref_ptr<StateUpdater> mStateUpdater;

@ -122,9 +122,9 @@ namespace MWRender
osg::ref_ptr<AtmosphereUpdater> mAtmosphereUpdater; osg::ref_ptr<AtmosphereUpdater> mAtmosphereUpdater;
std::auto_ptr<Sun> mSun; std::unique_ptr<Sun> mSun;
std::auto_ptr<Moon> mMasser; std::unique_ptr<Moon> mMasser;
std::auto_ptr<Moon> mSecunda; std::unique_ptr<Moon> mSecunda;
osg::ref_ptr<osg::Group> mRainNode; osg::ref_ptr<osg::Group> mRainNode;
osg::ref_ptr<osgParticle::ParticleSystem> mRainParticleSystem; osg::ref_ptr<osgParticle::ParticleSystem> mRainParticleSystem;

@ -41,7 +41,7 @@ namespace MWRender
Resource::ResourceSystem* mResourceSystem; Resource::ResourceSystem* mResourceSystem;
osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation; osg::ref_ptr<osgUtil::IncrementalCompileOperation> mIncrementalCompileOperation;
std::auto_ptr<RippleSimulation> mSimulation; std::unique_ptr<RippleSimulation> mSimulation;
bool mEnabled; bool mEnabled;
bool mToggled; bool mToggled;

@ -1,6 +1,6 @@
#include "ffmpeg_decoder.hpp" #include "ffmpeg_decoder.hpp"
// auto_ptr // unique_ptr
#include <memory> #include <memory>
#include <stdexcept> #include <stdexcept>

@ -70,7 +70,7 @@ namespace MWSound
virtual ~OpenAL_Output(); virtual ~OpenAL_Output();
struct StreamThread; struct StreamThread;
std::auto_ptr<StreamThread> mStreamThread; std::unique_ptr<StreamThread> mStreamThread;
friend class OpenAL_Sound; friend class OpenAL_Sound;
friend class OpenAL_Sound3D; friend class OpenAL_Sound3D;

@ -31,7 +31,7 @@ namespace MWSound
{ {
const VFS::Manager* mVFS; const VFS::Manager* mVFS;
std::auto_ptr<Sound_Output> mOutput; std::unique_ptr<Sound_Output> mOutput;
// Caches available music tracks by <playlist name, (sound files) > // Caches available music tracks by <playlist name, (sound files) >
std::map<std::string, std::vector<std::string> > mMusicFiles; std::map<std::string, std::vector<std::string> > mMusicFiles;

@ -299,7 +299,7 @@ namespace Compiler
{ {
// workaround for broken positioncell instructions. // workaround for broken positioncell instructions.
/// \todo add option to disable this /// \todo add option to disable this
std::auto_ptr<ErrorDowngrade> errorDowngrade (0); std::unique_ptr<ErrorDowngrade> errorDowngrade;
if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell") if (Misc::StringUtils::lowerCase (loc.mLiteral)=="positioncell")
errorDowngrade.reset (new ErrorDowngrade (getErrorHandler())); errorDowngrade.reset (new ErrorDowngrade (getErrorHandler()));

@ -170,49 +170,49 @@ namespace AiSequence
{ {
case Ai_Wander: case Ai_Wander:
{ {
std::auto_ptr<AiWander> ptr (new AiWander()); std::unique_ptr<AiWander> ptr (new AiWander());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;
} }
case Ai_Travel: case Ai_Travel:
{ {
std::auto_ptr<AiTravel> ptr (new AiTravel()); std::unique_ptr<AiTravel> ptr (new AiTravel());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;
} }
case Ai_Escort: case Ai_Escort:
{ {
std::auto_ptr<AiEscort> ptr (new AiEscort()); std::unique_ptr<AiEscort> ptr (new AiEscort());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;
} }
case Ai_Follow: case Ai_Follow:
{ {
std::auto_ptr<AiFollow> ptr (new AiFollow()); std::unique_ptr<AiFollow> ptr (new AiFollow());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;
} }
case Ai_Activate: case Ai_Activate:
{ {
std::auto_ptr<AiActivate> ptr (new AiActivate()); std::unique_ptr<AiActivate> ptr (new AiActivate());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;
} }
case Ai_Combat: case Ai_Combat:
{ {
std::auto_ptr<AiCombat> ptr (new AiCombat()); std::unique_ptr<AiCombat> ptr (new AiCombat());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;
} }
case Ai_Pursue: case Ai_Pursue:
{ {
std::auto_ptr<AiPursue> ptr (new AiPursue()); std::unique_ptr<AiPursue> ptr (new AiPursue());
ptr->load(esm); ptr->load(esm);
mPackages.back().mPackage = ptr.release(); mPackages.back().mPackage = ptr.release();
break; break;

@ -18,7 +18,7 @@ void DataManager::setResourcePath(const std::string &path)
MyGUI::IDataStream *DataManager::getData(const std::string &name) MyGUI::IDataStream *DataManager::getData(const std::string &name)
{ {
std::string fullpath = getDataPath(name); std::string fullpath = getDataPath(name);
std::auto_ptr<boost::filesystem::ifstream> stream; std::unique_ptr<boost::filesystem::ifstream> stream;
stream.reset(new boost::filesystem::ifstream); stream.reset(new boost::filesystem::ifstream);
stream->open(fullpath, std::ios::binary); stream->open(fullpath, std::ios::binary);
if (stream->fail()) if (stream->fail())

@ -92,7 +92,7 @@ osg::ref_ptr<BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr nif)
if (findBoundingBox(node)) if (findBoundingBox(node))
{ {
std::auto_ptr<btCompoundShape> compound (new btCompoundShape); std::unique_ptr<btCompoundShape> compound (new btCompoundShape);
btBoxShape* boxShape = new btBoxShape(getbtVector(mShape->mCollisionBoxHalfExtents)); btBoxShape* boxShape = new btBoxShape(getbtVector(mShape->mCollisionBoxHalfExtents));
btTransform transform = btTransform::getIdentity(); btTransform transform = btTransform::getIdentity();

@ -29,8 +29,8 @@ namespace Resource
const VFS::Manager* getVFS() const; const VFS::Manager* getVFS() const;
private: private:
std::auto_ptr<SceneManager> mSceneManager; std::unique_ptr<SceneManager> mSceneManager;
std::auto_ptr<TextureManager> mTextureManager; std::unique_ptr<TextureManager> mTextureManager;
const VFS::Manager* mVFS; const VFS::Manager* mVFS;

@ -58,7 +58,7 @@ namespace SceneUtil
private: private:
// The root bone is not a "real" bone, it has no corresponding node in the scene graph. // The root bone is not a "real" bone, it has no corresponding node in the scene graph.
// As far as the scene graph goes we support multiple root bones. // As far as the scene graph goes we support multiple root bones.
std::auto_ptr<Bone> mRootBone; std::unique_ptr<Bone> mRootBone;
typedef std::map<std::string, std::pair<osg::NodePath, osg::MatrixTransform*> > BoneCache; typedef std::map<std::string, std::pair<osg::NodePath, osg::MatrixTransform*> > BoneCache;
BoneCache mBoneCache; BoneCache mBoneCache;

@ -73,7 +73,7 @@ void TerrainGrid::loadCell(int x, int y)
if (!mStorage->getMinMaxHeights(1, center, minH, maxH)) if (!mStorage->getMinMaxHeights(1, center, minH, maxH))
return; // no terrain defined return; // no terrain defined
std::auto_ptr<GridElement> element (new GridElement); std::unique_ptr<GridElement> element (new GridElement);
osg::Vec2f worldCenter = center*mStorage->getCellWorldSize(); osg::Vec2f worldCenter = center*mStorage->getCellWorldSize();
element->mNode = new osg::PositionAttitudeTransform; element->mNode = new osg::PositionAttitudeTransform;

@ -55,7 +55,7 @@ private:
}; };
std::auto_ptr<AudioResampler> mAudioResampler; std::unique_ptr<AudioResampler> mAudioResampler;
uint8_t *mDataBuf; uint8_t *mDataBuf;
uint8_t **mFrameData; uint8_t **mFrameData;

@ -78,7 +78,7 @@ namespace Video
private: private:
VideoState* mState; VideoState* mState;
std::auto_ptr<MovieAudioFactory> mAudioFactory; std::unique_ptr<MovieAudioFactory> mAudioFactory;
}; };
} }

Loading…
Cancel
Save