Tetris: fix line clearing of final column #421

pull/426/head
nick black 4 years ago
parent e500d0f8f4
commit 752c29e648
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1,8 +1,5 @@
void LockPiece(){
curpiece_->mergedown(*board_);
if(!board_->cursor_move(0, 1)){
throw TetrisNotcursesErr("cursor_move()");
}
int bdimy, bdimx;
board_->get_dim(&bdimy, &bdimx);
int cleared; // how many contiguous lines were cleared
@ -12,6 +9,9 @@ void LockPiece(){
channels_set_fg(&tr, 0x00ff00); channels_set_bg_alpha(&tr, CELL_ALPHA_TRANSPARENT);
channels_set_fg(&bl, 0x0000ff); channels_set_bg_alpha(&bl, CELL_ALPHA_TRANSPARENT);
channels_set_fg(&br, 0x00ffff); channels_set_bg_alpha(&br, CELL_ALPHA_TRANSPARENT);
if(!board_->cursor_move(0, 1)){
throw TetrisNotcursesErr("cursor_move()");
}
if(!board_->stain(bdimy - 2, bdimx - 2, tl, tr, bl, br)){
throw TetrisNotcursesErr("stain()");
}
@ -26,7 +26,7 @@ void LockPiece(){
}
if(cleared){ // topmost verified clear is y + 1, bottommost is y + cleared
for(int dy = y ; dy >= 0 ; --dy){
for(int x = 1 ; x < bdimx - 2 ; ++x){
for(int x = 1 ; x < bdimx - 1 ; ++x){
ncpp::Cell c;
if(board_->get_at(dy, x, &c) < 0){
throw TetrisNotcursesErr("get_at()");

Loading…
Cancel
Save