mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 15:15:37 +00:00
Replace shared_ptr by unique_ptr
This commit is contained in:
parent
cfc951d645
commit
df092b558b
10 changed files with 24 additions and 22 deletions
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include <osg/Vec2f>
|
#include <osg/Vec2f>
|
||||||
|
|
||||||
|
#include <MyGUI_ITexture.h>
|
||||||
|
|
||||||
#include "windowpinnablebase.hpp"
|
#include "windowpinnablebase.hpp"
|
||||||
|
|
||||||
#include <components/esm3/cellid.hpp>
|
#include <components/esm3/cellid.hpp>
|
||||||
|
@ -142,8 +144,8 @@ namespace MWGui
|
||||||
|
|
||||||
MyGUI::ImageBox* mMapWidget;
|
MyGUI::ImageBox* mMapWidget;
|
||||||
MyGUI::ImageBox* mFogWidget;
|
MyGUI::ImageBox* mFogWidget;
|
||||||
std::shared_ptr<MyGUI::ITexture> mMapTexture;
|
std::unique_ptr<MyGUI::ITexture> mMapTexture;
|
||||||
std::shared_ptr<MyGUI::ITexture> mFogTexture;
|
std::unique_ptr<MyGUI::ITexture> mFogTexture;
|
||||||
int mCellX;
|
int mCellX;
|
||||||
int mCellY;
|
int mCellY;
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
|
|
||||||
~PartHolder();
|
~PartHolder();
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> getNode()
|
const osg::ref_ptr<osg::Node>& getNode() const
|
||||||
{
|
{
|
||||||
return mNode;
|
return mNode;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ private:
|
||||||
void operator= (const PartHolder&);
|
void operator= (const PartHolder&);
|
||||||
PartHolder(const PartHolder&);
|
PartHolder(const PartHolder&);
|
||||||
};
|
};
|
||||||
typedef std::shared_ptr<PartHolder> PartHolderPtr;
|
using PartHolderPtr = std::unique_ptr<PartHolder>;
|
||||||
|
|
||||||
struct EffectParams
|
struct EffectParams
|
||||||
{
|
{
|
||||||
|
|
|
@ -135,7 +135,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
|
||||||
|
|
||||||
segment.saveFogOfWar(fog->mFogTextures.back());
|
segment.saveFogOfWar(fog->mFogTextures.back());
|
||||||
|
|
||||||
cell->setFog(fog.release());
|
cell->setFog(std::move(fog));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -169,7 +169,7 @@ void LocalMap::saveFogOfWar(MWWorld::CellStore* cell)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cell->setFog(fog.release());
|
cell->setFog(std::move(fog));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,8 +425,8 @@ int NpcAnimation::getSlot(const osg::NodePath &path) const
|
||||||
{
|
{
|
||||||
for (int i=0; i<ESM::PRT_Count; ++i)
|
for (int i=0; i<ESM::PRT_Count; ++i)
|
||||||
{
|
{
|
||||||
PartHolderPtr part = mObjectParts[i];
|
const PartHolder* const part = mObjectParts[i].get();
|
||||||
if (!part.get())
|
if (part == nullptr)
|
||||||
continue;
|
continue;
|
||||||
if (std::find(path.begin(), path.end(), part->getNode().get()) != path.end())
|
if (std::find(path.begin(), path.end(), part->getNode().get()) != path.end())
|
||||||
{
|
{
|
||||||
|
@ -1023,8 +1023,8 @@ void NpcAnimation::releaseArrow(float attackStrength)
|
||||||
|
|
||||||
osg::Group* NpcAnimation::getArrowBone()
|
osg::Group* NpcAnimation::getArrowBone()
|
||||||
{
|
{
|
||||||
PartHolderPtr part = mObjectParts[ESM::PRT_Weapon];
|
const PartHolder* const part = mObjectParts[ESM::PRT_Weapon].get();
|
||||||
if (!part)
|
if (part == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
const MWWorld::InventoryStore& inv = mPtr.getClass().getInventoryStore(mPtr);
|
||||||
|
@ -1048,8 +1048,8 @@ osg::Group* NpcAnimation::getArrowBone()
|
||||||
|
|
||||||
osg::Node* NpcAnimation::getWeaponNode()
|
osg::Node* NpcAnimation::getWeaponNode()
|
||||||
{
|
{
|
||||||
PartHolderPtr part = mObjectParts[ESM::PRT_Weapon];
|
const PartHolder* const part = mObjectParts[ESM::PRT_Weapon].get();
|
||||||
if (!part)
|
if (part == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return part->getNode();
|
return part->getNode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,9 +153,9 @@ namespace MWSound
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
std::shared_ptr<Video::MovieAudioDecoder> MovieAudioFactory::createDecoder(Video::VideoState* videoState)
|
std::unique_ptr<Video::MovieAudioDecoder> MovieAudioFactory::createDecoder(Video::VideoState* videoState)
|
||||||
{
|
{
|
||||||
std::shared_ptr<MWSound::MovieAudioDecoder> decoder(new MWSound::MovieAudioDecoder(videoState));
|
std::unique_ptr<MWSound::MovieAudioDecoder> decoder(new MWSound::MovieAudioDecoder(videoState));
|
||||||
decoder->setupFormat();
|
decoder->setupFormat();
|
||||||
|
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace MWSound
|
||||||
|
|
||||||
class MovieAudioFactory : public Video::MovieAudioFactory
|
class MovieAudioFactory : public Video::MovieAudioFactory
|
||||||
{
|
{
|
||||||
std::shared_ptr<Video::MovieAudioDecoder> createDecoder(Video::VideoState* videoState) override;
|
std::unique_ptr<Video::MovieAudioDecoder> createDecoder(Video::VideoState* videoState) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1029,9 +1029,9 @@ namespace MWWorld
|
||||||
return !(left==right);
|
return !(left==right);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellStore::setFog(ESM::FogState *fog)
|
void CellStore::setFog(std::unique_ptr<ESM::FogState>&& fog)
|
||||||
{
|
{
|
||||||
mFogState.reset(fog);
|
mFogState = std::move(fog);
|
||||||
}
|
}
|
||||||
|
|
||||||
ESM::FogState* CellStore::getFog() const
|
ESM::FogState* CellStore::getFog() const
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <components/esm3/loadnpc.hpp>
|
#include <components/esm3/loadnpc.hpp>
|
||||||
#include <components/esm3/loadmisc.hpp>
|
#include <components/esm3/loadmisc.hpp>
|
||||||
#include <components/esm3/loadbody.hpp>
|
#include <components/esm3/loadbody.hpp>
|
||||||
|
#include <components/esm3/fogstate.hpp>
|
||||||
|
|
||||||
#include "timestamp.hpp"
|
#include "timestamp.hpp"
|
||||||
#include "ptr.hpp"
|
#include "ptr.hpp"
|
||||||
|
@ -39,7 +40,6 @@ namespace ESM
|
||||||
{
|
{
|
||||||
struct Cell;
|
struct Cell;
|
||||||
struct CellState;
|
struct CellState;
|
||||||
struct FogState;
|
|
||||||
struct CellId;
|
struct CellId;
|
||||||
struct RefNum;
|
struct RefNum;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ namespace MWWorld
|
||||||
// Even though fog actually belongs to the player and not cells,
|
// Even though fog actually belongs to the player and not cells,
|
||||||
// it makes sense to store it here since we need it once for each cell.
|
// it makes sense to store it here since we need it once for each cell.
|
||||||
// Note this is nullptr until the cell is explored to save some memory
|
// Note this is nullptr until the cell is explored to save some memory
|
||||||
std::shared_ptr<ESM::FogState> mFogState;
|
std::unique_ptr<ESM::FogState> mFogState;
|
||||||
|
|
||||||
const ESM::Cell *mCell;
|
const ESM::Cell *mCell;
|
||||||
State mState;
|
State mState;
|
||||||
|
@ -254,7 +254,7 @@ namespace MWWorld
|
||||||
|
|
||||||
void setWaterLevel (float level);
|
void setWaterLevel (float level);
|
||||||
|
|
||||||
void setFog (ESM::FogState* fog);
|
void setFog(std::unique_ptr<ESM::FogState>&& fog);
|
||||||
///< \note Takes ownership of the pointer
|
///< \note Takes ownership of the pointer
|
||||||
|
|
||||||
ESM::FogState* getFog () const;
|
ESM::FogState* getFog () const;
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace Video
|
||||||
class MovieAudioFactory
|
class MovieAudioFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual std::shared_ptr<MovieAudioDecoder> createDecoder(VideoState* videoState) = 0;
|
virtual std::unique_ptr<MovieAudioDecoder> createDecoder(VideoState* videoState) = 0;
|
||||||
virtual ~MovieAudioFactory() {}
|
virtual ~MovieAudioFactory() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
2
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
2
extern/osg-ffmpeg-videoplayer/videostate.hpp
vendored
|
@ -161,7 +161,7 @@ struct VideoState {
|
||||||
osg::ref_ptr<osg::Texture2D> mTexture;
|
osg::ref_ptr<osg::Texture2D> mTexture;
|
||||||
|
|
||||||
MovieAudioFactory* mAudioFactory;
|
MovieAudioFactory* mAudioFactory;
|
||||||
std::shared_ptr<MovieAudioDecoder> mAudioDecoder;
|
std::unique_ptr<MovieAudioDecoder> mAudioDecoder;
|
||||||
|
|
||||||
ExternalClock mExternalClock;
|
ExternalClock mExternalClock;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue