summaryrefslogtreecommitdiff
path: root/src/resources/db
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-01-17 15:57:05 +0300
committerAndrei Karas <akaras@inbox.ru>2016-01-17 19:19:57 +0300
commit261a118937d8b1cd41cf16d983f880e5957f84b1 (patch)
treed7b44426193cc31d309bebd801068b3960cdce60 /src/resources/db
parent41141188d70dd7d6e0b8667bda9d0f6569c0b97b (diff)
downloadmv-261a118937d8b1cd41cf16d983f880e5957f84b1.tar.gz
mv-261a118937d8b1cd41cf16d983f880e5957f84b1.tar.bz2
mv-261a118937d8b1cd41cf16d983f880e5957f84b1.tar.xz
mv-261a118937d8b1cd41cf16d983f880e5957f84b1.zip
Extend addchat command with support for cards.
Diffstat (limited to 'src/resources/db')
-rw-r--r--src/resources/db/itemdb.cpp16
-rw-r--r--src/resources/db/itemdb.h2
2 files changed, 18 insertions, 0 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index b4af71c17..9a815bed6 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -1056,6 +1056,22 @@ static void loadOrderSprite(ItemInfo *const itemInfo,
itemInfo->setDrawPriority(direction, priority);
}
+std::string ItemDB::getNamesStr(const std::vector<int> &parts)
+{
+ std::string str;
+ FOR_EACH (std::vector<int>::const_iterator, it, parts)
+ {
+ const int id = *it;
+ if (exists(id))
+ {
+ if (!str.empty())
+ str.append(",");
+ str.append(get(id).getName());
+ }
+ }
+ return str;
+}
+
#ifdef UNITTESTS
ItemDB::NamedItemInfos &ItemDB::getNamedItemInfosTest()
{
diff --git a/src/resources/db/itemdb.h b/src/resources/db/itemdb.h
index 9231bbfc8..7cc47b121 100644
--- a/src/resources/db/itemdb.h
+++ b/src/resources/db/itemdb.h
@@ -60,6 +60,8 @@ namespace ItemDB
const ItemDB::ItemInfos &getItemInfos();
+ std::string getNamesStr(const std::vector<int> &parts);
+
#ifdef UNITTESTS
ItemDB::NamedItemInfos &getNamedItemInfosTest();
#endif