forked from teamnwah/openmw-tes3coop
Fix some style issues flagged by cppcheck
This commit is contained in:
parent
64d02f577e
commit
03554b2f4b
16 changed files with 14 additions and 58 deletions
|
@ -155,8 +155,6 @@ namespace MWGui
|
||||||
void restock();
|
void restock();
|
||||||
void deleteLater();
|
void deleteLater();
|
||||||
|
|
||||||
bool mEnabled;
|
|
||||||
|
|
||||||
bool mIsCompanion;
|
bool mIsCompanion;
|
||||||
std::list<std::string> mKeywords;
|
std::list<std::string> mKeywords;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ namespace MWGui
|
||||||
, mSpellStatus(NULL)
|
, mSpellStatus(NULL)
|
||||||
, mEffectBox(NULL)
|
, mEffectBox(NULL)
|
||||||
, mMinimap(NULL)
|
, mMinimap(NULL)
|
||||||
, mCompass(NULL)
|
|
||||||
, mCrosshair(NULL)
|
, mCrosshair(NULL)
|
||||||
, mCellNameBox(NULL)
|
, mCellNameBox(NULL)
|
||||||
, mDrowningFrame(NULL)
|
, mDrowningFrame(NULL)
|
||||||
|
|
|
@ -69,7 +69,6 @@ namespace MWGui
|
||||||
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
MyGUI::Widget *mEffectBox, *mMinimapBox;
|
||||||
MyGUI::Button* mMinimapButton;
|
MyGUI::Button* mMinimapButton;
|
||||||
MyGUI::ScrollView* mMinimap;
|
MyGUI::ScrollView* mMinimap;
|
||||||
MyGUI::ImageBox* mCompass;
|
|
||||||
MyGUI::ImageBox* mCrosshair;
|
MyGUI::ImageBox* mCrosshair;
|
||||||
MyGUI::TextBox* mCellNameBox;
|
MyGUI::TextBox* mCellNameBox;
|
||||||
MyGUI::TextBox* mWeaponSpellBox;
|
MyGUI::TextBox* mWeaponSpellBox;
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace MWGui
|
||||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||||
void addSpell(const ESM::Spell& spell);
|
void addSpell(const ESM::Spell& spell);
|
||||||
void clearSpells();
|
void clearSpells();
|
||||||
int mLastPos,mCurrentY;
|
int mCurrentY;
|
||||||
|
|
||||||
static const int sLineHeight;
|
static const int sLineHeight;
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ namespace MWGui
|
||||||
|
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
out << val << "/" << max;
|
out << val << "/" << max;
|
||||||
setText(tname, out.str().c_str());
|
setText(tname, out.str());
|
||||||
|
|
||||||
pt->setProgressRange(std::max(0, max));
|
pt->setProgressRange(std::max(0, max));
|
||||||
pt->setProgressPosition(std::max(0, val));
|
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
|
// Check if an idle actor is too close to a door - if so start walking
|
||||||
storage.mDoorCheckDuration += duration;
|
storage.mDoorCheckDuration += duration;
|
||||||
|
|
||||||
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
|
|
||||||
|
|
||||||
if (storage.mDoorCheckDuration >= DOOR_CHECK_INTERVAL)
|
if (storage.mDoorCheckDuration >= DOOR_CHECK_INTERVAL)
|
||||||
{
|
{
|
||||||
storage.mDoorCheckDuration = 0; // restart timer
|
storage.mDoorCheckDuration = 0; // restart timer
|
||||||
|
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
|
||||||
if (mDistance && // actor is not intended to be stationary
|
if (mDistance && // actor is not intended to be stationary
|
||||||
proximityToDoor(actor, distance*1.6f))
|
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)
|
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())
|
if (mObstacleCheck.isEvading())
|
||||||
{
|
{
|
||||||
// first check if we're walking into a door
|
// first check if we're walking into a door
|
||||||
|
static float distance = MWBase::Environment::get().getWorld()->getMaxActivationDistance();
|
||||||
if (proximityToDoor(actor, distance))
|
if (proximityToDoor(actor, distance))
|
||||||
{
|
{
|
||||||
// remove allowed points then select another random destination
|
// 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)
|
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2)
|
||||||
{
|
{
|
||||||
osg::Vec3f pos1 (actor1.getRefData().getPosition().asVec3());
|
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)
|
/// 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);
|
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);
|
float getFightDistanceBias(const MWWorld::Ptr& actor1, const MWWorld::Ptr& actor2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -702,8 +702,6 @@ namespace MWPhysics
|
||||||
const char* env = getenv("OPENMW_PHYSICS_FPS");
|
const char* env = getenv("OPENMW_PHYSICS_FPS");
|
||||||
if (env)
|
if (env)
|
||||||
{
|
{
|
||||||
std::string str(env);
|
|
||||||
|
|
||||||
float physFramerate = std::atof(env);
|
float physFramerate = std::atof(env);
|
||||||
if (physFramerate > 0)
|
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;
|
mShape = new Resource::BulletShape;
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::ref_ptr<Resource::BulletShape> load(const Nif::NIFFilePtr file);
|
osg::ref_ptr<Resource::BulletShape> load(const Nif::NIFFilePtr& file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool findBoundingBox(const Nif::Node* node, int flags = 0);
|
bool findBoundingBox(const Nif::Node* node, int flags = 0);
|
||||||
|
|
|
@ -1191,8 +1191,8 @@ namespace NifOsg
|
||||||
if (pixelData->mipmaps.empty())
|
if (pixelData->mipmaps.empty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
unsigned int width = 0;
|
int width = 0;
|
||||||
unsigned int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
std::vector<unsigned int> mipmapVector;
|
std::vector<unsigned int> mipmapVector;
|
||||||
for (unsigned int i=0; i<pixelData->mipmaps.size()-3; ++i)
|
for (unsigned int i=0; i<pixelData->mipmaps.size()-3; ++i)
|
||||||
|
|
|
@ -63,7 +63,7 @@ class NodeToShapeVisitor : public osg::NodeVisitor
|
||||||
public:
|
public:
|
||||||
NodeToShapeVisitor()
|
NodeToShapeVisitor()
|
||||||
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
|
||||||
, mTriangleMesh(NULL)
|
, mTriangleMesh(nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,11 +71,11 @@ public:
|
||||||
virtual void apply(osg::Drawable &drawable)
|
virtual void apply(osg::Drawable &drawable)
|
||||||
{
|
{
|
||||||
if (!mTriangleMesh)
|
if (!mTriangleMesh)
|
||||||
mTriangleMesh = new btTriangleMesh;
|
mTriangleMesh.reset(new btTriangleMesh);
|
||||||
|
|
||||||
osg::Matrixf worldMat = osg::computeLocalToWorld(getNodePath());
|
osg::Matrixf worldMat = osg::computeLocalToWorld(getNodePath());
|
||||||
osg::TriangleFunctor<GetTriangleFunctor> functor;
|
osg::TriangleFunctor<GetTriangleFunctor> functor;
|
||||||
functor.setTriMesh(mTriangleMesh);
|
functor.setTriMesh(mTriangleMesh.get());
|
||||||
functor.setMatrix(worldMat);
|
functor.setMatrix(worldMat);
|
||||||
drawable.accept(functor);
|
drawable.accept(functor);
|
||||||
}
|
}
|
||||||
|
@ -86,14 +86,12 @@ public:
|
||||||
return osg::ref_ptr<BulletShape>();
|
return osg::ref_ptr<BulletShape>();
|
||||||
|
|
||||||
osg::ref_ptr<BulletShape> shape (new BulletShape);
|
osg::ref_ptr<BulletShape> shape (new BulletShape);
|
||||||
TriangleMeshShape* meshShape = new TriangleMeshShape(mTriangleMesh, true);
|
shape->mCollisionShape = new TriangleMeshShape(mTriangleMesh.release(), true);
|
||||||
shape->mCollisionShape = meshShape;
|
|
||||||
mTriangleMesh = NULL;
|
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
btTriangleMesh* mTriangleMesh;
|
std::unique_ptr<btTriangleMesh> mTriangleMesh;
|
||||||
};
|
};
|
||||||
|
|
||||||
BulletShapeManager::BulletShapeManager(const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager)
|
BulletShapeManager::BulletShapeManager(const VFS::Manager* vfs, SceneManager* sceneMgr, NifFileManager* nifFileManager)
|
||||||
|
|
|
@ -42,13 +42,4 @@ osg::Vec4f colourFromRGB(unsigned int clr)
|
||||||
return colour;
|
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 colourFromRGB (unsigned int clr);
|
||||||
|
|
||||||
osg::Vec4f colourFromRGBA (unsigned int clr);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -119,6 +119,7 @@ unsigned int WorkQueue::getNumActiveThreads() const
|
||||||
|
|
||||||
WorkThread::WorkThread(WorkQueue *workQueue)
|
WorkThread::WorkThread(WorkQueue *workQueue)
|
||||||
: mWorkQueue(workQueue)
|
: mWorkQueue(workQueue)
|
||||||
|
, mActive(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue