diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-04 00:44:29 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-04 00:44:29 +0200 |
commit | 44e36d9aaddb93b0ec0e38561c745a1182536752 (patch) | |
tree | f33032add745d2f566c9066fb29064ffb9d21b06 | |
parent | 62f7f72d2050b1ab70c8cedad8ba9922ee073f8f (diff) | |
download | minetest-44e36d9aaddb93b0ec0e38561c745a1182536752.tar.gz minetest-44e36d9aaddb93b0ec0e38561c745a1182536752.tar.bz2 minetest-44e36d9aaddb93b0ec0e38561c745a1182536752.zip |
Fix craftitem aliases
-rw-r--r-- | src/craftitemdef.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/craftitemdef.cpp b/src/craftitemdef.cpp index 622c5c65f..8d4cbea3c 100644 --- a/src/craftitemdef.cpp +++ b/src/craftitemdef.cpp @@ -85,8 +85,16 @@ public: { clear(); } - virtual const CraftItemDefinition* getCraftItemDefinition(const std::string &itemname) const + virtual const CraftItemDefinition* getCraftItemDefinition(const std::string &itemname_) const { + // Convert name according to possible alias + std::string itemname = itemname_; + std::map<std::string, std::string>::const_iterator i; + i = m_aliases.find(itemname); + if(i != m_aliases.end()){ + itemname = i->second; + } + // Get the definition core::map<std::string, CraftItemDefinition*>::Node *n; n = m_item_definitions.find(itemname); if(n == NULL) |