aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2015-07-04 19:43:46 +0200
committerest31 <MTest31@outlook.com>2015-07-04 19:43:46 +0200
commit64dc0532098ceeaa8a9de01984bd6a309578ec1e (patch)
tree641b035ba8105588a55ca68e5d73ea82d3e2ae5d
parentc53520aa314960855fc57bf09045c3f977557bb5 (diff)
downloadminetest-64dc0532098ceeaa8a9de01984bd6a309578ec1e.tar.gz
minetest-64dc0532098ceeaa8a9de01984bd6a309578ec1e.tar.bz2
minetest-64dc0532098ceeaa8a9de01984bd6a309578ec1e.zip
Fix endless loop since grandparent commit
-rw-r--r--src/craftdef.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/craftdef.cpp b/src/craftdef.cpp
index 022b98da3..409481e64 100644
--- a/src/craftdef.cpp
+++ b/src/craftdef.cpp
@@ -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()) << '"';