mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-09 12:42:11 +00:00
40 lines
854 B
C++
40 lines
854 B
C++
|
|
#include "weapon.hpp"
|
|
|
|
#include <components/esm/loadweap.hpp>
|
|
|
|
#include <components/esm_store/cell_store.hpp>
|
|
|
|
#include "../mwworld/ptr.hpp"
|
|
|
|
namespace MWClass
|
|
{
|
|
std::string Weapon::getName (const MWWorld::Ptr& ptr) const
|
|
{
|
|
ESMS::LiveCellRef<ESM::Weapon, MWWorld::RefData> *ref =
|
|
ptr.get<ESM::Weapon>();
|
|
|
|
return ref->base->name;
|
|
}
|
|
|
|
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);
|
|
}
|
|
}
|