Fix clang analyzer warnings

move
scrawl 9 years ago
parent a64ee9e0c2
commit c4d38bb42d

@ -1,4 +1,4 @@
#ifndef CSV_PREFS_STATE_H
#ifndef CSM_PREFS_STATE_H
#define CSM_PREFS_STATE_H
#include <map>

@ -108,7 +108,7 @@ void CSMWorld::IngredEffectRefIdAdapter::setNestedTable (const RefIdColumn* colu
ESM::Ingredient ingredient = record.get();
ingredient.mData =
static_cast<const NestedTableWrapper<std::vector<typename ESM::Ingredient::IRDTstruct> >&>(nestedTable).mNestedTable.at(0);
static_cast<const NestedTableWrapper<std::vector<ESM::Ingredient::IRDTstruct> >&>(nestedTable).mNestedTable.at(0);
record.setModified (ingredient);
}
@ -120,11 +120,11 @@ CSMWorld::NestedTableWrapperBase* CSMWorld::IngredEffectRefIdAdapter::nestedTabl
static_cast<const Record<ESM::Ingredient>&> (data.getRecord (RefIdData::LocalIndex (index, mType)));
// return the whole struct
std::vector<typename ESM::Ingredient::IRDTstruct> wrap;
std::vector<ESM::Ingredient::IRDTstruct> wrap;
wrap.push_back(record.get().mData);
// deleted by dtor of NestedTableStoring
return new NestedTableWrapper<std::vector<typename ESM::Ingredient::IRDTstruct> >(wrap);
return new NestedTableWrapper<std::vector<ESM::Ingredient::IRDTstruct> >(wrap);
}
QVariant CSMWorld::IngredEffectRefIdAdapter::getNestedData (const RefIdColumn *column,
@ -1129,7 +1129,7 @@ void CSMWorld::CreatureAttributesRefIdAdapter::setNestedTable (const RefIdColumn
// store the whole struct
creature.mData =
static_cast<const NestedTableWrapper<std::vector<typename ESM::Creature::NPDTstruct> > &>(nestedTable).mNestedTable.at(0);
static_cast<const NestedTableWrapper<std::vector<ESM::Creature::NPDTstruct> > &>(nestedTable).mNestedTable.at(0);
record.setModified (creature);
}
@ -1141,10 +1141,10 @@ CSMWorld::NestedTableWrapperBase* CSMWorld::CreatureAttributesRefIdAdapter::nest
static_cast<const Record<ESM::Creature>&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature)));
// return the whole struct
std::vector<typename ESM::Creature::NPDTstruct> wrap;
std::vector<ESM::Creature::NPDTstruct> wrap;
wrap.push_back(record.get().mData);
// deleted by dtor of NestedTableStoring
return new NestedTableWrapper<std::vector<typename ESM::Creature::NPDTstruct> >(wrap);
return new NestedTableWrapper<std::vector<ESM::Creature::NPDTstruct> >(wrap);
}
QVariant CSMWorld::CreatureAttributesRefIdAdapter::getNestedData (const RefIdColumn *column,
@ -1235,7 +1235,7 @@ void CSMWorld::CreatureAttackRefIdAdapter::setNestedTable (const RefIdColumn* co
// store the whole struct
creature.mData =
static_cast<const NestedTableWrapper<std::vector<typename ESM::Creature::NPDTstruct> > &>(nestedTable).mNestedTable.at(0);
static_cast<const NestedTableWrapper<std::vector<ESM::Creature::NPDTstruct> > &>(nestedTable).mNestedTable.at(0);
record.setModified (creature);
}
@ -1247,10 +1247,10 @@ CSMWorld::NestedTableWrapperBase* CSMWorld::CreatureAttackRefIdAdapter::nestedTa
static_cast<const Record<ESM::Creature>&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature)));
// return the whole struct
std::vector<typename ESM::Creature::NPDTstruct> wrap;
std::vector<ESM::Creature::NPDTstruct> wrap;
wrap.push_back(record.get().mData);
// deleted by dtor of NestedTableStoring
return new NestedTableWrapper<std::vector<typename ESM::Creature::NPDTstruct> >(wrap);
return new NestedTableWrapper<std::vector<ESM::Creature::NPDTstruct> >(wrap);
}
QVariant CSMWorld::CreatureAttackRefIdAdapter::getNestedData (const RefIdColumn *column,

@ -27,13 +27,6 @@
namespace
{
std::string fpsLevelToStr(int level)
{
if (level == 0)
return "#{sOff}";
else //if (level == 1)
return "#{sOn}";
}
std::string textureMipmappingToStr(const std::string& val)
{

@ -1377,7 +1377,7 @@ namespace MWMechanics
{
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
{
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
MWWorld::Ptr followTarget = (*it)->getTarget();
if (followTarget.isEmpty())
continue;
if (followTarget == actor)

@ -119,7 +119,7 @@ namespace MWMechanics
return TypeIdEscort;
}
MWWorld::Ptr AiEscort::getTarget()
MWWorld::Ptr AiEscort::getTarget() const
{
return MWBase::Environment::get().getWorld()->getPtr(mActorId, false);
}

@ -37,7 +37,7 @@ namespace MWMechanics
virtual int getTypeId() const;
MWWorld::Ptr getTarget();
MWWorld::Ptr getTarget() const;
virtual bool sideWithTarget() const { return true; }
void writeState(ESM::AiSequence::AiSequence &sequence) const;

@ -200,7 +200,7 @@ void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const
sequence.mPackages.push_back(package);
}
MWWorld::Ptr AiFollow::getTarget()
MWWorld::Ptr AiFollow::getTarget() const
{
if (mActorId == -2)
return MWWorld::Ptr();

@ -31,7 +31,7 @@ namespace MWMechanics
AiFollow(const ESM::AiSequence::AiFollow* follow);
MWWorld::Ptr getTarget();
MWWorld::Ptr getTarget() const;
virtual bool sideWithTarget() const { return true; }
virtual bool followTargetThroughDoors() const { return true; }
@ -60,7 +60,7 @@ namespace MWMechanics
float mY;
float mZ;
std::string mActorRefId;
int mActorId;
mutable int mActorId;
std::string mCellId;
bool mActive; // have we spotted the target?
int mFollowIndex;

@ -20,7 +20,7 @@
MWMechanics::AiPackage::~AiPackage() {}
MWWorld::Ptr MWMechanics::AiPackage::getTarget()
MWWorld::Ptr MWMechanics::AiPackage::getTarget() const
{
return MWWorld::Ptr();
}

@ -72,7 +72,7 @@ namespace MWMechanics
virtual void fastForward(const MWWorld::Ptr& actor, AiState& state) {}
/// Get the target actor the AI is targeted at (not applicable to all AI packages, default return empty Ptr)
virtual MWWorld::Ptr getTarget();
virtual MWWorld::Ptr getTarget() const;
/// Return true if having this AiPackage makes the actor side with the target in fights (default false)
virtual bool sideWithTarget() const;

@ -68,9 +68,8 @@ bool AiSequence::getCombatTarget(MWWorld::Ptr &targetActor) const
{
if (getTypeId() != AiPackage::TypeIdCombat)
return false;
const AiCombat *combat = static_cast<const AiCombat *>(mPackages.front());
targetActor = combat->getTarget();
targetActor = mPackages.front()->getTarget();
return !targetActor.isEmpty();
}
@ -114,8 +113,7 @@ bool AiSequence::isInCombat(const MWWorld::Ptr &actor) const
{
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
{
const AiCombat *combat = static_cast<const AiCombat *>(*it);
if (combat->getTarget() == actor)
if ((*it)->getTarget() == actor)
return true;
}
}
@ -255,7 +253,7 @@ void AiSequence::stack (const AiPackage& package, const MWWorld::Ptr& actor)
for (std::list<AiPackage *>::const_iterator iter (mPackages.begin()); iter!=mPackages.end(); ++iter)
{
if((*iter)->getTypeId() == AiPackage::TypeIdCombat && package.getTypeId() == AiPackage::TypeIdCombat
&& static_cast<const AiCombat*>(*iter)->getTarget() == static_cast<const AiCombat*>(&package)->getTarget())
&& (*iter)->getTarget() == (&package)->getTarget())
{
return; // already in combat with this actor
}

@ -1330,7 +1330,7 @@ namespace MWMechanics
{
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
{
MWWorld::Ptr target = static_cast<AiCombat*>(*it)->getTarget();
MWWorld::Ptr target = (*it)->getTarget();
if (!target.isEmpty() && target.getClass().isNpc())
isFightingNpc = true;
}

@ -62,13 +62,6 @@ namespace
}
}
void applyDynamicStatsEffect(int attribute, const MWWorld::Ptr& target, float magnitude)
{
MWMechanics::DynamicStat<float> value = target.getClass().getCreatureStats(target).getDynamic(attribute);
value.setCurrent(value.getCurrent()+magnitude, attribute == 2);
target.getClass().getCreatureStats(target).setDynamic(attribute, value);
}
}
namespace MWMechanics

@ -139,16 +139,16 @@ namespace Resource
virtual void apply(osg::Node& node)
{
if (osgFX::Effect* effect = dynamic_cast<osgFX::Effect*>(&node))
apply(*effect);
applyEffect(*effect);
osg::StateSet* stateset = node.getStateSet();
if (stateset)
apply(stateset);
applyStateSet(stateset);
traverse(node);
}
void apply(osgFX::Effect& effect)
void applyEffect(osgFX::Effect& effect)
{
for (int i =0; i<effect.getNumTechniques(); ++i)
{
@ -156,7 +156,7 @@ namespace Resource
for (int pass=0; pass<tech->getNumPasses(); ++pass)
{
if (tech->getPassStateSet(pass))
apply(tech->getPassStateSet(pass));
applyStateSet(tech->getPassStateSet(pass));
}
}
}
@ -165,29 +165,29 @@ namespace Resource
{
osg::StateSet* stateset = geode.getStateSet();
if (stateset)
apply(stateset);
applyStateSet(stateset);
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
osg::Drawable* drw = geode.getDrawable(i);
stateset = drw->getStateSet();
if (stateset)
apply(stateset);
applyStateSet(stateset);
}
}
void apply(osg::StateSet* stateset)
void applyStateSet(osg::StateSet* stateset)
{
const osg::StateSet::TextureAttributeList& texAttributes = stateset->getTextureAttributeList();
for(unsigned int unit=0;unit<texAttributes.size();++unit)
{
osg::StateAttribute *texture = stateset->getTextureAttribute(unit, osg::StateAttribute::TEXTURE);
if (texture)
apply(texture);
applyStateAttribute(texture);
}
}
void apply(osg::StateAttribute* attr)
void applyStateAttribute(osg::StateAttribute* attr)
{
osg::Texture* tex = attr->asTexture();
if (tex)

@ -8,7 +8,7 @@ namespace osg
namespace ESM
{
class Light;
struct Light;
}
namespace SceneUtil

Loading…
Cancel
Save