1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/apps/openmw/mwclass/weapon.cpp

40 lines
854 B
C++
Raw Normal View History

2010-08-03 12:14:04 +00:00
#include "weapon.hpp"
#include <components/esm/loadweap.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
2010-08-03 15:11:41 +00:00
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
ptr.get<ESM::Weapon>();
return ref->base->name;
}
2010-08-03 12:14:04 +00:00
bool Weapon::hasItemHealth (const MWWorld::Ptr& ptr) const
{
return true;
}
int Weapon::getItemMaxHealth (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
ptr.get<ESM::Weapon>();
return ref->base->data.health;
}
void Weapon::registerSelf()
{
boost::shared_ptr<Class> instance (new Weapon);
registerClass (typeid (ESM::Weapon).name(), instance);
}
}