switch source tree from k&r to c99

This commit is contained in:
nhmall
2021-01-26 21:06:16 -05:00
parent a2a9cb7b4f
commit f963c5aca7
232 changed files with 12099 additions and 17782 deletions

133
src/dig.c
View File

@@ -5,15 +5,14 @@
#include "hack.h"
static boolean NDECL(rm_waslit);
static void FDECL(mkcavepos,
(XCHAR_P, XCHAR_P, int, BOOLEAN_P, BOOLEAN_P));
static void FDECL(mkcavearea, (BOOLEAN_P));
static int NDECL(dig);
static void FDECL(dig_up_grave, (coord *));
static int FDECL(adj_pit_checks, (coord *, char *));
static void FDECL(pit_flow, (struct trap *, SCHAR_P));
static boolean FDECL(furniture_handled, (int, int, BOOLEAN_P));
static boolean rm_waslit(void);
static void mkcavepos(xchar, xchar, int, boolean, boolean);
static void mkcavearea(boolean);
static int dig(void);
static void dig_up_grave(coord *);
static int adj_pit_checks(coord *, char *);
static void pit_flow(struct trap *, schar);
static boolean furniture_handled(int, int, boolean);
/* Indices returned by dig_typ() */
enum dig_types {
@@ -26,7 +25,7 @@ enum dig_types {
};
static boolean
rm_waslit()
rm_waslit(void)
{
register xchar x, y;
@@ -44,10 +43,7 @@ rm_waslit()
* immediately after the effect is complete.
*/
static void
mkcavepos(x, y, dist, waslit, rockit)
xchar x, y;
int dist;
boolean waslit, rockit;
mkcavepos(xchar x, xchar y, int dist, boolean waslit, boolean rockit)
{
register struct rm *lev;
@@ -87,8 +83,7 @@ boolean waslit, rockit;
}
static void
mkcavearea(rockit)
register boolean rockit;
mkcavearea(boolean rockit)
{
int dist;
xchar xmin = u.ux, xmax = u.ux;
@@ -139,9 +134,7 @@ register boolean rockit;
/* When digging into location <x,y>, what are you actually digging into? */
int
dig_typ(otmp, x, y)
struct obj *otmp;
xchar x, y;
dig_typ(struct obj *otmp, xchar x, xchar y)
{
boolean ispick;
@@ -167,7 +160,7 @@ xchar x, y;
}
boolean
is_digging()
is_digging(void)
{
if (g.occupation == dig) {
return TRUE;
@@ -179,10 +172,7 @@ is_digging()
#define BY_OBJECT ((struct monst *) 0)
boolean
dig_check(madeby, verbose, x, y)
struct monst *madeby;
boolean verbose;
int x, y;
dig_check(struct monst *madeby, boolean verbose, int x, int y)
{
struct trap *ttmp = t_at(x, y);
const char *verb =
@@ -238,7 +228,7 @@ int x, y;
}
static int
dig(VOID_ARGS)
dig(void)
{
register struct rm *lev;
register xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y;
@@ -491,9 +481,7 @@ dig(VOID_ARGS)
}
static boolean
furniture_handled(x, y, madeby_u)
int x, y;
boolean madeby_u;
furniture_handled(int x, int y, boolean madeby_u)
{
struct rm *lev = &levl[x][y];
@@ -519,7 +507,7 @@ boolean madeby_u;
/* When will hole be finished? Very rough indication used by shopkeeper. */
int
holetime()
holetime(void)
{
if (g.occupation != dig || !*u.ushops)
return -1;
@@ -528,9 +516,8 @@ holetime()
/* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */
schar
fillholetyp(x, y, fill_if_any)
int x, y;
boolean fill_if_any; /* force filling if it exists at all */
fillholetyp(int x, int y,
boolean fill_if_any) /* force filling if it exists at all */
{
register int x1, y1;
int lo_x = max(1, x - 1), hi_x = min(x + 1, COLNO - 1),
@@ -563,10 +550,7 @@ boolean fill_if_any; /* force filling if it exists at all */
}
void
digactualhole(x, y, madeby, ttyp)
register int x, y;
struct monst *madeby;
int ttyp;
digactualhole(int x, int y, struct monst *madeby, int ttyp)
{
struct obj *oldobjs, *newobjs;
register struct trap *ttmp;
@@ -745,11 +729,8 @@ int ttyp;
* in apply.c.
*/
void
liquid_flow(x, y, typ, ttmp, fillmsg)
xchar x, y;
schar typ;
struct trap *ttmp;
const char *fillmsg;
liquid_flow(xchar x, xchar y, schar typ, struct trap *ttmp,
const char *fillmsg)
{
struct obj *objchain;
struct monst *mon;
@@ -779,9 +760,7 @@ const char *fillmsg;
/* return TRUE if digging succeeded, FALSE otherwise */
boolean
dighole(pit_only, by_magic, cc)
boolean pit_only, by_magic;
coord *cc;
dighole(boolean pit_only, boolean by_magic, coord *cc)
{
register struct trap *ttmp;
struct rm *lev;
@@ -917,8 +896,7 @@ coord *cc;
}
static void
dig_up_grave(cc)
coord *cc;
dig_up_grave(coord *cc)
{
struct obj *otmp;
xchar dig_x, dig_y;
@@ -977,8 +955,7 @@ coord *cc;
}
int
use_pick_axe(obj)
struct obj *obj;
use_pick_axe(struct obj *obj)
{
const char *sdp, *verb;
char *dsp, dirsyms[12], qbuf[BUFSZ];
@@ -1043,8 +1020,7 @@ struct obj *obj;
/* the "In what direction do you want to dig?" query. */
/* use_pick_axe2() uses the existing u.dx, u.dy and u.dz */
int
use_pick_axe2(obj)
struct obj *obj;
use_pick_axe2(struct obj *obj)
{
register int rx, ry;
register struct rm *lev;
@@ -1232,10 +1208,7 @@ struct obj *obj;
* zap == TRUE if wand/spell of digging, FALSE otherwise (chewing)
*/
void
watch_dig(mtmp, x, y, zap)
struct monst *mtmp;
xchar x, y;
boolean zap;
watch_dig(struct monst *mtmp, xchar x, xchar y, boolean zap)
{
struct rm *lev = &levl[x][y];
@@ -1278,8 +1251,7 @@ boolean zap;
/* Return TRUE if monster died, FALSE otherwise. Called from m_move(). */
boolean
mdig_tunnel(mtmp)
register struct monst *mtmp;
mdig_tunnel(struct monst *mtmp)
{
register struct rm *here;
int pile = rnd(12);
@@ -1361,8 +1333,7 @@ register struct monst *mtmp;
/* draft refers to air currents, but can be a pun on "draft" as conscription
for military service (probably not a good pun if it has to be explained) */
void
draft_message(unexpected)
boolean unexpected;
draft_message(boolean unexpected)
{
/*
* [Bug or TODO? Have caller pass coordinates and use the travel
@@ -1406,7 +1377,7 @@ boolean unexpected;
/* digging via wand zap or spell cast */
void
zap_dig()
zap_dig(void)
{
struct rm *room;
struct monst *mtmp;
@@ -1620,9 +1591,7 @@ zap_dig()
* down in the pit.
*/
static int
adj_pit_checks(cc, msg)
coord *cc;
char *msg;
adj_pit_checks(coord *cc, char *msg)
{
int ltyp;
struct rm *room;
@@ -1704,9 +1673,7 @@ char *msg;
* Ensure that all conjoined pits fill up.
*/
static void
pit_flow(trap, filltyp)
struct trap *trap;
schar filltyp;
pit_flow(struct trap *trap, schar filltyp)
{
/*
* FIXME?
@@ -1747,8 +1714,7 @@ schar filltyp;
}
struct obj *
buried_ball(cc)
coord *cc;
buried_ball(coord *cc)
{
int odist, bdist = COLNO;
struct obj *otmp, *ball = 0;
@@ -1798,7 +1764,7 @@ coord *cc;
}
void
buried_ball_to_punishment()
buried_ball_to_punishment(void)
{
coord cc;
struct obj *ball;
@@ -1821,7 +1787,7 @@ buried_ball_to_punishment()
}
void
buried_ball_to_freedom()
buried_ball_to_freedom(void)
{
coord cc;
struct obj *ball;
@@ -1847,9 +1813,7 @@ buried_ball_to_freedom()
/* move objects from fobj/nexthere lists to buriedobjlist, keeping position
information */
struct obj *
bury_an_obj(otmp, dealloced)
struct obj *otmp;
boolean *dealloced;
bury_an_obj(struct obj *otmp, boolean *dealloced)
{
struct obj *otmp2;
boolean under_ice;
@@ -1915,8 +1879,7 @@ boolean *dealloced;
}
void
bury_objs(x, y)
int x, y;
bury_objs(int x, int y)
{
struct obj *otmp, *otmp2;
struct monst *shkp;
@@ -1950,8 +1913,7 @@ int x, y;
/* move objects from buriedobjlist to fobj/nexthere lists */
void
unearth_objs(x, y)
int x, y;
unearth_objs(int x, int y)
{
struct obj *otmp, *otmp2, *bball;
coord cc;
@@ -1990,9 +1952,7 @@ int x, y;
*/
/* ARGSUSED */
void
rot_organic(arg, timeout)
anything *arg;
long timeout UNUSED;
rot_organic(anything *arg, long timeout UNUSED)
{
struct obj *obj = arg->a_obj;
@@ -2013,9 +1973,7 @@ long timeout UNUSED;
* Called when a corpse has rotted completely away.
*/
void
rot_corpse(arg, timeout)
anything *arg;
long timeout;
rot_corpse(anything *arg, long timeout)
{
xchar x = 0, y = 0;
struct obj *obj = arg->a_obj;
@@ -2067,8 +2025,7 @@ long timeout;
#if 0
void
bury_monst(mtmp)
struct monst *mtmp;
bury_monst(struct monst *mtmp)
{
debugpline1("bury_monst: %s", mon_nam(mtmp));
if (canseemon(mtmp)) {
@@ -2087,7 +2044,7 @@ struct monst *mtmp;
}
void
bury_you()
bury_you(void)
{
debugpline0("bury_you");
if (!Levitation && !Flying) {
@@ -2105,7 +2062,7 @@ bury_you()
}
void
unearth_you()
unearth_you(void)
{
debugpline0("unearth_you");
u.uburied = FALSE;
@@ -2116,7 +2073,7 @@ unearth_you()
}
void
escape_tomb()
escape_tomb(void)
{
debugpline0("escape_tomb");
if ((Teleportation || can_teleport(g.youmonst.data))
@@ -2163,7 +2120,7 @@ struct obj *otmp;
#ifdef DEBUG
/* bury everything at your loc and around */
int
wiz_debug_cmd_bury()
wiz_debug_cmd_bury(void)
{
int x, y;