diff --git a/source/main.cpp b/source/main.cpp index e424d717d5f58df72d659e0fffc73e2533d3c0f4..06e6f94a35f322405ea8bcc3365679e075a21aed 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -533,7 +533,10 @@ int eliminate_rows(MicroBitImage& stacked_shapes) { stacked_shapes.setPixelValue(x, above + 1, value); } } - // FIXME: we don't clear the top row, but we should! + // clear the top row, the manual shift down didn't clear it + for (int x = 0; x < 5; x++) { + stacked_shapes.setPixelValue(x, 0, 0); + } } } else { /* @@ -546,7 +549,16 @@ int eliminate_rows(MicroBitImage& stacked_shapes) { row--; } } while (row > 0); - // FIXME: we don't check if the top row can be eliminated, but we should! + /* + * these checks left out the top row, so manually check it now as a special + * case as the clearing behaviour for it is different + */ + if (is_row_contiquous(stacked_shapes, 0)) { + eliminated++; + for (int x = 0; x < 5; x++) { + stacked_shapes.setPixelValue(x, 0, 0); + } + } // return the number of eliminated rows return eliminated; }