X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/77e3814f0c0e3dea4d0032e25666f77e6f83bfff..4260e713b7e2a1e451ebfe72e5e76d20b75f07c7:/robots/move_robs.c diff --git a/robots/move_robs.c b/robots/move_robs.c index 4eaa5b52..1f8017a8 100644 --- a/robots/move_robs.c +++ b/robots/move_robs.c @@ -1,6 +1,8 @@ +/* $NetBSD: move_robs.c,v 1.10 2009/07/20 06:39:06 dholland Exp $ */ + /* - * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1980, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,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. * @@ -31,34 +29,37 @@ * SUCH DAMAGE. */ +#include #ifndef lint -static char sccsid[] = "@(#)move_robs.c 5.5 (Berkeley) 2/28/91"; +#if 0 +static char sccsid[] = "@(#)move_robs.c 8.1 (Berkeley) 5/31/93"; +#else +__RCSID("$NetBSD: move_robs.c,v 1.10 2009/07/20 06:39:06 dholland Exp $"); +#endif #endif /* not lint */ -# include "robots.h" -# include +#include +#include +#include +#include "robots.h" /* * move_robots: * Move the robots around */ void -move_robots(was_sig) -bool was_sig; +move_robots(int was_sig) { - register COORD *rp; - register int y, x; - register int mindist, d; - static COORD newpos; + 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; @@ -85,9 +86,10 @@ bool was_sig; if (rp->y < 0) continue; else if (rp->y == My_pos.y && rp->x == My_pos.x) - Dead = TRUE; + 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) @@ -112,14 +114,14 @@ bool 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); } @@ -128,8 +130,8 @@ bool was_sig; * add_score: * Add a score to the overall point total */ -add_score(add) -int add; +void +add_score(int add) { Score += add; move(Y_SCORE, X_SCORE); @@ -140,8 +142,8 @@ int add; * sign: * Return the sign of the number */ -sign(n) -int n; +int +sign(int n) { if (n < 0) return -1;