mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 18:19:55 +00:00
Fix clang analyzer warnings
This commit is contained in:
parent
a64ee9e0c2
commit
c4d38bb42d
16 changed files with 33 additions and 49 deletions
|
@ -1,4 +1,4 @@
|
||||||
#ifndef CSV_PREFS_STATE_H
|
#ifndef CSM_PREFS_STATE_H
|
||||||
#define CSM_PREFS_STATE_H
|
#define CSM_PREFS_STATE_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -108,7 +108,7 @@ void CSMWorld::IngredEffectRefIdAdapter::setNestedTable (const RefIdColumn* colu
|
||||||
ESM::Ingredient ingredient = record.get();
|
ESM::Ingredient ingredient = record.get();
|
||||||
|
|
||||||
ingredient.mData =
|
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);
|
record.setModified (ingredient);
|
||||||
}
|
}
|
||||||
|
@ -120,11 +120,11 @@ CSMWorld::NestedTableWrapperBase* CSMWorld::IngredEffectRefIdAdapter::nestedTabl
|
||||||
static_cast<const Record<ESM::Ingredient>&> (data.getRecord (RefIdData::LocalIndex (index, mType)));
|
static_cast<const Record<ESM::Ingredient>&> (data.getRecord (RefIdData::LocalIndex (index, mType)));
|
||||||
|
|
||||||
// return the whole struct
|
// return the whole struct
|
||||||
std::vector<typename ESM::Ingredient::IRDTstruct> wrap;
|
std::vector<ESM::Ingredient::IRDTstruct> wrap;
|
||||||
wrap.push_back(record.get().mData);
|
wrap.push_back(record.get().mData);
|
||||||
|
|
||||||
// deleted by dtor of NestedTableStoring
|
// 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,
|
QVariant CSMWorld::IngredEffectRefIdAdapter::getNestedData (const RefIdColumn *column,
|
||||||
|
@ -1129,7 +1129,7 @@ void CSMWorld::CreatureAttributesRefIdAdapter::setNestedTable (const RefIdColumn
|
||||||
|
|
||||||
// store the whole struct
|
// store the whole struct
|
||||||
creature.mData =
|
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);
|
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)));
|
static_cast<const Record<ESM::Creature>&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature)));
|
||||||
|
|
||||||
// return the whole struct
|
// return the whole struct
|
||||||
std::vector<typename ESM::Creature::NPDTstruct> wrap;
|
std::vector<ESM::Creature::NPDTstruct> wrap;
|
||||||
wrap.push_back(record.get().mData);
|
wrap.push_back(record.get().mData);
|
||||||
// deleted by dtor of NestedTableStoring
|
// 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,
|
QVariant CSMWorld::CreatureAttributesRefIdAdapter::getNestedData (const RefIdColumn *column,
|
||||||
|
@ -1235,7 +1235,7 @@ void CSMWorld::CreatureAttackRefIdAdapter::setNestedTable (const RefIdColumn* co
|
||||||
|
|
||||||
// store the whole struct
|
// store the whole struct
|
||||||
creature.mData =
|
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);
|
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)));
|
static_cast<const Record<ESM::Creature>&> (data.getRecord (RefIdData::LocalIndex (index, UniversalId::Type_Creature)));
|
||||||
|
|
||||||
// return the whole struct
|
// return the whole struct
|
||||||
std::vector<typename ESM::Creature::NPDTstruct> wrap;
|
std::vector<ESM::Creature::NPDTstruct> wrap;
|
||||||
wrap.push_back(record.get().mData);
|
wrap.push_back(record.get().mData);
|
||||||
// deleted by dtor of NestedTableStoring
|
// 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,
|
QVariant CSMWorld::CreatureAttackRefIdAdapter::getNestedData (const RefIdColumn *column,
|
||||||
|
|
|
@ -27,13 +27,6 @@
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
std::string fpsLevelToStr(int level)
|
|
||||||
{
|
|
||||||
if (level == 0)
|
|
||||||
return "#{sOff}";
|
|
||||||
else //if (level == 1)
|
|
||||||
return "#{sOn}";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string textureMipmappingToStr(const std::string& val)
|
std::string textureMipmappingToStr(const std::string& val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1377,7 +1377,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
if ((*it)->getTypeId() == MWMechanics::AiPackage::TypeIdFollow)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr followTarget = static_cast<MWMechanics::AiFollow*>(*it)->getTarget();
|
MWWorld::Ptr followTarget = (*it)->getTarget();
|
||||||
if (followTarget.isEmpty())
|
if (followTarget.isEmpty())
|
||||||
continue;
|
continue;
|
||||||
if (followTarget == actor)
|
if (followTarget == actor)
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace MWMechanics
|
||||||
return TypeIdEscort;
|
return TypeIdEscort;
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr AiEscort::getTarget()
|
MWWorld::Ptr AiEscort::getTarget() const
|
||||||
{
|
{
|
||||||
return MWBase::Environment::get().getWorld()->getPtr(mActorId, false);
|
return MWBase::Environment::get().getWorld()->getPtr(mActorId, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
virtual int getTypeId() const;
|
virtual int getTypeId() const;
|
||||||
|
|
||||||
MWWorld::Ptr getTarget();
|
MWWorld::Ptr getTarget() const;
|
||||||
virtual bool sideWithTarget() const { return true; }
|
virtual bool sideWithTarget() const { return true; }
|
||||||
|
|
||||||
void writeState(ESM::AiSequence::AiSequence &sequence) const;
|
void writeState(ESM::AiSequence::AiSequence &sequence) const;
|
||||||
|
|
|
@ -200,7 +200,7 @@ void AiFollow::writeState(ESM::AiSequence::AiSequence &sequence) const
|
||||||
sequence.mPackages.push_back(package);
|
sequence.mPackages.push_back(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr AiFollow::getTarget()
|
MWWorld::Ptr AiFollow::getTarget() const
|
||||||
{
|
{
|
||||||
if (mActorId == -2)
|
if (mActorId == -2)
|
||||||
return MWWorld::Ptr();
|
return MWWorld::Ptr();
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
AiFollow(const ESM::AiSequence::AiFollow* follow);
|
AiFollow(const ESM::AiSequence::AiFollow* follow);
|
||||||
|
|
||||||
MWWorld::Ptr getTarget();
|
MWWorld::Ptr getTarget() const;
|
||||||
virtual bool sideWithTarget() const { return true; }
|
virtual bool sideWithTarget() const { return true; }
|
||||||
virtual bool followTargetThroughDoors() const { return true; }
|
virtual bool followTargetThroughDoors() const { return true; }
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ namespace MWMechanics
|
||||||
float mY;
|
float mY;
|
||||||
float mZ;
|
float mZ;
|
||||||
std::string mActorRefId;
|
std::string mActorRefId;
|
||||||
int mActorId;
|
mutable int mActorId;
|
||||||
std::string mCellId;
|
std::string mCellId;
|
||||||
bool mActive; // have we spotted the target?
|
bool mActive; // have we spotted the target?
|
||||||
int mFollowIndex;
|
int mFollowIndex;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
MWMechanics::AiPackage::~AiPackage() {}
|
MWMechanics::AiPackage::~AiPackage() {}
|
||||||
|
|
||||||
MWWorld::Ptr MWMechanics::AiPackage::getTarget()
|
MWWorld::Ptr MWMechanics::AiPackage::getTarget() const
|
||||||
{
|
{
|
||||||
return MWWorld::Ptr();
|
return MWWorld::Ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace MWMechanics
|
||||||
virtual void fastForward(const MWWorld::Ptr& actor, AiState& state) {}
|
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)
|
/// 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)
|
/// Return true if having this AiPackage makes the actor side with the target in fights (default false)
|
||||||
virtual bool sideWithTarget() const;
|
virtual bool sideWithTarget() const;
|
||||||
|
|
|
@ -68,9 +68,8 @@ bool AiSequence::getCombatTarget(MWWorld::Ptr &targetActor) const
|
||||||
{
|
{
|
||||||
if (getTypeId() != AiPackage::TypeIdCombat)
|
if (getTypeId() != AiPackage::TypeIdCombat)
|
||||||
return false;
|
return false;
|
||||||
const AiCombat *combat = static_cast<const AiCombat *>(mPackages.front());
|
|
||||||
|
|
||||||
targetActor = combat->getTarget();
|
targetActor = mPackages.front()->getTarget();
|
||||||
|
|
||||||
return !targetActor.isEmpty();
|
return !targetActor.isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -114,8 +113,7 @@ bool AiSequence::isInCombat(const MWWorld::Ptr &actor) const
|
||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
|
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
|
||||||
{
|
{
|
||||||
const AiCombat *combat = static_cast<const AiCombat *>(*it);
|
if ((*it)->getTarget() == actor)
|
||||||
if (combat->getTarget() == actor)
|
|
||||||
return true;
|
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)
|
for (std::list<AiPackage *>::const_iterator iter (mPackages.begin()); iter!=mPackages.end(); ++iter)
|
||||||
{
|
{
|
||||||
if((*iter)->getTypeId() == AiPackage::TypeIdCombat && package.getTypeId() == AiPackage::TypeIdCombat
|
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
|
return; // already in combat with this actor
|
||||||
}
|
}
|
||||||
|
|
|
@ -1330,7 +1330,7 @@ namespace MWMechanics
|
||||||
{
|
{
|
||||||
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
|
if ((*it)->getTypeId() == AiPackage::TypeIdCombat)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr target = static_cast<AiCombat*>(*it)->getTarget();
|
MWWorld::Ptr target = (*it)->getTarget();
|
||||||
if (!target.isEmpty() && target.getClass().isNpc())
|
if (!target.isEmpty() && target.getClass().isNpc())
|
||||||
isFightingNpc = true;
|
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
|
namespace MWMechanics
|
||||||
|
|
|
@ -139,16 +139,16 @@ namespace Resource
|
||||||
virtual void apply(osg::Node& node)
|
virtual void apply(osg::Node& node)
|
||||||
{
|
{
|
||||||
if (osgFX::Effect* effect = dynamic_cast<osgFX::Effect*>(&node))
|
if (osgFX::Effect* effect = dynamic_cast<osgFX::Effect*>(&node))
|
||||||
apply(*effect);
|
applyEffect(*effect);
|
||||||
|
|
||||||
osg::StateSet* stateset = node.getStateSet();
|
osg::StateSet* stateset = node.getStateSet();
|
||||||
if (stateset)
|
if (stateset)
|
||||||
apply(stateset);
|
applyStateSet(stateset);
|
||||||
|
|
||||||
traverse(node);
|
traverse(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osgFX::Effect& effect)
|
void applyEffect(osgFX::Effect& effect)
|
||||||
{
|
{
|
||||||
for (int i =0; i<effect.getNumTechniques(); ++i)
|
for (int i =0; i<effect.getNumTechniques(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -156,7 +156,7 @@ namespace Resource
|
||||||
for (int pass=0; pass<tech->getNumPasses(); ++pass)
|
for (int pass=0; pass<tech->getNumPasses(); ++pass)
|
||||||
{
|
{
|
||||||
if (tech->getPassStateSet(pass))
|
if (tech->getPassStateSet(pass))
|
||||||
apply(tech->getPassStateSet(pass));
|
applyStateSet(tech->getPassStateSet(pass));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,29 +165,29 @@ namespace Resource
|
||||||
{
|
{
|
||||||
osg::StateSet* stateset = geode.getStateSet();
|
osg::StateSet* stateset = geode.getStateSet();
|
||||||
if (stateset)
|
if (stateset)
|
||||||
apply(stateset);
|
applyStateSet(stateset);
|
||||||
|
|
||||||
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
|
||||||
{
|
{
|
||||||
osg::Drawable* drw = geode.getDrawable(i);
|
osg::Drawable* drw = geode.getDrawable(i);
|
||||||
stateset = drw->getStateSet();
|
stateset = drw->getStateSet();
|
||||||
if (stateset)
|
if (stateset)
|
||||||
apply(stateset);
|
applyStateSet(stateset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::StateSet* stateset)
|
void applyStateSet(osg::StateSet* stateset)
|
||||||
{
|
{
|
||||||
const osg::StateSet::TextureAttributeList& texAttributes = stateset->getTextureAttributeList();
|
const osg::StateSet::TextureAttributeList& texAttributes = stateset->getTextureAttributeList();
|
||||||
for(unsigned int unit=0;unit<texAttributes.size();++unit)
|
for(unsigned int unit=0;unit<texAttributes.size();++unit)
|
||||||
{
|
{
|
||||||
osg::StateAttribute *texture = stateset->getTextureAttribute(unit, osg::StateAttribute::TEXTURE);
|
osg::StateAttribute *texture = stateset->getTextureAttribute(unit, osg::StateAttribute::TEXTURE);
|
||||||
if (texture)
|
if (texture)
|
||||||
apply(texture);
|
applyStateAttribute(texture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply(osg::StateAttribute* attr)
|
void applyStateAttribute(osg::StateAttribute* attr)
|
||||||
{
|
{
|
||||||
osg::Texture* tex = attr->asTexture();
|
osg::Texture* tex = attr->asTexture();
|
||||||
if (tex)
|
if (tex)
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace osg
|
||||||
|
|
||||||
namespace ESM
|
namespace ESM
|
||||||
{
|
{
|
||||||
class Light;
|
struct Light;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace SceneUtil
|
namespace SceneUtil
|
||||||
|
|
Loading…
Reference in a new issue