summaryrefslogtreecommitdiff
path: root/src/item.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-05-07 20:20:09 +0300
committerAndrei Karas <akaras@inbox.ru>2012-05-07 20:20:09 +0300
commit860c60be6c7a925bb4d8db291b771a6044d20308 (patch)
treeddeb0b2bd54a4b66bd699b220050e4f952bb429f /src/item.cpp
parent6f9d0494f09833e29a05a2c06287fbee73cb7421 (diff)
downloadmanaplus-860c60be6c7a925bb4d8db291b771a6044d20308.tar.gz
manaplus-860c60be6c7a925bb4d8db291b771a6044d20308.tar.bz2
manaplus-860c60be6c7a925bb4d8db291b771a6044d20308.tar.xz
manaplus-860c60be6c7a925bb4d8db291b771a6044d20308.zip
Add getName property to item and flooritem.
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/item.cpp b/src/item.cpp
index cc7d666b5..fda05aa30 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -31,6 +31,8 @@
#include "debug.h"
+extern int serverVersion;
+
Item::Item(int id, int quantity, int refine, unsigned char color,
bool equipment, bool equipped):
mImage(nullptr),
@@ -113,3 +115,12 @@ Image *Item::getImage(int id, unsigned char color)
image = Theme::getImageFromTheme("unknown-item.png");
return image;
}
+
+std::string Item::getName()
+{
+ const ItemInfo &info = ItemDB::get(mId);
+ if (serverVersion > 0)
+ return info.getName(mColor);
+ else
+ return info.getName();
+}