mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 09:35:28 +00:00
added test for actor ID
This commit is contained in:
parent
8086933282
commit
2acfe22975
@ -10,6 +10,14 @@
|
|||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
std::string Creature::getId (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::Creature>();
|
||||||
|
|
||||||
|
return ref->base->mId;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
std::string Creature::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::Creature, MWWorld::RefData> *ref =
|
||||||
|
@ -9,6 +9,9 @@ namespace MWClass
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return ID of \a ptr
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
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);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
@ -10,6 +10,14 @@
|
|||||||
|
|
||||||
namespace MWClass
|
namespace MWClass
|
||||||
{
|
{
|
||||||
|
std::string Npc::getId (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||||
|
ptr.get<ESM::NPC>();
|
||||||
|
|
||||||
|
return ref->base->mId;
|
||||||
|
}
|
||||||
|
|
||||||
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
std::string Npc::getName (const MWWorld::Ptr& ptr) const
|
||||||
{
|
{
|
||||||
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
ESMS::LiveCellRef<ESM::NPC, MWWorld::RefData> *ref =
|
||||||
|
@ -9,6 +9,9 @@ namespace MWClass
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
virtual std::string getId (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< Return ID of \a ptr
|
||||||
|
|
||||||
virtual std::string getName (const MWWorld::Ptr& ptr) const;
|
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);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
@ -114,7 +114,11 @@ namespace MWDialogue
|
|||||||
|
|
||||||
bool DialogueManager::isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const
|
bool DialogueManager::isMatching (const MWWorld::Ptr& actor, const ESM::DialInfo& info) const
|
||||||
{
|
{
|
||||||
// TODO check actor id
|
// actor id
|
||||||
|
if (!info.actor.empty())
|
||||||
|
if (info.actor!=MWWorld::Class::get (actor).getId (actor))
|
||||||
|
return false;
|
||||||
|
|
||||||
// TODO check actor race
|
// TODO check actor race
|
||||||
// TODO check actor class
|
// TODO check actor class
|
||||||
// TODO check actor faction
|
// TODO check actor faction
|
||||||
@ -134,7 +138,6 @@ namespace MWDialogue
|
|||||||
|
|
||||||
std::cout
|
std::cout
|
||||||
<< "unchecked entries:" << std::endl
|
<< "unchecked entries:" << std::endl
|
||||||
<< " actor id: " << info.actor << std::endl
|
|
||||||
<< " actor race: " << info.race << std::endl
|
<< " actor race: " << info.race << std::endl
|
||||||
<< " actor class: " << info.clas << std::endl
|
<< " actor class: " << info.clas << std::endl
|
||||||
<< " actor faction: " << info.npcFaction << std::endl
|
<< " actor faction: " << info.npcFaction << std::endl
|
||||||
|
@ -14,6 +14,11 @@ namespace MWWorld
|
|||||||
|
|
||||||
Class::~Class() {}
|
Class::~Class() {}
|
||||||
|
|
||||||
|
std::string Class::getId (const Ptr& ptr) const
|
||||||
|
{
|
||||||
|
throw std::runtime_error ("class does not support ID retrieval");
|
||||||
|
}
|
||||||
|
|
||||||
MWMechanics::CreatureStats& Class::getCreatureStats (const Ptr& ptr) const
|
MWMechanics::CreatureStats& Class::getCreatureStats (const Ptr& ptr) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error ("class does not have creature stats");
|
throw std::runtime_error ("class does not have creature stats");
|
||||||
|
@ -36,6 +36,10 @@ namespace MWWorld
|
|||||||
|
|
||||||
virtual ~Class();
|
virtual ~Class();
|
||||||
|
|
||||||
|
virtual std::string getId (const Ptr& ptr) const;
|
||||||
|
///< Return ID of \a ptr or throw an exception, if class does not support ID retrieval
|
||||||
|
/// (default implementation: throw an exception)
|
||||||
|
|
||||||
virtual std::string getName (const Ptr& ptr) const = 0;
|
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);
|
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||||
/// can return an empty string.
|
/// can return an empty string.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user