Fixed game stats screen #20

This commit is contained in:
2017-05-22 21:30:38 +02:00
parent 359e55de4b
commit 8bd852ad8b
2 changed files with 19 additions and 7 deletions

View File

@@ -223,6 +223,7 @@ void drawGuessWord(game_state *gs) {
}
rows++;
}
gs->wordRows = rows; //set the number of rows for clearing the screen later
tempstartpos = xcounter = gs->centerx - (gs->wordLength / rows);
}
@@ -327,13 +328,14 @@ int checkWin(game_state *gs) {
void printGameStats(game_state *gs) {
//clear();
int i;
int i, z;
double diff;
diff = difftime(gs->endTime, gs->startTime);
for (z = 0; z <= gs->wordRows; z++) { //<= takes the last row too
for (i = 0; i < gs->maxx; i++) {
mvprintw(gs->centery, i, " ");
mvprintw(gs->centery + 1, i, " ");
mvprintw(gs->centery + z, i, " ");
//mvprintw(gs->centery + 1, i, " ");
}
}
if (gs->moves >= gs->allowedMoves) {
mvprintw(gs->centery, gs->centerx - 10, "Game lost. Solution:");
@@ -447,3 +449,12 @@ void drawFigure(game_state *gs, int drawNext) {
}
void lala(void) {
int c;
if ((c = getch()) == 10) {
c *= 5;
}
}

View File

@@ -5,7 +5,7 @@
/* Defined macros */
#define DEFAULTTRIES 6
#define MAXWORDLENGTH 100
#define MAXWORDLENGTH 200
#define ALPHABET 26
#define ALPHABET_NUM 36
#define ANIM_DURATION 1
@@ -28,6 +28,7 @@ typedef struct {
char *alphabet;
time_t startTime;
time_t endTime;
int wordRows;
} game_state;
typedef struct word {