From b462731cbc1198051cd39ad2f95b1027e441067d Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 7 Jun 2009 18:30:39 +0000 Subject: ANSIfy function declarations. All object file diffs inspected. --- hack/alloc.c | 14 +++---- hack/hack.apply.c | 40 +++++++----------- hack/hack.bones.c | 8 ++-- hack/hack.c | 69 +++++++++++++----------------- hack/hack.cmd.c | 31 ++++++-------- hack/hack.do.c | 44 ++++++++----------- hack/hack.do_name.c | 45 +++++++------------- hack/hack.do_wear.c | 35 +++++++--------- hack/hack.dog.c | 26 +++++------- hack/hack.eat.c | 31 ++++++-------- hack/hack.end.c | 46 ++++++++------------ hack/hack.engrave.c | 35 ++++++---------- hack/hack.fight.c | 29 +++++-------- hack/hack.invent.c | 119 +++++++++++++++++++--------------------------------- hack/hack.ioctl.c | 10 ++--- hack/hack.lev.c | 40 +++++------------- hack/hack.main.c | 19 ++++----- hack/hack.makemon.c | 14 +++---- hack/hack.mhitu.c | 11 ++--- hack/hack.mklev.c | 50 ++++++++-------------- hack/hack.mkmaze.c | 19 ++++----- hack/hack.mkobj.c | 22 ++++------ hack/hack.mkshop.c | 31 ++++++-------- hack/hack.mon.c | 81 +++++++++++++---------------------- hack/hack.o_init.c | 27 +++++------- hack/hack.objnam.c | 29 +++++-------- hack/hack.options.c | 12 +++--- hack/hack.pager.c | 40 +++++++----------- hack/hack.potion.c | 23 ++++------ hack/hack.pri.c | 86 +++++++++++++++---------------------- hack/hack.read.c | 15 +++---- hack/hack.rip.c | 10 ++--- hack/hack.rumors.c | 18 ++++---- hack/hack.save.c | 21 ++++------ hack/hack.search.c | 16 ++++--- hack/hack.shk.c | 110 +++++++++++++++++++----------------------------- hack/hack.steal.c | 31 ++++++-------- hack/hack.termcap.c | 43 +++++++++---------- hack/hack.timeout.c | 8 ++-- hack/hack.topl.c | 36 +++++++--------- hack/hack.track.c | 11 +++-- hack/hack.trap.c | 41 ++++++++---------- hack/hack.tty.c | 31 +++++++------- hack/hack.u_init.c | 16 ++++--- hack/hack.unix.c | 45 ++++++++++---------- hack/hack.vault.c | 37 ++++++++-------- hack/hack.version.c | 6 +-- hack/hack.wield.c | 15 +++---- hack/hack.wizard.c | 17 ++++---- hack/hack.worm.c | 37 ++++++---------- hack/hack.worn.c | 11 ++--- hack/hack.zap.c | 70 +++++++++++++------------------ hack/rnd.c | 16 +++---- 53 files changed, 687 insertions(+), 1060 deletions(-) (limited to 'hack') diff --git a/hack/alloc.c b/hack/alloc.c index 53dc51eb..74eaf234 100644 --- a/hack/alloc.c +++ b/hack/alloc.c @@ -1,4 +1,4 @@ -/* $NetBSD: alloc.c,v 1.5 2003/04/02 18:36:33 jsm Exp $ */ +/* $NetBSD: alloc.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: alloc.c,v 1.5 2003/04/02 18:36:33 jsm Exp $"); +__RCSID("$NetBSD: alloc.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -80,8 +80,7 @@ __RCSID("$NetBSD: alloc.c,v 1.5 2003/04/02 18:36:33 jsm Exp $"); from lint */ long * -alloc(n) - unsigned n; +alloc(unsigned n) { long dummy = ftell(stderr); if (n) @@ -92,8 +91,7 @@ alloc(n) #else long * -alloc(lth) - unsigned lth; +alloc(unsigned lth) { char *ptr; @@ -103,9 +101,7 @@ alloc(lth) } long * -enlarge(ptr, lth) - char *ptr; - unsigned lth; +enlarge(char *ptr, unsigned lth) { char *nptr; diff --git a/hack/hack.apply.c b/hack/hack.apply.c index 6c119503..ef8ce2aa 100644 --- a/hack/hack.apply.c +++ b/hack/hack.apply.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.apply.c,v 1.9 2007/12/15 19:44:41 perry Exp $ */ +/* $NetBSD: hack.apply.c,v 1.10 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.apply.c,v 1.9 2007/12/15 19:44:41 perry Exp $"); +__RCSID("$NetBSD: hack.apply.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -83,7 +83,7 @@ static int dig(void); static int use_pick_axe(struct obj *); int -doapply() +doapply(void) { struct obj *obj; int res = 1; @@ -136,8 +136,7 @@ xit: /* ARGSUSED */ static void -use_camera(obj) /* */ - struct obj *obj __unused; +use_camera(struct obj *obj __unused) { struct monst *mtmp; if (!getdir(1)) { /* ask: in what direction? */ @@ -187,8 +186,7 @@ static struct obj *current_ice_box;/* a local variable of use_ice_box, to be * used by its local procedures in/ck_ice_box */ static int -in_ice_box(obj) - struct obj *obj; +in_ice_box(struct obj *obj) { if (obj == current_ice_box || (Punished && (obj == uball || obj == uchain))) { @@ -220,15 +218,13 @@ in_ice_box(obj) } static int -ck_ice_box(obj) - struct obj *obj; +ck_ice_box(struct obj *obj) { return (obj->o_cnt_id == current_ice_box->o_id); } static int -out_ice_box(obj) - struct obj *obj; +out_ice_box(struct obj *obj) { struct obj *otmp; if (obj == fcobj) @@ -246,8 +242,7 @@ out_ice_box(obj) } static void -use_ice_box(obj) - struct obj *obj; +use_ice_box(struct obj *obj) { int cnt = 0; struct obj *otmp; @@ -273,9 +268,7 @@ use_ice_box(obj) } static struct monst * -bchit(ddx, ddy, range, sym) - int ddx, ddy, range; - char sym; +bchit(int ddx, int ddy, int range, int sym) { struct monst *mtmp = (struct monst *) 0; int bchx = u.ux, bchy = u.uy; @@ -302,8 +295,7 @@ bchit(ddx, ddy, range, sym) /* ARGSUSED */ static void -use_whistle(obj) - struct obj *obj __unused; +use_whistle(struct obj *obj __unused) { struct monst *mtmp = fmon; pline("You produce a high whistling sound."); @@ -320,8 +312,7 @@ use_whistle(obj) /* ARGSUSED */ static void -use_magic_whistle(obj) - struct obj *obj __unused; +use_magic_whistle(struct obj *obj __unused) { struct monst *mtmp = fmon; pline("You produce a strange whistling sound."); @@ -338,7 +329,7 @@ static coord dig_pos; static boolean dig_down; static int -dig() +dig(void) { struct rm *lev; int dpx = dig_pos.x, dpy = dig_pos.y; @@ -410,13 +401,13 @@ dig() /* When will hole be finished? Very rough indication used by shopkeeper. */ int -holetime() +holetime(void) { return ((occupation == dig) ? (250 - dig_effort) / 20 : -1); } void -dighole() +dighole(void) { struct trap *ttmp = t_at(u.ux, u.uy); @@ -443,8 +434,7 @@ dighole() } static int -use_pick_axe(obj) - struct obj *obj; +use_pick_axe(struct obj *obj) { char dirsyms[12]; char *dsp = dirsyms, *sdp = sdir; diff --git a/hack/hack.bones.c b/hack/hack.bones.c index 35c45973..17b05606 100644 --- a/hack/hack.bones.c +++ b/hack/hack.bones.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.bones.c,v 1.6 2003/04/02 18:36:35 jsm Exp $ */ +/* $NetBSD: hack.bones.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.bones.c,v 1.6 2003/04/02 18:36:35 jsm Exp $"); +__RCSID("$NetBSD: hack.bones.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -75,7 +75,7 @@ char bones[] = "bones_xx"; /* save bones and possessions of a deceased adventurer */ void -savebones() +savebones(void) { int fd; struct obj *otmp; @@ -147,7 +147,7 @@ savebones() } int -getbones() +getbones(void) { int fd, x, y, ok; diff --git a/hack/hack.c b/hack/hack.c index 19eaf4c4..72c2ee9c 100644 --- a/hack/hack.c +++ b/hack/hack.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.c,v 1.7 2006/11/24 19:46:58 christos Exp $ */ +/* $NetBSD: hack.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.c,v 1.7 2006/11/24 19:46:58 christos Exp $"); +__RCSID("$NetBSD: hack.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -74,7 +74,7 @@ __RCSID("$NetBSD: hack.c,v 1.7 2006/11/24 19:46:58 christos Exp $"); * teleporting 3. when walking out of a lit room */ void -unsee() +unsee(void) { int x, y; struct rm *lev; @@ -110,10 +110,11 @@ unsee() * hack.do.c: seeoff(1) - go up or down the stairs in hack.trap.c:seeoff(1) * - fall through trapdoor */ +/* mode: */ + /* 1 to redo @, 0 to leave them *//* 1 means + * misc movement, 0 means blindness */ void -seeoff(mode) - int mode; /* 1 to redo @, 0 to leave them *//* 1 means - * misc movement, 0 means blindness */ +seeoff(int mode) { int x, y; struct rm *lev; @@ -140,7 +141,7 @@ seeoff(mode) } void -domove() +domove(void) { xchar oldx, oldy; struct monst *mtmp = NULL; @@ -381,9 +382,7 @@ nodrag: ; } void -movobj(obj, ox, oy) - struct obj *obj; - int ox, oy; +movobj(struct obj *obj, int ox, int oy) { /* Some dirty programming to get display right */ freeobj(obj); @@ -395,7 +394,7 @@ movobj(obj, ox, oy) } int -dopickup() +dopickup(void) { if (!g_at(u.ux, u.uy) && !o_at(u.ux, u.uy)) { pline("There is nothing here to pick up."); @@ -559,7 +558,7 @@ pickup(int all) /* turn around a corner if that is the only way we can proceed */ /* do not turn left or right twice */ void -lookaround() +lookaround(void) { int x, y, i, x0 = 0, y0 = 0, m0 = 0, i0 = 9; int corrct = 0, noturn = 0; @@ -670,7 +669,7 @@ lookaround() /* something like lookaround, but we are not running */ /* react only to monsters that might hit us */ int -monster_nearby() +monster_nearby(void) { int x, y; struct monst *mtmp; @@ -690,8 +689,7 @@ monster_nearby() #ifdef QUEST int -cansee(x, y) - xchar x, y; +cansee(xchar x, xchar y) { int dx, dy, adx, ady, sdx, sdy, dmax, d; if (Blind) @@ -735,8 +733,7 @@ cansee(x, y) } int -rroom(x, y) - int x, y; +rroom(int x, int y) { return (IS_ROOM(levl[u.ux + x][u.uy + y].typ)); } @@ -744,8 +741,7 @@ rroom(x, y) #else int -cansee(x, y) - xchar x, y; +cansee(xchar x, xchar y) { if (Blind || u.uswallow) return (0); @@ -759,15 +755,14 @@ cansee(x, y) #endif /* QUEST */ int -sgn(a) - int a; +sgn(int a) { return ((a > 0) ? 1 : (a == 0) ? 0 : -1); } #ifdef QUEST void -setsee() +setsee(void) { int x, y; @@ -785,7 +780,7 @@ setsee() #else void -setsee() +setsee(void) { int x, y; @@ -828,8 +823,7 @@ setsee() #endif /* QUEST */ void -nomul(nval) - int nval; +nomul(int nval) { if (multi < 0) return; @@ -838,7 +832,7 @@ nomul(nval) } int -abon() +abon(void) { if (u.ustr == 3) return (-3); @@ -857,7 +851,7 @@ abon() } int -dbon() +dbon(void) { if (u.ustr < 6) return (-1); @@ -877,9 +871,10 @@ dbon() return (6); } +/* may kill you; cause may be poison or */ +/* monster like 'A' */ void -losestr(num) /* may kill you; cause may be poison or */ - int num; /* monster like 'A' */ +losestr(int num) { u.ustr -= num; while (u.ustr < 3) { @@ -891,9 +886,7 @@ losestr(num) /* may kill you; cause may be poison or */ } void -losehp(n, knam) - int n; - const char *knam; +losehp(int n, const char *knam) { u.uhp -= n; if (u.uhp > u.uhpmax) @@ -906,9 +899,7 @@ losehp(n, knam) } void -losehp_m(n, mtmp) - int n; - struct monst *mtmp; +losehp_m(int n, struct monst *mtmp) { u.uhp -= n; flags.botl = 1; @@ -917,7 +908,7 @@ losehp_m(n, mtmp) } void -losexp() +losexp(void) { /* hit by V or W */ int num; @@ -933,7 +924,7 @@ losexp() } int -inv_weight() +inv_weight(void) { struct obj *otmp = invent; int wt = (u.ugold + 500) / 1000; @@ -957,7 +948,7 @@ inv_weight() } int -inv_cnt() +inv_cnt(void) { struct obj *otmp = invent; int ct = 0; @@ -969,7 +960,7 @@ inv_cnt() } long -newuexp() +newuexp(void) { return (10 * (1L << (u.ulevel - 1))); } diff --git a/hack/hack.cmd.c b/hack/hack.cmd.c index edc09ebd..49641828 100644 --- a/hack/hack.cmd.c +++ b/hack/hack.cmd.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.cmd.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.cmd.c,v 1.9 2009/06/07 18:30:39 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.8 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.cmd.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -141,8 +141,7 @@ const struct ext_func_tab extcmdlist[] = { }; void -rhack(cmd) - const char *cmd; +rhack(const char *cmd) { const struct func_tab *tlist = cmdlist; boolean firsttime = FALSE; @@ -243,7 +242,7 @@ rush: } int -doextcmd() +doextcmd(void) { /* here after # - now read a full-word * command */ char buf[BUFSZ]; @@ -264,15 +263,13 @@ doextcmd() } char -lowc(sym) - char sym; +lowc(int sym) { return ((sym >= 'A' && sym <= 'Z') ? sym + 'a' - 'A' : sym); } char -unctrl(sym) - char sym; +unctrl(int sym) { return ((sym >= ('A' & 037) && sym <= ('Z' & 037)) ? sym + 0140 : sym); } @@ -284,8 +281,7 @@ schar ydir[10] = {0, -1, -1, -1, 0, 1, 1, 1, 0, 0}; schar zdir[10] = {0, 0, 0, 0, 0, 0, 0, 0, 1, -1}; int -movecmd(sym) /* also sets u.dz, but returns false for <> */ - char sym; +movecmd(int sym) /* also sets u.dz, but returns false for <> */ { char *dp; @@ -299,8 +295,7 @@ movecmd(sym) /* also sets u.dz, but returns false for <> */ } int -getdir(s) - boolean s; +getdir(boolean s) { char dirsym; @@ -318,7 +313,7 @@ getdir(s) } void -confdir() +confdir(void) { int x = rn2(8); u.dx = xdir[x]; @@ -327,7 +322,7 @@ confdir() #ifdef QUEST int -finddir() +finddir(void) { int i, ui = u.di; for (i = 0; i <= 8; i++) { @@ -365,8 +360,7 @@ finddir() } int -isroom(x, y) - int x, y; +isroom(int x, int y) { /* what about POOL? */ return (isok(x, y) && (levl[x][y].typ == ROOM || (levl[x][y].typ >= LDOOR && flags.run >= 6))); @@ -374,8 +368,7 @@ isroom(x, y) #endif /* QUEST */ int -isok(x, y) - int x, y; +isok(int x, int y) { /* x corresponds to curx, so x==1 is the first column. Ach. %% */ return (x >= 1 && x <= COLNO - 1 && y >= 0 && y <= ROWNO - 1); diff --git a/hack/hack.do.c b/hack/hack.do.c index b606edad..103e8a29 100644 --- a/hack/hack.do.c +++ b/hack/hack.do.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: hack.do.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.do.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); +__RCSID("$NetBSD: hack.do.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ /* Contains code for 'd', 'D' (drop), '>', '<' (up, down) and 't' (throw) */ @@ -78,14 +78,13 @@ __RCSID("$NetBSD: hack.do.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); static int drop(struct obj *); int -dodrop() +dodrop(void) { return (drop(getobj("0$#", "drop"))); } static int -drop(obj) - struct obj *obj; +drop(struct obj *obj) { if (!obj) return (0); @@ -122,16 +121,14 @@ drop(obj) /* Called in several places - should not produce texts */ void -dropx(obj) - struct obj *obj; +dropx(struct obj *obj) { freeinv(obj); dropy(obj); } void -dropy(obj) - struct obj *obj; +dropy(struct obj *obj) { if (obj->otyp == CRYSKNIFE) obj->otyp = WORM_TOOTH; @@ -147,13 +144,13 @@ dropy(obj) /* drop several things */ int -doddrop() +doddrop(void) { return (ggetobj("drop", drop, 0)); } int -dodown() +dodown(void) { if (u.ux != xdnstair || u.uy != ydnstair) { pline("You can't go down here."); @@ -172,7 +169,7 @@ dodown() } int -doup() +doup(void) { if (u.ux != xupstair || u.uy != yupstair) { pline("You can't go up here."); @@ -191,9 +188,7 @@ doup() } void -goto_level(newlevel, at_stairs) - int newlevel; - boolean at_stairs; +goto_level(int newlevel, boolean at_stairs) { int fd; boolean up = (newlevel < dlevel); @@ -318,13 +313,13 @@ goto_level(newlevel, at_stairs) } int -donull() +donull(void) { return (1); /* Do nothing, but let other things happen */ } int -dopray() +dopray(void) { nomovemsg = "You finished your prayer."; nomul(-3); @@ -332,7 +327,7 @@ dopray() } int -dothrow() +dothrow(void) { struct obj *obj; struct monst *mon; @@ -531,9 +526,7 @@ dothrow() /* split obj so that it gets size num */ /* remainder is put in the object structure delivered by this call */ struct obj * -splitobj(obj, num) - struct obj *obj; - int num; +splitobj(struct obj *obj, int num) { struct obj *otmp; otmp = newobj(0); @@ -551,8 +544,7 @@ splitobj(obj, num) } void -more_experienced(exp, rexp) - int exp, rexp; +more_experienced(int exp, int rexp) { u.uexp += exp; u.urexp += 4 * exp + rexp; @@ -563,9 +555,7 @@ more_experienced(exp, rexp) } void -set_wounded_legs(side, timex) - long side; - int timex; +set_wounded_legs(long side, int timex) { if (!Wounded_legs || (Wounded_legs & TIMEOUT)) Wounded_legs |= side + timex; @@ -574,7 +564,7 @@ set_wounded_legs(side, timex) } void -heal_legs() +heal_legs(void) { if (Wounded_legs) { if ((Wounded_legs & BOTH_SIDES) == BOTH_SIDES) diff --git a/hack/hack.do_name.c b/hack/hack.do_name.c index 727be31f..e29e4d20 100644 --- a/hack/hack.do_name.c +++ b/hack/hack.do_name.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_name.c,v 1.7 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.do_name.c,v 1.8 2009/06/07 18:30:39 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.7 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.do_name.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -71,9 +71,7 @@ __RCSID("$NetBSD: hack.do_name.c,v 1.7 2008/01/28 06:55:41 dholland Exp $"); #include "extern.h" coord -getpos(force, goal) - int force; - const char *goal; +getpos(int force, const char *goal) { int cx, cy, i, c; coord cc; @@ -112,7 +110,7 @@ nxtc: ; } int -do_mname() +do_mname(void) { char buf[BUFSZ]; coord cc; @@ -167,8 +165,7 @@ do_mname() * when obj is in the inventory. */ void -do_oname(obj) - struct obj *obj; +do_oname(struct obj *obj) { struct obj *otmp, *otmp2; int lth; @@ -213,7 +210,7 @@ do_oname(obj) } int -ddocall() +ddocall(void) { struct obj *obj; @@ -235,8 +232,7 @@ ddocall() } void -docall(obj) - struct obj *obj; +docall(struct obj *obj) { char buf[BUFSZ]; struct obj otemp; @@ -268,9 +264,7 @@ const char *const ghostnames[] = {/* these names should have length < PL_NSIZ */ }; char * -xmonnam(mtmp, vb) - struct monst *mtmp; - int vb; +xmonnam(struct monst *mtmp, int vb) { static char buf[BUFSZ]; /* %% */ if (mtmp->mnamelth && !vb) { @@ -309,22 +303,19 @@ xmonnam(mtmp, vb) } char * -lmonnam(mtmp) - struct monst *mtmp; +lmonnam(struct monst *mtmp) { return (xmonnam(mtmp, 1)); } char * -monnam(mtmp) - struct monst *mtmp; +monnam(struct monst *mtmp) { return (xmonnam(mtmp, 0)); } char * -Monnam(mtmp) - struct monst *mtmp; +Monnam(struct monst *mtmp) { char *bp = monnam(mtmp); if ('a' <= *bp && *bp <= 'z') @@ -333,9 +324,7 @@ Monnam(mtmp) } char * -amonnam(mtmp, adj) - struct monst *mtmp; - const char *adj; +amonnam(struct monst *mtmp, const char *adj) { char *bp = monnam(mtmp); static char buf[BUFSZ]; /* %% */ @@ -347,9 +336,7 @@ amonnam(mtmp, adj) } char * -Amonnam(mtmp, adj) - struct monst *mtmp; - const char *adj; +Amonnam(struct monst *mtmp, const char *adj) { char *bp = amonnam(mtmp, adj); @@ -358,8 +345,7 @@ Amonnam(mtmp, adj) } char * -Xmonnam(mtmp) - struct monst *mtmp; +Xmonnam(struct monst *mtmp) { char *bp = Monnam(mtmp); if (!strncmp(bp, "The ", 4)) { @@ -370,8 +356,7 @@ Xmonnam(mtmp) } char * -visctrl(c) - char c; +visctrl(int c) { static char ccc[3]; if (c < 040) { diff --git a/hack/hack.do_wear.c b/hack/hack.do_wear.c index a031d441..6b0ffd1f 100644 --- a/hack/hack.do_wear.c +++ b/hack/hack.do_wear.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.do_wear.c,v 1.5 2003/04/02 18:36:36 jsm Exp $ */ +/* $NetBSD: hack.do_wear.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,21 +63,20 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.do_wear.c,v 1.5 2003/04/02 18:36:36 jsm Exp $"); +__RCSID("$NetBSD: hack.do_wear.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" void -off_msg(otmp) - struct obj *otmp; +off_msg(struct obj *otmp) { pline("You were wearing %s.", doname(otmp)); } int -doremarm() +doremarm(void) { struct obj *otmp; if (!uarm && !uarmh && !uarms && !uarmg) { @@ -104,7 +103,7 @@ doremarm() } int -doremring() +doremring(void) { if (!uleft && !uright) { pline("Not wearing any ring."); @@ -138,8 +137,7 @@ doremring() } int -dorr(otmp) - struct obj *otmp; +dorr(struct obj *otmp) { if (cursed(otmp)) return (0); @@ -149,8 +147,7 @@ dorr(otmp) } int -cursed(otmp) - struct obj *otmp; +cursed(struct obj *otmp) { if (otmp->cursed) { pline("You can't. It appears to be cursed."); @@ -160,8 +157,7 @@ cursed(otmp) } int -armoroff(otmp) - struct obj *otmp; +armoroff(struct obj *otmp) { int delay = -objects[otmp->otyp].oc_delay; if (cursed(otmp)) @@ -186,7 +182,7 @@ armoroff(otmp) } int -doweararm() +doweararm(void) { struct obj *otmp; int delay; @@ -251,7 +247,7 @@ doweararm() } int -dowearring() +dowearring(void) { struct obj *otmp; long mask = 0; @@ -329,8 +325,7 @@ dowearring() } void -ringoff(obj) - struct obj *obj; +ringoff(struct obj *obj) { long mask; mask = obj->owornmask & W_RING; @@ -368,7 +363,7 @@ ringoff(obj) } void -find_ac() +find_ac(void) { int uac = 10; if (uarm) @@ -392,7 +387,7 @@ find_ac() } void -glibr() +glibr(void) { struct obj *otmp; int xfl = 0; @@ -421,7 +416,7 @@ glibr() } struct obj * -some_armor() +some_armor(void) { struct obj *otmph = uarm; if (uarmh && (!otmph || !rn2(4))) @@ -434,7 +429,7 @@ some_armor() } void -corrode_armor() +corrode_armor(void) { struct obj *otmph = some_armor(); if (otmph) { diff --git a/hack/hack.dog.c b/hack/hack.dog.c index 7537454b..3bbda261 100644 --- a/hack/hack.dog.c +++ b/hack/hack.dog.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.dog.c,v 1.9 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.dog.c,v 1.10 2009/06/07 18:30:39 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.9 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.dog.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -81,7 +81,7 @@ const struct permonst la_dog = void -makedog() +makedog(void) { struct monst *mtmp = makemon(&li_dog, u.ux, u.uy); if (!mtmp) @@ -90,8 +90,7 @@ makedog() } void -initedog(mtmp) - struct monst *mtmp; +initedog(struct monst *mtmp) { mtmp->mtame = mtmp->mpeaceful = 1; EDOG(mtmp)->hungrytime = 1000 + moves; @@ -108,7 +107,7 @@ struct monst *fallen_down = 0;/* monsters that fell through a trapdoor */ /* they will appear on the next level @ goes to, even if he goes up! */ void -losedogs() +losedogs(void) { struct monst *mtmp; while ((mtmp = mydogs) != NULL) { @@ -126,7 +125,7 @@ losedogs() } void -keepdogs() +keepdogs(void) { struct monst *mtmp; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) @@ -143,8 +142,7 @@ keepdogs() } void -fall_down(mtmp) - struct monst *mtmp; +fall_down(struct monst *mtmp) { relmon(mtmp); mtmp->nmon = fallen_down; @@ -162,8 +160,7 @@ fall_down(mtmp) #define POISON 5 #define UNDEF 6 int -dogfood(obj) - struct obj *obj; +dogfood(struct obj *obj) { switch (obj->olet) { case FOOD_SYM: @@ -473,8 +470,7 @@ newdogpos: /* return roomnumber or -1 */ int -inroom(x, y) - xchar x, y; +inroom(xchar x, xchar y) { #ifndef QUEST struct mkroom *croom = &rooms[0]; @@ -489,9 +485,7 @@ inroom(x, y) } int -tamedog(mtmp, obj) - struct monst *mtmp; - struct obj *obj; +tamedog(struct monst *mtmp, struct obj *obj) { struct monst *mtmp2; diff --git a/hack/hack.eat.c b/hack/hack.eat.c index e533ca5e..9cd24b22 100644 --- a/hack/hack.eat.c +++ b/hack/hack.eat.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.eat.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */ +/* $NetBSD: hack.eat.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.eat.c,v 1.6 2003/04/02 18:36:36 jsm Exp $"); +__RCSID("$NetBSD: hack.eat.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -90,7 +90,7 @@ const char *const hu_stat[] = { }; void -init_uhunger() +init_uhunger(void) { u.uhunger = 900; u.uhs = NOT_HUNGRY; @@ -115,7 +115,7 @@ static struct { } tin; int -opentin() +opentin(void) { int r; @@ -151,7 +151,7 @@ opentin() } int -Meatdone() +Meatdone(void) { u.usym = '@'; prme(); @@ -159,7 +159,7 @@ Meatdone() } int -doeat() +doeat(void) { struct obj *otmp; struct objclass *ftmp; @@ -340,7 +340,7 @@ eatx: /* called in hack.main.c */ void -gethungry() +gethungry(void) { --u.uhunger; if (moves % 2) { @@ -364,8 +364,7 @@ gethungry() /* called after vomiting and after performing feats of magic */ void -morehungry(num) - int num; +morehungry(int num) { u.uhunger -= num; newuhs(TRUE); @@ -373,15 +372,14 @@ morehungry(num) /* called after eating something (and after drinking fruit juice) */ void -lesshungry(num) - int num; +lesshungry(int num) { u.uhunger += num; newuhs(FALSE); } int -unfaint() +unfaint(void) { u.uhs = FAINTING; flags.botl = 1; @@ -389,8 +387,7 @@ unfaint() } void -newuhs(incr) - boolean incr; +newuhs(boolean incr) { int newhs, h = u.uhunger; @@ -449,16 +446,14 @@ newuhs(incr) ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) int -poisonous(otmp) - struct obj *otmp; +poisonous(struct obj *otmp) { return (strchr(POISONOUS, CORPSE_I_TO_C(otmp->otyp)) != 0); } /* returns 1 if some text was printed */ int -eatcorpse(otmp) - struct obj *otmp; +eatcorpse(struct obj *otmp) { char let = CORPSE_I_TO_C(otmp->otyp); int tp = 0; diff --git a/hack/hack.end.c b/hack/hack.end.c index 3ea064b4..bb9f59e9 100644 --- a/hack/hack.end.c +++ b/hack/hack.end.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.end.c,v 1.10 2009/05/06 02:59:12 ginsbach Exp $ */ +/* $NetBSD: hack.end.c,v 1.11 2009/06/07 18:30:39 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.10 2009/05/06 02:59:12 ginsbach Exp $"); +__RCSID("$NetBSD: hack.end.c,v 1.11 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -76,7 +76,7 @@ __RCSID("$NetBSD: hack.end.c,v 1.10 2009/05/06 02:59:12 ginsbach Exp $"); xchar maxdlevel = 1; int -dodone() +dodone(void) { done1(0); return 0; @@ -85,8 +85,7 @@ dodone() /*ARGSUSED*/ void -done1(n) - int n __unused; +done1(int n __unused) { (void) signal(SIGINT, SIG_IGN); pline("Really quit?"); @@ -107,8 +106,7 @@ int done_hup; /*ARGSUSED*/ void -done_intr(n) - int n __unused; +done_intr(int n __unused) { done_stopprint++; (void) signal(SIGINT, SIG_IGN); @@ -116,8 +114,7 @@ done_intr(n) } void -done_hangup(n) - int n; +done_hangup(int n) { done_hup++; (void) signal(SIGHUP, SIG_IGN); @@ -125,8 +122,7 @@ done_hangup(n) } void -done_in_by(mtmp) - struct monst *mtmp; +done_in_by(struct monst *mtmp) { static char buf[BUFSZ]; pline("You die ..."); @@ -151,8 +147,7 @@ done_in_by(mtmp) */ /* Be careful not to call panic from here! */ void -done(st1) - const char *st1; +done(const char *st1) { #ifdef WIZARD @@ -316,7 +311,7 @@ struct toptenentry { } *tt_head; void -topten() +topten(void) { int uid = getuid(); int rank, rank0 = -1, rank1 = 0; @@ -483,7 +478,7 @@ unlock: } void -outheader() +outheader(void) { char linebuf[BUFSZ]; char *bp; @@ -577,8 +572,7 @@ outentry(int rank, struct toptenentry *t1, int so) } char * -itoa(a) - int a; +itoa(int a) { static char buf[12]; Sprintf(buf, "%d", a); @@ -586,8 +580,7 @@ itoa(a) } const char * -ordin(n) - int n; +ordin(int n) { int dg = n % 10; @@ -596,7 +589,7 @@ ordin(n) } void -clearlocks() +clearlocks(void) { int x; (void) signal(SIGHUP, SIG_IGN); @@ -609,8 +602,7 @@ clearlocks() #ifdef NOSAVEONHANGUP /*ARGSUSED*/ void -hangup(n) - int n; +hangup(int n __unused) { (void) signal(SIGINT, SIG_IGN); clearlocks(); @@ -619,8 +611,7 @@ hangup(n) #endif /* NOSAVEONHANGUP */ char * -eos(s) - char *s; +eos(char *s) { while (*s) s++; @@ -629,8 +620,7 @@ eos(s) /* it is the callers responsibility to check that there is room for c */ void -charcat(s, c) - char *s, c; +charcat(char *s, int c) { while (*s) s++; @@ -644,9 +634,7 @@ charcat(s, c) * if argc == -1). */ void -prscore(argc, argv) - int argc; - char **argv; +prscore(int argc, char **argv) { char **players = NULL; int playerct; diff --git a/hack/hack.engrave.c b/hack/hack.engrave.c index a0ab1178..649983af 100644 --- a/hack/hack.engrave.c +++ b/hack/hack.engrave.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.engrave.c,v 1.6 2003/04/02 18:36:36 jsm Exp $ */ +/* $NetBSD: hack.engrave.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.engrave.c,v 1.6 2003/04/02 18:36:36 jsm Exp $"); +__RCSID("$NetBSD: hack.engrave.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -85,8 +85,7 @@ struct engr { } *head_engr; struct engr * -engr_at(x, y) - xchar x, y; +engr_at(xchar x, xchar y) { struct engr *ep = head_engr; while (ep) { @@ -98,9 +97,7 @@ engr_at(x, y) } int -sengr_at(s, x, y) - const char *s; - xchar x, y; +sengr_at(const char *s, xchar x, xchar y) { struct engr *ep = engr_at(x, y); char *t; @@ -121,16 +118,14 @@ sengr_at(s, x, y) } void -u_wipe_engr(cnt) - int cnt; +u_wipe_engr(int cnt) { if (!u.uswallow && !Levitation) wipe_engr_at(u.ux, u.uy, cnt); } void -wipe_engr_at(x, y, cnt) - xchar x, y, cnt; +wipe_engr_at(xchar x, xchar y, xchar cnt) { struct engr *ep = engr_at(x, y); int lth, pos; @@ -158,8 +153,7 @@ wipe_engr_at(x, y, cnt) } void -read_engr_at(x, y) - int x, y; +read_engr_at(int x, int y) { struct engr *ep = engr_at(x, y); if (ep && ep->engr_txt[0]) { @@ -181,9 +175,7 @@ read_engr_at(x, y) } void -make_engr_at(x, y, s) - int x, y; - const char *s; +make_engr_at(int x, int y, const char *s) { struct engr *ep; @@ -203,7 +195,7 @@ make_engr_at(x, y, s) } int -doengrave() +doengrave(void) { int len; char *sp; @@ -345,8 +337,7 @@ doengrave() } void -save_engravings(fd) - int fd; +save_engravings(int fd) { struct engr *ep = head_engr; while (ep) { @@ -363,8 +354,7 @@ save_engravings(fd) } void -rest_engravings(fd) - int fd; +rest_engravings(int fd) { struct engr *ep; unsigned lth; @@ -382,8 +372,7 @@ rest_engravings(fd) } void -del_engr(ep) - struct engr *ep; +del_engr(struct engr *ep) { struct engr *ept; if (ep == head_engr) diff --git a/hack/hack.fight.c b/hack/hack.fight.c index 038ca889..9d490408 100644 --- a/hack/hack.fight.c +++ b/hack/hack.fight.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.fight.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.fight.c,v 1.9 2009/06/07 18:30:39 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.8 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.fight.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -74,8 +74,7 @@ static long noisetime; /* hitmm returns 0 (miss), 1 (hit), or 2 (kill) */ int -hitmm(magr, mdef) - struct monst *magr, *mdef; +hitmm(struct monst *magr, struct monst *mdef) { const struct permonst *pa = magr->data, *pd = mdef->data; int didhit; @@ -144,8 +143,7 @@ hitmm(magr, mdef) /* drop (perhaps) a cadaver and remove monster */ void -mondied(mdef) - struct monst *mdef; +mondied(struct monst *mdef) { const struct permonst *pd = mdef->data; if (letter(pd->mlet) && rn2(3)) { @@ -161,8 +159,7 @@ mondied(mdef) /* drop a rock and remove monster */ void -monstone(mdef) - struct monst *mdef; +monstone(struct monst *mdef) { if (strchr(mlarge, mdef->data->mlet)) mksobj_at(ENORMOUS_ROCK, mdef->mx, mdef->my); @@ -177,8 +174,7 @@ monstone(mdef) int -fightm(mtmp) - struct monst *mtmp; +fightm(struct monst *mtmp) { struct monst *mon; for (mon = fmon; mon; mon = mon->nmon) @@ -192,9 +188,7 @@ fightm(mtmp) /* u is hit by sth, but not a monster */ int -thitu(tlev, dam, name) - int tlev, dam; - const char *name; +thitu(int tlev, int dam, const char *name) { char buf[BUFSZ]; setan(name, buf); @@ -216,11 +210,9 @@ thitu(tlev, dam, name) char mlarge[] = "bCDdegIlmnoPSsTUwY',&"; +/* return TRUE if mon still alive */ boolean -hmon(mon, obj, thrown) /* return TRUE if mon still alive */ - struct monst *mon; - struct obj *obj; - int thrown; +hmon(struct monst *mon, struct obj *obj, int thrown) { int tmp; boolean hittxt = FALSE; @@ -348,8 +340,7 @@ hmon(mon, obj, thrown) /* return TRUE if mon still alive */ /* try to attack; return FALSE if monster evaded */ /* u.dx and u.dy must be set */ int -attack(mtmp) - struct monst *mtmp; +attack(struct monst *mtmp) { schar tmp; boolean malive = TRUE; diff --git a/hack/hack.invent.c b/hack/hack.invent.c index 6bc8a173..6bb41c0f 100644 --- a/hack/hack.invent.c +++ b/hack/hack.invent.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.invent.c,v 1.10 2006/03/29 01:19:51 jnemeth Exp $ */ +/* $NetBSD: hack.invent.c,v 1.11 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.invent.c,v 1.10 2006/03/29 01:19:51 jnemeth Exp $"); +__RCSID("$NetBSD: hack.invent.c,v 1.11 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -82,8 +82,7 @@ static void assigninvlet(struct obj *); static char *xprname(struct obj *, char); static void -assigninvlet(otmp) - struct obj *otmp; +assigninvlet(struct obj *otmp) { boolean inuse[52]; int i; @@ -118,8 +117,7 @@ assigninvlet(otmp) } struct obj * -addinv(obj) - struct obj *obj; +addinv(struct obj *obj) { struct obj *otmp; @@ -165,8 +163,7 @@ addinv(obj) } void -useup(obj) - struct obj *obj; +useup(struct obj *obj) { if (obj->quan > 1) { obj->quan--; @@ -179,8 +176,7 @@ useup(obj) } void -freeinv(obj) - struct obj *obj; +freeinv(struct obj *obj) { struct obj *otmp; @@ -196,8 +192,7 @@ freeinv(obj) /* destroy object in fobj chain (if unpaid, it remains on the bill) */ void -delobj(obj) - struct obj *obj; +delobj(struct obj *obj) { freeobj(obj); unpobj(obj); @@ -206,8 +201,7 @@ delobj(obj) /* unlink obj from chain starting with fobj */ void -freeobj(obj) - struct obj *obj; +freeobj(struct obj *obj) { struct obj *otmp; @@ -226,8 +220,7 @@ freeobj(obj) /* Note: freegold throws away its argument! */ void -freegold(gold) - struct gold *gold; +freegold(struct gold *gold) { struct gold *gtmp; @@ -246,8 +239,7 @@ freegold(gold) } void -deltrap(trap) - struct trap *trap; +deltrap(struct trap *trap) { struct trap *ttmp; @@ -263,8 +255,7 @@ deltrap(trap) struct wseg *m_atseg; struct monst * -m_at(x, y) - int x, y; +m_at(int x, int y) { struct monst *mtmp; #ifndef NOWORM @@ -289,8 +280,7 @@ m_at(x, y) } struct obj * -o_at(x, y) - int x, y; +o_at(int x, int y) { struct obj *otmp; @@ -301,8 +291,7 @@ o_at(x, y) } struct obj * -sobj_at(n, x, y) - int n, x, y; +sobj_at(int n, int x, int y) { struct obj *otmp; @@ -313,8 +302,7 @@ sobj_at(n, x, y) } int -carried(obj) - struct obj *obj; +carried(struct obj *obj) { struct obj *otmp; for (otmp = invent; otmp; otmp = otmp->nobj) @@ -324,8 +312,7 @@ carried(obj) } int -carrying(type) - int type; +carrying(int type) { struct obj *otmp; @@ -336,9 +323,7 @@ carrying(type) } struct obj * -o_on(id, objchn) - unsigned int id; - struct obj *objchn; +o_on(unsigned int id, struct obj *objchn) { while (objchn) { if (objchn->o_id == id) @@ -349,8 +334,7 @@ o_on(id, objchn) } struct trap * -t_at(x, y) - int x, y; +t_at(int x, int y) { struct trap *trap = ftrap; while (trap) { @@ -362,8 +346,7 @@ t_at(x, y) } struct gold * -g_at(x, y) - int x, y; +g_at(int x, int y) { struct gold *gold = fgold; while (gold) { @@ -376,8 +359,7 @@ g_at(x, y) /* make dummy object structure containing gold - for temporary use only */ struct obj * -mkgoldobj(q) - long q; +mkgoldobj(long q) { struct obj *otmp; @@ -397,8 +379,7 @@ mkgoldobj(q) * &zeroobj explicitly no object (as in w-). */ struct obj * -getobj(let, word) - const char *let, *word; +getobj(const char *let, const char *word) { struct obj *otmp; char ilet, ilet1, ilet2; @@ -561,8 +542,7 @@ getobj(let, word) } int -ckunpaid(otmp) - struct obj *otmp; +ckunpaid(struct obj *otmp) { return (otmp->unpaid); } @@ -570,10 +550,7 @@ ckunpaid(otmp) /* interactive version of getobj - used for Drop and Identify */ /* return the number of times fn was called successfully */ int -ggetobj(word, fn, max) - const char *word; - int (*fn)(struct obj *); - int max; +ggetobj(const char *word, int (*fn)(struct obj *), int max) { char buf[BUFSZ]; char *ip; @@ -654,13 +631,10 @@ ggetobj(word, fn, max) * objects to be treated. Return the number of objects treated. */ int -askchain(objchn, olets, allflag, fn, ckfn, max) - struct obj *objchn; - char *olets; - int allflag; - int (*fn)(struct obj *); - int (*ckfn)(struct obj *); - int max; +askchain(struct obj *objchn, char *olets, int allflag, + int (*fn)(struct obj *), + int (*ckfn)(struct obj *), + int max) { struct obj *otmp, *otmp2; char sym, ilet; @@ -702,10 +676,9 @@ ret: return (cnt); } +/* should of course only be called for things in invent */ char -obj_to_let(obj) /* should of course only be called for things - * in invent */ - struct obj *obj; +obj_to_let(struct obj *obj) { struct obj *otmp; char ilet; @@ -720,16 +693,13 @@ obj_to_let(obj) /* should of course only be called for things } void -prinv(obj) - struct obj *obj; +prinv(struct obj *obj) { pline(xprname(obj, obj_to_let(obj))); } static char * -xprname(obj, let) - struct obj *obj; - char let; +xprname(struct obj *obj, char let) { static char li[BUFSZ]; @@ -740,7 +710,7 @@ xprname(obj, let) } int -ddoinv() +ddoinv(void) { doinv((char *) 0); return (0); @@ -749,8 +719,7 @@ ddoinv() /* called with 0 or "": all objects in inventory */ /* otherwise: all objects with (serial) letter in lets */ void -doinv(lets) - char *lets; +doinv(char *lets) { struct obj *otmp; char ilet; @@ -781,7 +750,7 @@ doinv(lets) } int -dotypeinv() +dotypeinv(void) { /* free after Robert Viduya */ /* Changed to one type only, so he doesnt have to type cr */ char c, ilet; @@ -858,7 +827,7 @@ dotypeinv() /* look at what is here */ int -dolook() +dolook(void) { struct obj *otmp = NULL, *otmp0 = NULL; struct gold *gold = NULL; @@ -914,8 +883,7 @@ dolook() } void -stackobj(obj) - struct obj *obj; +stackobj(struct obj *obj) { struct obj *otmp = fobj; for (otmp = fobj; otmp; otmp = otmp->nobj) @@ -927,9 +895,7 @@ stackobj(obj) /* merge obj with otmp and delete obj if types agree */ int -merged(otmp, obj, lose) - struct obj *otmp, *obj; - int lose; +merged(struct obj *otmp, struct obj *obj, int lose) { if (obj->otyp == otmp->otyp && obj->unpaid == otmp->unpaid && @@ -956,7 +922,7 @@ static long goldcounted; * [Bug: d$ and pickup still tell you how much it was.] */ int -countgold() +countgold(void) { if ((goldcounted += 100 * (u.ulevel + 1)) >= u.ugold) { long eps = 0; @@ -970,7 +936,7 @@ countgold() } int -doprgold() +doprgold(void) { if (!u.ugold) pline("You do not carry any gold."); @@ -987,7 +953,7 @@ doprgold() /* --- end of gold counting section --- */ int -doprwep() +doprwep(void) { if (!uwep) pline("You are empty handed."); @@ -997,7 +963,7 @@ doprwep() } int -doprarm() +doprarm(void) { if (!uarm && !uarmg && !uarms && !uarmh) pline("You are not wearing any armor."); @@ -1022,7 +988,7 @@ doprarm() } int -doprring() +doprring(void) { if (!uleft && !uright) pline("You are not wearing any rings."); @@ -1041,8 +1007,7 @@ doprring() } int -digit(c) - char c; +digit(int c) { return (c >= '0' && c <= '9'); } diff --git a/hack/hack.ioctl.c b/hack/hack.ioctl.c index ebf2ae8c..95bb7b9b 100644 --- a/hack/hack.ioctl.c +++ b/hack/hack.ioctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.ioctl.c,v 1.7 2003/04/02 18:36:37 jsm Exp $ */ +/* $NetBSD: hack.ioctl.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.ioctl.c,v 1.7 2003/04/02 18:36:37 jsm Exp $"); +__RCSID("$NetBSD: hack.ioctl.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ /* @@ -77,13 +77,13 @@ __RCSID("$NetBSD: hack.ioctl.c,v 1.7 2003/04/02 18:36:37 jsm Exp $"); struct termios termios; void -getioctls() +getioctls(void) { (void) tcgetattr(fileno(stdin), &termios); } void -setioctls() +setioctls(void) { (void) tcsetattr(fileno(stdin), TCSADRAIN, &termios); } @@ -91,7 +91,7 @@ setioctls() #ifdef SUSPEND /* implies BSD */ #include int -dosuspend() +dosuspend(void) { #ifdef SIGTSTP if (signal(SIGTSTP, SIG_IGN) == SIG_DFL) { diff --git a/hack/hack.lev.c b/hack/hack.lev.c index 602bde5c..c846d18e 100644 --- a/hack/hack.lev.c +++ b/hack/hack.lev.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.lev.c,v 1.9 2009/01/18 13:30:33 tnn Exp $ */ +/* $NetBSD: hack.lev.c,v 1.10 2009/06/07 18:30:39 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.9 2009/01/18 13:30:33 tnn Exp $"); +__RCSID("$NetBSD: hack.lev.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -79,9 +79,7 @@ __RCSID("$NetBSD: hack.lev.c,v 1.9 2009/01/18 13:30:33 tnn Exp $"); boolean level_exists[MAXLEVEL + 1]; void -savelev(fd, lev) - int fd; - xchar lev; +savelev(int fd, xchar lev) { #ifndef NOWORM struct wseg *wtmp, *wtmp2; @@ -130,10 +128,7 @@ savelev(fd, lev) } void -bwrite(fd, loc, num) - int fd; - const void *loc; - size_t num; +bwrite(int fd, const void *loc, size_t num) { /* lint wants the 3rd arg of write to be an int; lint -p an unsigned */ if ((size_t)write(fd, loc, num) != num) @@ -141,9 +136,7 @@ bwrite(fd, loc, num) } void -saveobjchn(fd, otmp) - int fd; - struct obj *otmp; +saveobjchn(int fd, struct obj *otmp) { struct obj *otmp2; unsigned xl; @@ -161,9 +154,7 @@ saveobjchn(fd, otmp) } void -savemonchn(fd, mtmp) - int fd; - struct monst *mtmp; +savemonchn(int fd, struct monst *mtmp) { struct monst *mtmp2; unsigned xl; @@ -186,9 +177,7 @@ savemonchn(fd, mtmp) } void -savegoldchn(fd, gold) - int fd; - struct gold *gold; +savegoldchn(int fd, struct gold *gold) { struct gold *gold2; while (gold) { @@ -201,9 +190,7 @@ savegoldchn(fd, gold) } void -savetrapchn(fd, trap) - int fd; - struct trap *trap; +savetrapchn(int fd, struct trap *trap) { struct trap *trap2; while (trap) { @@ -216,9 +203,7 @@ savetrapchn(fd, trap) } void -getlev(fd, pid, lev) - int fd, pid; - xchar lev; +getlev(int fd, int pid, xchar lev) { struct gold *gold; struct trap *trap; @@ -320,10 +305,7 @@ getlev(fd, pid, lev) } void -mread(fd, buf, len) - int fd; - char *buf; - unsigned len; +mread(int fd, char *buf, unsigned len) { int rlen; @@ -339,7 +321,7 @@ mread(fd, buf, len) } void -mklev() +mklev(void) { if (getbones()) return; diff --git a/hack/hack.main.c b/hack/hack.main.c index 5f62384d..be76bc55 100644 --- a/hack/hack.main.c +++ b/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.main.c,v 1.10 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.main.c,v 1.11 2009/06/07 18:30:39 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.10 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.main.c,v 1.11 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -96,9 +96,7 @@ int main(int, char *[]); static void chdirx(const char *, boolean); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { int fd; #ifdef CHDIR @@ -477,8 +475,7 @@ not_recovered: } void -glo(foo) - int foo; +glo(int foo) { /* construct the string xlock.n */ char *tf; @@ -495,7 +492,7 @@ glo(foo) * It may still contain a suffix denoting pl_character. */ void -askname() +askname(void) { int c, ct; printf("\nWho are you? "); @@ -535,9 +532,7 @@ impossible(const char *s, ...) #ifdef CHDIR static void -chdirx(dir, wr) - const char *dir; - boolean wr; +chdirx(const char *dir, boolean wr) { #ifdef SECURE @@ -578,7 +573,7 @@ chdirx(dir, wr) #endif void -stop_occupation() +stop_occupation(void) { if (occupation) { pline("You stop %s.", occtxt); diff --git a/hack/hack.makemon.c b/hack/hack.makemon.c index 44202cca..9a0821e8 100644 --- a/hack/hack.makemon.c +++ b/hack/hack.makemon.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.makemon.c,v 1.7 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.makemon.c,v 1.8 2009/06/07 18:30:39 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.7 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.makemon.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -181,8 +181,7 @@ gotmon: } coord -enexto(xx, yy) - xchar xx, yy; +enexto(xchar xx, xchar yy) { xchar x, y; coord foo[15], *tfoo; @@ -237,8 +236,7 @@ goodpos(int x, int y) } void -rloc(mtmp) - struct monst *mtmp; +rloc(struct monst *mtmp) { int tx, ty; char ch = mtmp->data->mlet; @@ -265,9 +263,7 @@ rloc(mtmp) } struct monst * -mkmon_at(let, x, y) - char let; - int x, y; +mkmon_at(int let, int x, int y) { int ct; const struct permonst *ptr; diff --git a/hack/hack.mhitu.c b/hack/hack.mhitu.c index db1720f1..d926898a 100644 --- a/hack/hack.mhitu.c +++ b/hack/hack.mhitu.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mhitu.c,v 1.6 2003/04/02 18:36:37 jsm Exp $ */ +/* $NetBSD: hack.mhitu.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mhitu.c,v 1.6 2003/04/02 18:36:37 jsm Exp $"); +__RCSID("$NetBSD: hack.mhitu.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -74,8 +74,7 @@ __RCSID("$NetBSD: hack.mhitu.c,v 1.6 2003/04/02 18:36:37 jsm Exp $"); * returns 1 if monster dies (e.g. 'y', 'F'), 0 otherwise */ int -mhitu(mtmp) - struct monst *mtmp; +mhitu(struct monst *mtmp) { const struct permonst *mdat = mtmp->data; int tmp, ctmp; @@ -402,9 +401,7 @@ mhitu(mtmp) } int -hitu(mtmp, dam) - struct monst *mtmp; - int dam; +hitu(struct monst *mtmp, int dam) { int tmp, res; diff --git a/hack/hack.mklev.c b/hack/hack.mklev.c index 2a4fc05e..bb160fe3 100644 --- a/hack/hack.mklev.c +++ b/hack/hack.mklev.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mklev.c,v 1.6 2003/04/02 18:36:38 jsm Exp $ */ +/* $NetBSD: hack.mklev.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mklev.c,v 1.6 2003/04/02 18:36:38 jsm Exp $"); +__RCSID("$NetBSD: hack.mklev.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -97,7 +97,7 @@ int rscnt, rsmax; /* 0..rscnt-1: currently under consideration */ /* rscnt..rsmax: discarded */ void -makelevel() +makelevel(void) { struct mkroom *croom, *troom; unsigned tryct; @@ -210,7 +210,7 @@ makelevel() } int -makerooms() +makerooms(void) { struct rectangle *rsp; int lx, ly, hx, hy, lowx, lowy, hix, hiy, dx, dy; @@ -282,8 +282,7 @@ makerooms() } void -addrs(lowx, lowy, hix, hiy) - int lowx, lowy, hix, hiy; +addrs(int lowx, int lowy, int hix, int hiy) { struct rectangle *rsp; int lx, ly, hx, hy, xlim, ylim; @@ -318,10 +317,9 @@ addrs(lowx, lowy, hix, hiy) } } +/* discarded: piece of a discarded area */ void -addrsx(lx, ly, hx, hy, discarded) - int lx, ly, hx, hy; - boolean discarded; /* piece of a discarded area */ +addrsx(int lx, int ly, int hx, int hy, boolean discarded) { struct rectangle *rsp; @@ -353,8 +351,7 @@ addrsx(lx, ly, hx, hy, discarded) } int -comp(vx, vy) - const void *vx, *vy; +comp(const void *vx, const void *vy) { const struct mkroom *x = vx, *y = vy; if (x->lx < y->lx) @@ -393,8 +390,7 @@ gotit: /* see whether it is allowable to create a door at [x,y] */ int -okdoor(x, y) - int x, y; +okdoor(int x, int y) { if (levl[x - 1][y].typ == DOOR || levl[x + 1][y].typ == DOOR || levl[x][y + 1].typ == DOOR || levl[x][y - 1].typ == DOOR || @@ -407,9 +403,7 @@ okdoor(x, y) } void -dodoor(x, y, aroom) - int x, y; - struct mkroom *aroom; +dodoor(int x, int y, struct mkroom *aroom) { if (doorindex >= DOORMAX) { impossible("DOORMAX exceeded?"); @@ -421,10 +415,7 @@ dodoor(x, y, aroom) } void -dosdoor(x, y, aroom, type) - int x, y; - struct mkroom *aroom; - int type; +dosdoor(int x, int y, struct mkroom *aroom, int type) { struct mkroom *broom; int tmp; @@ -450,8 +441,7 @@ dosdoor(x, y, aroom, type) /* Only called from makerooms() */ int -maker(lowx, ddx, lowy, ddy) - schar lowx, ddx, lowy, ddy; +maker(schar lowx, schar ddx, schar lowy, schar ddy) { struct mkroom *croom; int x, y, hix = lowx + ddx, hiy = lowy + ddy; @@ -535,7 +525,7 @@ chk: } void -makecorridors() +makecorridors(void) { int a, b; @@ -560,8 +550,7 @@ makecorridors() } void -join(a, b) - int a, b; +join(int a, int b) { coord cc, tt; int tx, ty, xx, yy; @@ -702,7 +691,7 @@ join(a, b) } void -make_niches() +make_niches(void) { int ct = rnd(nroom / 2 + 1); while (ct--) @@ -710,14 +699,13 @@ make_niches() } void -makevtele() +makevtele(void) { makeniche(TRUE); } void -makeniche(with_trap) - boolean with_trap; +makeniche(boolean with_trap) { struct mkroom *aroom; struct rm *rm; @@ -770,9 +758,7 @@ makeniche(with_trap) /* make a trap somewhere (in croom if mazeflag = 0) */ void -mktrap(num, mazeflag, croom) - int num, mazeflag; - struct mkroom *croom; +mktrap(int num, int mazeflag, struct mkroom *croom) { struct trap *ttmp; int kind, nopierc, nomimic, fakedoor, fakegold, tryct = 0; diff --git a/hack/hack.mkmaze.c b/hack/hack.mkmaze.c index 471edc29..b71d5741 100644 --- a/hack/hack.mkmaze.c +++ b/hack/hack.mkmaze.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mkmaze.c,v 1.6 2003/04/02 18:36:38 jsm Exp $ */ +/* $NetBSD: hack.mkmaze.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mkmaze.c,v 1.6 2003/04/02 18:36:38 jsm Exp $"); +__RCSID("$NetBSD: hack.mkmaze.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -73,7 +73,7 @@ const struct permonst hell_hound = {"hell hound", 'd', 12, 14, 2, 3, 6, 0}; void -makemaz() +makemaz(void) { int x, y; int zx, zy; @@ -152,8 +152,7 @@ makemaz() } void -walkfrom(x, y) - int x, y; +walkfrom(int x, int y) { int q, a, dir; int dirs[4]; @@ -174,9 +173,7 @@ walkfrom(x, y) } void -move(x, y, dir) - int *x, *y; - int dir; +move(int *x, int *y, int dir) { switch (dir) { case 0: @@ -195,9 +192,7 @@ move(x, y, dir) } int -okay(x, y, dir) - int x, y; - int dir; +okay(int x, int y, int dir) { move(&x, &y, dir); move(&x, &y, dir); @@ -208,7 +203,7 @@ okay(x, y, dir) } coord -mazexy() +mazexy(void) { coord mm; mm.x = 3 + 2 * rn2(COLNO / 2 - 2); diff --git a/hack/hack.mkobj.c b/hack/hack.mkobj.c index 4a72255f..b204cdf2 100644 --- a/hack/hack.mkobj.c +++ b/hack/hack.mkobj.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mkobj.c,v 1.6 2003/04/02 18:36:38 jsm Exp $ */ +/* $NetBSD: hack.mkobj.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mkobj.c,v 1.6 2003/04/02 18:36:38 jsm Exp $"); +__RCSID("$NetBSD: hack.mkobj.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -72,8 +72,7 @@ __RCSID("$NetBSD: hack.mkobj.c,v 1.6 2003/04/02 18:36:38 jsm Exp $"); char mkobjstr[] = "))[[!!!!????%%%%/=**))[[!!!!????%%%%/=**(%"; struct obj * -mkobj_at(let, x, y) - int let, x, y; +mkobj_at(int let, int x, int y) { struct obj *otmp = mkobj(let); otmp->ox = x; @@ -84,8 +83,7 @@ mkobj_at(let, x, y) } void -mksobj_at(otyp, x, y) - int otyp, x, y; +mksobj_at(int otyp, int x, int y) { struct obj *otmp = mksobj(otyp); otmp->ox = x; @@ -95,8 +93,7 @@ mksobj_at(otyp, x, y) } struct obj * -mkobj(let) - int let; +mkobj(int let) { if (!let) let = mkobjstr[rn2(sizeof(mkobjstr) - 1)]; @@ -113,8 +110,7 @@ mkobj(let) struct obj zeroobj; struct obj * -mksobj(otyp) - int otyp; +mksobj(int otyp) { struct obj *otmp; char let = objects[otyp].oc_olet; @@ -193,15 +189,13 @@ mksobj(otyp) } int -letter(c) - int c; +letter(int c) { return (('@' <= c && c <= 'Z') || ('a' <= c && c <= 'z')); } int -weight(obj) - struct obj *obj; +weight(struct obj *obj) { int wt = objects[obj->otyp].oc_weight; return (wt ? wt * obj->quan : (obj->quan + 1) / 2); diff --git a/hack/hack.mkshop.c b/hack/hack.mkshop.c index e30cb544..06b16753 100644 --- a/hack/hack.mkshop.c +++ b/hack/hack.mkshop.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mkshop.c,v 1.8 2003/04/02 18:36:38 jsm Exp $ */ +/* $NetBSD: hack.mkshop.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.mkshop.c,v 1.8 2003/04/02 18:36:38 jsm Exp $"); +__RCSID("$NetBSD: hack.mkshop.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -76,7 +76,7 @@ __RCSID("$NetBSD: hack.mkshop.c,v 1.8 2003/04/02 18:36:38 jsm Exp $"); const schar shprobs[] = {3, 3, 5, 5, 10, 10, 14, 50}; /* their probabilities */ void -mkshop() +mkshop(void) { struct mkroom *sroom; int sh, sx, sy, i = -1; @@ -209,8 +209,7 @@ gottype: } void -mkzoo(type) - int type; +mkzoo(int type) { struct mkroom *sroom; struct monst *mon; @@ -275,7 +274,7 @@ mkzoo(type) } const struct permonst * -morguemon() +morguemon(void) { int i = rn2(100), hd = rn2(dlevel); @@ -287,7 +286,7 @@ morguemon() } void -mkswamp() +mkswamp(void) { /* Michiel Huisjes & Fred de Wilde */ struct mkroom *sroom; int sx, sy, i, eelct = 0; @@ -315,8 +314,7 @@ mkswamp() } int -nexttodoor(sx, sy) - int sx, sy; +nexttodoor(int sx, int sy) { int dx, dy; struct rm *lev; @@ -329,39 +327,34 @@ nexttodoor(sx, sy) } int -has_dnstairs(sroom) - struct mkroom *sroom; +has_dnstairs(struct mkroom *sroom) { return (sroom->lx <= xdnstair && xdnstair <= sroom->hx && sroom->ly <= ydnstair && ydnstair <= sroom->hy); } int -has_upstairs(sroom) - struct mkroom *sroom; +has_upstairs(struct mkroom *sroom) { return (sroom->lx <= xupstair && xupstair <= sroom->hx && sroom->ly <= yupstair && yupstair <= sroom->hy); } int -isbig(sroom) - struct mkroom *sroom; +isbig(struct mkroom *sroom) { int area = (sroom->hx - sroom->lx) * (sroom->hy - sroom->ly); return (area > 20); } int -dist2(x0, y0, x1, y1) - int x0, y0, x1, y1; +dist2(int x0, int y0, int x1, int y1) { return ((x0 - x1) * (x0 - x1) + (y0 - y1) * (y0 - y1)); } int -sq(a) - int a; +sq(int a) { return (a * a); } diff --git a/hack/hack.mon.c b/hack/hack.mon.c index 187382ff..8ee9b470 100644 --- a/hack/hack.mon.c +++ b/hack/hack.mon.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.mon.c,v 1.8 2008/01/28 06:55:41 dholland Exp $ */ +/* $NetBSD: hack.mon.c,v 1.9 2009/06/07 18:30:39 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.8 2008/01/28 06:55:41 dholland Exp $"); +__RCSID("$NetBSD: hack.mon.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -83,7 +83,7 @@ const char *const warnings[] = { }; void -movemon() +movemon(void) { struct monst *mtmp; int fr; @@ -173,9 +173,7 @@ next_mon: } void -justswld(mtmp, name) - struct monst *mtmp; - const char *name; +justswld(struct monst *mtmp, const char *name) { mtmp->mx = u.ux; @@ -191,10 +189,7 @@ justswld(mtmp, name) } void -youswld(mtmp, dam, die, name) - struct monst *mtmp; - int dam, die; - const char *name; +youswld(struct monst *mtmp, int dam, int die, const char *name) { if (mtmp != u.ustuck) return; @@ -212,8 +207,7 @@ youswld(mtmp, dam, die, name) } int -dochugw(mtmp) - struct monst *mtmp; +dochugw(struct monst *mtmp) { int x = mtmp->mx; int y = mtmp->my; @@ -233,8 +227,7 @@ dochugw(mtmp) /* returns 1 if monster died moving, 0 otherwise */ int -dochug(mtmp) - struct monst *mtmp; +dochug(struct monst *mtmp) { const struct permonst *mdat; int tmp = 0, nearby, scared; @@ -548,8 +541,7 @@ postmov: } void -mpickgold(mtmp) - struct monst *mtmp; +mpickgold(struct monst *mtmp) { struct gold *gold; while ((gold = g_at(mtmp->mx, mtmp->my)) != NULL) { @@ -561,8 +553,7 @@ mpickgold(mtmp) } void -mpickgems(mtmp) - struct monst *mtmp; +mpickgems(struct monst *mtmp) { struct obj *otmp; for (otmp = fobj; otmp; otmp = otmp->nobj) @@ -579,10 +570,7 @@ mpickgems(mtmp) /* return number of acceptable neighbour positions */ int -mfndpos(mon, poss, info, flag) - struct monst *mon; - coord poss[9]; - int info[9], flag; +mfndpos(struct monst *mon, coord poss[9], int info[9], int flag) { int x, y, nx, ny, cnt = 0, ntyp; struct monst *mtmp; @@ -674,15 +662,13 @@ nexttry: /* eels prefer the water, but if there is no } int -dist(x, y) - int x, y; +dist(int x, int y) { return ((x - u.ux) * (x - u.ux) + (y - u.uy) * (y - u.uy)); } void -poisoned(string, pname) - const char *string, *pname; +poisoned(const char *string, const char *pname) { int i; @@ -710,8 +696,7 @@ poisoned(string, pname) } void -mondead(mtmp) - struct monst *mtmp; +mondead(struct monst *mtmp) { relobj(mtmp, 1); unpmon(mtmp); @@ -730,8 +715,7 @@ mondead(mtmp) /* called when monster is moved to larger structure */ void -replmon(mtmp, mtmp2) - struct monst *mtmp, *mtmp2; +replmon(struct monst *mtmp, struct monst *mtmp2) { relmon(mtmp); monfree(mtmp); @@ -746,8 +730,7 @@ replmon(mtmp, mtmp2) } void -relmon(mon) - struct monst *mon; +relmon(struct monst *mon) { struct monst *mtmp; @@ -767,15 +750,14 @@ struct monst *fdmon; /* chain of dead monsters, need not to be * saved */ void -monfree(mtmp) - struct monst *mtmp; +monfree(struct monst *mtmp) { mtmp->nmon = fdmon; fdmon = mtmp; } void -dmonsfree() +dmonsfree(void) { struct monst *mtmp; while ((mtmp = fdmon) != NULL) { @@ -785,8 +767,7 @@ dmonsfree() } void -unstuck(mtmp) - struct monst *mtmp; +unstuck(struct monst *mtmp) { if (u.ustuck == mtmp) { if (u.uswallow) { @@ -801,8 +782,7 @@ unstuck(mtmp) } void -killed(mtmp) - struct monst *mtmp; +killed(struct monst *mtmp) { #ifdef lint #define NEW_SCORING @@ -940,7 +920,7 @@ kludge(const char *str, const char *arg) } void -rescham() +rescham(void) { /* force all chameleons to become normal */ struct monst *mtmp; @@ -951,11 +931,10 @@ rescham() } } -int -newcham(mtmp, mdat) /* make a chameleon look like a new monster */ +/* make a chameleon look like a new monster */ /* returns 1 if the monster actually changed */ - struct monst *mtmp; - const struct permonst *mdat; +int +newcham(struct monst *mtmp, const struct permonst *mdat) { int mhp, hpn, hpd; @@ -996,10 +975,9 @@ newcham(mtmp, mdat) /* make a chameleon look like a new monster */ return (1); } +/* Make monster mtmp next to you (if possible) */ void -mnexto(mtmp) /* Make monster mtmp next to you (if - * possible) */ - struct monst *mtmp; +mnexto(struct monst *mtmp) { coord mm; mm = enexto(u.ux, u.uy); @@ -1009,15 +987,13 @@ mnexto(mtmp) /* Make monster mtmp next to you (if } int -ishuman(mtmp) - struct monst *mtmp; +ishuman(struct monst *mtmp) { return (mtmp->data->mlet == '@'); } void -setmangry(mtmp) - struct monst *mtmp; +setmangry(struct monst *mtmp) { if (!mtmp->mpeaceful) return; @@ -1033,8 +1009,7 @@ setmangry(mtmp) * object */ int -canseemon(mtmp) - struct monst *mtmp; +canseemon(struct monst *mtmp) { return ((!mtmp->minvis || See_invisible) && (!mtmp->mhide || !o_at(mtmp->mx, mtmp->my)) diff --git a/hack/hack.o_init.c b/hack/hack.o_init.c index 1f99752e..d556203b 100644 --- a/hack/hack.o_init.c +++ b/hack/hack.o_init.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.o_init.c,v 1.8 2009/01/18 00:34:03 lukem Exp $ */ +/* $NetBSD: hack.o_init.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.o_init.c,v 1.8 2009/01/18 00:34:03 lukem Exp $"); +__RCSID("$NetBSD: hack.o_init.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -73,8 +73,7 @@ __RCSID("$NetBSD: hack.o_init.c,v 1.8 2009/01/18 00:34:03 lukem Exp $"); #include "hack.onames.h" /* for LAST_GEM */ int -letindex(let) - char let; +letindex(int let) { int i = 0; char ch; @@ -85,7 +84,7 @@ letindex(let) } void -init_objects() +init_objects(void) { int i, j, first, last, sum, end; char let; @@ -138,8 +137,7 @@ check: } int -probtype(let) - char let; +probtype(int let) { int i = bases[letindex(let)]; int prob = rn2(100); @@ -151,7 +149,7 @@ probtype(let) } void -setgemprobs() +setgemprobs(void) { int j, first; @@ -170,14 +168,13 @@ setgemprobs() } void -oinit() +oinit(void) { /* level dependent initialization */ setgemprobs(); } void -savenames(fd) - int fd; +savenames(int fd) { int i; size_t len; @@ -197,8 +194,7 @@ savenames(fd) } void -restnames(fd) - int fd; +restnames(int fd) { int i; unsigned len; @@ -213,7 +209,7 @@ restnames(fd) } int -dodiscovered() +dodiscovered(void) { /* free after Robert Viduya */ int i, end; int ct = 0; @@ -237,8 +233,7 @@ dodiscovered() } int -interesting_to_discover(i) - int i; +interesting_to_discover(int i) { return ( objects[i].oc_uname != NULL || diff --git a/hack/hack.objnam.c b/hack/hack.objnam.c index d78eb7a9..f7857918 100644 --- a/hack/hack.objnam.c +++ b/hack/hack.objnam.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.objnam.c,v 1.7 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.objnam.c,v 1.8 2009/06/07 18:30:39 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.7 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.objnam.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -75,8 +75,7 @@ __RCSID("$NetBSD: hack.objnam.c,v 1.7 2008/01/28 06:55:42 dholland Exp $"); #define PREFIX 15 char * -strprepend(s, pref) - char *s, *pref; +strprepend(char *s, char *pref) { int i = strlen(pref); if (i > PREFIX) { @@ -89,8 +88,7 @@ strprepend(s, pref) } char * -sitoa(a) - int a; +sitoa(int a) { static char buf[13]; Sprintf(buf, (a < 0) ? "%d" : "+%d", a); @@ -98,8 +96,7 @@ sitoa(a) } char * -typename(otyp) - int otyp; +typename(int otyp) { static char buf[BUFSZ]; struct objclass *ocl = &objects[otyp]; @@ -149,8 +146,7 @@ typename(otyp) } char * -xname(obj) - struct obj *obj; +xname(struct obj *obj) { static char bufr[BUFSZ]; char *buf = &(bufr[PREFIX]); /* leave room for "17 -3 " */ @@ -314,8 +310,7 @@ nopl: } char * -doname(obj) - struct obj *obj; +doname(struct obj *obj) { char prefix[PREFIX]; char *bp = xname(obj); @@ -374,9 +369,7 @@ setan(const char *str, char *buf) } char * -aobjnam(otmp, verb) - struct obj *otmp; - const char *verb; +aobjnam(struct obj *otmp, const char *verb) { char *bp = xname(otmp); char prefix[PREFIX]; @@ -400,8 +393,7 @@ aobjnam(otmp, verb) } char * -Doname(obj) - struct obj *obj; +Doname(struct obj *obj) { char *s = doname(obj); @@ -414,8 +406,7 @@ const char *const wrp[] = {"wand", "ring", "potion", "scroll", "gem"}; const char wrpsym[] = {WAND_SYM, RING_SYM, POTION_SYM, SCROLL_SYM, GEM_SYM}; struct obj * -readobjnam(bp) - char *bp; +readobjnam(char *bp) { char *p; unsigned ii; diff --git a/hack/hack.options.c b/hack/hack.options.c index ea55cb81..b03454aa 100644 --- a/hack/hack.options.c +++ b/hack/hack.options.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.options.c,v 1.7 2004/01/01 16:02:51 jsm Exp $ */ +/* $NetBSD: hack.options.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.options.c,v 1.7 2004/01/01 16:02:51 jsm Exp $"); +__RCSID("$NetBSD: hack.options.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -72,7 +72,7 @@ __RCSID("$NetBSD: hack.options.c,v 1.7 2004/01/01 16:02:51 jsm Exp $"); #include "extern.h" void -initoptions() +initoptions(void) { char *opts; @@ -89,9 +89,7 @@ initoptions() } void -parseoptions(opts, from_env) - char *opts; - boolean from_env; +parseoptions(char *opts, boolean from_env) { char *op, *op2; unsigned num; @@ -237,7 +235,7 @@ bad: } int -doset() +doset(void) { char buf[BUFSZ]; diff --git a/hack/hack.pager.c b/hack/hack.pager.c index b52a6471..ee474a1e 100644 --- a/hack/hack.pager.c +++ b/hack/hack.pager.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pager.c,v 1.11 2007/12/15 19:44:41 perry Exp $ */ +/* $NetBSD: hack.pager.c,v 1.12 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.pager.c,v 1.11 2007/12/15 19:44:41 perry Exp $"); +__RCSID("$NetBSD: hack.pager.c,v 1.12 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -80,7 +80,7 @@ __RCSID("$NetBSD: hack.pager.c,v 1.11 2007/12/15 19:44:41 perry Exp $"); #include "extern.h" int -dowhatis() +dowhatis(void) { FILE *fp; char bufr[BUFSZ + 6]; @@ -130,18 +130,15 @@ dowhatis() static int got_intrup; void -intruph(n) - int n __unused; +intruph(int n __unused) { got_intrup++; } /* simple pager, also used from dohelp() */ +/* strip: nr of chars to be stripped from each line (0 or 1) */ void -page_more(fp, strip) - FILE *fp; - int strip; /* nr of chars to be stripped from each line - * (0 or 1) */ +page_more(FILE *fp, int strip) { char *bufr, *ep; sig_t prevsig = signal(SIGINT, intruph); @@ -171,14 +168,14 @@ static boolean whole_screen = TRUE; * map */ void -set_whole_screen() +set_whole_screen(void) { /* called in termcap as soon as LI is known */ whole_screen = (LI - ROWNO - 2 <= PAGMIN || !CD); } #ifdef NEWS int -readnews() +readnews(void) { int ret; @@ -189,9 +186,9 @@ readnews() } #endif /* NEWS */ +/* mode: 0: open 1: wait+close 2: close */ void -set_pager(mode) - int mode; /* 0: open 1: wait+close 2: close */ +set_pager(int mode) { static boolean so; if (mode == 0) { @@ -221,8 +218,7 @@ set_pager(mode) } int -page_line(s) /* returns 1 if we should quit */ - const char *s; +page_line(const char *s) /* returns 1 if we should quit */ { if (cury == LI - 1) { if (!*s) @@ -258,9 +254,7 @@ page_line(s) /* returns 1 if we should quit */ */ void -cornline(mode, text) - int mode; - const char *text; +cornline(int mode, const char *text) { static struct line { struct line *next_line; @@ -354,7 +348,7 @@ cleanup: } int -dohelp() +dohelp(void) { char c; @@ -366,11 +360,9 @@ dohelp() return (0); } +/* return: 0 - cannot open fnam; 1 - otherwise */ int -page_file(fnam, silent) /* return: 0 - cannot open fnam; 1 - - * otherwise */ - const char *fnam; - boolean silent; +page_file(const char *fnam, boolean silent) { #ifdef DEF_PAGER /* this implies that UNIX is defined */ { @@ -426,7 +418,7 @@ page_file(fnam, silent) /* return: 0 - cannot open fnam; 1 - #ifdef UNIX #ifdef SHELL int -dosh() +dosh(void) { char *str; if (child(0)) { diff --git a/hack/hack.potion.c b/hack/hack.potion.c index 9d210d49..147f0a98 100644 --- a/hack/hack.potion.c +++ b/hack/hack.potion.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.potion.c,v 1.6 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.potion.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,14 +63,14 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.potion.c,v 1.6 2003/04/02 18:36:39 jsm Exp $"); +__RCSID("$NetBSD: hack.potion.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" int -dodrink() +dodrink(void) { struct obj *otmp, *objs; struct monst *mtmp; @@ -263,7 +263,7 @@ use_it: } void -pluslvl() +pluslvl(void) { int num; @@ -279,9 +279,7 @@ pluslvl() } void -strange_feeling(obj, txt) - struct obj *obj; - const char *txt; +strange_feeling(struct obj *obj, const char *txt) { if (flags.beginner) pline("You have a strange feeling for a moment, then it passes."); @@ -297,9 +295,7 @@ const char *const bottlenames[] = { }; void -potionhit(mon, obj) - struct monst *mon; - struct obj *obj; +potionhit(struct monst *mon, struct obj *obj) { const char *botlnam = bottlenames[rn2(SIZE(bottlenames))]; boolean uclose, isyou = (mon == &youmonst); @@ -367,8 +363,7 @@ potionhit(mon, obj) } void -potionbreathe(obj) - struct obj *obj; +potionbreathe(struct obj *obj) { switch (obj->otyp) { case POT_RESTORE_STRENGTH: @@ -430,7 +425,7 @@ potionbreathe(obj) * -- become a jug? Etc. */ int -dodip() +dodip(void) { struct obj *potion, *obj; @@ -451,7 +446,7 @@ dodip() } void -ghost_from_bottle() +ghost_from_bottle(void) { struct monst *mtmp; diff --git a/hack/hack.pri.c b/hack/hack.pri.c index 70ef79d9..52c768af 100644 --- a/hack/hack.pri.c +++ b/hack/hack.pri.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pri.c,v 1.9 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.pri.c,v 1.10 2009/06/07 18:30:39 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.9 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.pri.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -72,7 +72,7 @@ xchar scrlx, scrhx, scrly, scrhy; /* corners of new area on * screen */ void -swallowed() +swallowed(void) { char ulook[] = "|@|"; ulook[1] = u.usym; @@ -120,8 +120,7 @@ panic(const char *fmt, ...) } void -atl(x, y, ch) -int x, y, ch; +atl(int x, int y, int ch) { struct rm *crm = &levl[x][y]; @@ -137,8 +136,7 @@ int x, y, ch; } void -on_scr(x, y) -int x, y; +on_scr(int x, int y) { if (x < scrlx) scrlx = x; @@ -156,8 +154,7 @@ int x, y; */ void -tmp_at(x, y) - schar x, y; +tmp_at(schar x, schar y) { static schar prevx, prevy; static char let; @@ -188,8 +185,7 @@ tmp_at(x, y) /* like the previous, but the symbols are first erased on completion */ void -Tmp_at(x, y) - schar x, y; +Tmp_at(schar x, schar y) { static char let; static xchar cnt; @@ -229,16 +225,14 @@ Tmp_at(x, y) } void -setclipped() +setclipped(void) { error("Hack needs a screen of size at least %d by %d.\n", ROWNO + 2, COLNO); } void -at(x, y, ch) - xchar x, y; - char ch; +at(xchar x, xchar y, int ch) { #ifndef lint /* if xchar is unsigned, lint will complain about if(x < 0) */ @@ -258,21 +252,21 @@ at(x, y, ch) } void -prme() +prme(void) { if (!Invisible) at(u.ux, u.uy, u.usym); } int -doredraw() +doredraw(void) { docrt(); return (0); } void -docrt() +docrt(void) { int x, y; struct rm *room; @@ -319,8 +313,7 @@ docrt() } void -docorner(xmin, ymax) - int xmin, ymax; +docorner(int xmin, int ymax) { int x, y; struct rm *room; @@ -361,13 +354,13 @@ docorner(xmin, ymax) } void -curs_on_u() +curs_on_u(void) { curs(u.ux, u.uy + 2); } void -pru() +pru(void) { if (u.udispl && (Invisible || u.udisx != u.ux || u.udisy != u.uy)) /* if(! levl[u.udisx][u.udisy].new) */ @@ -432,8 +425,7 @@ prl(int x, int y) } char -news0(x, y) - xchar x, y; +news0(xchar x, xchar y) { struct obj *otmp; struct trap *ttmp; @@ -493,8 +485,7 @@ news0(x, y) } void -newsym(x, y) - int x, y; +newsym(int x, int y) { atl(x, y, news0(x, y)); } @@ -502,8 +493,7 @@ newsym(x, y) /* used with wand of digging (or pick-axe): fill scrsym and force display */ /* also when a POOL evaporates */ void -mnewsym(x, y) - int x, y; +mnewsym(int x, int y) { struct rm *room; char newscrsym; @@ -519,8 +509,7 @@ mnewsym(x, y) } void -nosee(x, y) - int x, y; +nosee(int x, int y) { struct rm *room; @@ -536,8 +525,7 @@ nosee(x, y) #ifndef QUEST void -prl1(x, y) - int x, y; +prl1(int x, int y) { if (u.dx) { if (u.dy) { @@ -559,8 +547,7 @@ prl1(x, y) } void -nose1(x, y) - int x, y; +nose1(int x, int y) { if (u.dx) { if (u.dy) { @@ -583,8 +570,7 @@ nose1(x, y) #endif /* QUEST */ int -vism_at(x, y) - int x, y; +vism_at(int x, int y) { struct monst *mtmp; @@ -597,8 +583,7 @@ vism_at(x, y) #ifdef NEWSCR void -pobj(obj) - struct obj *obj; +pobj(struct obj *obj) { int show = (!obj->oinvis || See_invisible) && cansee(obj->ox, obj->oy); @@ -619,8 +604,7 @@ pobj(obj) #endif /* NEWSCR */ void -unpobj(obj) - struct obj *obj; +unpobj(struct obj *obj) { /* * if(obj->odispl){ if(!vism_at(obj->odx, obj->ody)) newsym(obj->odx, @@ -631,7 +615,7 @@ unpobj(obj) } void -seeobjs() +seeobjs(void) { struct obj *obj, *obj2; for (obj = fobj; obj; obj = obj2) { @@ -649,7 +633,7 @@ seeobjs() } void -seemons() +seemons(void) { struct monst *mtmp; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { @@ -665,8 +649,7 @@ seemons() } void -pmon(mon) - struct monst *mon; +pmon(struct monst *mon) { int show = (Blind && Telepat) || canseemon(mon); if (mon->mdispl) { @@ -685,8 +668,7 @@ pmon(mon) } void -unpmon(mon) - struct monst *mon; +unpmon(struct monst *mon) { if (mon->mdispl) { newsym(mon->mdx, mon->mdy); @@ -695,7 +677,7 @@ unpmon(mon) } void -nscr() +nscr(void) { int x, y; struct rm *room; @@ -717,8 +699,7 @@ nscr() /* 100 suffices for bot(); no relation with COLNO */ char oldbot[100], newbot[100]; void -cornbot(lth) - int lth; +cornbot(int lth) { if ((unsigned)lth < sizeof(oldbot)) { oldbot[lth] = 0; @@ -727,7 +708,7 @@ cornbot(lth) } void -bot() +bot(void) { char *ob = oldbot, *nb = newbot; int i; @@ -782,8 +763,7 @@ bot() #ifdef WAN_PROBING void -mstatusline(mtmp) - struct monst *mtmp; +mstatusline(struct monst *mtmp) { pline("Status of %s: ", monnam(mtmp)); pline("Level %-2d Gold %-5lu Hp %3d(%d) Ac %-2d Dam %d", @@ -793,7 +773,7 @@ mstatusline(mtmp) #endif /* WAN_PROBING */ void -cls() +cls(void) { if (flags.toplin == 1) more(); diff --git a/hack/hack.read.c b/hack/hack.read.c index f43f0b98..e224a437 100644 --- a/hack/hack.read.c +++ b/hack/hack.read.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.read.c,v 1.8 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.read.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.read.c,v 1.8 2003/04/02 18:36:39 jsm Exp $"); +__RCSID("$NetBSD: hack.read.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -71,7 +71,7 @@ __RCSID("$NetBSD: hack.read.c,v 1.8 2003/04/02 18:36:39 jsm Exp $"); #include "extern.h" int -doread() +doread(void) { struct obj *scroll; boolean confused = (Confusion != 0); @@ -528,8 +528,7 @@ doread() } int -identify(otmp) /* also called by newmail() */ - struct obj *otmp; +identify(struct obj *otmp) /* also called by newmail() */ { objects[otmp->otyp].oc_name_known = 1; otmp->known = otmp->dknown = 1; @@ -538,8 +537,7 @@ identify(otmp) /* also called by newmail() */ } void -litroom(on) - boolean on; +litroom(boolean on) { #ifndef QUEST int num, zx, zy; @@ -627,8 +625,7 @@ do_it: /* Test whether we may genocide all monsters with symbol ch */ int -monstersym(ch) /* arnold@ucsfcgl */ - char ch; +monstersym(int ch) /* arnold@ucsfcgl */ { const struct permonst *mp; diff --git a/hack/hack.rip.c b/hack/hack.rip.c index 9e2ffb79..575aa02d 100644 --- a/hack/hack.rip.c +++ b/hack/hack.rip.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.rip.c,v 1.8 2007/12/15 19:44:41 perry Exp $ */ +/* $NetBSD: hack.rip.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.rip.c,v 1.8 2007/12/15 19:44:41 perry Exp $"); +__RCSID("$NetBSD: hack.rip.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -84,7 +84,7 @@ static const char *ripbot = "\ _________)/\\\\_//(\\/(/\\)/\\//\\/|_)_______"; void -outrip() +outrip(void) { char buf[BUFSZ]; @@ -125,9 +125,7 @@ outrip() } void -center(line, text) - int line __unused; - char *text; +center(int line __unused, char *text) { int n = strlen(text) / 2; printf(ripmid, 8 + n, text, 8 - n, ""); diff --git a/hack/hack.rumors.c b/hack/hack.rumors.c index 383bba9d..0a0077c2 100644 --- a/hack/hack.rumors.c +++ b/hack/hack.rumors.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.rumors.c,v 1.5 2003/04/02 18:36:39 jsm Exp $ */ +/* $NetBSD: hack.rumors.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.rumors.c,v 1.5 2003/04/02 18:36:39 jsm Exp $"); +__RCSID("$NetBSD: hack.rumors.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" /* for RUMORFILE and BSD (strchr) */ @@ -74,8 +74,7 @@ int n_used_rumors = -1; char *usedbits; void -init_rumors(rumf) - FILE *rumf; +init_rumors(FILE *rumf) { int i; n_used_rumors = 0; @@ -89,8 +88,7 @@ init_rumors(rumf) } int -skipline(rumf) - FILE *rumf; +skipline(FILE *rumf) { char line[COLNO]; while (1) { @@ -102,8 +100,7 @@ skipline(rumf) } void -outline(rumf) - FILE *rumf; +outline(FILE *rumf) { char line[COLNO]; char *ep; @@ -116,7 +113,7 @@ outline(rumf) } void -outrumor() +outrumor(void) { int rn, i; FILE *rumf; @@ -143,8 +140,7 @@ none: } int -used(i) - int i; +used(int i) { return (usedbits[i / CHARSZ] & (1 << (i % CHARSZ))); } diff --git a/hack/hack.save.c b/hack/hack.save.c index 9a968da4..93b5794f 100644 --- a/hack/hack.save.c +++ b/hack/hack.save.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.save.c,v 1.10 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.save.c,v 1.11 2009/06/07 18:30:39 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.10 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.save.c,v 1.11 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -75,7 +75,7 @@ __RCSID("$NetBSD: hack.save.c,v 1.10 2008/01/28 06:55:42 dholland Exp $"); int -dosave() +dosave(void) { if (dosave0(0)) { settty("Be seeing you ...\n"); @@ -86,8 +86,7 @@ dosave() #ifndef NOSAVEONHANGUP void -hangup(n) - int n __unused; +hangup(int n __unused) { (void) dosave0(1); exit(1); @@ -96,8 +95,7 @@ hangup(n) /* returns 1 if save successful */ int -dosave0(hu) - int hu; +dosave0(int hu) { int fd, ofd; int tmp; /* not ! */ @@ -158,8 +156,7 @@ dosave0(hu) } int -dorecover(fd) - int fd; +dorecover(int fd) { int nfd; int tmp; /* not a ! */ @@ -243,8 +240,7 @@ monfnd: } struct obj * -restobjchn(fd) - int fd; +restobjchn(int fd) { struct obj *otmp, *otmp2 = NULL; struct obj *first = 0; @@ -271,8 +267,7 @@ restobjchn(fd) } struct monst * -restmonchn(fd) - int fd; +restmonchn(int fd) { struct monst *mtmp, *mtmp2 = NULL; struct monst *first = 0; diff --git a/hack/hack.search.c b/hack/hack.search.c index 9c00d6b4..ea4a0ec0 100644 --- a/hack/hack.search.c +++ b/hack/hack.search.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.search.c,v 1.5 2003/04/02 18:36:40 jsm Exp $ */ +/* $NetBSD: hack.search.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,14 +63,14 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.search.c,v 1.5 2003/04/02 18:36:40 jsm Exp $"); +__RCSID("$NetBSD: hack.search.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" int -findit() +findit(void) { /* returns number of things found */ int num; xchar zx, zy; @@ -116,7 +116,7 @@ findit() } int -dosearch() +dosearch(void) { xchar x, y; struct trap *trap; @@ -174,7 +174,7 @@ dosearch() } int -doidtrap() +doidtrap(void) { struct trap *trap; int x, y; @@ -195,8 +195,7 @@ doidtrap() } void -wakeup(mtmp) - struct monst *mtmp; +wakeup(struct monst *mtmp) { mtmp->msleep = 0; setmangry(mtmp); @@ -206,8 +205,7 @@ wakeup(mtmp) /* NOTE: we must check if(mtmp->mimic) before calling this routine */ void -seemimic(mtmp) - struct monst *mtmp; +seemimic(struct monst *mtmp) { mtmp->mimic = 0; mtmp->mappearance = 0; diff --git a/hack/hack.shk.c b/hack/hack.shk.c index 6f6abc45..c24ecdc4 100644 --- a/hack/hack.shk.c +++ b/hack/hack.shk.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.shk.c,v 1.8 2006/03/30 01:32:27 jnemeth Exp $ */ +/* $NetBSD: hack.shk.c,v 1.9 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.shk.c,v 1.8 2006/03/30 01:32:27 jnemeth Exp $"); +__RCSID("$NetBSD: hack.shk.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -86,73 +86,64 @@ int shlevel = 0; struct monst *shopkeeper = 0; struct obj *billobjs = 0; void -obfree(obj, merge) - struct obj *obj, *merge; +obfree(struct obj *obj, struct obj *merge) { free((char *) obj); } int -inshop() { +inshop(void) { return (0); } void -shopdig(n) - int n; +shopdig(int n) { } void -addtobill(obj) - struct obj *obj; +addtobill(struct obj *obj) { } void -subfrombill(obj) - struct obj *obj; +subfrombill(struct obj *obj) { } void -splitbill(o1, o2) - struct obj *o1, *o2; +splitbill(struct obj *o1, struct obj *o2) { } int -dopay() { +dopay(void) +{ return (0); } void -paybill() +paybill(void) { } int -doinvbill(n) - int n; +doinvbill(int n) { return (0); } void -shkdead(m) - struct monst *m; +shkdead(struct monst *m) { } int -shkcatch(obj) - struct obj *obj; +shkcatch(struct obj *obj) { return (0); } int -shk_move(m) - struct monst *m; +shk_move(struct monst *m) { return (0); } void -replshk(mtmp, mtmp2) - struct monst *mtmp, *mtmp2; +replshk(struct monst *mtmp, struct monst *mtmp2) { } -char *shkname(m) - struct monst *m; +char * +shkname(struct monst *m) { return (""); } @@ -196,15 +187,13 @@ static const char *const shopnam[] = { }; char * -shkname(mtmp) /* called in do_name.c */ - struct monst *mtmp; +shkname(struct monst *mtmp) /* called in do_name.c */ { return (ESHK(mtmp)->shknam); } void -shkdead(mtmp) /* called in mon.c */ - struct monst *mtmp; +shkdead(struct monst *mtmp) /* called in mon.c */ { struct eshk *eshk = ESHK(mtmp); @@ -219,8 +208,7 @@ shkdead(mtmp) /* called in mon.c */ } void -replshk(mtmp, mtmp2) - struct monst *mtmp, *mtmp2; +replshk(struct monst *mtmp, struct monst *mtmp2) { if (mtmp == shopkeeper) { shopkeeper = mtmp2; @@ -229,7 +217,7 @@ replshk(mtmp, mtmp2) } static void -setpaid() +setpaid(void) { /* caller has checked that shopkeeper exists */ /* either we paid or left the shop or he just died */ struct obj *obj; @@ -254,7 +242,7 @@ setpaid() } static void -addupbill() +addupbill(void) { /* delivers result in total */ /* caller has checked that shopkeeper exists */ int ct = ESHK(shopkeeper)->billct; @@ -267,7 +255,7 @@ addupbill() } int -inshop() +inshop(void) { int roomno = inroom(u.ux, u.uy); @@ -360,8 +348,7 @@ inshop() } static void -findshk(roomno) - int roomno; +findshk(int roomno) { struct monst *mtmp; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) @@ -389,8 +376,7 @@ findshk(roomno) } static struct bill_x * -onbill(obj) - struct obj *obj; +onbill(struct obj *obj) { struct bill_x *bp; if (!shopkeeper) @@ -408,8 +394,7 @@ onbill(obj) /* called with two args on merge */ void -obfree(obj, merge) - struct obj *obj, *merge; +obfree(struct obj *obj, struct obj *merge) { struct bill_x *bp = onbill(obj); struct bill_x *bpm; @@ -437,9 +422,7 @@ obfree(obj, merge) } static void -pay(tmp, shkp) - long tmp; - struct monst *shkp; +pay(long tmp, struct monst *shkp) { long robbed = ESHK(shkp)->robbed; @@ -455,7 +438,7 @@ pay(tmp, shkp) } int -dopay() +dopay(void) { long ltmp; struct bill_x *bp; @@ -577,8 +560,7 @@ dopay() /* 0 if not enough money */ /* -1 if object could not be found (but was paid) */ static int -dopayobj(bp) - struct bill_x *bp; +dopayobj(struct bill_x *bp) { struct obj *obj; long ltmp; @@ -627,7 +609,7 @@ dopayobj(bp) /* routine called after dying (or quitting) with nonempty bill */ void -paybill() +paybill(void) { if (shlevel == dlevel && shopkeeper && ESHK(shopkeeper)->billct) { addupbill(); @@ -648,8 +630,7 @@ paybill() /* find obj on one of the lists */ struct obj * -bp_to_obj(bp) - struct bill_x *bp; +bp_to_obj(struct bill_x *bp) { struct obj *obj; struct monst *mtmp; @@ -672,8 +653,7 @@ bp_to_obj(bp) /* called in hack.c when we pickup an object */ void -addtobill(obj) - struct obj *obj; +addtobill(struct obj *obj) { struct bill_x *bp; if (!inshop() || @@ -696,8 +676,7 @@ addtobill(obj) } void -splitbill(obj, otmp) - struct obj *obj, *otmp; +splitbill(struct obj *obj, struct obj *otmp) { /* otmp has been split off from obj */ struct bill_x *bp; @@ -730,8 +709,7 @@ splitbill(obj, otmp) } void -subfrombill(obj) - struct obj *obj; +subfrombill(struct obj *obj) { long ltmp; int tmp; @@ -796,9 +774,9 @@ subfrombill(obj) plur(ltmp)); } +/* mode: 0: deliver count 1: paged */ int -doinvbill(mode) - int mode; /* 0: deliver count 1: paged */ +doinvbill(int mode) { struct bill_x *bp; struct obj *obj; @@ -859,8 +837,7 @@ quit: } static int -getprice(obj) - struct obj *obj; +getprice(struct obj *obj) { int tmp, ac; @@ -920,7 +897,7 @@ getprice(obj) } static int -realhunger() +realhunger(void) { /* not completely foolproof */ int tmp = u.uhunger; struct obj *otmp = invent; @@ -933,8 +910,7 @@ realhunger() } int -shkcatch(obj) - struct obj *obj; +shkcatch(struct obj *obj) { struct monst *shkp = shopkeeper; @@ -955,8 +931,7 @@ shkcatch(obj) * shk_move: return 1: he moved 0: he didnt -1: let m_move do it */ int -shk_move(shkp) - struct monst *shkp; +shk_move(struct monst *shkp) { struct monst *mtmp; const struct permonst *mdat = shkp->data; @@ -1159,8 +1134,7 @@ online(int x, int y) /* Does this monster follow me downstairs? */ int -follower(mtmp) - struct monst *mtmp; +follower(struct monst *mtmp) { return (mtmp->mtame || strchr("1TVWZi&, ", mtmp->data->mlet) #ifndef QUEST diff --git a/hack/hack.steal.c b/hack/hack.steal.c index 3991205e..0164609a 100644 --- a/hack/hack.steal.c +++ b/hack/hack.steal.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.steal.c,v 1.5 2003/04/02 18:36:40 jsm Exp $ */ +/* $NetBSD: hack.steal.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,24 +63,25 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.steal.c,v 1.5 2003/04/02 18:36:40 jsm Exp $"); +__RCSID("$NetBSD: hack.steal.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include #include "hack.h" #include "extern.h" -long /* actually returns something that fits in an - * int */ -somegold() +/* + * actually returns something that fits in an int + */ +long +somegold(void) { return ((u.ugold < 100) ? u.ugold : (u.ugold > 10000) ? rnd(10000) : rnd((int) u.ugold)); } void -stealgold(mtmp) - struct monst *mtmp; +stealgold(struct monst *mtmp) { struct gold *gold = g_at(u.ux, u.uy); long tmp; @@ -109,7 +110,7 @@ stealgold(mtmp) unsigned stealoid; /* object to be stolen */ unsigned stealmid; /* monster doing the stealing */ int -stealarm() +stealarm(void) { struct monst *mtmp; struct obj *otmp; @@ -137,8 +138,7 @@ stealarm() /* (or at least, when N should flee now) */ /* avoid stealing the object stealoid */ int -steal(mtmp) - struct monst *mtmp; +steal(struct monst *mtmp) { struct obj *otmp; int tmp; @@ -226,17 +226,14 @@ steal(mtmp) } void -mpickobj(mtmp, otmp) - struct monst *mtmp; - struct obj *otmp; +mpickobj(struct monst *mtmp, struct obj *otmp) { otmp->nobj = mtmp->minvent; mtmp->minvent = otmp; } int -stealamulet(mtmp) - struct monst *mtmp; +stealamulet(struct monst *mtmp) { struct obj *otmp; @@ -256,9 +253,7 @@ stealamulet(mtmp) /* release the objects the killed animal has stolen */ void -relobj(mtmp, show) - struct monst *mtmp; - int show; +relobj(struct monst *mtmp, int show) { struct obj *otmp, *otmp2; diff --git a/hack/hack.termcap.c b/hack/hack.termcap.c index 11d8d9e4..5d847dce 100644 --- a/hack/hack.termcap.c +++ b/hack/hack.termcap.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.termcap.c,v 1.16 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.termcap.c,v 1.17 2009/06/07 18:30:39 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.16 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.termcap.c,v 1.17 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -83,7 +83,7 @@ char *CD; /* tested in pri.c: docorner() */ int CO, LI; /* used in pri.c and whatis.c */ void -startup() +startup(void) { char *term; @@ -135,24 +135,27 @@ startup() } void -start_screen() +start_screen(void) { xputs(TI); xputs(VS); } void -end_screen() +end_screen(void) { xputs(VE); xputs(TE); } -/* Cursor movements */ +/* + * Cursor movements + * + * x,y not xchar: perhaps xchar is unsigned and + * curx-x would be unsigned as well + */ void -curs(x, y) - int x, y; /* not xchar: perhaps xchar is unsigned and - * curx-x would be unsigned as well */ +curs(int x, int y) { if (y == cury && x == curx) @@ -174,8 +177,7 @@ curs(x, y) } void -nocmov(x, y) - int x, y; +nocmov(int x, int y) { if (cury > y) { if (UP) { @@ -223,8 +225,7 @@ nocmov(x, y) } void -cmov(x, y) - int x, y; +cmov(int x, int y) { char buf[256]; @@ -268,14 +269,14 @@ cl_end(void) } void -clear_screen() +clear_screen(void) { xputs(CL); curx = cury = 1; } void -home() +home(void) { char buf[256]; @@ -289,35 +290,35 @@ home() } void -standoutbeg() +standoutbeg(void) { if (SO) xputs(SO); } void -standoutend() +standoutend(void) { if (SE) xputs(SE); } void -backsp() +backsp(void) { xputs(BC_BS); curx--; } void -bell() +bell(void) { (void) putchar('\007'); /* curx does not change */ (void) fflush(stdout); } void -delay_output() +delay_output(void) { /* delay 50 ms - could also use a 'nap'-system call */ @@ -326,7 +327,7 @@ delay_output() } void -cl_eos() +cl_eos(void) { /* free after Robert Viduya *//* must only be * called with curx = 1 */ diff --git a/hack/hack.timeout.c b/hack/hack.timeout.c index ef239e48..49632f4f 100644 --- a/hack/hack.timeout.c +++ b/hack/hack.timeout.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.timeout.c,v 1.6 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.timeout.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,14 +63,14 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.timeout.c,v 1.6 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.timeout.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" void -timeout() +timeout(void) { struct prop *upp; if (Stoned) @@ -121,7 +121,7 @@ const char *const stoned_texts[] = { }; void -stoned_dialogue() +stoned_dialogue(void) { long i = (Stoned & TIMEOUT); diff --git a/hack/hack.topl.c b/hack/hack.topl.c index e4f2fb9c..a9550c8f 100644 --- a/hack/hack.topl.c +++ b/hack/hack.topl.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.topl.c,v 1.8 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.topl.c,v 1.9 2009/06/07 18:30:39 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.8 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.topl.c,v 1.9 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -80,7 +80,7 @@ struct topl { #define OTLMAX 20 /* max nr of old toplines remembered */ int -doredotopl() +doredotopl(void) { if (last_redone_topl) last_redone_topl = last_redone_topl->next_topl; @@ -94,7 +94,7 @@ doredotopl() } void -redotoplin() +redotoplin(void) { home(); if (strchr(toplines, '\n')) @@ -109,7 +109,7 @@ redotoplin() } void -remember_topl() +remember_topl(void) { struct topl *tl; int cnt = OTLMAX; @@ -137,8 +137,7 @@ remember_topl() } void -addtopl(s) - const char *s; +addtopl(const char *s) { curs(tlx, tly); if (tlx + (int)strlen(s) > CO) @@ -149,9 +148,9 @@ addtopl(s) flags.toplin = 1; } +/* s = allowed chars besides space/return */ void -xmore(s) - const char *s; /* allowed chars besides space/return */ +xmore(const char *s) { if (flags.toplin) { curs(tlx, tly); @@ -174,20 +173,19 @@ xmore(s) } void -more() +more(void) { xmore(""); } void -cmore(s) - const char *s; +cmore(const char *s) { xmore(s); } void -clrlin() +clrlin(void) { if (flags.toplin) { home(); @@ -210,9 +208,7 @@ pline(const char *fmt, ...) } void -vpline(line, ap) - const char *line; - va_list ap; +vpline(const char *line, va_list ap) { char pbuf[BUFSZ]; char *bp = pbuf, *tl; @@ -275,9 +271,10 @@ vpline(line, ap) } void -putsym(c) - char c; +putsym(int c1) { + char c = c1; /* XXX this hack prevents .o diffs -- remove later */ + switch (c) { case '\b': backsp(); @@ -298,8 +295,7 @@ putsym(c) } void -putstr(s) - const char *s; +putstr(const char *s) { while (*s) putsym(*s++); diff --git a/hack/hack.track.c b/hack/hack.track.c index 844bab5a..2621b4cd 100644 --- a/hack/hack.track.c +++ b/hack/hack.track.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.track.c,v 1.6 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.track.c,v 1.7 2009/06/07 18:30:39 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.6 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.track.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -76,14 +76,14 @@ int utcnt = 0; int utpnt = 0; void -initrack() +initrack(void) { utcnt = utpnt = 0; } /* add to track */ void -settrack() +settrack(void) { if (utcnt < UTSZ) utcnt++; @@ -95,8 +95,7 @@ settrack() } coord * -gettrack(x, y) - int x, y; +gettrack(int x, int y) { int i, cnt, distsq; coord tc; diff --git a/hack/hack.trap.c b/hack/hack.trap.c index 9d7a8058..da058edf 100644 --- a/hack/hack.trap.c +++ b/hack/hack.trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.trap.c,v 1.7 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.trap.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.trap.c,v 1.7 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.trap.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -86,8 +86,7 @@ const char *const traps[] = { }; struct trap * -maketrap(x, y, typ) - int x, y, typ; +maketrap(int x, int y, int typ) { struct trap *ttmp; @@ -103,8 +102,7 @@ maketrap(x, y, typ) } void -dotrap(trap) - struct trap *trap; +dotrap(struct trap *trap) { int ttype = trap->ttyp; @@ -206,8 +204,7 @@ dotrap(trap) } int -mintrap(mtmp) - struct monst *mtmp; +mintrap(struct monst *mtmp) { struct trap *trap = t_at(mtmp->mx, mtmp->my); int wasintrap = mtmp->mtrapped; @@ -299,8 +296,7 @@ mintrap(mtmp) } void -selftouch(arg) - const char *arg; +selftouch(const char *arg) { if (uwep && uwep->otyp == DEAD_COCKATRICE) { pline("%s touch the dead cockatrice.", arg); @@ -311,7 +307,7 @@ selftouch(arg) } void -float_up() +float_up(void) { if (u.utrap) { if (u.utraptype == TT_PIT) { @@ -325,7 +321,7 @@ float_up() } void -float_down() +float_down(void) { struct trap *trap; pline("You float gently to the ground."); @@ -344,7 +340,7 @@ float_down() } void -vtele() +vtele(void) { struct mkroom *croom; for (croom = &rooms[0]; croom->hx >= 0; croom++) @@ -362,7 +358,7 @@ vtele() } void -tele() +tele(void) { coord cc; int nux, nuy; @@ -388,8 +384,7 @@ tele() } void -teleds(nux, nuy) - int nux, nuy; +teleds(int nux, int nuy) { if (Punished) unplacebc(); @@ -415,8 +410,7 @@ teleds(nux, nuy) } int -teleok(x, y) - int x, y; +teleok(int x, int y) { /* might throw him into a POOL */ return (isok(x, y) && !IS_ROCK(levl[x][y].typ) && !m_at(x, y) && !sobj_at(ENORMOUS_ROCK, x, y) && !t_at(x, y) @@ -425,7 +419,7 @@ teleok(x, y) } int -dotele() +dotele(void) { if ( #ifdef WIZARD @@ -446,8 +440,7 @@ dotele() } void -placebc(attach) - int attach; +placebc(int attach) { if (!uchain || !uball) { impossible("Where are your chain and ball??"); @@ -466,7 +459,7 @@ placebc(attach) } void -unplacebc() +unplacebc(void) { if (!carried(uball)) { freeobj(uball); @@ -477,7 +470,7 @@ unplacebc() } void -level_tele() +level_tele(void) { int newlevel; if (Teleport_control) { @@ -529,7 +522,7 @@ level_tele() } void -drown() +drown(void) { pline("You fall into a pool!"); pline("You can't swim!"); diff --git a/hack/hack.tty.c b/hack/hack.tty.c index 642225bb..b6027f1d 100644 --- a/hack/hack.tty.c +++ b/hack/hack.tty.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.tty.c,v 1.12 2003/08/07 09:37:19 agc Exp $ */ +/* $NetBSD: hack.tty.c,v 1.13 2009/06/07 18:30:39 dholland Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)hack.tty.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: hack.tty.c,v 1.12 2003/08/07 09:37:19 agc Exp $"); +__RCSID("$NetBSD: hack.tty.c,v 1.13 2009/06/07 18:30:39 dholland Exp $"); #endif #endif /* not lint */ @@ -128,7 +128,7 @@ struct termios inittyb, curttyb; * Called by startup() in termcap.c and after returning from ! or ^Z */ void -gettty() +gettty(void) { if (tcgetattr(0, &inittyb) < 0) perror("Hack (gettty)"); @@ -148,8 +148,7 @@ gettty() /* reset terminal to original state */ void -settty(s) - const char *s; +settty(const char *s) { clear_screen(); end_screen(); @@ -164,7 +163,7 @@ settty(s) } void -setctty() +setctty(void) { if (tcsetattr(0, TCSADRAIN, &curttyb) < 0) perror("Hack (setctty)"); @@ -172,7 +171,7 @@ setctty() void -setftty() +setftty(void) { int change = 0; flags.cbreak = ON; @@ -219,8 +218,7 @@ error(const char *fmt, ...) * resulting string is "\033". */ void -getlin(bufp) - char *bufp; +getlin(char *bufp) { char *obufp = bufp; int c; @@ -268,14 +266,13 @@ getlin(bufp) } void -getret() +getret(void) { cgetret(""); } void -cgetret(s) - const char *s; +cgetret(const char *s) { putsym('\n'); if (flags.standout) @@ -290,9 +287,9 @@ cgetret(s) char morc; /* tell the outside world what char he used */ +/* s = chars allowed besides space or return */ void -xwaitforspace(s) - const char *s; /* chars allowed besides space or return */ +xwaitforspace(const char *s) { int c; @@ -312,7 +309,7 @@ xwaitforspace(s) } char * -parse() +parse(void) { static char inputline[COLNO]; int foo; @@ -348,7 +345,7 @@ parse() } char -readchar() +readchar(void) { int sym; @@ -379,7 +376,7 @@ noteof: ; } void -end_of_input() +end_of_input(void) { settty("End of input?\n"); clearlocks(); diff --git a/hack/hack.u_init.c b/hack/hack.u_init.c index de2fbfb0..28d3fc40 100644 --- a/hack/hack.u_init.c +++ b/hack/hack.u_init.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.u_init.c,v 1.9 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.u_init.c,v 1.10 2009/06/07 18:30:39 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.9 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.u_init.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -158,7 +158,7 @@ struct trobj Wizard[] = { }; void -u_init() +u_init(void) { int i; char exper = 'y', pc; @@ -326,8 +326,7 @@ got_suffix: } void -ini_inv(trop) - struct trobj *trop; +ini_inv(struct trobj *trop) { struct obj *obj; while (trop->trolet) { @@ -389,7 +388,7 @@ ini_inv(trop) #ifdef WIZARD void -wiz_inv() +wiz_inv(void) { struct trobj *trop = &Extra_objs[0]; char *ep = getenv("INVENT"); @@ -420,7 +419,7 @@ wiz_inv() #endif /* WIZARD */ void -plnamesuffix() +plnamesuffix(void) { char *p; if ((p = strrchr(plname, '-')) != NULL) { @@ -435,8 +434,7 @@ plnamesuffix() } int -role_index(pc) - char pc; +role_index(int pc) { /* must be called only from u_init() */ /* so that rolesyms[] is defined */ char *cp; diff --git a/hack/hack.unix.c b/hack/hack.unix.c index 6c8ca7e6..23425ef5 100644 --- a/hack/hack.unix.c +++ b/hack/hack.unix.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.unix.c,v 1.10 2009/05/06 02:59:12 ginsbach Exp $ */ +/* $NetBSD: hack.unix.c,v 1.11 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.unix.c,v 1.10 2009/05/06 02:59:12 ginsbach Exp $"); +__RCSID("$NetBSD: hack.unix.c,v 1.11 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ /* This file collects some Unix dependencies; hack.pager.c contains some more */ @@ -97,13 +97,13 @@ extern int locknum; void -setrandom() +setrandom(void) { (void) srandom((int) time((time_t *) 0)); } struct tm * -getlt() +getlt(void) { time_t date; @@ -112,13 +112,13 @@ getlt() } int -getyear() +getyear(void) { return (1900 + getlt()->tm_year); } char * -getdatestr() +getdatestr(void) { static char datestr[7]; struct tm *lt = getlt(); @@ -129,7 +129,7 @@ getdatestr() } int -phase_of_the_moon() +phase_of_the_moon(void) { /* 0-7, with 0: new, 4: full *//* moon * period: 29.5306 days */ /* year: 365.2422 days */ @@ -146,7 +146,7 @@ phase_of_the_moon() } int -night() +night(void) { int hour = getlt()->tm_hour; @@ -154,7 +154,7 @@ night() } int -midnight() +midnight(void) { return (getlt()->tm_hour == 0); } @@ -162,8 +162,7 @@ midnight() struct stat buf, hbuf; void -gethdate(name) - char *name; +gethdate(char *name) { #if 0 /* old version - for people short of space */ @@ -226,8 +225,7 @@ uptodate(int fd) /* see whether we should throw away this xlock file */ int -veryold(fd) - int fd; +veryold(int fd) { int i; time_t date; @@ -266,7 +264,7 @@ veryold(fd) } void -getlock() +getlock(void) { int i = 0, fd; @@ -374,7 +372,7 @@ static char *mailbox; static long laststattime; void -getmailstatus() +getmailstatus(void) { if (!(mailbox = getenv("MAIL"))) return; @@ -389,7 +387,7 @@ getmailstatus() } void -ckmailstatus() +ckmailstatus(void) { if (!mailbox #ifdef MAILCKFREQ @@ -413,7 +411,7 @@ ckmailstatus() } void -newmail() +newmail(void) { /* produce a scroll of mail */ struct obj *obj; @@ -439,9 +437,7 @@ newmail() /* make md run through the cave */ void -mdrush(md, away) - struct monst *md; - boolean away; +mdrush(struct monst *md, boolean away) { int uroom = inroom(u.ux, u.uy); if (uroom >= 0) { @@ -499,7 +495,7 @@ mdrush(md, away) } void -readmail() +readmail(void) { #ifdef DEF_MAILREADER /* This implies that UNIX is defined */ char *mr = 0; @@ -521,10 +517,11 @@ readmail() } #endif /* MAIL */ +/* + * normalize file name - we don't like ..'s or /'s + */ void -regularize(s) /* normalize file name - we don't like ..'s - * or /'s */ - char *s; +regularize(char *s) { char *lp; diff --git a/hack/hack.vault.c b/hack/hack.vault.c index f312bf10..482b0207 100644 --- a/hack/hack.vault.c +++ b/hack/hack.vault.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.vault.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: hack.vault.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,31 +63,35 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.vault.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); +__RCSID("$NetBSD: hack.vault.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" #ifdef QUEST void -setgd( /* mtmp */ ) -{ /* struct monst *mtmp; */ +setgd(void) +{ } + int -gd_move() { +gd_move(void) +{ return (2); } + void -gddead() +gddead(void) { } + void -replgd(mtmp, mtmp2) - struct monst *mtmp, *mtmp2; +replgd(struct monst *mtmp __unused, struct monst *mtmp2 __unused) { } + void -invault() +invault(void) { } @@ -118,7 +122,7 @@ static void restfakecorr(void); static int goldincorridor(void); static void -restfakecorr() +restfakecorr(void) { int fcx, fcy, fcbeg; struct rm *crm; @@ -142,7 +146,7 @@ restfakecorr() } static int -goldincorridor() +goldincorridor(void) { int fci; @@ -153,7 +157,7 @@ goldincorridor() } void -setgd() +setgd(void) { struct monst *mtmp; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) @@ -166,7 +170,7 @@ setgd() } void -invault() +invault(void) { int tmp = inroom(u.ux, u.uy); if (tmp < 0 || rooms[tmp].rtype != VAULT) { @@ -257,7 +261,7 @@ fnd: } int -gd_move() +gd_move(void) { int x, y, dx, dy, gx, gy, nx, ny, typ; struct fakecorridor *fcp; @@ -361,14 +365,13 @@ newpos: } void -gddead() +gddead(void) { guard = 0; } void -replgd(mtmp, mtmp2) - struct monst *mtmp, *mtmp2; +replgd(struct monst *mtmp, struct monst *mtmp2) { if (mtmp == guard) guard = mtmp2; diff --git a/hack/hack.version.c b/hack/hack.version.c index b50c4014..857580bd 100644 --- a/hack/hack.version.c +++ b/hack/hack.version.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.version.c,v 1.5 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.version.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.version.c,v 1.5 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.version.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "date.h" @@ -71,7 +71,7 @@ __RCSID("$NetBSD: hack.version.c,v 1.5 2003/04/02 18:36:41 jsm Exp $"); #include "extern.h" int -doversion() +doversion(void) { pline("%s 1.0.3 - last edit %s.", ( #ifdef QUEST diff --git a/hack/hack.wield.c b/hack/hack.wield.c index 37ebcb03..7dd1e161 100644 --- a/hack/hack.wield.c +++ b/hack/hack.wield.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.wield.c,v 1.6 2003/04/02 18:36:41 jsm Exp $ */ +/* $NetBSD: hack.wield.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,21 +63,20 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.wield.c,v 1.6 2003/04/02 18:36:41 jsm Exp $"); +__RCSID("$NetBSD: hack.wield.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" #include "extern.h" void -setuwep(obj) - struct obj *obj; +setuwep(struct obj *obj) { setworn(obj, W_WEP); } int -dowield() +dowield(void) { struct obj *wep; int res = 0; @@ -116,7 +115,7 @@ dowield() } void -corrode_weapon() +corrode_weapon(void) { if (!uwep || uwep->olet != WEAPON_SYM) return; /* %% */ @@ -129,9 +128,7 @@ corrode_weapon() } int -chwepon(otmp, amount) - struct obj *otmp; - int amount; +chwepon(struct obj *otmp, int amount) { const char *color = (amount < 0) ? "black" : "green"; const char *time; diff --git a/hack/hack.wizard.c b/hack/hack.wizard.c index 8e268aaa..f1b5b031 100644 --- a/hack/hack.wizard.c +++ b/hack/hack.wizard.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.wizard.c,v 1.7 2008/01/28 06:55:42 dholland Exp $ */ +/* $NetBSD: hack.wizard.c,v 1.8 2009/06/07 18:30:39 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.7 2008/01/28 06:55:42 dholland Exp $"); +__RCSID("$NetBSD: hack.wizard.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ /* wizard code - inspired by rogue code from Merlyn Leroy (digi-g!brian) */ @@ -80,7 +80,7 @@ const char wizapp[] = "@DNPTUVXcemntx"; /* If he has found the Amulet, make the wizard appear after some time */ void -amulet() +amulet(void) { struct obj *otmp; struct monst *mtmp; @@ -102,8 +102,7 @@ amulet() } int -wiz_hit(mtmp) - struct monst *mtmp; +wiz_hit(struct monst *mtmp) { /* if we have stolen or found the amulet, we disappear */ if (mtmp->minvent && mtmp->minvent->olet == AMULET_SYM && @@ -150,8 +149,7 @@ hithim: } void -inrange(mtmp) - struct monst *mtmp; +inrange(struct monst *mtmp) { schar tx, ty; @@ -255,7 +253,7 @@ inrange(mtmp) } void -aggravate() +aggravate(void) { struct monst *mtmp; @@ -267,8 +265,7 @@ aggravate() } void -clonewiz(mtmp) - struct monst *mtmp; +clonewiz(struct monst *mtmp) { struct monst *mtmp2; diff --git a/hack/hack.worm.c b/hack/hack.worm.c index 8da7e78b..287af018 100644 --- a/hack/hack.worm.c +++ b/hack/hack.worm.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.worm.c,v 1.6 2006/05/13 22:43:02 christos Exp $ */ +/* $NetBSD: hack.worm.c,v 1.7 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.worm.c,v 1.6 2006/05/13 22:43:02 christos Exp $"); +__RCSID("$NetBSD: hack.worm.c,v 1.7 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -77,8 +77,7 @@ struct wseg *wheads[32]; long wgrowtime[32]; int -getwn(mtmp) - struct monst *mtmp; +getwn(struct monst *mtmp) { int tmp; for (tmp = 1; tmp < 32; tmp++) @@ -91,8 +90,7 @@ getwn(mtmp) /* called to initialize a worm unless cut in half */ void -initworm(mtmp) - struct monst *mtmp; +initworm(struct monst *mtmp) { struct wseg *wtmp; int tmp = mtmp->wormno; @@ -107,8 +105,7 @@ initworm(mtmp) } void -worm_move(mtmp) - struct monst *mtmp; +worm_move(struct monst *mtmp) { struct wseg *wtmp, *whd = NULL; int tmp = mtmp->wormno; @@ -140,8 +137,7 @@ worm_move(mtmp) } void -worm_nomove(mtmp) - struct monst *mtmp; +worm_nomove(struct monst *mtmp) { int tmp; struct wseg *wtmp; @@ -157,8 +153,7 @@ worm_nomove(mtmp) } void -wormdead(mtmp) - struct monst *mtmp; +wormdead(struct monst *mtmp) { int tmp = mtmp->wormno; struct wseg *wtmp, *wtmp2; @@ -173,8 +168,7 @@ wormdead(mtmp) } void -wormhit(mtmp) - struct monst *mtmp; +wormhit(struct monst *mtmp) { int tmp = mtmp->wormno; struct wseg *wtmp; @@ -185,8 +179,7 @@ wormhit(mtmp) } void -wormsee(tmp) - unsigned tmp; +wormsee(unsigned tmp) { struct wseg *wtmp = wsegs[tmp]; if (!wtmp) @@ -199,8 +192,7 @@ wormsee(tmp) } void -pwseg(wtmp) - struct wseg *wtmp; +pwseg(struct wseg *wtmp) { if (!wtmp->wdispl) { atl(wtmp->wx, wtmp->wy, '~'); @@ -208,11 +200,9 @@ pwseg(wtmp) } } +/* weptyp is uwep->otyp or 0 */ void -cutworm(mtmp, x, y, weptyp) - struct monst *mtmp; - xchar x, y; - uchar weptyp; /* uwep->otyp or 0 */ +cutworm(struct monst *mtmp, xchar x, xchar y, uchar weptyp) { struct wseg *wtmp, *wtmp2; struct monst *mtmp2; @@ -283,8 +273,7 @@ cutworm(mtmp, x, y, weptyp) } void -remseg(wtmp) - struct wseg *wtmp; +remseg(struct wseg *wtmp) { if (wtmp->wdispl) newsym(wtmp->wx, wtmp->wy); diff --git a/hack/hack.worn.c b/hack/hack.worn.c index 953949ab..d0ca0f3b 100644 --- a/hack/hack.worn.c +++ b/hack/hack.worn.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.worn.c,v 1.5 2003/04/02 18:36:42 jsm Exp $ */ +/* $NetBSD: hack.worn.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.worn.c,v 1.5 2003/04/02 18:36:42 jsm Exp $"); +__RCSID("$NetBSD: hack.worn.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -109,9 +109,7 @@ struct worn { }; void -setworn(obj, mask) - struct obj *obj; - long mask; +setworn(struct obj *obj, long mask) { struct worn *wp; struct obj *oobj; @@ -142,8 +140,7 @@ setworn(obj, mask) /* called e.g. when obj is destroyed */ void -setnotworn(obj) - struct obj *obj; +setnotworn(struct obj *obj) { struct worn *wp; diff --git a/hack/hack.zap.c b/hack/hack.zap.c index e974d2b1..cfec5768 100644 --- a/hack/hack.zap.c +++ b/hack/hack.zap.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.zap.c,v 1.7 2004/01/27 20:30:29 jsm Exp $ */ +/* $NetBSD: hack.zap.c,v 1.8 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.zap.c,v 1.7 2004/01/27 20:30:29 jsm Exp $"); +__RCSID("$NetBSD: hack.zap.c,v 1.8 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include "hack.h" @@ -80,9 +80,7 @@ const char *const fl[] = { /* Routines for IMMEDIATE wands. */ /* bhitm: monster mtmp was hit by the effect of wand otmp */ void -bhitm(mtmp, otmp) - struct monst *mtmp; - struct obj *otmp; +bhitm(struct monst *mtmp, struct obj *otmp) { wakeup(mtmp); switch (otmp->otyp) { @@ -134,10 +132,12 @@ bhitm(mtmp, otmp) } } +/* + * object obj was hit by the effect of wand otmp + * returns TRUE if sth was done + */ int -bhito(obj, otmp) /* object obj was hit by the effect of wand - * otmp */ - struct obj *obj, *otmp; /* returns TRUE if sth was done */ +bhito(struct obj *obj, struct obj *otmp) { int res = TRUE; @@ -190,7 +190,7 @@ bhito(obj, otmp) /* object obj was hit by the effect of wand } int -dozap() +dozap(void) { struct obj *obj; xchar zx, zy; @@ -337,8 +337,7 @@ dozap() } const char * -exclam(force) - int force; +exclam(int force) { /* force == 0 occurs e.g. with sleep ray */ /* @@ -349,11 +348,10 @@ exclam(force) } void -hit(str, mtmp, force) - const char *str; - struct monst *mtmp; - const char *force; /* usually either "." or "!" */ +hit(const char *str, struct monst *mtmp, const char *force) { + /* force is usually either "." or "!" */ + if (!cansee(mtmp->mx, mtmp->my)) pline("The %s hits it.", str); else @@ -361,9 +359,7 @@ hit(str, mtmp, force) } void -miss(str, mtmp) - const char *str; - struct monst *mtmp; +miss(const char *str, struct monst *mtmp) { if (!cansee(mtmp->mx, mtmp->my)) pline("The %s misses it.", str); @@ -382,13 +378,12 @@ miss(str, mtmp) /* check !u.uswallow before calling bhit() */ struct monst * -bhit(ddx, ddy, range, sym, fhitm, fhito, obj) - int ddx, ddy, range; /* direction and range */ - char sym; /* symbol displayed on path */ - /* fns called when mon/obj hit */ - void (*fhitm)(struct monst *, struct obj *); - int (*fhito)(struct obj *, struct obj *); - struct obj *obj; /* 2nd arg to fhitm/fhito */ +bhit(int ddx, int ddy, int range, /* direction and range */ + int sym, /* symbol displayed on path */ + /* fns called when mon/obj hit */ + void (*fhitm)(struct monst *, struct obj *), + int (*fhito)(struct obj *, struct obj *), + struct obj *obj) /* 2nd arg to fhitm/fhito */ { struct monst *mtmp; struct obj *otmp; @@ -481,8 +476,7 @@ boomhit(int dx, int dy) } char -dirlet(dx, dy) - int dx, dy; +dirlet(int dx, int dy) { return (dx == dy) ? '\\' : (dx && dy) ? '/' : dx ? '-' : '|'; @@ -492,10 +486,7 @@ dirlet(dx, dy) /* type == -1,-2,-3: bolts sent out by wizard */ /* called with dx = dy = 0 with vertical bolts */ void -buzz(type, sx, sy, dx, dy) - int type; - xchar sx, sy; - int dx, dy; +buzz(int type, xchar sx, xchar sy, int dx, int dy) { int abstype = abs(type); const char *fltxt = (type == -1) ? "blaze of fire" : fl[abstype]; @@ -648,9 +639,7 @@ buzz(type, sx, sy, dx, dy) } int -zhit(mon, type) /* returns damage to mon */ - struct monst *mon; - int type; +zhit(struct monst *mon, int type) /* returns damage to mon */ { int tmp = 0; @@ -690,8 +679,7 @@ zhit(mon, type) /* returns damage to mon */ ? 'a' + (otyp - DEAD_ACID_BLOB)\ : '@' + (otyp - DEAD_HUMAN)) int -revive(obj) - struct obj *obj; +revive(struct obj *obj) { struct monst *mtmp = NULL; @@ -708,8 +696,7 @@ revive(obj) } void -rloco(obj) - struct obj *obj; +rloco(struct obj *obj) { int tx, ty, otx, oty; @@ -725,9 +712,10 @@ rloco(obj) newsym(otx, oty); } +/* fractured by pick-axe or wand of striking */ +/* no texts here! */ void -fracture_rock(obj) /* fractured by pick-axe or wand of striking */ - struct obj *obj; /* no texts here! */ +fracture_rock(struct obj *obj) { /* unpobj(obj); */ obj->otyp = ROCK; @@ -739,7 +727,7 @@ fracture_rock(obj) /* fractured by pick-axe or wand of striking */ } void -burn_scrolls() +burn_scrolls(void) { struct obj *obj, *obj2; int cnt = 0; diff --git a/hack/rnd.c b/hack/rnd.c index 10f93126..00650e3b 100644 --- a/hack/rnd.c +++ b/hack/rnd.c @@ -1,4 +1,4 @@ -/* $NetBSD: rnd.c,v 1.5 2003/04/02 18:36:42 jsm Exp $ */ +/* $NetBSD: rnd.c,v 1.6 2009/06/07 18:30:39 dholland Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: rnd.c,v 1.5 2003/04/02 18:36:42 jsm Exp $"); +__RCSID("$NetBSD: rnd.c,v 1.6 2009/06/07 18:30:39 dholland Exp $"); #endif /* not lint */ #include @@ -73,29 +73,25 @@ __RCSID("$NetBSD: rnd.c,v 1.5 2003/04/02 18:36:42 jsm Exp $"); #define RND(x) ((random()>>3) % x) int -rn1(x, y) - int x, y; +rn1(int x, int y) { return (RND(x) + y); } int -rn2(x) - int x; +rn2(int x) { return (RND(x)); } int -rnd(x) - int x; +rnd(int x) { return (RND(x) + 1); } int -d(n, x) - int n, x; +d(int n, int x) { int tmp = n; -- cgit v1.2.3-56-ge451