mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 19:45:40 +00:00
Merge branch 'make_shared' into 'master'
Use std::make_shared instead of new See merge request OpenMW/openmw!1753
This commit is contained in:
commit
9275b3c08f
12 changed files with 24 additions and 27 deletions
|
@ -260,11 +260,11 @@ std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, b
|
|||
{
|
||||
case Token::Type_Keyword_True:
|
||||
|
||||
return std::shared_ptr<CSMFilter::Node> (new BooleanNode (true));
|
||||
return std::make_shared<BooleanNode>(true);
|
||||
|
||||
case Token::Type_Keyword_False:
|
||||
|
||||
return std::shared_ptr<CSMFilter::Node> (new BooleanNode (false));
|
||||
return std::make_shared<BooleanNode>(false);
|
||||
|
||||
case Token::Type_Keyword_And:
|
||||
case Token::Type_Keyword_Or:
|
||||
|
@ -278,7 +278,7 @@ std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseImp (bool allowEmpty, b
|
|||
if (mError)
|
||||
return std::shared_ptr<Node>();
|
||||
|
||||
return std::shared_ptr<CSMFilter::Node> (new NotNode (node));
|
||||
return std::make_shared<NotNode>(node);
|
||||
}
|
||||
|
||||
case Token::Type_Keyword_Text:
|
||||
|
@ -340,8 +340,8 @@ std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseNAry (const Token& keyw
|
|||
|
||||
switch (keyword.mType)
|
||||
{
|
||||
case Token::Type_Keyword_And: return std::shared_ptr<CSMFilter::Node> (new AndNode (nodes));
|
||||
case Token::Type_Keyword_Or: return std::shared_ptr<CSMFilter::Node> (new OrNode (nodes));
|
||||
case Token::Type_Keyword_And: return std::make_shared<AndNode>(nodes);
|
||||
case Token::Type_Keyword_Or: return std::make_shared<OrNode>(nodes);
|
||||
default: error(); return std::shared_ptr<Node>();
|
||||
}
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseText()
|
|||
return std::shared_ptr<Node>();
|
||||
}
|
||||
|
||||
return std::shared_ptr<Node> (new TextNode (columnId, text));
|
||||
return std::make_shared<TextNode>(columnId, text);
|
||||
}
|
||||
|
||||
std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
|
||||
|
@ -532,7 +532,7 @@ std::shared_ptr<CSMFilter::Node> CSMFilter::Parser::parseValue()
|
|||
return std::shared_ptr<Node>();
|
||||
}
|
||||
|
||||
return std::shared_ptr<Node> (new ValueNode (columnId, lowerType, upperType, lower, upper));
|
||||
return std::make_shared<ValueNode>(columnId, lowerType, upperType, lower, upper);
|
||||
}
|
||||
|
||||
void CSMFilter::Parser::error()
|
||||
|
|
|
@ -330,9 +330,7 @@ void ActorAnimation::resetControllers(osg::Node* node)
|
|||
if (node == nullptr)
|
||||
return;
|
||||
|
||||
std::shared_ptr<SceneUtil::ControllerSource> src;
|
||||
src.reset(new NullAnimationTime);
|
||||
SceneUtil::ForceControllerSourcesVisitor removeVisitor(src);
|
||||
SceneUtil::ForceControllerSourcesVisitor removeVisitor(std::make_shared<NullAnimationTime>());
|
||||
node->accept(removeVisitor);
|
||||
}
|
||||
|
||||
|
|
|
@ -521,7 +521,7 @@ namespace MWRender
|
|||
, mAlpha(1.f)
|
||||
{
|
||||
for(size_t i = 0;i < sNumBlendMasks;i++)
|
||||
mAnimationTimePtr[i].reset(new AnimationTime);
|
||||
mAnimationTimePtr[i] = std::make_shared<AnimationTime>();
|
||||
|
||||
mLightListCallback = new SceneUtil::LightListCallback;
|
||||
}
|
||||
|
@ -630,8 +630,7 @@ namespace MWRender
|
|||
if(!mResourceSystem->getVFS()->exists(kfname))
|
||||
return;
|
||||
|
||||
std::shared_ptr<AnimSource> animsrc;
|
||||
animsrc.reset(new AnimSource);
|
||||
auto animsrc = std::make_shared<AnimSource>();
|
||||
animsrc->mKeyframes = mResourceSystem->getKeyframeManager()->get(kfname);
|
||||
|
||||
if (!animsrc->mKeyframes || animsrc->mKeyframes->mTextKeys.empty() || animsrc->mKeyframes->mKeyframeControllers.empty())
|
||||
|
@ -660,7 +659,7 @@ namespace MWRender
|
|||
animsrc->mControllerMap[blendMask].insert(std::make_pair(bonename, cloned));
|
||||
}
|
||||
|
||||
mAnimSources.push_back(animsrc);
|
||||
mAnimSources.push_back(std::move(animsrc));
|
||||
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(mAnimationTimePtr[0]);
|
||||
mObjectRoot->accept(assignVisitor);
|
||||
|
@ -1574,7 +1573,7 @@ namespace MWRender
|
|||
params.mLoop = loop;
|
||||
params.mEffectId = effectId;
|
||||
params.mBoneName = bonename;
|
||||
params.mAnimTime = std::shared_ptr<EffectAnimationTime>(new EffectAnimationTime);
|
||||
params.mAnimTime = std::make_shared<EffectAnimationTime>();
|
||||
trans->addUpdateCallback(new UpdateVfxCallback(params));
|
||||
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::shared_ptr<SceneUtil::ControllerSource>(params.mAnimTime));
|
||||
|
|
|
@ -63,7 +63,7 @@ CreatureWeaponAnimation::CreatureWeaponAnimation(const MWWorld::Ptr &ptr, const
|
|||
updateParts();
|
||||
}
|
||||
|
||||
mWeaponAnimationTime = std::shared_ptr<WeaponAnimationTime>(new WeaponAnimationTime(this));
|
||||
mWeaponAnimationTime = std::make_shared<WeaponAnimationTime>(this);
|
||||
}
|
||||
|
||||
void CreatureWeaponAnimation::showWeapons(bool showWeapon)
|
||||
|
|
|
@ -32,7 +32,7 @@ void EffectManager::addEffect(const std::string &model, const std::string& textu
|
|||
node->setNodeMask(Mask_Effect);
|
||||
|
||||
Effect effect;
|
||||
effect.mAnimTime.reset(new EffectAnimationTime);
|
||||
effect.mAnimTime = std::make_shared<EffectAnimationTime>();
|
||||
|
||||
SceneUtil::FindMaxControllerLengthVisitor findMaxLengthVisitor;
|
||||
node->accept(findMaxLengthVisitor);
|
||||
|
|
|
@ -275,8 +275,8 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> par
|
|||
{
|
||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||
|
||||
mHeadAnimationTime = std::shared_ptr<HeadAnimationTime>(new HeadAnimationTime(mPtr));
|
||||
mWeaponAnimationTime = std::shared_ptr<WeaponAnimationTime>(new WeaponAnimationTime(this));
|
||||
mHeadAnimationTime = std::make_shared<HeadAnimationTime>(mPtr);
|
||||
mWeaponAnimationTime = std::make_shared<WeaponAnimationTime>(this);
|
||||
|
||||
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
||||
{
|
||||
|
@ -846,7 +846,7 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
|
|||
if (type == ESM::PRT_Weapon)
|
||||
src = mWeaponAnimationTime;
|
||||
else
|
||||
src.reset(new NullAnimationTime);
|
||||
src = std::make_shared<NullAnimationTime>();
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(src);
|
||||
node->accept(assignVisitor);
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace
|
|||
}
|
||||
|
||||
osg::ref_ptr<NifOsg::FlipController> controller (new NifOsg::FlipController(0, 0.3f/rippleFrameCount, textures));
|
||||
controller->setSource(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
|
||||
controller->setSource(std::make_shared<SceneUtil::FrameTimeSource>());
|
||||
node->addUpdateCallback(controller);
|
||||
|
||||
osg::ref_ptr<osg::StateSet> stateset (new osg::StateSet);
|
||||
|
|
|
@ -642,7 +642,7 @@ namespace MWRender
|
|||
|
||||
mParticleEffect = mSceneManager->getInstance(mCurrentParticleEffect, mParticleNode);
|
||||
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor = std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource);
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor(std::make_shared<SceneUtil::FrameTimeSource>());
|
||||
mParticleEffect->accept(assignVisitor);
|
||||
|
||||
SetupVisitor alphaFaderSetupVisitor(mPrecipitationAlpha);
|
||||
|
|
|
@ -599,7 +599,7 @@ void Water::createSimpleWaterStateSet(osg::Node* node, float alpha)
|
|||
float fps = Fallback::Map::getFloat("Water_SurfaceFPS");
|
||||
|
||||
osg::ref_ptr<NifOsg::FlipController> controller (new NifOsg::FlipController(0, 1.f/fps, textures));
|
||||
controller->setSource(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
|
||||
controller->setSource(std::make_shared<SceneUtil::FrameTimeSource>());
|
||||
node->setUpdateCallback(controller);
|
||||
|
||||
stateset->setTextureAttributeAndModes(0, textures[0], osg::StateAttribute::ON);
|
||||
|
|
|
@ -38,8 +38,8 @@ namespace MWSound
|
|||
public:
|
||||
MovieAudioDecoder(Video::VideoState *videoState)
|
||||
: Video::MovieAudioDecoder(videoState), mAudioTrack(nullptr)
|
||||
, mDecoderBridge(std::make_shared<MWSoundDecoderBridge>(this))
|
||||
{
|
||||
mDecoderBridge.reset(new MWSoundDecoderBridge(this));
|
||||
}
|
||||
|
||||
size_t getSampleOffset()
|
||||
|
|
|
@ -244,7 +244,7 @@ namespace MWWorld
|
|||
|
||||
mParent->addChild(state.mNode);
|
||||
|
||||
state.mEffectAnimationTime.reset(new MWRender::EffectAnimationTime);
|
||||
state.mEffectAnimationTime = std::make_shared<MWRender::EffectAnimationTime>();
|
||||
|
||||
SceneUtil::AssignControllerSourcesVisitor assignVisitor (state.mEffectAnimationTime);
|
||||
state.mNode->accept(assignVisitor);
|
||||
|
|
|
@ -388,9 +388,9 @@ namespace NifOsg
|
|||
{
|
||||
bool autoPlay = animflags & Nif::NiNode::AnimFlag_AutoPlay;
|
||||
if (autoPlay)
|
||||
toSetup->setSource(std::shared_ptr<SceneUtil::ControllerSource>(new SceneUtil::FrameTimeSource));
|
||||
toSetup->setSource(std::make_shared<SceneUtil::FrameTimeSource>());
|
||||
|
||||
toSetup->setFunction(std::shared_ptr<ControllerFunction>(new ControllerFunction(ctrl)));
|
||||
toSetup->setFunction(std::make_shared<ControllerFunction>(ctrl));
|
||||
}
|
||||
|
||||
static osg::ref_ptr<osg::LOD> handleLodNode(const Nif::NiLODNode* niLodNode)
|
||||
|
|
Loading…
Reference in a new issue