Hitscreen gets updated after Player input and before win check
This commit is contained in:
12
hangman.c
12
hangman.c
@@ -104,12 +104,11 @@ void startGame(game_state *gs, hitfeed *hf) {
|
|||||||
time(&gs->startTime);
|
time(&gs->startTime);
|
||||||
while (checkWin(gs)) {
|
while (checkWin(gs)) {
|
||||||
updateScreen(gs);
|
updateScreen(gs);
|
||||||
printHitFeed(gs, hf);
|
|
||||||
playerInput(gs, hf);
|
playerInput(gs, hf);
|
||||||
|
printHitFeed(gs, hf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void quitProgram(void) {
|
void quitProgram(void) {
|
||||||
endwin();
|
endwin();
|
||||||
}
|
}
|
||||||
@@ -456,9 +455,12 @@ void printHitFeed(game_state *gs, hitfeed *hf) {
|
|||||||
mvprintw(newMaxy + i, newMaxx, hf->history[i]);
|
mvprintw(newMaxy + i, newMaxx, hf->history[i]);
|
||||||
}
|
}
|
||||||
/* Print best score above history feed */
|
/* Print best score above history feed */
|
||||||
char message[100];
|
if (hf->besthit != 0) {
|
||||||
sprintf(message, "Best: %s (%i hits)", hf->beststreak, hf->besthit);
|
/* There is a hit. So a best score can be displayed */
|
||||||
mvprintw(newMaxy - 1, newMaxx, message);
|
char message[100];
|
||||||
|
sprintf(message, "Best: %s (%i hits)", hf->beststreak, hf->besthit);
|
||||||
|
mvprintw(newMaxy - 1, newMaxx, message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user