Tetris: clear out lines #421

This commit is contained in:
nick black 2020-03-26 00:10:22 -04:00
parent 1cd9ec2b31
commit 4afa02a44f
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -22,7 +22,7 @@ void LockPiece(){
}
cleared = 0;
int y;
for(y = bdimy - 2 ; y > 0 ; --y){
for(y = bdimy - 2 ; y > 0 ; --y){ // get the lowest cleared area
if(LineClear(y)){
++cleared;
}else if(cleared){
@ -36,7 +36,11 @@ void LockPiece(){
if(board_->get_at(dy, x, &c) < 0){
throw TetrisNotcursesErr("get_at()");
}
if(board_->putc(dy + 1, x, &c) < 0){
if(board_->putc(dy + cleared, x, &c) < 0){
throw TetrisNotcursesErr("putc()");
}
c.get().gcluster = 0;
if(board_->putc(dy, x, &c) < 0){
throw TetrisNotcursesErr("putc()");
}
}