X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/47c4a13aeb96fe1fe49bddec4fb90e77c81cf366..70f825fc24933eacf0a9d8619a5cb35e7153b41a:/atc/update.c diff --git a/atc/update.c b/atc/update.c index a1b8aa77..963c57f3 100644 --- a/atc/update.c +++ b/atc/update.c @@ -1,4 +1,4 @@ -/* $NetBSD: update.c,v 1.9 1999/07/24 23:58:15 hubertf Exp $ */ +/* $NetBSD: update.c,v 1.14 2005/08/10 17:53:28 rpaulo Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -15,11 +15,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. * @@ -50,15 +46,15 @@ #if 0 static char sccsid[] = "@(#)update.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: update.c,v 1.9 1999/07/24 23:58:15 hubertf Exp $"); +__RCSID("$NetBSD: update.c,v 1.14 2005/08/10 17:53:28 rpaulo Exp $"); #endif -#endif not lint +#endif /* not lint */ #include "include.h" +/* ARGSUSED */ void -update(dummy) - int dummy; +update(int dummy __attribute__((__unused__))) { int i, dir_diff, unclean; PLANE *pp, *p1, *p2; @@ -215,7 +211,7 @@ update(dummy) * we don't update props on odd updates. */ if ((rand() % sp->newplane_time) == 0) - addplane(); + (void)addplane(); #ifdef SYSV alarm(sp->update_secs); @@ -223,8 +219,7 @@ update(dummy) } const char * -command(pp) - const PLANE *pp; +command(const PLANE *pp) { static char buf[50], *bp, *comm_start; @@ -238,7 +233,7 @@ command(pp) if (pp->altitude == 0) (void)sprintf(bp, "Holding @ A%d", pp->orig_no); else if (pp->new_dir >= MAXDIR || pp->new_dir < 0) - strcpy(bp, "Circle"); + (void)strcpy(bp, "Circle"); else if (pp->new_dir != pp->dir) (void)sprintf(bp, "%d", dir_deg(pp->new_dir)); @@ -249,13 +244,12 @@ command(pp) bp = strchr(buf, '\0'); if (*comm_start == '\0' && (pp->status == S_UNMARKED || pp->status == S_IGNORED)) - strcpy(bp, "---------"); + (void)strcpy(bp, "---------"); return (buf); } char -name(p) - const PLANE *p; +name(const PLANE *p) { if (p->plane_type == 0) return ('A' + p->plane_no); @@ -264,8 +258,7 @@ name(p) } int -number(l) - char l; +number(int l) { if (l < 'a' && l > 'z' && l < 'A' && l > 'Z') return (-1); @@ -276,7 +269,7 @@ number(l) } int -next_plane() +next_plane(void) { static int last_plane = -1; PLANE *pp; @@ -305,12 +298,12 @@ next_plane() } int -addplane() +addplane(void) { PLANE p, *pp, *p1; - int i, num_starts, close, rnd, rnd2, pnum; + int i, num_starts, isclose, rnd, rnd2, pnum; - memset(&p, 0, sizeof (p)); + (void)memset(&p, 0, sizeof (p)); p.status = S_MARKED; p.plane_type = random() % 2; @@ -338,13 +331,13 @@ addplane() p.ypos = sp->exit[rnd2].y; p.new_dir = p.dir = sp->exit[rnd2].dir; p.altitude = p.new_altitude = 7; - close = 0; + isclose = 0; for (p1 = air.head; p1 != NULL; p1 = p1->next) if (too_close(p1, &p, 4)) { - close++; + isclose++; break; } - if (close) + if (isclose) continue; } else { p.orig_type = T_AIRPORT; @@ -367,7 +360,7 @@ addplane() pp = newplane(); if (pp == NULL) loser(NULL, "Out of memory!"); - memcpy(pp, &p, sizeof (p)); + (void)memcpy(pp, &p, sizeof (p)); if (pp->orig_type == T_AIRPORT) append(&ground, pp); @@ -377,9 +370,8 @@ addplane() return (pp->dest_type); } -PLANE * -findplane(n) - int n; +PLANE * +findplane(int n) { PLANE *pp; @@ -393,20 +385,18 @@ findplane(n) } int -too_close(p1, p2, dist) - const PLANE *p1, *p2; - int dist; +too_close(const PLANE *p1, const PLANE *p2, int dist) { if (ABS(p1->altitude - p2->altitude) <= dist && - ABS(p1->xpos - p2->xpos) <= dist && ABS(p1->ypos - p2->ypos) <= dist) + ABS(p1->xpos - p2->xpos) <= dist && + ABS(p1->ypos - p2->ypos) <= dist) return (1); else return (0); } int -dir_deg(d) - int d; +dir_deg(int d) { switch (d) { case 0: return (0);