summaryrefslogtreecommitdiff
path: root/src/inventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r--src/inventory.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 40dc602d0..f2cc2ede3 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -246,6 +246,14 @@ std::string ItemStack::getItemString() const
return os.str();
}
+std::string ItemStack::getDescription(IItemDefManager *itemdef) const
+{
+ std::string desc = metadata.getString("description");
+ if (desc.empty())
+ desc = getDefinition(itemdef).description;
+ return desc.empty() ? name : desc;
+}
+
ItemStack ItemStack::addItem(ItemStack newitem, IItemDefManager *itemdef)
{