| 1 | # include "hangman.h" |
| 2 | |
| 3 | /* |
| 4 | * endgame: |
| 5 | * Do what's necessary at the end of the game |
| 6 | */ |
| 7 | endgame() |
| 8 | { |
| 9 | register char ch; |
| 10 | |
| 11 | prman(); |
| 12 | if (Errors >= MAXERRS) |
| 13 | Errors = MAXERRS + 2; |
| 14 | prword(); |
| 15 | prdata(); |
| 16 | move(MESGY, MESGX); |
| 17 | if (Errors > MAXERRS) |
| 18 | printw("Sorry, the word was \"%s\"\n", Word); |
| 19 | else |
| 20 | printw("You got it!\n"); |
| 21 | |
| 22 | for (;;) { |
| 23 | mvaddstr(MESGY + 1, MESGX, "Another word? "); |
| 24 | leaveok(stdscr, FALSE); |
| 25 | refresh(); |
| 26 | if ((ch = readch()) == 'n') |
| 27 | die(); |
| 28 | else if (ch == 'y') |
| 29 | break; |
| 30 | mvaddstr(MESGY + 2, MESGX, "Please type 'y' or 'n'"); |
| 31 | } |
| 32 | |
| 33 | leaveok(stdscr, TRUE); |
| 34 | move(MESGY, MESGX); |
| 35 | addstr("\n\n\n"); |
| 36 | } |