diff options
author | Ivan Davydov <lotigara@lotigara.ru> | 2025-04-05 19:35:56 +0300 |
---|---|---|
committer | Ivan Davydov <lotigara@lotigara.ru> | 2025-04-05 19:35:56 +0300 |
commit | 1e410b277ca4468b136dcb8df578293dc3dbcb19 (patch) | |
tree | 1c8491fcb34d44be454ad03a6c85e712cea89b20 | |
parent | acdbbac995f5525eb1eb8143eb9d7554eb9221f8 (diff) |
Code style improvements
-rwxr-xr-x | a.out | bin | 16328 -> 16328 bytes | |||
-rw-r--r-- | clicker-ncurses.c | 12 |
2 files changed, 6 insertions, 6 deletions
Binary files differ diff --git a/clicker-ncurses.c b/clicker-ncurses.c index 6adf5bf..fbcc076 100644 --- a/clicker-ncurses.c +++ b/clicker-ncurses.c @@ -46,32 +46,31 @@ main (void) /* Refresh our window to include settings above */ refresh(); + /* Initialize the structure and set the values */ struct game *cur_game = malloc(sizeof(struct game)); cur_game->click = 1; cur_game->multiplifier = 2; /* The main loop that also catches user input */ int ch = 0; - while ( ch = getch() ) + while (ch = getch()) { - if ( ch == ' ') + if (ch == ' ') { set_score(cur_game, get_score(cur_game) + get_click(cur_game)); - mvprintw(3, 1, "%d", get_score(cur_game)); } - if ( ch == 'q') + if (ch == 'q') { break; } - if ( ch == 'u') + if (ch == 'u') { if (get_score(cur_game) >= 2 * get_multiplifier(cur_game)) { set_score(cur_game, get_score(cur_game) - get_click(cur_game) * 2); set_click(cur_game, get_click(cur_game) * get_multiplifier(cur_game)); - mvprintw(3, 1, "%d", get_score(cur_game)); } } } @@ -90,6 +89,7 @@ void * set_score (struct game *game, int score) { game->score = score; + mvprintw(3, 1, "%d", game->score); } int |