mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-30 04:15:31 +00:00
Merge pull request #2518 from Capostrophic/activation
Allow objects to use their ID instead of the name for tooltip/activation checks (bug #5158)
This commit is contained in:
commit
b205aae4e1
50 changed files with 123 additions and 248 deletions
|
@ -138,6 +138,7 @@
|
|||
Bug #5134: Doors rotation by "Lock" console command is inconsistent
|
||||
Bug #5137: Textures with Clamp Mode set to Clamp instead of Wrap are too dark outside the boundaries
|
||||
Bug #5149: Failing lock pick attempts isn't always a crime
|
||||
Bug #5188: Objects without a name don't fallback to their ID
|
||||
Bug #5161: Creature companions can't be activated when they are knocked down
|
||||
Feature #1774: Handle AvoidNode
|
||||
Feature #2229: Improve pathfinding AI
|
||||
|
|
|
@ -89,9 +89,7 @@ namespace MWClass
|
|||
|
||||
bool Activator::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
return !getName(ptr).empty();
|
||||
}
|
||||
|
||||
bool Activator::allowTelekinesis(const MWWorld::ConstPtr &ptr) const {
|
||||
|
@ -103,7 +101,7 @@ namespace MWClass
|
|||
const MWWorld::LiveCellRef<ESM::Activator> *ref = ptr.get<ESM::Activator>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
|
||||
std::string text;
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
|
|
|
@ -20,11 +20,10 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
virtual bool allowTelekinesis(const MWWorld::ConstPtr& ptr) const;
|
||||
///< Return whether this class of object can be activated with telekinesis
|
||||
|
|
|
@ -91,14 +91,4 @@ namespace MWClass
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Actor::canBeActivated(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
MWMechanics::CreatureStats &stats = getCreatureStats(ptr);
|
||||
|
||||
if (stats.getAiSequence().isInCombat() && !stats.isDead())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,8 +42,6 @@ namespace MWClass
|
|||
|
||||
virtual bool isActor() const;
|
||||
|
||||
virtual bool canBeActivated(const MWWorld::Ptr& ptr) const;
|
||||
|
||||
// not implemented
|
||||
Actor(const Actor&);
|
||||
Actor& operator= (const Actor&);
|
||||
|
|
|
@ -45,8 +45,9 @@ namespace MWClass
|
|||
std::string Apparatus::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Apparatus::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -93,19 +94,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Apparatus::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Apparatus::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Apparatus> *ref = ptr.get<ESM::Apparatus>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -20,8 +20,7 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
|
@ -33,9 +32,6 @@ namespace MWClass
|
|||
virtual int getValue (const MWWorld::ConstPtr& ptr) const;
|
||||
///< Return trade value of the object. Throws an exception, if the object can't be traded.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ namespace MWClass
|
|||
std::string Armor::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Armor::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -199,19 +200,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Armor::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Armor::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Armor> *ref = ptr.get<ESM::Armor>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -19,8 +19,7 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
|
@ -43,9 +42,6 @@ namespace MWClass
|
|||
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
|
||||
/// no such skill.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@ namespace MWClass
|
|||
return std::string();
|
||||
}
|
||||
|
||||
bool BodyPart::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void BodyPart::registerSelf()
|
||||
{
|
||||
std::shared_ptr<MWWorld::Class> instance (new BodyPart);
|
||||
|
|
|
@ -18,8 +18,10 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
|
|
|
@ -50,8 +50,9 @@ namespace MWClass
|
|||
std::string Book::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Book::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -109,19 +110,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Book::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Book::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Book> *ref = ptr.get<ESM::Book>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,8 +17,7 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
|
@ -27,9 +26,6 @@ namespace MWClass
|
|||
virtual std::string getScript (const MWWorld::ConstPtr& ptr) const;
|
||||
///< Return name of the script attached to ptr
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -48,8 +48,9 @@ namespace MWClass
|
|||
std::string Clothing::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Clothing::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -157,19 +158,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Clothing::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Clothing::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Clothing> *ref = ptr.get<ESM::Clothing>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,8 +17,7 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
|
@ -35,9 +34,6 @@ namespace MWClass
|
|||
/// Return the index of the skill this item corresponds to when equipped or -1, if there is
|
||||
/// no such skill.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -224,8 +224,9 @@ namespace MWClass
|
|||
std::string Container::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
MWWorld::ContainerStore& Container::getContainerStore (const MWWorld::Ptr& ptr)
|
||||
|
@ -252,26 +253,18 @@ namespace MWClass
|
|||
|
||||
bool Container::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
if (getName(ptr).empty())
|
||||
return false;
|
||||
|
||||
if (const MWWorld::CustomData* data = ptr.getRefData().getCustomData())
|
||||
return !canBeHarvested(ptr) || data->asContainerCustomData().mContainerStore.hasVisibleItems();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Container::canBeActivated(const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return hasToolTip(ptr);
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Container::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Container> *ref = ptr.get<ESM::Container>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr));
|
||||
|
||||
std::string text;
|
||||
int lockLevel = ptr.getCellRef().getLockLevel();
|
||||
|
|
|
@ -20,15 +20,14 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
@ -63,8 +62,6 @@ namespace MWClass
|
|||
const;
|
||||
///< Write additional state from \a ptr into \a state.
|
||||
|
||||
virtual bool canBeActivated(const MWWorld::Ptr& ptr) const;
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual void respawn (const MWWorld::Ptr& ptr) const;
|
||||
|
|
|
@ -214,8 +214,9 @@ namespace MWClass
|
|||
std::string Creature::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats& Creature::getCreatureStats (const MWWorld::Ptr& ptr) const
|
||||
|
@ -583,7 +584,7 @@ namespace MWClass
|
|||
const MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr));
|
||||
|
||||
std::string text;
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp())
|
||||
|
|
|
@ -44,11 +44,10 @@ namespace MWClass
|
|||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip(const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
|
|
@ -39,6 +39,11 @@ namespace MWClass
|
|||
return "";
|
||||
}
|
||||
|
||||
bool CreatureLevList::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CreatureLevList::respawn(const MWWorld::Ptr &ptr) const
|
||||
{
|
||||
ensureCustomData(ptr);
|
||||
|
|
|
@ -12,8 +12,10 @@ namespace MWClass
|
|||
public:
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
|
|
|
@ -102,8 +102,9 @@ namespace MWClass
|
|||
std::string Door::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Door::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -281,19 +282,12 @@ namespace MWClass
|
|||
registerClass (typeid (ESM::Door).name(), instance);
|
||||
}
|
||||
|
||||
bool Door::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Door::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Door> *ref = ptr.get<ESM::Door>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr));
|
||||
|
||||
std::string text;
|
||||
|
||||
|
|
|
@ -25,16 +25,12 @@ namespace MWClass
|
|||
virtual bool useAnim() const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -47,8 +47,9 @@ namespace MWClass
|
|||
std::string Ingredient::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Ingredient::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -105,19 +106,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Ingredient::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Ingredient::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Ingredient> *ref = ptr.get<ESM::Ingredient>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,16 +17,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -10,6 +10,11 @@ namespace MWClass
|
|||
return "";
|
||||
}
|
||||
|
||||
bool ItemLevList::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ItemLevList::registerSelf()
|
||||
{
|
||||
std::shared_ptr<Class> instance (new ItemLevList);
|
||||
|
|
|
@ -10,8 +10,10 @@ namespace MWClass
|
|||
public:
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
static void registerSelf();
|
||||
};
|
||||
|
|
|
@ -70,9 +70,10 @@ namespace MWClass
|
|||
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||
|
||||
if (ref->mBase->mModel.empty())
|
||||
return "";
|
||||
return std::string();
|
||||
|
||||
return ref->mBase->mName;
|
||||
const std::string& name = ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Light::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -141,9 +142,7 @@ namespace MWClass
|
|||
|
||||
bool Light::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
return showsInInventory(ptr);
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Light::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
|
@ -151,7 +150,7 @@ namespace MWClass
|
|||
const MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -19,11 +19,10 @@ namespace MWClass
|
|||
virtual bool useAnim() const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
|
|
@ -47,8 +47,9 @@ namespace MWClass
|
|||
std::string Lockpick::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Lockpick::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -104,19 +105,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Lockpick::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Lockpick::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Lockpick> *ref = ptr.get<ESM::Lockpick>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,16 +17,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -56,8 +56,9 @@ namespace MWClass
|
|||
std::string Miscellaneous::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Miscellaneous::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -134,13 +135,6 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Miscellaneous::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Miscellaneous::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Miscellaneous> *ref = ptr.get<ESM::Miscellaneous>();
|
||||
|
@ -159,14 +153,16 @@ namespace MWClass
|
|||
else // gold displays its count also if it's 1.
|
||||
countString = " (" + std::to_string(count) + ")";
|
||||
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + countString;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + countString;
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
if (ref->mRef.getSoul() != "")
|
||||
{
|
||||
const ESM::Creature *creature = store.get<ESM::Creature>().search(ref->mRef.getSoul());
|
||||
if (creature)
|
||||
if (creature && !creature->mName.empty())
|
||||
info.caption += " (" + creature->mName + ")";
|
||||
else if (creature)
|
||||
info.caption += " (" + creature->mId + ")";
|
||||
}
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,16 +17,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -531,7 +531,9 @@ namespace MWClass
|
|||
}
|
||||
|
||||
const MWWorld::LiveCellRef<ESM::NPC> *ref = ptr.get<ESM::NPC>();
|
||||
return ref->mBase->mName;
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
MWMechanics::CreatureStats& Npc::getCreatureStats (const MWWorld::Ptr& ptr) const
|
||||
|
@ -1071,7 +1073,7 @@ namespace MWClass
|
|||
MWGui::ToolTipInfo info;
|
||||
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr));
|
||||
if(fullHelp && ptr.getRefData().getCustomData() && ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
|
||||
if(fullHelp && !ref->mBase->mName.empty() && ptr.getRefData().getCustomData() && ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
|
||||
{
|
||||
info.caption += " (";
|
||||
info.caption += MyGUI::TextIterator::toTagsString(ref->mBase->mName);
|
||||
|
|
|
@ -48,8 +48,7 @@ namespace MWClass
|
|||
///< Add reference into a cell for rendering
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual MWMechanics::CreatureStats& getCreatureStats (const MWWorld::Ptr& ptr) const;
|
||||
///< Return creature stats
|
||||
|
@ -61,7 +60,7 @@ namespace MWClass
|
|||
///< Return container store
|
||||
|
||||
virtual bool hasToolTip(const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
|
|
@ -49,8 +49,9 @@ namespace MWClass
|
|||
std::string Potion::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -98,19 +99,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Potion::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Potion::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Potion> *ref = ptr.get<ESM::Potion>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,16 +17,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -47,8 +47,9 @@ namespace MWClass
|
|||
std::string Probe::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
std::shared_ptr<MWWorld::Action> Probe::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const
|
||||
|
@ -104,19 +105,12 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Probe::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Probe::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Probe> *ref = ptr.get<ESM::Probe>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,16 +17,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -44,8 +44,9 @@ namespace MWClass
|
|||
std::string Repair::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -93,13 +94,6 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Repair::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
bool Repair::hasItemHealth (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
return true;
|
||||
|
@ -117,7 +111,7 @@ namespace MWClass
|
|||
const MWWorld::LiveCellRef<ESM::Repair> *ref = ptr.get<ESM::Repair>();
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
std::string text;
|
||||
|
|
|
@ -17,16 +17,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -45,6 +45,11 @@ namespace MWClass
|
|||
return "";
|
||||
}
|
||||
|
||||
bool Static::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Static::registerSelf()
|
||||
{
|
||||
std::shared_ptr<Class> instance (new Static);
|
||||
|
|
|
@ -17,8 +17,10 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ namespace MWClass
|
|||
std::string Weapon::getName (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
|
||||
const std::string& name = ref->mBase->mName;
|
||||
|
||||
return ref->mBase->mName;
|
||||
return !name.empty() ? name : ref->mBase->mId;
|
||||
}
|
||||
|
||||
std::shared_ptr<MWWorld::Action> Weapon::activate (const MWWorld::Ptr& ptr,
|
||||
|
@ -155,20 +156,13 @@ namespace MWClass
|
|||
return ref->mBase->mIcon;
|
||||
}
|
||||
|
||||
bool Weapon::hasToolTip (const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
|
||||
|
||||
return (ref->mBase->mName != "");
|
||||
}
|
||||
|
||||
MWGui::ToolTipInfo Weapon::getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const
|
||||
{
|
||||
const MWWorld::LiveCellRef<ESM::Weapon> *ref = ptr.get<ESM::Weapon>();
|
||||
const ESM::WeaponType* weaponType = MWMechanics::getWeaponType(ref->mBase->mData.mType);
|
||||
|
||||
MWGui::ToolTipInfo info;
|
||||
info.caption = MyGUI::TextIterator::toTagsString(ref->mBase->mName) + MWGui::ToolTips::getCountString(count);
|
||||
info.caption = MyGUI::TextIterator::toTagsString(getName(ptr)) + MWGui::ToolTips::getCountString(count);
|
||||
info.icon = ref->mBase->mIcon;
|
||||
|
||||
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
|
|
|
@ -18,16 +18,12 @@ namespace MWClass
|
|||
virtual void insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWPhysics::PhysicsSystem& physics) const;
|
||||
|
||||
virtual std::string getName (const MWWorld::ConstPtr& ptr) const;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual std::shared_ptr<MWWorld::Action> activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor) const;
|
||||
///< Generate action for activation
|
||||
|
||||
virtual bool hasToolTip (const MWWorld::ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const MWWorld::ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
||||
|
|
|
@ -959,7 +959,7 @@ namespace MWMechanics
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!target.getClass().canBeActivated(target))
|
||||
if (!target.getClass().hasToolTip(target))
|
||||
return true;
|
||||
|
||||
// TODO: implement a better check to check if target is owned bed
|
||||
|
|
|
@ -109,11 +109,6 @@ namespace MWWorld
|
|||
throw std::runtime_error("class cannot block");
|
||||
}
|
||||
|
||||
bool Class::canBeActivated(const Ptr& ptr) const
|
||||
{
|
||||
return !getName(ptr).empty();
|
||||
}
|
||||
|
||||
void Class::onHit(const Ptr& ptr, float damage, bool ishealth, const Ptr& object, const Ptr& attacker, const osg::Vec3f& hitPosition, bool successful) const
|
||||
{
|
||||
throw std::runtime_error("class cannot be hit");
|
||||
|
@ -298,7 +293,7 @@ namespace MWWorld
|
|||
|
||||
bool Class::hasToolTip (const ConstPtr& ptr) const
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string Class::getEnchantment (const ConstPtr& ptr) const
|
||||
|
|
|
@ -83,8 +83,7 @@ namespace MWWorld
|
|||
///< Add reference into a cell for rendering (default implementation: don't render anything).
|
||||
|
||||
virtual std::string getName (const ConstPtr& ptr) const = 0;
|
||||
///< \return name (the one that is to be presented to the user; not the internal one);
|
||||
/// can return an empty string.
|
||||
///< \return name or ID; can return an empty string.
|
||||
|
||||
virtual void adjustPosition(const MWWorld::Ptr& ptr, bool force) const;
|
||||
///< Adjust position to stand on ground. Must be called post model load
|
||||
|
@ -95,7 +94,7 @@ namespace MWWorld
|
|||
/// (default implementation: throw an exception)
|
||||
|
||||
virtual bool hasToolTip (const ConstPtr& ptr) const;
|
||||
///< @return true if this object has a tooltip when focused (default implementation: false)
|
||||
///< @return true if this object has a tooltip when focused (default implementation: true)
|
||||
|
||||
virtual MWGui::ToolTipInfo getToolTipInfo (const ConstPtr& ptr, int count) const;
|
||||
///< @return the content of the tool tip to be displayed. raises exception if the object has no tooltip.
|
||||
|
@ -140,10 +139,6 @@ namespace MWWorld
|
|||
///< Play the appropriate sound for a blocked attack, depending on the currently equipped shield
|
||||
/// (default implementation: throw an exception)
|
||||
|
||||
virtual bool canBeActivated(const Ptr& ptr) const;
|
||||
///< \return Can the player activate this object?
|
||||
/// (default implementation: true if object's user-readable name is not empty, false otherwise)
|
||||
|
||||
virtual std::shared_ptr<Action> activate (const Ptr& ptr, const Ptr& actor) const;
|
||||
///< Generate action for activation (default implementation: return a null action).
|
||||
|
||||
|
|
|
@ -236,7 +236,7 @@ namespace MWWorld
|
|||
if (toActivate.isEmpty())
|
||||
return;
|
||||
|
||||
if (!toActivate.getClass().canBeActivated(toActivate))
|
||||
if (!toActivate.getClass().hasToolTip(toActivate))
|
||||
return;
|
||||
|
||||
MWBase::Environment::get().getWorld()->activate(toActivate, player);
|
||||
|
|
|
@ -3023,7 +3023,7 @@ namespace MWWorld
|
|||
target = getFacedObject();
|
||||
|
||||
// if the faced object can not be activated, do not use it
|
||||
if (!target.isEmpty() && !target.getClass().canBeActivated(target))
|
||||
if (!target.isEmpty() && !target.getClass().hasToolTip(target))
|
||||
target = nullptr;
|
||||
|
||||
if (target.isEmpty())
|
||||
|
@ -3082,7 +3082,7 @@ namespace MWWorld
|
|||
{
|
||||
target = result2.mHitObject;
|
||||
hitPosition = result2.mHitPointWorld;
|
||||
if (dist2 > getMaxActivationDistance() && !target.isEmpty() && !target.getClass().canBeActivated(target))
|
||||
if (dist2 > getMaxActivationDistance() && !target.isEmpty() && !target.getClass().hasToolTip(target))
|
||||
target = nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -3650,7 +3650,7 @@ namespace MWWorld
|
|||
if (fromProjectile && effectInfo.mArea <= 0)
|
||||
continue; // Don't play explosion for projectiles with 0-area effects
|
||||
|
||||
if (!fromProjectile && effectInfo.mRange == ESM::RT_Touch && (!ignore.isEmpty()) && (!ignore.getClass().isActor() && !ignore.getClass().canBeActivated(ignore)))
|
||||
if (!fromProjectile && effectInfo.mRange == ESM::RT_Touch && !ignore.isEmpty() && !ignore.getClass().isActor() && !ignore.getClass().hasToolTip(ignore))
|
||||
continue; // Don't play explosion for touch spells on non-activatable objects except when spell is from the projectile enchantment
|
||||
|
||||
// Spawn the explosion orb effect
|
||||
|
|
Loading…
Reference in a new issue