summaryrefslogtreecommitdiff
path: root/src/resources/itemdb.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-24 21:34:15 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-24 21:37:38 +0200
commit4e18e7619e9a8c909dea3374a2a7aa39befe0c16 (patch)
treebb7cf8bcf21eca8f2a43bf59421737419628b46b /src/resources/itemdb.cpp
parentcc28b48adcc8ef3b584312e598035c34384dcf78 (diff)
downloadmana-4e18e7619e9a8c909dea3374a2a7aa39befe0c16.tar.gz
mana-4e18e7619e9a8c909dea3374a2a7aa39befe0c16.tar.bz2
mana-4e18e7619e9a8c909dea3374a2a7aa39befe0c16.tar.xz
mana-4e18e7619e9a8c909dea3374a2a7aa39befe0c16.zip
Fixed item links that aren't written in lowercase
In commit 2a9f8e05312c210ec204e09861f47c3d017706eb I meant to move the normalizing of item names into the database, but the commit failed to include this change.
Diffstat (limited to 'src/resources/itemdb.cpp')
-rw-r--r--src/resources/itemdb.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index a8a0681d..9a17eb3a 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -96,6 +96,12 @@ static WeaponType weaponTypeFromString(const std::string &name, int id = 0)
else return WPNTYPE_NONE;
}
+static std::string normalized(const std::string &name)
+{
+ std::string normalized = name;
+ return toLower(trim(normalized));;
+}
+
void ItemDB::load()
{
if (mLoaded)
@@ -196,8 +202,7 @@ void ItemDB::load()
mItemInfos[id] = itemInfo;
if (!name.empty())
{
- std::string temp = name;
- toLower(trim(temp));
+ std::string temp = normalized(name);
NamedItemInfos::const_iterator itr = mNamedItemInfos.find(temp);
if (itr == mNamedItemInfos.end())
@@ -262,7 +267,7 @@ const ItemInfo &ItemDB::get(const std::string &name)
{
assert(mLoaded);
- NamedItemInfos::const_iterator i = mNamedItemInfos.find(name);
+ NamedItemInfos::const_iterator i = mNamedItemInfos.find(normalized(name));
if (i == mNamedItemInfos.end())
{