Tetris: take upper halves into account for PieceStuck()

This commit is contained in:
nick black 2020-03-25 22:05:29 -04:00
parent d5e0b24f01
commit 642741f2c9
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -6,6 +6,17 @@ bool PieceStuck() {
int y, x;
curpiece_->get_dim(&y, &x);
while(x--){
ncpp::Cell piecec;
if(curpiece_->get_at(y - 1, x, &piecec) < 0){
throw TetrisNotcursesErr("get_at()");
}
if(!piecec.get().gcluster || piecec.get().gcluster == ' '){
continue;
}
const char* egc = curpiece_->get_extended_gcluster(piecec);
if(strcmp(egc, "") && strcmp(egc, "")){
continue;
}
int cmpy = y, cmpx = x; // need game area coordinates via translation
curpiece_->translate(*board_, &cmpy, &cmpx);
ncpp::Cell c;