diff options
author | jsm <jsm@NetBSD.org> | 2001-03-25 20:43:58 +0000 |
---|---|---|
committer | jsm <jsm@NetBSD.org> | 2001-03-25 20:43:58 +0000 |
commit | 00b8e31689c6400d8ad915067f021b8e246df989 (patch) | |
tree | eb00203724cf2a378ca54c9419738dd06661f34c /hack/hack.mon.c | |
parent | 57d9770b2eb590f5cad0b445cdbb91acb168736f (diff) | |
download | bsdgames-darwin-00b8e31689c6400d8ad915067f021b8e246df989.tar.gz bsdgames-darwin-00b8e31689c6400d8ad915067f021b8e246df989.tar.zst bsdgames-darwin-00b8e31689c6400d8ad915067f021b8e246df989.zip |
Make mostly gcc -W clean, and other cleanup:
Use const.
Add __noreturn__ attributes.
Add a __format__ attribute.
Add __unused__ attributes.
Use symbolic constants for open() and lseek().
Declare types of all function parameters; convert some function
definitions to ISO C form.
Ensure standard file descriptors are open on startup.
Check for errors writing output of makedefs.
Avoid duplicate definitions of variables.
Diffstat (limited to 'hack/hack.mon.c')
-rw-r--r-- | hack/hack.mon.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/hack/hack.mon.c b/hack/hack.mon.c index df37d3a9..8c0d7223 100644 --- a/hack/hack.mon.c +++ b/hack/hack.mon.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mon.c,v 1.4 1997/10/19 16:58:34 christos Exp $ */ +/* $NetBSD: hack.mon.c,v 1.5 2001/03/25 20:44:01 jsm Exp $ */ /* * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. @@ -6,7 +6,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: hack.mon.c,v 1.4 1997/10/19 16:58:34 christos Exp $"); +__RCSID("$NetBSD: hack.mon.c,v 1.5 2001/03/25 20:44:01 jsm Exp $"); #endif /* not lint */ #include <stdlib.h> @@ -21,7 +21,7 @@ __RCSID("$NetBSD: hack.mon.c,v 1.4 1997/10/19 16:58:34 christos Exp $"); int warnlevel; /* used by movemon and dochugw */ long lastwarntime; int lastwarnlev; -char *warnings[] = { +const char *const warnings[] = { "white", "pink", "red", "ruby", "purple", "black" }; @@ -93,7 +93,7 @@ next_mon: warnlevel = SIZE(warnings) - 1; if (warnlevel >= 0) if (warnlevel > lastwarnlev || moves > lastwarntime + 5) { - char *rr; + const char *rr; switch (Warning & (LEFT_RING | RIGHT_RING)) { case LEFT_RING: rr = "Your left ring glows"; @@ -118,7 +118,7 @@ next_mon: void justswld(mtmp, name) struct monst *mtmp; - char *name; + const char *name; { mtmp->mx = u.ux; @@ -137,7 +137,7 @@ void youswld(mtmp, dam, die, name) struct monst *mtmp; int dam, die; - char *name; + const char *name; { if (mtmp != u.ustuck) return; @@ -178,7 +178,7 @@ int dochug(mtmp) struct monst *mtmp; { - struct permonst *mdat; + const struct permonst *mdat; int tmp = 0, nearby, scared; if (mtmp->cham && !rn2(6)) @@ -260,8 +260,7 @@ dochug(mtmp) } int -m_move(mtmp, after) - struct monst *mtmp; +m_move(struct monst *mtmp, int after) { struct monst *mtmp2; int nx, ny, omx, omy, appr, nearer, cnt, i, j; @@ -623,7 +622,7 @@ dist(x, y) void poisoned(string, pname) - char *string, *pname; + const char *string, *pname; { int i; @@ -749,7 +748,7 @@ killed(mtmp) #define NEW_SCORING #endif /* lint */ int tmp, nk, x, y; - struct permonst *mdat; + const struct permonst *mdat; if (mtmp->cham) mtmp->data = PM_CHAMELEON; @@ -869,8 +868,7 @@ killed(mtmp) } void -kludge(str, arg) - char *str, *arg; +kludge(const char *str, const char *arg) { if (Blind) { if (*str == '%') @@ -897,7 +895,7 @@ int newcham(mtmp, mdat) /* make a chameleon look like a new monster */ /* returns 1 if the monster actually changed */ struct monst *mtmp; - struct permonst *mdat; + const struct permonst *mdat; { int mhp, hpn, hpd; |