added getName function

pull/7/head
Marc Zinnschlag 15 years ago
parent f50ced4616
commit 239498bcd4

@ -3,8 +3,20 @@
#include <components/esm/loadacti.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Activator::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Activator, MWWorld::RefData> *ref =
ptr.get<ESM::Activator>();
return ref->base->name;
}
void Activator::registerSelf()
{
boost::shared_ptr<Class> instance (new Activator);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadappa.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Apparatus::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Apparatus, MWWorld::RefData> *ref =
ptr.get<ESM::Apparatus>();
return ref->base->name;
}
void Apparatus::registerSelf()
{
boost::shared_ptr<Class> instance (new Apparatus);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -9,6 +9,14 @@
namespace MWClass
{
std::string Armor::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Armor, MWWorld::RefData> *ref =
ptr.get<ESM::Armor>();
return ref->base->name;
}
bool Armor::hasItemHealth (const MWWorld::Ptr& ptr) const
{
return true;

@ -9,6 +9,10 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
///< \return Item health data available?

@ -3,8 +3,20 @@
#include <components/esm/loadbook.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Book::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Book, MWWorld::RefData> *ref =
ptr.get<ESM::Book>();
return ref->base->name;
}
void Book::registerSelf()
{
boost::shared_ptr<Class> instance (new Book);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadclot.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Clothing::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
ptr.get<ESM::Clothing>();
return ref->base->name;
}
void Clothing::registerSelf()
{
boost::shared_ptr<Class> instance (new Clothing);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadcont.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Container::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Container, MWWorld::RefData> *ref =
ptr.get<ESM::Container>();
return ref->base->name;
}
void Container::registerSelf()
{
boost::shared_ptr<Class> instance (new Container);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -9,6 +9,14 @@
namespace MWClass
{
std::string Creature::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
ptr.get<ESM::Creature>();
return ref->base->name;
}
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
{
if (!ptr.getRefData().getCreatureStats().get())

@ -9,6 +9,10 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
///< Return creature stats

@ -5,6 +5,11 @@
namespace MWClass
{
std::string CreatureLevList::getName (const MWWorld::Ptr& ptr) const
{
return "";
}
void CreatureLevList::registerSelf()
{
boost::shared_ptr<Class> instance (new CreatureLevList);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loaddoor.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Door::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Door, MWWorld::RefData> *ref =
ptr.get<ESM::Door>();
return ref->base->name;
}
void Door::registerSelf()
{
boost::shared_ptr<Class> instance (new Door);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadingr.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Ingredient::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Ingredient, MWWorld::RefData> *ref =
ptr.get<ESM::Ingredient>();
return ref->base->name;
}
void Ingredient::registerSelf()
{
boost::shared_ptr<Class> instance (new Ingredient);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -5,6 +5,11 @@
namespace MWClass
{
std::string ItemLevList::getName (const MWWorld::Ptr& ptr) const
{
return "";
}
void ItemLevList::registerSelf()
{
boost::shared_ptr<Class> instance (new ItemLevList);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,23 @@
#include <components/esm/loadligh.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Light::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Light, MWWorld::RefData> *ref =
ptr.get<ESM::Light>();
if (ref->base->model.empty())
return "";
return ref->base->name;
}
void Light::registerSelf()
{
boost::shared_ptr<Class> instance (new Light);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadlocks.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Lockpick::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Tool, MWWorld::RefData> *ref =
ptr.get<ESM::Tool>();
return ref->base->name;
}
void Lockpick::registerSelf()
{
boost::shared_ptr<Class> instance (new Lockpick);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadmisc.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Misc::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Misc, MWWorld::RefData> *ref =
ptr.get<ESM::Misc>();
return ref->base->name;
}
void Misc::registerSelf()
{
boost::shared_ptr<Class> instance (new Misc);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -9,6 +9,14 @@
namespace MWClass
{
std::string Npc::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
ptr.get<ESM::NPC>();
return ref->base->name;
}
MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const
{
if (!ptr.getRefData().getCreatureStats().get())

@ -9,6 +9,10 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
///< Return creature stats

@ -3,8 +3,20 @@
#include <components/esm/loadalch.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Potion::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Potion, MWWorld::RefData> *ref =
ptr.get<ESM::Potion>();
return ref->base->name;
}
void Potion::registerSelf()
{
boost::shared_ptr<Class> instance (new Potion);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadlocks.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Probe::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Probe, MWWorld::RefData> *ref =
ptr.get<ESM::Probe>();
return ref->base->name;
}
void Probe::registerSelf()
{
boost::shared_ptr<Class> instance (new Probe);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -3,8 +3,20 @@
#include <components/esm/loadlocks.hpp>
#include <components/esm_store/cell_store.hpp>
#include "../mwworld/ptr.hpp"
namespace MWClass
{
std::string Repair::getName (const MWWorld::Ptr& ptr) const
{
ESMS::LiveCellRef<ESM::Repair, MWWorld::RefData> *ref =
ptr.get<ESM::Repair>();
return ref->base->name;
}
void Repair::registerSelf()
{
boost::shared_ptr<Class> instance (new Repair);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -5,6 +5,11 @@
namespace MWClass
{
std::string Static::getName (const MWWorld::Ptr& ptr) const
{
return "";
}
void Static::registerSelf()
{
boost::shared_ptr<Class> instance (new Static);

@ -9,6 +9,9 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
static void registerSelf();
};

@ -9,6 +9,14 @@
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;

@ -9,6 +9,10 @@ namespace MWClass
{
public:
virtual std::string getName (const MWWorld::Ptr& ptr) const;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual bool hasItemHealth (const MWWorld::Ptr& ptr) const;
///< \return Item health data available?

@ -32,6 +32,10 @@ namespace MWWorld
virtual ~Class();
virtual std::string getName (const Ptr& ptr) const = 0;
///< \return name (the one that is to be presented to the user; not the internal one);
/// can return an empty string.
virtual MWMechanics::CreatureStats& getCreatureStats (const Ptr& ptr) const;
///< Return creature stats or throw an exception, if class does not have creature stats
/// (default implementation: throw an exceoption)

Loading…
Cancel
Save