git repos / blockattack-game

commit 405b6531

sago007 · 2016-04-13 19:11
405b65310fdd10372587bcd4ee1ea8003600ca19 patch · browse files
parent 285a976a6a90fdf505543ba846682d2448b5e94c

Fixed some incorrect and/or logic regarding grey garbage

Changed files

M source/code/BlockGame.cpp before
diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index e307f43..24637c4 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp
@@ -632,20 +632,17 @@ bool BlockGame::CreateGarbage(int wide, int height) {
//Creates garbage using a given wide and height
bool BlockGame::CreateGreyGarbage() {
int startPosition = 12;
- while ((!(LineEmpty(startPosition))) || (startPosition == 29)) {
+ while ( startPosition <= 29 && !LineEmpty(startPosition) ) {
startPosition++;
}
- if (startPosition == 29) {
+ if (startPosition >= 29) {
return false; //failed to place blocks
}
if (29-startPosition<1) {
return false; //not enough space
}
- int start, end;
- {
- start=0;
- end=6;
- }
+ int start = 0;
+ int end = 6;
for (int i = startPosition; i <startPosition+1; i++) {
for (int j = start; j < end; j++) {
board[j][i] = 2*1000000+nextGarbageNumber;