X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/a0bb5b9abf33dc2d2220eb3bd6e79c964e92a1c1..e1ae4d1a77877d5f408947890cf752c0c0998291:/robots/move_robs.c diff --git a/robots/move_robs.c b/robots/move_robs.c index b45357cd..446d5b26 100644 --- a/robots/move_robs.c +++ b/robots/move_robs.c @@ -1,4 +1,4 @@ -/* $NetBSD: move_robs.c,v 1.4 1997/10/12 14:10:00 lukem Exp $ */ +/* $NetBSD: move_robs.c,v 1.9 2009/07/20 06:00:56 dholland Exp $ */ /* * Copyright (c) 1980, 1993 @@ -12,11 +12,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -38,30 +34,29 @@ #if 0 static char sccsid[] = "@(#)move_robs.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: move_robs.c,v 1.4 1997/10/12 14:10:00 lukem Exp $"); +__RCSID("$NetBSD: move_robs.c,v 1.9 2009/07/20 06:00:56 dholland Exp $"); #endif #endif /* not lint */ -# include "robots.h" +#include "robots.h" /* * move_robots: * Move the robots around */ void -move_robots(was_sig) - int was_sig; +move_robots(int was_sig) { - COORD *rp; + COORD *rp; if (Real_time) signal(SIGALRM, move_robots); -# ifdef DEBUG +#ifdef DEBUG move(Min.y, Min.x); addch(inch()); move(Max.y, Max.x); addch(inch()); -# endif DEBUG +#endif /* DEBUG */ for (rp = Robots; rp < &Robots[MAXROBOTS]; rp++) { if (rp->y < 0) continue; @@ -91,6 +86,7 @@ move_robots(was_sig) Dead = TRUE; else if (Field[rp->y][rp->x] > 1) { mvaddch(rp->y, rp->x, HEAP); + Scrap[Num_scrap++] = *rp; rp->y = -1; Num_robots--; if (Waiting) @@ -115,14 +111,14 @@ move_robots(was_sig) longjmp(End_move, 0); } -# ifdef DEBUG +#ifdef DEBUG standout(); move(Min.y, Min.x); addch(inch()); move(Max.y, Max.x); addch(inch()); standend(); -# endif DEBUG +#endif /* DEBUG */ if (Real_time) alarm(3); } @@ -132,8 +128,7 @@ move_robots(was_sig) * Add a score to the overall point total */ void -add_score(add) - int add; +add_score(int add) { Score += add; move(Y_SCORE, X_SCORE); @@ -145,8 +140,7 @@ add_score(add) * Return the sign of the number */ int -sign(n) - int n; +sign(int n) { if (n < 0) return -1;