Skip to content

Commit

Permalink
Fixed assorted issues
Browse files Browse the repository at this point in the history
* destructor is virtual
* renamed class to Actor
* corrected indentation of case statement
  • Loading branch information
dteviot committed Aug 25, 2015
1 parent bb54bbd commit 541d7fb
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion apps/openmw/CMakeLists.txt
Expand Up @@ -74,7 +74,7 @@ add_openmw_dir (mwphysics

add_openmw_dir (mwclass
classes activator creature npc weapon armor potion apparatus book clothing container door
ingredient creaturelevlist itemlevlist light lockpick misc probe repair static mobile
ingredient creaturelevlist itemlevlist light lockpick misc probe repair static actor
)

add_openmw_dir (mwmechanics
Expand Down
40 changes: 20 additions & 20 deletions apps/openmw/mwclass/mobile.cpp → apps/openmw/mwclass/actor.cpp
@@ -1,4 +1,4 @@
#include "mobile.hpp"
#include "actor.hpp"

#include <components/esm/loadmgef.hpp>

Expand All @@ -17,16 +17,16 @@

namespace MWClass
{
Mobile::Mobile() {}
Actor::Actor() {}

Mobile::~Mobile() {}
Actor::~Actor() {}

void Mobile::adjustPosition(const MWWorld::Ptr& ptr, bool force) const
void Actor::adjustPosition(const MWWorld::Ptr& ptr, bool force) const
{
MWBase::Environment::get().getWorld()->adjustPosition(ptr, force);
}

void Mobile::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
void Actor::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const
{
if (!model.empty())
{
Expand All @@ -37,7 +37,7 @@ namespace MWClass
MWBase::Environment::get().getMechanicsManager()->add(ptr);
}

void Mobile::block(const MWWorld::Ptr &ptr) const
void Actor::block(const MWWorld::Ptr &ptr) const
{
MWWorld::InventoryStore& inv = getInventoryStore(ptr);
MWWorld::ContainerStoreIterator shield = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
Expand All @@ -47,26 +47,26 @@ namespace MWClass
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
switch (shield->getClass().getEquipmentSkill(*shield))
{
case ESM::Skill::LightArmor:
sndMgr->playSound3D(ptr, "Light Armor Hit", 1.0f, 1.0f);
break;
case ESM::Skill::MediumArmor:
sndMgr->playSound3D(ptr, "Medium Armor Hit", 1.0f, 1.0f);
break;
case ESM::Skill::HeavyArmor:
sndMgr->playSound3D(ptr, "Heavy Armor Hit", 1.0f, 1.0f);
break;
default:
return;
case ESM::Skill::LightArmor:
sndMgr->playSound3D(ptr, "Light Armor Hit", 1.0f, 1.0f);
break;
case ESM::Skill::MediumArmor:
sndMgr->playSound3D(ptr, "Medium Armor Hit", 1.0f, 1.0f);
break;
case ESM::Skill::HeavyArmor:
sndMgr->playSound3D(ptr, "Heavy Armor Hit", 1.0f, 1.0f);
break;
default:
return;
}
}

bool Mobile::hasToolTip(const MWWorld::Ptr& ptr) const
bool Actor::hasToolTip(const MWWorld::Ptr& ptr) const
{
return !ptr.getClass().getCreatureStats(ptr).getAiSequence().isInCombat() || getCreatureStats(ptr).isDead();
}

osg::Vec3f Mobile::getRotationVector(const MWWorld::Ptr& ptr) const
osg::Vec3f Actor::getRotationVector(const MWWorld::Ptr& ptr) const
{
MWMechanics::Movement &movement = getMovementSettings(ptr);
osg::Vec3f vec(movement.mRotation[0], movement.mRotation[1], movement.mRotation[2]);
Expand All @@ -76,7 +76,7 @@ namespace MWClass
return vec;
}

float Mobile::getEncumbrance(const MWWorld::Ptr& ptr) const
float Actor::getEncumbrance(const MWWorld::Ptr& ptr) const
{
float weight = getContainerStore(ptr).getWeight();
const MWMechanics::MagicEffects& effects = getCreatureStats(ptr).getMagicEffects();
Expand Down
10 changes: 5 additions & 5 deletions apps/openmw/mwclass/mobile.hpp → apps/openmw/mwclass/actor.hpp
Expand Up @@ -11,14 +11,14 @@ namespace ESM
namespace MWClass
{
/// \brief Class holding functionality common to Creature and NPC
class Mobile : public MWWorld::Class
class Actor : public MWWorld::Class
{
protected:

Mobile();
Actor();

public:
~Mobile();
virtual ~Actor();

virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
///< Adjust position to stand on ground. Must be called post model load
Expand All @@ -39,8 +39,8 @@ namespace MWClass
/// effects). Throws an exception, if the object can't hold other objects.

// not implemented
Mobile(const Mobile&);
Mobile& operator= (const Mobile&);
Actor(const Actor&);
Actor& operator= (const Actor&);
};
}

Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwclass/creature.hpp
@@ -1,7 +1,7 @@
#ifndef GAME_MWCLASS_CREATURE_H
#define GAME_MWCLASS_CREATURE_H

#include "mobile.hpp"
#include "actor.hpp"

namespace ESM
{
Expand All @@ -10,7 +10,7 @@ namespace ESM

namespace MWClass
{
class Creature : public Mobile
class Creature : public Actor
{
void ensureCustomData (const MWWorld::Ptr& ptr) const;

Expand Down
2 changes: 1 addition & 1 deletion apps/openmw/mwclass/npc.cpp
Expand Up @@ -946,7 +946,7 @@ namespace MWClass
{
// According to UESP, inventory weight is ignored in werewolf form. Does that include
// feather and burden effects?
return getNpcStats(ptr).isWerewolf() ? 0.0f : Mobile::getEncumbrance(ptr);
return getNpcStats(ptr).isWerewolf() ? 0.0f : Actor::getEncumbrance(ptr);
}

bool Npc::apply (const MWWorld::Ptr& ptr, const std::string& id,
Expand Down
4 changes: 2 additions & 2 deletions apps/openmw/mwclass/npc.hpp
@@ -1,7 +1,7 @@
#ifndef GAME_MWCLASS_NPC_H
#define GAME_MWCLASS_NPC_H

#include "mobile.hpp"
#include "actor.hpp"

namespace ESM
{
Expand All @@ -10,7 +10,7 @@ namespace ESM

namespace MWClass
{
class Npc : public Mobile
class Npc : public Actor
{
void ensureCustomData (const MWWorld::Ptr& ptr) const;

Expand Down

0 comments on commit 541d7fb

Please sign in to comment.