From dfce1cca7e9f2a93d3246b5dba2113e20cbc447a Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 28 Jan 2008 06:55:41 +0000 Subject: Make hack build with WARNS=4. --- hack/extern.h | 4 ++-- hack/hack.cmd.c | 6 +++--- hack/hack.do_name.c | 7 ++++--- hack/hack.dog.c | 10 +++++----- hack/hack.end.c | 28 +++++++++++++++------------- hack/hack.fight.c | 21 +++++++++++---------- hack/hack.lev.c | 8 ++++---- hack/hack.main.c | 6 +++--- hack/hack.makemon.c | 9 +++++---- hack/hack.mon.c | 11 ++++++----- hack/hack.objnam.c | 19 ++++++++++--------- hack/hack.pri.c | 6 +++--- hack/hack.save.c | 6 +++--- hack/hack.termcap.c | 16 +++++++--------- hack/hack.topl.c | 8 ++++---- hack/hack.track.c | 13 +++++++------ hack/hack.u_init.c | 10 +++++----- hack/hack.wizard.c | 8 +++++--- 18 files changed, 102 insertions(+), 94 deletions(-) (limited to 'hack') diff --git a/hack/extern.h b/hack/extern.h index e2ef242e..a402f2f1 100644 --- a/hack/extern.h +++ b/hack/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.6 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: extern.h,v 1.7 2008/01/28 06:55:41 dholland Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -503,7 +503,7 @@ void curs(int, int); void nocmov(int, int); void cmov(int, int); int xputc(int); -void xputs(char *); +void xputs(const char *); void cl_end(void); void clear_screen(void); void home(void); diff --git a/hack/hack.cmd.c b/hack/hack.cmd.c index 8647c5cb..edc09ebd 100644 --- a/hack/hack.cmd.c +++ b/hack/hack.cmd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.cmd.c,v 1.7 2003/04/02 18:36:35 jsm Exp $ */ +/* $NetBSD: hack.cmd.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.cmd.c,v 1.7 2003/04/02 18:36:35 jsm Exp $"); +__RCSID("$NetBSD: hack.cmd.c,v 1.8 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -228,7 +228,7 @@ rush: { char expcmd[10]; char *cp = expcmd; - while (*cmd && cp - expcmd < sizeof(expcmd) - 2) { + while (*cmd && cp - expcmd < (int)sizeof(expcmd) - 2) { if (*cmd >= 040 && *cmd < 0177) *cp++ = *cmd++; else { diff --git a/hack/hack.do_name.c b/hack/hack.do_name.c index 58a309a2..727be31f 100644 --- a/hack/hack.do_name.c +++ b/hack/hack.do_name.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.7 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.do_name.c,v 1.6 2003/04/02 18:36:36 jsm Exp $"); +__RCSID("$NetBSD: hack.do_name.c,v 1.7 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include @@ -116,7 +116,8 @@ do_mname() { char buf[BUFSZ]; coord cc; - int cx, cy, lth, i; + int cx, cy, lth; + unsigned i; struct monst *mtmp, *mtmp2; cc = getpos(0, "the monster you want to name"); cx = cc.x; diff --git a/hack/hack.dog.c b/hack/hack.dog.c index 95699a79..7537454b 100644 --- a/hack/hack.dog.c +++ b/hack/hack.dog.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.dog.c,v 1.8 2006/03/30 01:31:13 jnemeth Exp $ */ +/* $NetBSD: hack.dog.c,v 1.9 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.dog.c,v 1.8 2006/03/30 01:31:13 jnemeth Exp $"); +__RCSID("$NetBSD: hack.dog.c,v 1.9 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -239,7 +239,7 @@ dog_move(struct monst *mtmp, int after) /* Note: if apport == 1 then our behaviour is independent of udist */ if (mtmp->minvent) { if (!rn2(udist) || !rn2((int) edog->apport)) - if (rn2(10) < edog->apport) { + if ((unsigned) rn2(10) < edog->apport) { relobj(mtmp, (int) mtmp->minvis); if (edog->apport > 1) edog->apport--; @@ -255,7 +255,7 @@ dog_move(struct monst *mtmp, int after) goto eatobj; } if (obj->owt < 10 * mtmp->data->mlevel) - if (rn2(20) < edog->apport + 3) + if ((unsigned) rn2(20) < edog->apport + 3) if (rn2(udist) || !rn2((int) edog->apport)) { freeobj(obj); unpobj(obj); @@ -291,7 +291,7 @@ dog_move(struct monst *mtmp, int after) } } else if (gtyp == UNDEF && dogroom >= 0 && uroom == dogroom && - !mtmp->minvent && edog->apport > rn2(8)) { + !mtmp->minvent && edog->apport > (unsigned)rn2(8)) { gx = obj->ox; gy = obj->oy; gtyp = APPORT; diff --git a/hack/hack.end.c b/hack/hack.end.c index 0b8a44bc..30a4fd85 100644 --- a/hack/hack.end.c +++ b/hack/hack.end.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.end.c,v 1.8 2007/12/15 19:44:41 perry Exp $ */ +/* $NetBSD: hack.end.c,v 1.9 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.end.c,v 1.8 2007/12/15 19:44:41 perry Exp $"); +__RCSID("$NetBSD: hack.end.c,v 1.9 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include @@ -448,8 +448,8 @@ topten() t1->plchar, t1->sex, t1->name, t1->death); if (done_stopprint) continue; - if (rank > flags.end_top && - (rank < rank0 - flags.end_around || rank > rank0 + flags.end_around) + if (rank > (int)flags.end_top && + (rank < rank0 - (int)flags.end_around || rank > rank0 + (int)flags.end_around) && (!flags.end_own || #ifdef PERS_IS_UID t1->uid != t0->uid)) @@ -457,8 +457,8 @@ topten() strncmp(t1->name, t0->name, NAMSZ))) #endif /* PERS_IS_UID */ continue; - if (rank == rank0 - flags.end_around && - rank0 > flags.end_top + flags.end_around + 1 && + if (rank == rank0 - (int)flags.end_around && + rank0 > (int)flags.end_top + (int)flags.end_around + 1 && !flags.end_own) (void) putchar('\n'); if (rank != rank0) @@ -499,8 +499,9 @@ outheader() int outentry(int rank, struct toptenentry *t1, int so) { - boolean quit = FALSE, killed = FALSE, starv = FALSE; + boolean quit = FALSE, gotkilled = FALSE, starv = FALSE; char linebuf[BUFSZ]; + linebuf[0] = 0; if (rank) Sprintf(eos(linebuf), "%3d", rank); @@ -530,15 +531,15 @@ outentry(int rank, struct toptenentry *t1, int so) else if (!strncmp(t1->death, "starv", 5)) Sprintf(eos(linebuf), "starved to death"), starv = TRUE; else - Sprintf(eos(linebuf), "was killed"), killed = TRUE; + Sprintf(eos(linebuf), "was killed"), gotkilled = TRUE; Sprintf(eos(linebuf), " on%s level %d", - (killed || starv) ? "" : " dungeon", t1->level); + (gotkilled || starv) ? "" : " dungeon", t1->level); if (t1->maxlvl != t1->level) Sprintf(eos(linebuf), " [max %d]", t1->maxlvl); if (quit && t1->death[4]) Sprintf(eos(linebuf), t1->death + 4); } - if (killed) + if (gotkilled) Sprintf(eos(linebuf), " by %s%s", (!strncmp(t1->death, "trick", 5) || !strncmp(t1->death, "the ", 4)) ? "" : @@ -588,9 +589,10 @@ const char * ordin(n) int n; { - int d = n % 10; - return ((d == 0 || d > 3 || n / 10 == 1) ? "th" : (d == 1) ? "st" : - (d == 2) ? "nd" : "rd"); + int dg = n % 10; + + return ((dg == 0 || dg > 3 || n / 10 == 1) ? "th" : (dg == 1) ? "st" : + (dg == 2) ? "nd" : "rd"); } void diff --git a/hack/hack.fight.c b/hack/hack.fight.c index 86dd2f6b..038ca889 100644 --- a/hack/hack.fight.c +++ b/hack/hack.fight.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.fight.c,v 1.7 2006/03/29 01:18:39 jnemeth Exp $ */ +/* $NetBSD: hack.fight.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.fight.c,v 1.7 2006/03/29 01:18:39 jnemeth Exp $"); +__RCSID("$NetBSD: hack.fight.c,v 1.8 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -78,9 +78,10 @@ hitmm(magr, mdef) struct monst *magr, *mdef; { const struct permonst *pa = magr->data, *pd = mdef->data; - int hit; + int didhit; schar tmp; boolean vis; + if (strchr("Eauy", pa->mlet)) return (0); if (magr->mfroz) @@ -91,8 +92,8 @@ hitmm(magr, mdef) if (mdef->msleep) mdef->msleep = 0; } - hit = (tmp > rnd(20)); - if (hit) + didhit = (tmp > rnd(20)); + if (didhit) mdef->msleep = 0; vis = (cansee(magr->mx, magr->my) && cansee(mdef->mx, mdef->my)); if (vis) { @@ -102,7 +103,7 @@ hitmm(magr, mdef) if (magr->mimic) seemimic(magr); (void) sprintf(buf, "%s %s", Monnam(magr), - hit ? "hits" : "misses"); + didhit ? "hits" : "misses"); pline("%s %s.", buf, monnam(mdef)); } else { boolean far = (dist(magr->mx, magr->my) > 15); @@ -113,7 +114,7 @@ hitmm(magr, mdef) far ? " in the distance" : ""); } } - if (hit) { + if (didhit) { if (magr->data->mlet == 'c' && !magr->cham) { magr->mhpmax += 3; if (vis) @@ -121,7 +122,7 @@ hitmm(magr, mdef) else if (mdef->mtame) pline("You have a peculiarly sad feeling for a moment, then it passes."); monstone(mdef); - hit = 2; + didhit = 2; } else if ((mdef->mhp -= d(pa->damn, pa->damd)) < 1) { magr->mhpmax += 1 + rn2(pd->mlevel + 1); if (magr->mtame && magr->mhpmax > 8 * pa->mlevel) { @@ -135,10 +136,10 @@ hitmm(magr, mdef) else if (mdef->mtame) pline("You have a sad feeling for a moment, then it passes."); mondied(mdef); - hit = 2; + didhit = 2; } } - return (hit); + return (didhit); } /* drop (perhaps) a cadaver and remove monster */ diff --git a/hack/hack.lev.c b/hack/hack.lev.c index c0cb3ef6..e65bfea6 100644 --- a/hack/hack.lev.c +++ b/hack/hack.lev.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.lev.c,v 1.6 2003/04/02 18:36:37 jsm Exp $ */ +/* $NetBSD: hack.lev.c,v 1.7 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.lev.c,v 1.6 2003/04/02 18:36:37 jsm Exp $"); +__RCSID("$NetBSD: hack.lev.c,v 1.7 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include @@ -327,8 +327,8 @@ mread(fd, buf, len) { int rlen; - rlen = read(fd, buf, (int) len); - if (rlen != len) { + rlen = read(fd, buf, len); + if (rlen < 0 || (size_t)rlen != len) { pline("Read %d instead of %u bytes.\n", rlen, len); if (restoring) { (void) unlink(SAVEF); diff --git a/hack/hack.main.c b/hack/hack.main.c index 930de44d..5f62384d 100644 --- a/hack/hack.main.c +++ b/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.main.c,v 1.9 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: hack.main.c,v 1.10 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.main.c,v 1.9 2004/01/27 20:30:29 jsm Exp $"); +__RCSID("$NetBSD: hack.main.c,v 1.10 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include @@ -513,7 +513,7 @@ askname() if (c != '-') if (c < 'A' || (c > 'Z' && c < 'a') || c > 'z') c = '_'; - if (ct < sizeof(plname) - 1) + if (ct < (int)sizeof(plname) - 1) plname[ct++] = c; } plname[ct] = 0; diff --git a/hack/hack.makemon.c b/hack/hack.makemon.c index 308ece9b..44202cca 100644 --- a/hack/hack.makemon.c +++ b/hack/hack.makemon.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.makemon.c,v 1.6 2003/04/02 18:36:37 jsm Exp $ */ +/* $NetBSD: hack.makemon.c,v 1.7 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.makemon.c,v 1.6 2003/04/02 18:36:37 jsm Exp $"); +__RCSID("$NetBSD: hack.makemon.c,v 1.7 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -84,6 +84,7 @@ makemon(const struct permonst *ptr, int x, int y) { struct monst *mtmp; int tmp, ct; + unsigned i; boolean anything = (!ptr); if (x != 0 || y != 0) @@ -117,8 +118,8 @@ makemon(const struct permonst *ptr, int x, int y) gotmon: mtmp = newmonst(ptr->pxlth); *mtmp = zeromonst; /* clear all entries in structure */ - for (ct = 0; ct < ptr->pxlth; ct++) - ((char *) &(mtmp->mextra[0]))[ct] = 0; + for (i = 0; i < ptr->pxlth; i++) + ((char *) &(mtmp->mextra[0]))[i] = 0; mtmp->nmon = fmon; fmon = mtmp; mtmp->m_id = flags.ident++; diff --git a/hack/hack.mon.c b/hack/hack.mon.c index e88ce6cb..187382ff 100644 --- a/hack/hack.mon.c +++ b/hack/hack.mon.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mon.c,v 1.7 2006/03/30 01:28:46 jnemeth Exp $ */ +/* $NetBSD: hack.mon.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mon.c,v 1.7 2006/03/30 01:28:46 jnemeth Exp $"); +__RCSID("$NetBSD: hack.mon.c,v 1.8 2008/01/28 06:55:41 dholland Exp $"); #endif /* not lint */ #include @@ -217,9 +217,10 @@ dochugw(mtmp) { int x = mtmp->mx; int y = mtmp->my; - int d = dochug(mtmp); + int dead = dochug(mtmp); int dd; - if (!d) /* monster still alive */ + + if (!dead) /* monster still alive */ if (Warning) if (!mtmp->mpeaceful) if (mtmp->data->mlevel > warnlevel) @@ -227,7 +228,7 @@ dochugw(mtmp) if (dd < 100) if (!canseemon(mtmp)) warnlevel = mtmp->data->mlevel; - return (d); + return (dead); } /* returns 1 if monster died moving, 0 otherwise */ diff --git a/hack/hack.objnam.c b/hack/hack.objnam.c index 41a486e7..d78eb7a9 100644 --- a/hack/hack.objnam.c +++ b/hack/hack.objnam.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.objnam.c,v 1.6 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.objnam.c,v 1.7 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.objnam.c,v 1.6 2003/04/02 18:36:39 jsm Exp $"); +__RCSID("$NetBSD: hack.objnam.c,v 1.7 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include @@ -418,7 +418,8 @@ readobjnam(bp) char *bp; { char *p; - int i; + unsigned ii; + int i; int cnt, spe, spesgn, typ, heavy; char let; char *un, *dn, *an; @@ -550,18 +551,18 @@ sing: an = bp; goto srch; } - for (i = 0; i < sizeof(wrpsym); i++) { - int j = strlen(wrp[i]); - if (!strncmp(bp, wrp[i], j)) { - let = wrpsym[i]; + for (ii = 0; ii < sizeof(wrpsym); ii++) { + int j = strlen(wrp[ii]); + if (!strncmp(bp, wrp[ii], j)) { + let = wrpsym[ii]; bp += j; if (!strncmp(bp, " of ", 4)) an = bp + 4; /* else if(*bp) ?? */ goto srch; } - if (!strcmp(p - j, wrp[i])) { - let = wrpsym[i]; + if (!strcmp(p - j, wrp[ii])) { + let = wrpsym[ii]; p -= j; *p = 0; if (p[-1] == ' ') diff --git a/hack/hack.pri.c b/hack/hack.pri.c index d69dbd4a..70ef79d9 100644 --- a/hack/hack.pri.c +++ b/hack/hack.pri.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pri.c,v 1.8 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.pri.c,v 1.9 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.pri.c,v 1.8 2003/04/02 18:36:39 jsm Exp $"); +__RCSID("$NetBSD: hack.pri.c,v 1.9 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -720,7 +720,7 @@ void cornbot(lth) int lth; { - if (lth < sizeof(oldbot)) { + if ((unsigned)lth < sizeof(oldbot)) { oldbot[lth] = 0; flags.botl = 1; } diff --git a/hack/hack.save.c b/hack/hack.save.c index 75e5f759..9a968da4 100644 --- a/hack/hack.save.c +++ b/hack/hack.save.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.save.c,v 1.9 2007/12/15 19:44:41 perry Exp $ */ +/* $NetBSD: hack.save.c,v 1.10 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.save.c,v 1.9 2007/12/15 19:44:41 perry Exp $"); +__RCSID("$NetBSD: hack.save.c,v 1.10 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include @@ -175,7 +175,7 @@ dorecover(fd) fcobj = restobjchn(fd); fallen_down = restmonchn(fd); mread(fd, (char *) &tmp, sizeof tmp); - if (tmp != getuid()) { /* strange ... */ + if (tmp != (int) getuid()) { /* strange ... */ (void) close(fd); (void) unlink(SAVEF); puts("Saved game was not yours."); diff --git a/hack/hack.termcap.c b/hack/hack.termcap.c index edfa8a01..11d8d9e4 100644 --- a/hack/hack.termcap.c +++ b/hack/hack.termcap.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.termcap.c,v 1.15 2007/01/17 02:35:28 chuck Exp $ */ +/* $NetBSD: hack.termcap.c,v 1.16 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.termcap.c,v 1.15 2007/01/17 02:35:28 chuck Exp $"); +__RCSID("$NetBSD: hack.termcap.c,v 1.16 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include @@ -76,8 +76,8 @@ __RCSID("$NetBSD: hack.termcap.c,v 1.15 2007/01/17 02:35:28 chuck Exp $"); #include "def.flag.h" /* for flags.nonull */ static struct tinfo *info; -static char *HO, *CL, *CE, *CM, *ND, *XD, *BC_BS, *SO, *SE, *TI, *TE; -static char *VS, *VE; +static const char *HO, *CL, *CE, *CM, *ND, *XD, *BC_BS, *SO, *SE, *TI, *TE; +static const char *VS, *VE; static int SG; char *CD; /* tested in pri.c: docorner() */ int CO, LI; /* used in pri.c and whatis.c */ @@ -236,21 +236,19 @@ cmov(x, y) } int -xputc(c) - char c; +xputc(int c) { return (fputc(c, stdout)); } void -xputs(s) - char *s; +xputs(const char *s) { tputs(s, 1, xputc); } void -cl_end() +cl_end(void) { if (CE) xputs(CE); diff --git a/hack/hack.topl.c b/hack/hack.topl.c index b2e29b62..e4f2fb9c 100644 --- a/hack/hack.topl.c +++ b/hack/hack.topl.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.topl.c,v 1.7 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.topl.c,v 1.8 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.topl.c,v 1.7 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.topl.c,v 1.8 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include @@ -141,7 +141,7 @@ addtopl(s) const char *s; { curs(tlx, tly); - if (tlx + strlen(s) > CO) + if (tlx + (int)strlen(s) > CO) putsym('\n'); putstr(s); tlx = curx; @@ -232,7 +232,7 @@ vpline(line, ap) /* But messages like "You die..." deserve their own line */ n0 = strlen(bp); if (flags.toplin == 1 && tly == 1 && - n0 + strlen(toplines) + 3 < CO - 8 && /* leave room for + n0 + (int)strlen(toplines) + 3 < CO - 8 && /* leave room for * --More-- */ strncmp(bp, "You ", 4)) { (void) strcat(toplines, " "); diff --git a/hack/hack.track.c b/hack/hack.track.c index 8e054434..844bab5a 100644 --- a/hack/hack.track.c +++ b/hack/hack.track.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.track.c,v 1.5 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.track.c,v 1.6 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.track.c,v 1.5 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.track.c,v 1.6 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -98,16 +98,17 @@ coord * gettrack(x, y) int x, y; { - int i, cnt, dist; + int i, cnt, distsq; coord tc; + cnt = utcnt; for (i = utpnt - 1; cnt--; i--) { if (i == -1) i = UTSZ - 1; tc = utrack[i]; - dist = (x - tc.x) * (x - tc.x) + (y - tc.y) * (y - tc.y); - if (dist < 3) - return (dist ? &(utrack[i]) : 0); + distsq = (x - tc.x) * (x - tc.x) + (y - tc.y) * (y - tc.y); + if (distsq < 3) + return (distsq ? &(utrack[i]) : 0); } return (0); } diff --git a/hack/hack.u_init.c b/hack/hack.u_init.c index 9b111029..de2fbfb0 100644 --- a/hack/hack.u_init.c +++ b/hack/hack.u_init.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.u_init.c,v 1.8 2004/11/05 21:30:32 dsl Exp $ */ +/* $NetBSD: hack.u_init.c,v 1.9 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.u_init.c,v 1.8 2004/11/05 21:30:32 dsl Exp $"); +__RCSID("$NetBSD: hack.u_init.c,v 1.9 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ #include @@ -311,9 +311,9 @@ got_suffix: } find_ac(); if (!rn2(20)) { - int d = rn2(7) - 2; /* biased variation */ - u.ustr += d; - u.ustrmax += d; + int dr = rn2(7) - 2; /* biased variation */ + u.ustr += dr; + u.ustrmax += dr; } #ifdef WIZARD if (wizard) diff --git a/hack/hack.wizard.c b/hack/hack.wizard.c index 38004cb0..8e268aaa 100644 --- a/hack/hack.wizard.c +++ b/hack/hack.wizard.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.wizard.c,v 1.6 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.wizard.c,v 1.7 2008/01/28 06:55:42 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.wizard.c,v 1.6 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.wizard.c,v 1.7 2008/01/28 06:55:42 dholland Exp $"); #endif /* not lint */ /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */ @@ -141,7 +141,9 @@ hithim: * on level 26 again. */ if (hitu(mtmp, d(mtmp->data->damn, mtmp->data->damd)) - && !rn2(20) && stealamulet(mtmp)); + && !rn2(20) && stealamulet(mtmp)) { + /* nothing */ + } } else inrange(mtmp); /* try magic */ return (0); -- cgit v1.2.3-56-ge451