diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-08-24 21:55:15 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-08-24 21:55:15 +0000 |
commit | 5eafc7fbbc99105a1f1fd7ce0f177b555dc44e5d (patch) | |
tree | 456557c0b9640c17d818d595fc4218d539f40464 /games/battlestar/fly.c | |
parent | 6919cadb832d489208ea47402a42805ca4c3e750 (diff) |
various linux-based patches; from linux people; sent by jsm@octomino.demon.co.uk
Diffstat (limited to 'games/battlestar/fly.c')
-rw-r--r-- | games/battlestar/fly.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/games/battlestar/fly.c b/games/battlestar/fly.c index f9d72d5507f..323d7572be8 100644 --- a/games/battlestar/fly.c +++ b/games/battlestar/fly.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fly.c,v 1.3 1997/06/30 19:56:35 kstailey Exp $ */ +/* $OpenBSD: fly.c,v 1.4 1997/08/24 21:55:08 deraadt Exp $ */ /* $NetBSD: fly.c,v 1.3 1995/03/21 15:07:28 cgd Exp $ */ /* @@ -42,7 +42,8 @@ static char rcsid[] = "$NetBSD: fly.c,v 1.3 1995/03/21 15:07:28 cgd Exp $"; #endif #endif /* not lint */ -#include "externs.h" +#include <unistd.h> +#include "extern.h" #undef UP #include <curses.h> @@ -53,10 +54,18 @@ static char rcsid[] = "$NetBSD: fly.c,v 1.3 1995/03/21 15:07:28 cgd Exp $"; int row, column; int dr = 0, dc = 0; char destroyed; -int clock = 120; /* time for all the flights in the game */ +int bclock = 120; /* time for all the flights in the game */ char cross = 0; sig_t oldsig; +void blast __P((void)); +void endfly __P((void)); +void moveenemy __P((void)); +void notarget __P((void)); +void screen __P((void)); +void succumb __P((void)); +void target __P((void)); + void succumb() { @@ -70,10 +79,9 @@ succumb() } } +int visual() { - void moveenemy(); - destroyed = 0; if(initscr() == NULL){ puts("Whoops! No more memory..."); @@ -173,13 +181,14 @@ visual() endfly(); return(1); } - if (clock <= 0){ + if (bclock <= 0){ endfly(); die(); } } } +void screen() { register int r,c,n; @@ -196,6 +205,7 @@ screen() refresh(); } +void target() { register int n; @@ -208,6 +218,7 @@ target() } } +void notarget() { register int n; @@ -220,6 +231,7 @@ notarget() } } +void blast() { register int n; @@ -263,7 +275,7 @@ moveenemy() row += (rnd(9) - 4) % (4 - abs(row - MIDR)); column += (rnd(9) - 4) % (4 - abs(column - MIDC)); } - clock--; + bclock--; mvaddstr(oldr, oldc - 1, " "); if (cross) target(); @@ -273,18 +285,20 @@ moveenemy() move(LINES-1, 42); printw("%3d", fuel); move(LINES-1, 57); - printw("%3d", clock); + printw("%3d", bclock); refresh(); signal(SIGALRM, moveenemy); alarm(1); } +void endfly() { alarm(0); signal(SIGALRM, SIG_DFL); mvcur(0,COLS-1,LINES-1,0); endwin(); + setvbuf(stdout, NULL, _IOLBF, BUFSIZ); signal(SIGTSTP, SIG_DFL); signal(SIGINT, oldsig); } |