]> git.lizzy.rs Git - minetest.git/blobdiff - src/craftdef.cpp
Set acceleration only once in falling node
[minetest.git] / src / craftdef.cpp
index 022b98da3285ed5e842b24c115e078546274a2b8..67c3ae62ac39205be2f37abc7f15457c1aba58d2 100644 (file)
@@ -214,7 +214,7 @@ static void craftDecrementOrReplaceInput(CraftInput &input,
                for (std::vector<std::pair<std::string, std::string> >::iterator
                                j = pairs.begin();
                                j != pairs.end(); ++j) {
-                       if (item.name == craftGetItemName(j->first, gamedef)) {
+                       if (inputItemMatchesRecipe(item.name, j->first, gamedef->idef())) {
                                if (item.count == 1) {
                                        item.deSerialize(j->second, gamedef->idef());
                                        found_replacement = true;
@@ -242,12 +242,13 @@ static std::string craftDumpMatrix(const std::vector<std::string> &items,
 {
        std::ostringstream os(std::ios::binary);
        os << "{ ";
+       unsigned int x = 0;
        for(std::vector<std::string>::size_type i = 0;
-                       i < items.size(); i++) {
-               if (i == width) {
+                       i < items.size(); i++, x++) {
+               if (x == width) {
                        os << "; ";
-                       i = 0;
-               } else if (i != 0) {
+                       x = 0;
+               } else if (x != 0) {
                        os << ",";
                }
                os << '"' << items[i] << '"';
@@ -262,12 +263,13 @@ std::string craftDumpMatrix(const std::vector<ItemStack> &items,
 {
        std::ostringstream os(std::ios::binary);
        os << "{ ";
+       unsigned int x = 0;
        for (std::vector<ItemStack>::size_type i = 0;
-                       i < items.size(); i++) {
-               if (i == width) {
+                       i < items.size(); i++, x++) {
+               if (x == width) {
                        os << "; ";
-                       i = 0;
-               } else if (i != 0) {
+                       x = 0;
+               } else if (x != 0) {
                        os << ",";
                }
                os << '"' << (items[i].getItemString()) << '"';
@@ -962,10 +964,10 @@ class CCraftDefManager: public IWritableCraftDefManager
        {
                std::ostringstream os(std::ios::binary);
                os << "Crafting definitions:\n";
-               for (int type = 0; type <= craft_hash_type_max; type++) {
+               for (int type = 0; type <= craft_hash_type_max; ++type) {
                        for (std::map<u64, std::vector<CraftDefinition*> >::const_iterator
                                        it = (m_craft_defs[type]).begin();
-                                       it != (m_craft_defs[type]).end(); it++) {
+                                       it != (m_craft_defs[type]).end(); ++it) {
                                for (std::vector<CraftDefinition*>::size_type i = 0;
                                                i < it->second.size(); i++) {
                                        os << "type " << type
@@ -990,10 +992,10 @@ class CCraftDefManager: public IWritableCraftDefManager
        }
        virtual void clear()
        {
-               for (int type = 0; type <= craft_hash_type_max; type++) {
+               for (int type = 0; type <= craft_hash_type_max; ++type) {
                        for (std::map<u64, std::vector<CraftDefinition*> >::iterator
                                        it = m_craft_defs[type].begin();
-                                       it != m_craft_defs[type].end(); it++) {
+                                       it != m_craft_defs[type].end(); ++it) {
                                for (std::vector<CraftDefinition*>::iterator
                                                iit = it->second.begin();
                                                iit != it->second.end(); ++iit) {