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

View File

@@ -5,10 +5,9 @@
#include "hack.h"
static void FDECL(m_lose_armor, (struct monst *, struct obj *));
static void FDECL(m_dowear_type,
(struct monst *, long, BOOLEAN_P, BOOLEAN_P));
static int FDECL(extra_pref, (struct monst *, struct obj *));
static void m_lose_armor(struct monst *, struct obj *);
static void m_dowear_type(struct monst *, long, boolean, boolean);
static int extra_pref(struct monst *, struct obj *);
const struct worn {
long w_mask;
@@ -44,9 +43,7 @@ const struct worn {
/* Updated to use the extrinsic and blocked fields. */
void
setworn(obj, mask)
register struct obj *obj;
long mask;
setworn(struct obj *obj, long mask)
{
register const struct worn *wp;
register struct obj *oobj;
@@ -115,8 +112,7 @@ long mask;
/* called e.g. when obj is destroyed */
/* Updated to use the extrinsic and blocked fields. */
void
setnotworn(obj)
register struct obj *obj;
setnotworn(struct obj *obj)
{
register const struct worn *wp;
register int p;
@@ -147,7 +143,7 @@ register struct obj *obj;
/* called when saving with FREEING flag set has just discarded inventory */
void
allunworn()
allunworn(void)
{
const struct worn *wp;
@@ -165,8 +161,7 @@ allunworn()
/* return item worn in slot indiciated by wornmask; needed by poly_obj() */
struct obj *
wearmask_to_obj(wornmask)
long wornmask;
wearmask_to_obj(long wornmask)
{
const struct worn *wp;
@@ -178,8 +173,7 @@ long wornmask;
/* return a bitmask of the equipment slot(s) a given item might be worn in */
long
wearslot(obj)
struct obj *obj;
wearslot(struct obj *obj)
{
int otyp = obj->otyp;
/* practically any item can be wielded or quivered; it's up to
@@ -251,8 +245,7 @@ struct obj *obj;
}
void
mon_set_minvis(mon)
struct monst *mon;
mon_set_minvis(struct monst *mon)
{
mon->perminvis = 1;
if (!mon->invis_blkd) {
@@ -264,10 +257,10 @@ struct monst *mon;
}
void
mon_adjust_speed(mon, adjust, obj)
struct monst *mon;
int adjust; /* positive => increase speed, negative => decrease */
struct obj *obj; /* item to make known if effect can be seen */
mon_adjust_speed(struct monst *mon,
int adjust, /* positive => increase speed, negative =>
decrease */
struct obj *obj) /* item to make known if effect can be seen */
{
struct obj *otmp;
boolean give_msg = !g.in_mklev, petrify = FALSE;
@@ -343,10 +336,8 @@ struct obj *obj; /* item to make known if effect can be seen */
/* armor put on or taken off; might be magical variety
[TODO: rename to 'update_mon_extrinsics()' and change all callers...] */
void
update_mon_intrinsics(mon, obj, on, silently)
struct monst *mon;
struct obj *obj;
boolean on, silently;
update_mon_intrinsics(struct monst *mon, struct obj *obj, boolean on,
boolean silently)
{
int unseen;
uchar mask;
@@ -456,8 +447,7 @@ boolean on, silently;
}
int
find_mac(mon)
register struct monst *mon;
find_mac(struct monst *mon)
{
register struct obj *obj;
int base = mon->data->ac;
@@ -497,9 +487,7 @@ register struct monst *mon;
* already worn body armor is too obviously buggy...
*/
void
m_dowear(mon, creation)
register struct monst *mon;
boolean creation;
m_dowear(struct monst *mon, boolean creation)
{
#define RACE_EXCEPTION TRUE
/* Note the restrictions here are the same as in dowear in do_wear.c
@@ -536,11 +524,8 @@ boolean creation;
}
static void
m_dowear_type(mon, flag, creation, racialexception)
struct monst *mon;
long flag;
boolean creation;
boolean racialexception;
m_dowear_type(struct monst *mon, long flag, boolean creation,
boolean racialexception)
{
struct obj *old, *best, *obj;
int m_delay = 0;
@@ -688,9 +673,7 @@ boolean racialexception;
#undef RACE_EXCEPTION
struct obj *
which_armor(mon, flag)
struct monst *mon;
long flag;
which_armor(struct monst *mon, long flag)
{
if (mon == &g.youmonst) {
switch (flag) {
@@ -724,9 +707,7 @@ long flag;
/* remove an item of armor and then drop it */
static void
m_lose_armor(mon, obj)
struct monst *mon;
struct obj *obj;
m_lose_armor(struct monst *mon, struct obj *obj)
{
mon->misc_worn_check &= ~obj->owornmask;
if (obj->owornmask)
@@ -741,7 +722,7 @@ struct obj *obj;
/* all objects with their bypass bit set should now be reset to normal */
void
clear_bypasses()
clear_bypasses(void)
{
struct obj *otmp, *nobj;
struct monst *mtmp;
@@ -803,8 +784,7 @@ clear_bypasses()
}
void
bypass_obj(obj)
struct obj *obj;
bypass_obj(struct obj *obj)
{
obj->bypass = 1;
g.context.bypasses = TRUE;
@@ -812,9 +792,8 @@ struct obj *obj;
/* set or clear the bypass bit in a list of objects */
void
bypass_objlist(objchain, on)
struct obj *objchain;
boolean on; /* TRUE => set, FALSE => clear */
bypass_objlist(struct obj *objchain,
boolean on) /* TRUE => set, FALSE => clear */
{
if (on && objchain)
g.context.bypasses = TRUE;
@@ -827,8 +806,7 @@ boolean on; /* TRUE => set, FALSE => clear */
/* return the first object without its bypass bit set; set that bit
before returning so that successive calls will find further objects */
struct obj *
nxt_unbypassed_obj(objchain)
struct obj *objchain;
nxt_unbypassed_obj(struct obj *objchain)
{
while (objchain) {
if (!objchain->bypass) {
@@ -845,9 +823,7 @@ struct obj *objchain;
there's an added complication that the array may have stale pointers
for deleted objects (see Multiple-Drop case in askchain(invent.c)) */
struct obj *
nxt_unbypassed_loot(lootarray, listhead)
Loot *lootarray;
struct obj *listhead;
nxt_unbypassed_loot(Loot *lootarray, struct obj *listhead)
{
struct obj *o, *obj;
@@ -865,9 +841,7 @@ struct obj *listhead;
}
void
mon_break_armor(mon, polyspot)
struct monst *mon;
boolean polyspot;
mon_break_armor(struct monst *mon, boolean polyspot)
{
register struct obj *otmp;
struct permonst *mdat = mon->data;
@@ -1030,9 +1004,7 @@ boolean polyspot;
/* bias a monster's preferences towards armor that has special benefits. */
static int
extra_pref(mon, obj)
struct monst *mon;
struct obj *obj;
extra_pref(struct monst *mon, struct obj *obj)
{
/* currently only does speed boots, but might be expanded if monsters
* get to use more armor abilities
@@ -1053,9 +1025,7 @@ struct obj *obj;
* -1 If the race/object combination is unacceptable.
*/
int
racial_exception(mon, obj)
struct monst *mon;
struct obj *obj;
racial_exception(struct monst *mon, struct obj *obj)
{
const struct permonst *ptr = raceptr(mon);