switch source tree from k&r to c99
This commit is contained in:
141
src/do.c
141
src/do.c
@@ -7,21 +7,22 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static void FDECL(trycall, (struct obj *));
|
||||
static void NDECL(polymorph_sink);
|
||||
static boolean NDECL(teleport_sink);
|
||||
static void FDECL(dosinkring, (struct obj *));
|
||||
static int FDECL(drop, (struct obj *));
|
||||
static boolean FDECL(engulfer_digests_food, (struct obj *));
|
||||
static int NDECL(wipeoff);
|
||||
static int FDECL(menu_drop, (int));
|
||||
static NHFILE *NDECL(currentlevel_rewrite);
|
||||
static void NDECL(final_level);
|
||||
/* static boolean FDECL(badspot, (XCHAR_P,XCHAR_P)); */
|
||||
static void trycall(struct obj *);
|
||||
static void polymorph_sink(void);
|
||||
static boolean teleport_sink(void);
|
||||
static void dosinkring(struct obj *);
|
||||
static int drop(struct obj *);
|
||||
static boolean engulfer_digests_food(struct obj *);
|
||||
static int wipeoff(void);
|
||||
static int menu_drop(int);
|
||||
static NHFILE *currentlevel_rewrite(void);
|
||||
static void final_level(void);
|
||||
|
||||
/* static boolean badspot(xchar,xchar); */
|
||||
|
||||
/* 'd' command: drop one inventory item */
|
||||
int
|
||||
dodrop()
|
||||
dodrop(void)
|
||||
{
|
||||
int result;
|
||||
|
||||
@@ -42,10 +43,7 @@ dodrop()
|
||||
* it's gone for good... If the destination is not a pool, returns FALSE.
|
||||
*/
|
||||
boolean
|
||||
boulder_hits_pool(otmp, rx, ry, pushing)
|
||||
struct obj *otmp;
|
||||
register int rx, ry;
|
||||
boolean pushing;
|
||||
boulder_hits_pool(struct obj *otmp, int rx, int ry, boolean pushing)
|
||||
{
|
||||
if (!otmp || otmp->otyp != BOULDER) {
|
||||
impossible("Not a boulder?");
|
||||
@@ -127,10 +125,7 @@ boolean pushing;
|
||||
* away.
|
||||
*/
|
||||
boolean
|
||||
flooreffects(obj, x, y, verb)
|
||||
struct obj *obj;
|
||||
int x, y;
|
||||
const char *verb;
|
||||
flooreffects(struct obj *obj, int x, int y, const char *verb)
|
||||
{
|
||||
struct trap *t;
|
||||
struct monst *mtmp;
|
||||
@@ -269,8 +264,7 @@ deletedwithboulder:
|
||||
|
||||
/* obj is an object dropped on an altar */
|
||||
void
|
||||
doaltarobj(obj)
|
||||
register struct obj *obj;
|
||||
doaltarobj(struct obj *obj)
|
||||
{
|
||||
if (Blind)
|
||||
return;
|
||||
@@ -297,8 +291,7 @@ register struct obj *obj;
|
||||
}
|
||||
|
||||
static void
|
||||
trycall(obj)
|
||||
register struct obj *obj;
|
||||
trycall(struct obj *obj)
|
||||
{
|
||||
if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname)
|
||||
docall(obj);
|
||||
@@ -307,7 +300,7 @@ register struct obj *obj;
|
||||
/* Transforms the sink at the player's position into
|
||||
a fountain, throne, altar or grave. */
|
||||
static void
|
||||
polymorph_sink()
|
||||
polymorph_sink(void)
|
||||
{
|
||||
uchar sym = S_sink;
|
||||
boolean sinklooted;
|
||||
@@ -364,7 +357,7 @@ polymorph_sink()
|
||||
/* Teleports the sink at the player's position;
|
||||
return True if sink teleported. */
|
||||
static boolean
|
||||
teleport_sink()
|
||||
teleport_sink(void)
|
||||
{
|
||||
int cx, cy;
|
||||
int cnt = 0;
|
||||
@@ -395,8 +388,7 @@ teleport_sink()
|
||||
|
||||
/* obj is a ring being dropped over a kitchen sink */
|
||||
static void
|
||||
dosinkring(obj)
|
||||
register struct obj *obj;
|
||||
dosinkring(struct obj *obj)
|
||||
{
|
||||
struct obj *otmp, *otmp2;
|
||||
boolean ideed = TRUE;
|
||||
@@ -561,9 +553,7 @@ register struct obj *obj;
|
||||
|
||||
/* some common tests when trying to drop or throw items */
|
||||
boolean
|
||||
canletgo(obj, word)
|
||||
struct obj *obj;
|
||||
const char *word;
|
||||
canletgo(struct obj *obj, const char *word)
|
||||
{
|
||||
if (obj->owornmask & (W_ARMOR | W_ACCESSORY)) {
|
||||
if (*word)
|
||||
@@ -599,8 +589,7 @@ const char *word;
|
||||
}
|
||||
|
||||
static int
|
||||
drop(obj)
|
||||
register struct obj *obj;
|
||||
drop(struct obj *obj)
|
||||
{
|
||||
if (!obj)
|
||||
return 0;
|
||||
@@ -664,8 +653,7 @@ register struct obj *obj;
|
||||
called in several places - may produce output
|
||||
(eg ship_object() and dropy() -> sellobj() both produce output) */
|
||||
void
|
||||
dropx(obj)
|
||||
register struct obj *obj;
|
||||
dropx(struct obj *obj)
|
||||
{
|
||||
freeinv(obj);
|
||||
if (!u.uswallow) {
|
||||
@@ -679,17 +667,14 @@ register struct obj *obj;
|
||||
|
||||
/* dropy - put dropped object at destination; called from lots of places */
|
||||
void
|
||||
dropy(obj)
|
||||
struct obj *obj;
|
||||
dropy(struct obj *obj)
|
||||
{
|
||||
dropz(obj, FALSE);
|
||||
}
|
||||
|
||||
/* dropz - really put dropped object at its destination... */
|
||||
void
|
||||
dropz(obj, with_impact)
|
||||
struct obj *obj;
|
||||
boolean with_impact;
|
||||
dropz(struct obj *obj, boolean with_impact)
|
||||
{
|
||||
if (obj == uwep)
|
||||
setuwep((struct obj *) 0);
|
||||
@@ -729,8 +714,7 @@ boolean with_impact;
|
||||
for purple worm, immediately eat any corpse, glob, or special meat item
|
||||
from object polymorph; return True if object is used up, False otherwise */
|
||||
static boolean
|
||||
engulfer_digests_food(obj)
|
||||
struct obj *obj;
|
||||
engulfer_digests_food(struct obj *obj)
|
||||
{
|
||||
/* animal swallower (purple worn, trapper, lurker above) eats any
|
||||
corpse, glob, or meat <item> but not other types of food */
|
||||
@@ -774,8 +758,7 @@ struct obj *obj;
|
||||
/* things that must change when not held; recurse into containers.
|
||||
Called for both player and monsters */
|
||||
void
|
||||
obj_no_longer_held(obj)
|
||||
struct obj *obj;
|
||||
obj_no_longer_held(struct obj *obj)
|
||||
{
|
||||
if (!obj) {
|
||||
return;
|
||||
@@ -806,7 +789,7 @@ struct obj *obj;
|
||||
|
||||
/* 'D' command: drop several things */
|
||||
int
|
||||
doddrop()
|
||||
doddrop(void)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
@@ -830,8 +813,7 @@ doddrop()
|
||||
|
||||
/* Drop things from the hero's inventory, using a menu. */
|
||||
static int
|
||||
menu_drop(retry)
|
||||
int retry;
|
||||
menu_drop(int retry)
|
||||
{
|
||||
int n, i, n_dropped = 0;
|
||||
long cnt;
|
||||
@@ -947,7 +929,7 @@ int retry;
|
||||
|
||||
/* the '>' command */
|
||||
int
|
||||
dodown()
|
||||
dodown(void)
|
||||
{
|
||||
struct trap *trap = 0;
|
||||
stairway *stway = stairway_at(u.ux, u.uy);
|
||||
@@ -1102,7 +1084,7 @@ dodown()
|
||||
|
||||
/* the '<' command */
|
||||
int
|
||||
doup()
|
||||
doup(void)
|
||||
{
|
||||
stairway *stway = stairway_at(u.ux,u.uy);
|
||||
|
||||
@@ -1153,7 +1135,7 @@ doup()
|
||||
|
||||
/* check that we can write out the current level */
|
||||
static NHFILE *
|
||||
currentlevel_rewrite()
|
||||
currentlevel_rewrite(void)
|
||||
{
|
||||
NHFILE *nhfp;
|
||||
char whynot[BUFSZ];
|
||||
@@ -1180,7 +1162,7 @@ currentlevel_rewrite()
|
||||
|
||||
#ifdef INSURANCE
|
||||
void
|
||||
save_currentstate()
|
||||
save_currentstate(void)
|
||||
{
|
||||
NHFILE *nhfp;
|
||||
|
||||
@@ -1203,8 +1185,7 @@ save_currentstate()
|
||||
|
||||
/*
|
||||
static boolean
|
||||
badspot(x, y)
|
||||
register xchar x, y;
|
||||
badspot(register xchar x, register xchar y)
|
||||
{
|
||||
return (boolean) ((levl[x][y].typ != ROOM
|
||||
&& levl[x][y].typ != AIR
|
||||
@@ -1216,8 +1197,7 @@ register xchar x, y;
|
||||
/* when arriving on a level, if hero and a monster are trying to share same
|
||||
spot, move one; extracted from goto_level(); also used by wiz_makemap() */
|
||||
void
|
||||
u_collide_m(mtmp)
|
||||
struct monst *mtmp;
|
||||
u_collide_m(struct monst *mtmp)
|
||||
{
|
||||
coord cc;
|
||||
|
||||
@@ -1253,9 +1233,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
goto_level(newlevel, at_stairs, falling, portal)
|
||||
d_level *newlevel;
|
||||
boolean at_stairs, falling, portal;
|
||||
goto_level(d_level *newlevel, boolean at_stairs, boolean falling, boolean portal)
|
||||
{
|
||||
int l_idx, save_mode;
|
||||
NHFILE *nhfp;
|
||||
@@ -1754,7 +1732,7 @@ boolean at_stairs, falling, portal;
|
||||
|
||||
/* usually called from goto_level(); might be called from Sting_effects() */
|
||||
void
|
||||
maybe_lvltport_feedback()
|
||||
maybe_lvltport_feedback(void)
|
||||
{
|
||||
if (g.dfr_post_msg && !strncmpi(g.dfr_post_msg, "You materialize", 15)) {
|
||||
/* "You materialize on a different level." */
|
||||
@@ -1764,7 +1742,7 @@ maybe_lvltport_feedback()
|
||||
}
|
||||
|
||||
static void
|
||||
final_level()
|
||||
final_level(void)
|
||||
{
|
||||
struct monst *mtmp;
|
||||
|
||||
@@ -1784,10 +1762,8 @@ final_level()
|
||||
|
||||
/* change levels at the end of this turn, after monsters finish moving */
|
||||
void
|
||||
schedule_goto(tolev, utotype_flags, pre_msg, post_msg)
|
||||
d_level *tolev;
|
||||
int utotype_flags;
|
||||
const char *pre_msg, *post_msg;
|
||||
schedule_goto(d_level *tolev, int utotype_flags,
|
||||
const char *pre_msg, const char *post_msg)
|
||||
{
|
||||
/* UTOTYPE_DEFERRED is used, so UTOTYPE_NONE can trigger deferred_goto() */
|
||||
u.utotype = utotype_flags | UTOTYPE_DEFERRED;
|
||||
@@ -1802,7 +1778,7 @@ const char *pre_msg, *post_msg;
|
||||
|
||||
/* handle something like portal ejection */
|
||||
void
|
||||
deferred_goto()
|
||||
deferred_goto(void)
|
||||
{
|
||||
if (!on_level(&u.uz, &u.utolev)) {
|
||||
d_level dest, oldlev;
|
||||
@@ -1838,8 +1814,7 @@ deferred_goto()
|
||||
* corpse is gone.
|
||||
*/
|
||||
boolean
|
||||
revive_corpse(corpse)
|
||||
struct obj *corpse;
|
||||
revive_corpse(struct obj *corpse)
|
||||
{
|
||||
struct monst *mtmp, *mcarry;
|
||||
boolean is_uwep, chewed;
|
||||
@@ -1927,9 +1902,7 @@ struct obj *corpse;
|
||||
/* Revive the corpse via a timeout. */
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
revive_mon(arg, timeout)
|
||||
anything *arg;
|
||||
long timeout UNUSED;
|
||||
revive_mon(anything *arg, long timeout UNUSED)
|
||||
{
|
||||
struct obj *body = arg->a_obj;
|
||||
struct permonst *mptr = &mons[body->corpsenm];
|
||||
@@ -1975,9 +1948,7 @@ long timeout UNUSED;
|
||||
/* Timeout callback. Revive the corpse as a zombie. */
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
zombify_mon(arg, timeout)
|
||||
anything *arg;
|
||||
long timeout UNUSED;
|
||||
zombify_mon(anything *arg, long timeout UNUSED)
|
||||
{
|
||||
struct obj *body = arg->a_obj;
|
||||
int zmon = zombie_form(&mons[body->corpsenm]);
|
||||
@@ -1995,10 +1966,7 @@ long timeout UNUSED;
|
||||
}
|
||||
|
||||
boolean
|
||||
cmd_safety_prevention(cmddesc, act, flagcounter)
|
||||
const char *cmddesc;
|
||||
const char *act;
|
||||
int *flagcounter;
|
||||
cmd_safety_prevention(const char *cmddesc, const char *act, int *flagcounter)
|
||||
{
|
||||
if (flags.safe_wait && !iflags.menu_requested
|
||||
&& !g.multi && monster_nearby()) {
|
||||
@@ -2018,7 +1986,7 @@ int *flagcounter;
|
||||
/* '.' command: do nothing == rest; also the
|
||||
' ' command iff 'rest_on_space' option is On */
|
||||
int
|
||||
donull()
|
||||
donull(void)
|
||||
{
|
||||
if (cmd_safety_prevention("a no-op (to rest)",
|
||||
"Are you waiting to get hit?",
|
||||
@@ -2028,7 +1996,7 @@ donull()
|
||||
}
|
||||
|
||||
static int
|
||||
wipeoff(VOID_ARGS)
|
||||
wipeoff(void)
|
||||
{
|
||||
if (u.ucreamed < 4)
|
||||
u.ucreamed = 0;
|
||||
@@ -2054,7 +2022,7 @@ wipeoff(VOID_ARGS)
|
||||
}
|
||||
|
||||
int
|
||||
dowipe()
|
||||
dowipe(void)
|
||||
{
|
||||
if (u.ucreamed) {
|
||||
static NEARDATA char buf[39];
|
||||
@@ -2072,9 +2040,8 @@ dowipe()
|
||||
|
||||
/* common wounded legs feedback */
|
||||
void
|
||||
legs_in_no_shape(for_what, by_steed)
|
||||
const char *for_what; /* jumping, kicking, riding */
|
||||
boolean by_steed;
|
||||
legs_in_no_shape(const char *for_what, /* jumping, kicking, riding */
|
||||
boolean by_steed)
|
||||
{
|
||||
if (by_steed && u.usteed) {
|
||||
pline("%s is in no shape for %s.", Monnam(u.usteed), for_what);
|
||||
@@ -2091,9 +2058,7 @@ boolean by_steed;
|
||||
}
|
||||
|
||||
void
|
||||
set_wounded_legs(side, timex)
|
||||
long side;
|
||||
int timex;
|
||||
set_wounded_legs(long side, int timex)
|
||||
{
|
||||
/* KMH -- STEED
|
||||
* If you are riding, your steed gets the wounded legs instead.
|
||||
@@ -2112,8 +2077,8 @@ int timex;
|
||||
}
|
||||
|
||||
void
|
||||
heal_legs(how)
|
||||
int how; /* 0: ordinary, 1: dismounting steed, 2: limbs turn to stone */
|
||||
heal_legs(int how) /* 0: ordinary, 1: dismounting steed,
|
||||
2: limbs turn to stone */
|
||||
{
|
||||
if (Wounded_legs) {
|
||||
g.context.botl = 1;
|
||||
|
||||
Reference in New Issue
Block a user