summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlexander Harkness <bearbin@gmail.com>2016-05-17 16:23:52 +0200
committerAlexander Harkness <bearbin@gmail.com>2016-05-17 16:28:26 +0200
commitdb7ff89b9bd1c8b6630627482d40fa5e7044d976 (patch)
treec5d2e872dcd82180ee4aea7b24104f526afb776d /src
parentSome 1.9 Crafting Recipes and Items. (diff)
downloadcuberite-itemsinicleanup.tar
cuberite-itemsinicleanup.tar.gz
cuberite-itemsinicleanup.tar.bz2
cuberite-itemsinicleanup.tar.lz
cuberite-itemsinicleanup.tar.xz
cuberite-itemsinicleanup.tar.zst
cuberite-itemsinicleanup.zip
Diffstat (limited to 'src')
-rw-r--r--src/BlockID.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/BlockID.cpp b/src/BlockID.cpp
index 357f6a5a4..01f2f3bde 100644
--- a/src/BlockID.cpp
+++ b/src/BlockID.cpp
@@ -64,7 +64,10 @@ public:
int Resolve(const AString & a_ItemName)
{
- ItemMap::iterator itr = m_Map.find(a_ItemName);
+ // Convert to lowercase and remove underscores.
+ auto saneItemName = StrToLower(a_ItemName);
+ saneItemName.erase(std::remove(saneItemName.begin(), saneItemName.end(), '_'), saneItemName.end());
+ ItemMap::iterator itr = m_Map.find(saneItemName);
if (itr == m_Map.end())
{
return -1;
@@ -75,8 +78,12 @@ public:
bool ResolveItem(const AString & a_ItemName, cItem & a_Item)
{
+ // Convert to lowercase and remove underscores.
+ auto saneItemName = StrToLower(a_ItemName);
+ saneItemName.erase(std::remove(saneItemName.begin(), saneItemName.end(), '_'), saneItemName.end());
+
// Split into parts divided by either ':' or '^'
- AStringVector Split = StringSplitAndTrim(a_ItemName, ":^");
+ AStringVector Split = StringSplitAndTrim(saneItemName, ":^");
if (Split.empty())
{
return false;