Fix endless loop since grandparent commit
authorest31 <MTest31@outlook.com>
Sat, 4 Jul 2015 17:43:46 +0000 (19:43 +0200)
committerest31 <MTest31@outlook.com>
Sat, 4 Jul 2015 17:43:46 +0000 (19:43 +0200)
src/craftdef.cpp

index 022b98da3285ed5e842b24c115e078546274a2b8..409481e64ad402019810ec557601f889a7636e10 100644 (file)
@@ -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()) << '"';