diff options
Diffstat (limited to 'src/item.cpp')
-rw-r--r-- | src/item.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/item.cpp b/src/item.cpp index 94eaf383e..33d3916d3 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -62,7 +62,14 @@ void Item::setId(int id) mDrawImage->decRef(); ResourceManager *resman = ResourceManager::getInstance(); - SpriteDisplay display = getInfo().getDisplay(); + ItemInfo info = getInfo(); + mTags = info.getTags(); + logger->log("tag0=" + toString(mTags[1])); + +// for (int f = 0; f < mTags->size(); f ++) +// logger->log("tag: %d", (*mTags)[f]); + + SpriteDisplay display = info.getDisplay(); std::string imagePath = paths.getStringValue("itemIcons") + display.image; mImage = resman->getImage(imagePath); @@ -81,6 +88,13 @@ void Item::setId(int id) } } +bool Item::isHaveTag(int tagId) +{ + if (mTags.find(tagId) == mTags.end()) + return false; + return mTags[tagId] > 0; +} + Image *Item::getImage(int id) { ResourceManager *resman = ResourceManager::getInstance(); |