Commit 2961f0d8 authored by Andrei Kortunov's avatar Andrei Kortunov

Allow to use the %Name for creatures (bug #4644)

parent 29ea72ed
......@@ -120,6 +120,7 @@
Bug #4622: Recharging enchanted items with Soul Gems does not award experience if it fails
Bug #4628: NPC record reputation, disposition and faction rank should have unsigned char type
Bug #4633: Sneaking stance affects speed even if the actor is not able to crouch
Bug #4644: %Name should be available for all actors, not just for NPCs
Feature #912: Editor: Add missing icons to UniversalId tables
Feature #1645: Casting effects from objects
Feature #2606: Editor: Implemented (optional) case sensitive global search
......
......@@ -288,10 +288,17 @@ namespace MWScript
return "None";
}
std::string InterpreterContext::getNPCName() const
std::string InterpreterContext::getActorName() const
{
ESM::NPC npc = *getReferenceImp().get<ESM::NPC>()->mBase;
return npc.mName;
const MWWorld::Ptr& ptr = getReferenceImp();
if (ptr.getClass().isNpc())
{
const ESM::NPC* npc = ptr.get<ESM::NPC>()->mBase;
return npc->mName;
}
const ESM::Creature* creature = ptr.get<ESM::Creature>()->mBase;
return creature->mName;
}
std::string InterpreterContext::getNPCRace() const
......
......@@ -93,7 +93,7 @@ namespace MWScript
virtual std::string getActionBinding(const std::string& action) const;
virtual std::string getNPCName() const;
virtual std::string getActorName() const;
virtual std::string getNPCRace() const;
......
......@@ -55,7 +55,7 @@ namespace Interpreter
virtual std::string getActionBinding(const std::string& action) const = 0;
virtual std::string getNPCName() const = 0;
virtual std::string getActorName() const = 0;
virtual std::string getNPCRace() const = 0;
......
......@@ -138,7 +138,7 @@ namespace Interpreter{
retval << context.getNPCRace();
}
else if((found = check(temp, "name", &i, &start))){
retval << context.getNPCName();
retval << context.getActorName();
}
}
else { // In messagebox or book, not dialogue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment