X-Git-Url: https://git.cameronkatri.com/bsdgames-darwin.git/blobdiff_plain/634cb6ceab3191623a3daed5e953821e3f37a4cb..d94a9b5dea5c721a6db0064e291d1c654bc89607:/trek/shield.c diff --git a/trek/shield.c b/trek/shield.c index ed78e2d0..ed484300 100644 --- a/trek/shield.c +++ b/trek/shield.c @@ -1,4 +1,4 @@ -/* $NetBSD: shield.c,v 1.5 1997/10/12 21:25:17 christos Exp $ */ +/* $NetBSD: shield.c,v 1.11 2009/05/24 22:55:03 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,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)shield.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: shield.c,v 1.5 1997/10/12 21:25:17 christos Exp $"); +__RCSID("$NetBSD: shield.c,v 1.11 2009/05/24 22:55:03 dholland Exp $"); #endif #endif /* not lint */ @@ -63,31 +59,29 @@ __RCSID("$NetBSD: shield.c,v 1.5 1997/10/12 21:25:17 christos Exp $"); ** so you get partial hits. */ -struct cvntab Udtab[] = -{ +const struct cvntab Udtab[] = { { "u", "p", (cmdfun)1, 0 }, { "d", "own", (cmdfun)0, 0 }, { NULL, NULL, NULL, 0 } }; void -shield(f) -int f; +shield(int f) { int i; - struct cvntab *r; + const struct cvntab *r; char s[100]; - char *device, *dev2, *dev3; + const char *device, *dev2, *dev3; int ind; char *stat; if (f > 0 && (Ship.shldup || damaged(SRSCAN))) return; - if (f < 0) - { + if (f < 0) { /* cloaking device */ if (Ship.ship == QUEENE) { - printf("Ye Faire Queene does not have the cloaking device.\n"); + printf("Ye Faire Queene does not have the " + "cloaking device.\n"); return; } device = "Cloaking device"; @@ -95,9 +89,7 @@ int f; ind = CLOAK; dev3 = "it"; stat = &Ship.cloaked; - } - else - { + } else { /* shields */ device = "Shields"; dev2 = "are"; @@ -105,34 +97,30 @@ int f; ind = SHIELD; stat = &Ship.shldup; } - if (damaged(ind)) - { + if (damaged(ind)) { if (f <= 0) out(ind); return; } - if (Ship.cond == DOCKED) - { + if (Ship.cond == DOCKED) { printf("%s %s down while docked\n", device, dev2); return; } - if (f <= 0 && !testnl()) - { + if (f <= 0 && !testnl()) { r = getcodpar("Up or down", Udtab); i = (long) r->value; - } - else - { + } else { if (*stat) - (void)sprintf(s, "%s %s up. Do you want %s down", device, dev2, dev3); + (void)sprintf(s, "%s %s up. Do you want %s down", + device, dev2, dev3); else - (void)sprintf(s, "%s %s down. Do you want %s up", device, dev2, dev3); + (void)sprintf(s, "%s %s down. Do you want %s up", + device, dev2, dev3); if (!getynpar(s)) return; i = !*stat; } - if (*stat == i) - { + if (*stat == i) { printf("%s already ", device); if (i) printf("up\n"); @@ -140,11 +128,12 @@ int f; printf("down\n"); return; } - if (i) + if (i) { if (f >= 0) Ship.energy -= Param.shupengy; else Ship.cloakgood = 0; + } Move.free = 0; if (f >= 0) Move.shldchg = 1;