diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/db/itemdb.cpp | 10 | ||||
-rw-r--r-- | src/resources/db/itemdb.h | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index a98f0dad4..274b44bb2 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -801,6 +801,16 @@ bool ItemDB::exists(const int id) return i != mItemInfos.end(); } +bool ItemDB::exists(const std::string &name) +{ + if (!mLoaded) + return false; + + const NamedItemInfos::const_iterator i = mNamedItemInfos.find( + normalize(name)); + return i != mNamedItemInfos.end(); +} + const ItemInfo &ItemDB::get(const int id) { if (!mLoaded) diff --git a/src/resources/db/itemdb.h b/src/resources/db/itemdb.h index 96de60b6a..1515d3ba0 100644 --- a/src/resources/db/itemdb.h +++ b/src/resources/db/itemdb.h @@ -49,6 +49,7 @@ namespace ItemDB const StringVect &getTags(); bool exists(const int id) A_WARN_UNUSED; + bool exists(const std::string &name) A_WARN_UNUSED; const ItemInfo &get(const int id) A_WARN_UNUSED; const ItemInfo &get(const std::string &name) A_WARN_UNUSED; |