Files
retrobsd/src/games/hangman/endgame.c
Serge Vakulenko aecac2f5d7 Ported hangman.
2014-09-08 18:07:59 -07:00

38 lines
628 B
C

#include "hangman.h"
/*
* endgame:
* Do what's necessary at the end of the game
*/
void
endgame()
{
register char ch;
prman();
if (Errors >= MAXERRS)
Errors = MAXERRS + 2;
prword();
prdata();
move(MESGY, MESGX);
if (Errors > MAXERRS)
printw("Sorry, the word was \"%s\"\n", Word);
else
printw("You got it!\n");
for (;;) {
mvaddstr(MESGY + 1, MESGX, "Another word? ");
leaveok(stdscr, FALSE);
refresh();
if ((ch = readch()) == 'n')
die(0);
else if (ch == 'y')
break;
mvaddstr(MESGY + 2, MESGX, "Please type 'y' or 'n'");
}
leaveok(stdscr, TRUE);
move(MESGY, MESGX);
addstr("\n\n\n");
}