Fix some style issues flagged by cppcheck

pull/1504/head
scrawl 7 years ago
parent 64d02f577e
commit 03554b2f4b

@ -155,8 +155,6 @@ namespace MWGui
void restock();
void deleteLater();
bool mEnabled;
bool mIsCompanion;
std::list<std::string> mKeywords;

@ -80,7 +80,6 @@ namespace MWGui
, mSpellStatus(NULL)
, mEffectBox(NULL)
, mMinimap(NULL)
, mCompass(NULL)
, mCrosshair(NULL)
, mCellNameBox(NULL)
, mDrowningFrame(NULL)

@ -69,7 +69,6 @@ namespace MWGui
MyGUI::Widget *mEffectBox, *mMinimapBox;
MyGUI::Button* mMinimapButton;
MyGUI::ScrollView* mMinimap;
MyGUI::ImageBox* mCompass;
MyGUI::ImageBox* mCrosshair;
MyGUI::TextBox* mCellNameBox;
MyGUI::TextBox* mWeaponSpellBox;

@ -46,7 +46,7 @@ namespace MWGui
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
void addSpell(const ESM::Spell& spell);
void clearSpells();
int mLastPos,mCurrentY;
int mCurrentY;
static const int sLineHeight;

@ -105,7 +105,7 @@ namespace MWGui
std::stringstream out;
out << val << "/" << max;
setText(tname, out.str().c_str());
setText(tname, out.str());
pt->setProgressRange(std::max(0, max));
pt->setProgressPosition(std::max(0, val));

@ -451,11 +451,10 @@ namespace MWMechanics
// Check if an idle actor is too close to a door - if so start walking
storage.mDoorCheckDuration += duration;
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
if (storage.mDoorCheckDuration >= DOOR_CHECK_INTERVAL)
{
storage.mDoorCheckDuration = 0; // restart timer
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
if (mDistance && // actor is not intended to be stationary
proximityToDoor(actor, distance*1.6f))
{
@ -531,11 +530,10 @@ namespace MWMechanics
void AiWander::evadeObstacles(const MWWorld::Ptr& actor, AiWanderStorage& storage, float duration, ESM::Position& pos)
{
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
if (mObstacleCheck.isEvading())
{
// first check if we're walking into a door
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
if (proximityToDoor(actor, distance))
{
// remove allowed points then select another random destination

@ -424,26 +424,6 @@ namespace MWMechanics
}
}
bool isEnvironmentCompatible(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim)
{
const MWWorld::Class& attackerClass = attacker.getClass();
MWBase::World* world = MWBase::Environment::get().getWorld();
// If attacker is fish, victim must be in water
if (attackerClass.isPureWaterCreature(attacker))
{
return world->isWading(victim);
}
// If attacker can't swim, victim must not be in water
if (!attackerClass.canSwim(attacker))
{
return !world->isSwimming(victim);
}
return true;
}
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2)
{
osg::Vec3f pos1 (actor1.getRefData().getPosition().asVec3());

@ -39,10 +39,6 @@ void getHandToHandDamage (const MWWorld::Ptr& attacker, const MWWorld::Ptr& vict
/// Apply the fatigue loss incurred by attacking with the given weapon (weapon may be empty = hand-to-hand)
void applyFatigueLoss(const MWWorld::Ptr& attacker, const MWWorld::Ptr& weapon, float attackStrength);
/// Can attacker operate in victim's environment?
/// e.g. If attacker is a fish, is victim in water? Or, if attacker can't swim, is victim on land?
bool isEnvironmentCompatible(const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim);
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2);
}

@ -702,8 +702,6 @@ namespace MWPhysics
const char* env = getenv("OPENMW_PHYSICS_FPS");
if (env)
{
std::string str(env);
float physFramerate = std::atof(env);
if (physFramerate > 0)
{

@ -49,7 +49,7 @@ BulletNifLoader::~BulletNifLoader()
{
}
osg::ref_ptr<Resource::BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr nif)
osg::ref_ptr<Resource::BulletShape> BulletNifLoader::load(const Nif::NIFFilePtr& nif)
{
mShape = new Resource::BulletShape;

@ -50,7 +50,7 @@ public:
abort();
}
osg::ref_ptr<Resource::BulletShape> load(const Nif::NIFFilePtr file);
osg::ref_ptr<Resource::BulletShape> load(const Nif::NIFFilePtr& file);
private:
bool findBoundingBox(const Nif::Node* node, int flags = 0);

@ -1191,8 +1191,8 @@ namespace NifOsg
if (pixelData->mipmaps.empty())
return NULL;
unsigned int width = 0;
unsigned int height = 0;
int width = 0;
int height = 0;
std::vector<unsigned int> mipmapVector;
for (unsigned int i=0; i<pixelData->mipmaps.size()-3; ++i)

@ -63,7 +63,7 @@ class NodeToShapeVisitor : public osg::NodeVisitor
public:
NodeToShapeVisitor()
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mTriangleMesh(NULL)
, mTriangleMesh(nullptr)
{
}
@ -71,11 +71,11 @@ public:
virtual void apply(osg::Drawable &drawable)
{
if (!mTriangleMesh)
mTriangleMesh = new btTriangleMesh;
mTriangleMesh.reset(new btTriangleMesh);
osg::Matrixf worldMat = osg::computeLocalToWorld(getNodePath());
osg::TriangleFunctor<GetTriangleFunctor> functor;
functor.setTriMesh(mTriangleMesh);
functor.setTriMesh(mTriangleMesh.get());
functor.setMatrix(worldMat);
drawable.accept(functor);
}
@ -86,14 +86,12 @@ public:
return osg::ref_ptr<BulletShape>();
osg::ref_ptr<BulletShape> shape (new BulletShape);
TriangleMeshShape* meshShape = new TriangleMeshShape(mTriangleMesh, true);
shape->mCollisionShape = meshShape;
mTriangleMesh = NULL;
shape->mCollisionShape = new TriangleMeshShape(mTriangleMesh.release(), true);
return shape;
}
private:
btTriangleMesh* mTriangleMesh;
std::unique_ptr<btTriangleMesh> mTriangleMesh;
};
BulletShapeManager::BulletShapeManager(const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager)

@ -42,13 +42,4 @@ osg::Vec4f colourFromRGB(unsigned int clr)
return colour;
}
osg::Vec4f colourFromRGBA(unsigned int clr)
{
osg::Vec4f colour(((clr >> 0) & 0xFF) / 255.0f,
((clr >> 8) & 0xFF) / 255.0f,
((clr >> 16) & 0xFF) / 255.0f,
((clr >> 24) & 0xFF) / 255.0f);
return colour;
}
}

@ -15,8 +15,6 @@ namespace SceneUtil
osg::Vec4f colourFromRGB (unsigned int clr);
osg::Vec4f colourFromRGBA (unsigned int clr);
}
#endif

@ -119,6 +119,7 @@ unsigned int WorkQueue::getNumActiveThreads() const
WorkThread::WorkThread(WorkQueue *workQueue)
: mWorkQueue(workQueue)
, mActive(false)
{
}

Loading…
Cancel
Save