главная|main page

состояние|status

блог|blog

файлы|files

программы|software

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Davydov <lotigara@lotigara.ru>2025-04-05 19:35:56 +0300
committerIvan Davydov <lotigara@lotigara.ru>2025-04-05 19:35:56 +0300
commit1e410b277ca4468b136dcb8df578293dc3dbcb19 (patch)
tree1c8491fcb34d44be454ad03a6c85e712cea89b20
parentacdbbac995f5525eb1eb8143eb9d7554eb9221f8 (diff)
Code style improvements
-rwxr-xr-xa.outbin16328 -> 16328 bytes
-rw-r--r--clicker-ncurses.c12
2 files changed, 6 insertions, 6 deletions
diff --git a/a.out b/a.out
index eb2626a..038790f 100755
--- a/a.out
+++ b/a.out
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