diff options
| author | david <[email protected]> | 2026-07-28 03:23:28 -0300 |
|---|---|---|
| committer | david <[email protected]> | 2026-07-28 03:23:28 -0300 |
| commit | acb78f0835a458377495d6417f93110c45d07816 (patch) | |
| tree | b5bbf282e44a45060f45fd4bc0894dceb29ee664 /games | |
| parent | 64d81da061d573fcd5b0a814cdc38844854cb211 (diff) | |
| download | petratc-acb78f0835a458377495d6417f93110c45d07816.tar.gz petratc-acb78f0835a458377495d6417f93110c45d07816.zip | |
fixed a couple bugs
Diffstat (limited to 'games')
| -rw-r--r-- | games/gamecatch.c | 7 | ||||
| -rw-r--r-- | games/gameclicker.c | 3 | ||||
| -rw-r--r-- | games/gamemaze.c | 5 |
3 files changed, 7 insertions, 8 deletions
diff --git a/games/gamecatch.c b/games/gamecatch.c index 0680027..a1328d5 100644 --- a/games/gamecatch.c +++ b/games/gamecatch.c @@ -97,10 +97,9 @@ void gamecatch(){ running = 1; while (running) { - if(!running){stop();} int ch = getch(); switch (ch) { - case 'q': case 'Q': stop(); break; + case 'q': case 'Q': running = 0; break; case 'a': case 'A': case KEY_LEFT: curs.posx-= 2; if(curs.posx < 0) curs.posx = width - 6; @@ -123,7 +122,7 @@ void gamecatch(){ mvwvline(win, 1, width + 1, ACS_VLINE, height); mvwaddch(win, 0, width + 1, ACS_TTEE); mvwaddch(win, height + 1, width + 1, ACS_BTEE); - //this should do it + /*this should do it*/ mvwprintw(win, 1, width + 3, "caught: %d/30", howmany); mvwprintw(win, 2, width + 3, "(catch 30 to win!)"); @@ -143,7 +142,7 @@ void gamecatch(){ droop[i].posx <= curs.posx + 5) { droop[i].active = 0; howmany++; - if(howmany == 30){won = 1; running = 0; stop();} + if(howmany == 30){won = 1; running = 0;} } } } diff --git a/games/gameclicker.c b/games/gameclicker.c index 2ac2ca3..f7ff783 100644 --- a/games/gameclicker.c +++ b/games/gameclicker.c @@ -182,6 +182,7 @@ static char *bignumprint(bignum b) { snprintf(nice, 32, "%.2lfe3*%d", b.x, b.y); } return nice; + free(nice); } @@ -279,7 +280,7 @@ void gameclicker(){ int ch; while((ch = getch()) != ERR){ //drain the whole queue each frame so rapid clicks/keys aren't ignroed switch (ch) { - case 'q': case 'Q': stop(); break; + case 'q': case 'Q': running = 0; break; case 'a': cheeses = addmixregbig(cheeses, 50.0); break; case 'b': cheeses = mulmixregbig(cheeses, 235.2); break; case KEY_MOUSE: { diff --git a/games/gamemaze.c b/games/gamemaze.c index 6e563cf..d4fb956 100644 --- a/games/gamemaze.c +++ b/games/gamemaze.c @@ -37,7 +37,7 @@ static void stop() { clear(); refresh(); endwin(); - if(won){addstat(&rat.fun); printf("the rat feels less hungry...\n\n");} + if(won){addstat(&rat.fun);} won = 0; found = 0; running = 0; @@ -270,10 +270,9 @@ void gamemaze(){ running = 1; while (running) { - if (!running) stop(); int ch = getch(); switch (ch) { - case 'q': case 'Q': stop(); break; + case 'q': case 'Q': running = 0; break; case 'r': case 'R': properrestart(&curs, &W, &H); break; case 'a': case 'A': case KEY_LEFT: if(curs.posx > 0 && !iswall(curs.posy, curs.posx - 1)){ |
