UMOK: get endgame working once more

This commit is contained in:
nick black 2019-12-25 18:17:52 -05:00 committed by Nick Black
parent fb0e03fe89
commit 1cc100cd2d
3 changed files with 14 additions and 10 deletions

View File

@ -273,7 +273,7 @@ ext_demos(struct notcurses* nc, const char* demos){
results[i].failed = true;
break;
}
hud_completion_notify(i, &results[i]);
hud_completion_notify(&results[i]);
}
return results;
}
@ -375,10 +375,10 @@ int main(int argc, char** argv){
}else{
nanosleep(&demodelay, NULL);
}
if(ext_demos(nc, demos)){
if(ext_demos(nc, demos) == NULL){
goto err;
}
if(results == NULL){
if(hud_destroy()){
goto err;
}
if(notcurses_stop(nc)){

View File

@ -104,7 +104,7 @@ timespec_mul(const struct timespec* ts, unsigned multiplier, struct timespec* pr
/*----------------------------------HUD----------------------------------*/
extern struct ncplane* hud;
struct ncplane* hud_create(struct notcurses* nc);
int hud_destroy(struct ncplane* hud);
int hud_destroy(void);
// let the HUD know about an upcoming demo
int hud_schedule(const char* demoname);
@ -129,7 +129,7 @@ typedef struct demoresult {
} demoresult;
// let the HUD know that a demo has completed, reporting the stats
int hud_completion_notify(int idx, const demoresult* result);
int hud_completion_notify(const demoresult* result);
// HUD retrieves results on demand from core
const demoresult* demoresult_lookup(int idx);

View File

@ -75,9 +75,13 @@ struct ncplane* hud_create(struct notcurses* nc){
return (hud = n);
}
int hud_destroy(struct ncplane* h){
hud = NULL;
return ncplane_destroy(h);
int hud_destroy(void){
int ret = 0;
if(hud){
ret = ncplane_destroy(hud);
hud = NULL;
}
return ret;
}
// mouse has been pressed on the hud. the caller is responsible for rerendering.
@ -99,7 +103,7 @@ int hud_grab(int y, int x){
hud_grab_y = y;
ncplane_yx(hud, &hud_pos_y, &hud_pos_x);
if(x == hud_pos_x + HUD_COLS - 1 && y == hud_pos_y){
return hud_destroy(hud);
return hud_destroy();
}
ret = hud_grabbed_bg(hud);
}
@ -116,7 +120,7 @@ int hud_release(void){
}
// currently running demo is always at y = HUD_ROWS-1
int hud_completion_notify(int idx, const demoresult* result){
int hud_completion_notify(const demoresult* result){
if(running){
running->totalns = result->timens;
}