Fix craftitem aliases
authorPerttu Ahola <celeron55@gmail.com>
Sat, 3 Dec 2011 22:44:29 +0000 (00:44 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Sat, 3 Dec 2011 22:44:29 +0000 (00:44 +0200)
src/craftitemdef.cpp

index 622c5c65ff9153bf8836304464ba963012765b86..8d4cbea3c45ba6d876bb221620b6ceb9d58a6449 100644 (file)
@@ -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)