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
// 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;
CSMSettings::UserSettings mUserSettings;

@ -138,7 +138,7 @@ void CSMWorld::CommandDispatcher::executeModify (QAbstractItemModel *model, cons
if (mLocked)
return;
std::auto_ptr<CSMWorld::UpdateCellCommand> modifyCell;
std::unique_ptr<CSMWorld::UpdateCellCommand> modifyCell;
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_));
if (modifyCell.get())

@ -738,7 +738,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
const std::string& destination,
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);
mData.insertRecord(*newRecord, type, destination);
}

@ -35,7 +35,7 @@ namespace CSVRender
std::string mId;
osg::ref_ptr<osg::Group> mCellNode;
std::map<std::string, Object *> mObjects;
std::auto_ptr<Terrain::TerrainGrid> mTerrain;
std::unique_ptr<Terrain::TerrainGrid> mTerrain;
int mX;
int mY;

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

@ -91,7 +91,7 @@ namespace CSVWorld
Creator *CreatorFactory<CreatorT, scope>::makeCreator (CSMDoc::Document& document,
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);

@ -66,7 +66,7 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QMo
CSMWorld::Columns::ColumnId columnId = static_cast<CSMWorld::Columns::ColumnId> (
mTable->getColumnId (index.column()));
if (QVariant::String == v.type())
{
label->setText(v.toString());
@ -75,7 +75,7 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QMo
{
int data = v.toInt();
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (columnId));
label->setText(QString::fromUtf8(enumNames.at(data).c_str()));
}
else
@ -116,7 +116,7 @@ mIndex(index)
CSVWorld::DialogueDelegateDispatcherProxy::DialogueDelegateDispatcherProxy(QWidget* editor, CSMWorld::ColumnBase::Display display) :
mEditor(editor),
mDisplay(display),
mIndexWrapper(NULL)
mIndexWrapper(nullptr)
{
}
@ -324,11 +324,11 @@ CSVWorld::IdContextMenu::IdContextMenu(QWidget *widget, CSMWorld::ColumnBase::Di
Q_ASSERT(mWidget != NULL);
Q_ASSERT(CSMWorld::ColumnBase::isId(display));
Q_ASSERT(mIdType != CSMWorld::UniversalId::Type_None);
mWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(mWidget,
SIGNAL(customContextMenuRequested(const QPoint &)),
this,
connect(mWidget,
SIGNAL(customContextMenuRequested(const QPoint &)),
this,
SLOT(showContextMenu(const QPoint &)));
mEditIdAction = new QAction(this);
@ -352,7 +352,7 @@ void CSVWorld::IdContextMenu::excludeId(const std::string &id)
QString CSVWorld::IdContextMenu::getWidgetValue() const
{
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(mWidget);
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(mWidget);
QLabel *label = qobject_cast<QLabel *>(mWidget);
QString value = "";
@ -411,7 +411,7 @@ void CSVWorld::IdContextMenu::showContextMenu(const QPoint &pos)
{
removeEditIdActionFromMenu();
}
if (!mContextMenu->actions().isEmpty())
{
mContextMenu->exec(mWidget->mapToGlobal(pos));
@ -588,9 +588,9 @@ void CSVWorld::EditWidget::remake(int row)
tablesLayout->addWidget(label);
tablesLayout->addWidget(table);
connect(table,
SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)),
this,
connect(table,
SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)),
this,
SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &)));
}
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 (viewRecord()), this, SLOT (viewRecord()));
connect (mButtons, SIGNAL (switchToRow (int)), this, SLOT (switchToRow (int)));
connect (this, SIGNAL (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));
updateCurrentId();
getEditWidget().remake (row);
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);
if (index.isValid())
switchToRow (index.row());
switchToRow (index.row());
}

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

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

@ -65,7 +65,7 @@ namespace CSVWorld
/// Allow subclasses to wrap the create command together with additional commands
/// 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);
CSMWorld::Data& getData() const;

@ -35,7 +35,7 @@ void CSVWorld::ReferenceCreator::configureCreateCommand (CSMWorld::CreateCommand
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)
{
// get the old count
@ -51,11 +51,11 @@ void CSVWorld::ReferenceCreator::pushCommand (std::auto_ptr<CSMWorld::CreateComm
int count = cellTable.data (countIndex).toInt();
// 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));
getUndoStack().beginMacro (command->text());
GenericCreator::pushCommand (command, id);
GenericCreator::pushCommand (std::move (command), id);
getUndoStack().push (increment.release());
getUndoStack().endMacro();
}
@ -148,11 +148,11 @@ void CSVWorld::ReferenceCreator::cloneMode(const std::string& originId,
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
{
return new ReferenceCreator(document.getData(),
document.getUndoStack(),
return new ReferenceCreator(document.getData(),
document.getUndoStack(),
id,
document.getIdCompletionManager());
}

@ -29,7 +29,7 @@ namespace CSVWorld
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);
int getRefNumCount() const;

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

@ -338,7 +338,7 @@ int main(int argc, char**argv)
boost::filesystem::ofstream logfile;
std::auto_ptr<OMW::Engine> engine;
std::unique_ptr<OMW::Engine> engine;
int ret = 0;
try

@ -54,7 +54,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<ContainerCustomData> data (new ContainerCustomData);
std::unique_ptr<ContainerCustomData> data (new ContainerCustomData);
MWWorld::LiveCellRef<ESM::Container> *ref =
ptr.get<ESM::Container>();
@ -299,7 +299,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData())
{
// 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());
}

@ -92,7 +92,7 @@ namespace MWClass
{
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>();
@ -803,7 +803,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData())
{
// 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>();

@ -91,7 +91,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<CreatureLevListCustomData> data (new CreatureLevListCustomData);
std::unique_ptr<CreatureLevListCustomData> data (new CreatureLevListCustomData);
data->mSpawnActorId = -1;
data->mSpawn = true;

@ -307,7 +307,7 @@ namespace MWClass
{
if (!ptr.getRefData().getCustomData())
{
std::auto_ptr<DoorCustomData> data(new DoorCustomData);
std::unique_ptr<DoorCustomData> data(new DoorCustomData);
data->mDoorState = 0;
ptr.getRefData().setCustomData(data.release());

@ -290,7 +290,7 @@ namespace MWClass
{
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>();
@ -1238,7 +1238,7 @@ namespace MWClass
if (!ptr.getRefData().getCustomData())
{
// 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());
}
}

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -59,7 +59,7 @@ int MWMechanics::AiActivate::getTypeId() 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;
ESM::AiSequence::AiPackageContainer package;

@ -632,7 +632,7 @@ namespace MWMechanics
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;
ESM::AiSequence::AiPackageContainer package;

@ -117,7 +117,7 @@ namespace MWMechanics
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.mY = mY;
escort->mData.mZ = mZ;

@ -172,7 +172,7 @@ bool AiFollow::isCommanded() 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.mY = mY;
follow->mData.mZ = mZ;

@ -81,7 +81,7 @@ MWWorld::Ptr AiPursue::getTarget() 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;
ESM::AiSequence::AiPackageContainer package;

@ -94,7 +94,7 @@ namespace MWMechanics
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.mY = mY;
travel->mData.mZ = mZ;

@ -726,7 +726,7 @@ namespace MWMechanics
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.mDuration = mDuration;
wander->mData.mTimeOfDay = mTimeOfDay;

@ -19,7 +19,7 @@ namespace MWPhysics
Actor::Actor(const MWWorld::Ptr& ptr, osg::ref_ptr<NifBullet::BulletShapeInstance> shape, btCollisionWorld* world)
: 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)
, mExternalCollisionMode(true)
, mCollisionWorld(world)

@ -109,9 +109,9 @@ namespace MWPhysics
bool mCanWaterWalk;
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 mHalfExtents;

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

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

@ -111,7 +111,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
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());
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 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.mMaxX = mBounds.xMax();

@ -123,7 +123,7 @@ void Objects::insertModel(const MWWorld::Ptr &ptr, const std::string &mesh, bool
{
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)
{
@ -141,7 +141,7 @@ void Objects::insertCreature(const MWWorld::Ptr &ptr, const std::string &mesh, b
ptr.getRefData().getBaseNode()->setNodeMask(Mask_Actor);
// CreatureAnimation
std::auto_ptr<Animation> anim;
std::unique_ptr<Animation> anim;
if (weaponsShields)
anim.reset(new CreatureWeaponAnimation(ptr, mesh, mResourceSystem));
@ -156,7 +156,7 @@ void Objects::insertNPC(const MWWorld::Ptr &ptr)
insertBegin(ptr);
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()));
}

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

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

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

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

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

@ -31,7 +31,7 @@ namespace MWSound
{
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) >
std::map<std::string, std::vector<std::string> > mMusicFiles;

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

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

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

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

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

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

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

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

Loading…
Cancel
Save