mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
Tetris: take upper halves into account for PieceStuck()
This commit is contained in:
parent
d5e0b24f01
commit
642741f2c9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user