switch source tree from k&r to c99
This commit is contained in:
@@ -7,22 +7,21 @@
|
||||
|
||||
#include "mfndpos.h"
|
||||
|
||||
static boolean FDECL(dog_hunger, (struct monst *, struct edog *));
|
||||
static int FDECL(dog_invent, (struct monst *, struct edog *, int));
|
||||
static int FDECL(dog_goal, (struct monst *, struct edog *, int, int, int));
|
||||
static struct monst *FDECL(find_targ, (struct monst *, int, int, int));
|
||||
static int FDECL(find_friends, (struct monst *, struct monst *, int));
|
||||
static struct monst *FDECL(best_target, (struct monst *));
|
||||
static long FDECL(score_targ, (struct monst *, struct monst *));
|
||||
static boolean FDECL(can_reach_location, (struct monst *, XCHAR_P,
|
||||
XCHAR_P, XCHAR_P, XCHAR_P));
|
||||
static boolean FDECL(could_reach_item, (struct monst *, XCHAR_P, XCHAR_P));
|
||||
static void FDECL(quickmimic, (struct monst *));
|
||||
static boolean dog_hunger(struct monst *, struct edog *);
|
||||
static int dog_invent(struct monst *, struct edog *, int);
|
||||
static int dog_goal(struct monst *, struct edog *, int, int, int);
|
||||
static struct monst *find_targ(struct monst *, int, int, int);
|
||||
static int find_friends(struct monst *, struct monst *, int);
|
||||
static struct monst *best_target(struct monst *);
|
||||
static long score_targ(struct monst *, struct monst *);
|
||||
static boolean can_reach_location(struct monst *, xchar, xchar, xchar,
|
||||
xchar);
|
||||
static boolean could_reach_item(struct monst *, xchar, xchar);
|
||||
static void quickmimic(struct monst *);
|
||||
|
||||
/* pick a carried item for pet to drop */
|
||||
struct obj *
|
||||
droppables(mon)
|
||||
struct monst *mon;
|
||||
droppables(struct monst *mon)
|
||||
{
|
||||
struct obj *obj, *wep, dummy, *pickaxe, *unihorn, *key;
|
||||
|
||||
@@ -121,11 +120,10 @@ static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS,
|
||||
0 };
|
||||
|
||||
|
||||
static void FDECL(wantdoor, (int, int, genericptr_t));
|
||||
static void wantdoor(int, int, genericptr_t);
|
||||
|
||||
boolean
|
||||
cursed_object_at(x, y)
|
||||
int x, y;
|
||||
cursed_object_at(int x, int y)
|
||||
{
|
||||
struct obj *otmp;
|
||||
|
||||
@@ -136,9 +134,7 @@ int x, y;
|
||||
}
|
||||
|
||||
int
|
||||
dog_nutrition(mtmp, obj)
|
||||
struct monst *mtmp;
|
||||
struct obj *obj;
|
||||
dog_nutrition(struct monst *mtmp, struct obj *obj)
|
||||
{
|
||||
int nutrit;
|
||||
|
||||
@@ -200,11 +196,11 @@ struct obj *obj;
|
||||
|
||||
/* returns 2 if pet dies, otherwise 1 */
|
||||
int
|
||||
dog_eat(mtmp, obj, x, y, devour)
|
||||
register struct monst *mtmp;
|
||||
register struct obj *obj; /* if unpaid, then thrown or kicked by hero */
|
||||
int x, y; /* dog's starting location, might be different from current */
|
||||
boolean devour;
|
||||
dog_eat(struct monst *mtmp,
|
||||
struct obj *obj, /* if unpaid, then thrown or kicked by hero */
|
||||
int x, /* dog's starting location, */
|
||||
int y, /* might be different from current */
|
||||
boolean devour)
|
||||
{
|
||||
register struct edog *edog = EDOG(mtmp);
|
||||
boolean poly, grow, heal, eyes, slimer, deadmimic;
|
||||
@@ -356,9 +352,7 @@ boolean devour;
|
||||
|
||||
/* hunger effects -- returns TRUE on starvation */
|
||||
static boolean
|
||||
dog_hunger(mtmp, edog)
|
||||
struct monst *mtmp;
|
||||
struct edog *edog;
|
||||
dog_hunger(struct monst *mtmp, struct edog *edog)
|
||||
{
|
||||
if (g.monstermoves > edog->hungrytime + 500) {
|
||||
if (!carnivorous(mtmp->data) && !herbivorous(mtmp->data)) {
|
||||
@@ -402,10 +396,7 @@ struct edog *edog;
|
||||
* returns 1 if object eaten (since that counts as dog's move), 2 if died
|
||||
*/
|
||||
static int
|
||||
dog_invent(mtmp, edog, udist)
|
||||
register struct monst *mtmp;
|
||||
register struct edog *edog;
|
||||
int udist;
|
||||
dog_invent(struct monst *mtmp, struct edog *edog, int udist)
|
||||
{
|
||||
register int omx, omy, carryamt = 0;
|
||||
struct obj *obj, *otmp;
|
||||
@@ -475,10 +466,8 @@ int udist;
|
||||
/* set dog's goal -- gtyp, gx, gy;
|
||||
returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */
|
||||
static int
|
||||
dog_goal(mtmp, edog, after, udist, whappr)
|
||||
register struct monst *mtmp;
|
||||
struct edog *edog;
|
||||
int after, udist, whappr;
|
||||
dog_goal(register struct monst *mtmp, struct edog *edog,
|
||||
int after, int udist, int whappr)
|
||||
{
|
||||
register int omx, omy;
|
||||
boolean in_masters_sight, dog_has_minvent;
|
||||
@@ -619,10 +608,7 @@ int after, udist, whappr;
|
||||
}
|
||||
|
||||
static struct monst *
|
||||
find_targ(mtmp, dx, dy, maxdist)
|
||||
register struct monst *mtmp;
|
||||
int dx, dy;
|
||||
int maxdist;
|
||||
find_targ(register struct monst *mtmp, int dx, int dy, int maxdist)
|
||||
{
|
||||
struct monst *targ = 0;
|
||||
int curx = mtmp->mx, cury = mtmp->my;
|
||||
@@ -662,9 +648,7 @@ int maxdist;
|
||||
}
|
||||
|
||||
static int
|
||||
find_friends(mtmp, mtarg, maxdist)
|
||||
struct monst *mtmp, *mtarg;
|
||||
int maxdist;
|
||||
find_friends(struct monst *mtmp, struct monst *mtarg, int maxdist)
|
||||
{
|
||||
struct monst *pal;
|
||||
int dx = sgn(mtarg->mx - mtmp->mx),
|
||||
@@ -708,8 +692,7 @@ int maxdist;
|
||||
}
|
||||
|
||||
static long
|
||||
score_targ(mtmp, mtarg)
|
||||
struct monst *mtmp, *mtarg;
|
||||
score_targ(struct monst *mtmp, struct monst *mtarg)
|
||||
{
|
||||
long score = 0L;
|
||||
|
||||
@@ -809,8 +792,7 @@ struct monst *mtmp, *mtarg;
|
||||
}
|
||||
|
||||
static struct monst *
|
||||
best_target(mtmp)
|
||||
struct monst *mtmp; /* Pet */
|
||||
best_target(struct monst *mtmp) /* Pet */
|
||||
{
|
||||
int dx, dy;
|
||||
long bestscore = -40000L, currscore;
|
||||
@@ -867,9 +849,8 @@ struct monst *mtmp; /* Pet */
|
||||
* (may have attacked something)
|
||||
*/
|
||||
int
|
||||
dog_move(mtmp, after)
|
||||
register struct monst *mtmp;
|
||||
int after; /* this is extra fast monster movement */
|
||||
dog_move(register struct monst *mtmp,
|
||||
int after) /* this is extra fast monster movement */
|
||||
{
|
||||
int omx, omy; /* original mtmp position */
|
||||
int appr, whappr, udist;
|
||||
@@ -1272,9 +1253,7 @@ int after; /* this is extra fast monster movement */
|
||||
|
||||
/* check if a monster could pick up objects from a location */
|
||||
static boolean
|
||||
could_reach_item(mon, nx, ny)
|
||||
struct monst *mon;
|
||||
xchar nx, ny;
|
||||
could_reach_item(struct monst *mon, xchar nx, xchar ny)
|
||||
{
|
||||
if ((!is_pool(nx, ny) || is_swimmer(mon->data))
|
||||
&& (!is_lava(nx, ny) || likes_lava(mon->data))
|
||||
@@ -1291,9 +1270,7 @@ xchar nx, ny;
|
||||
* calls deep.
|
||||
*/
|
||||
static boolean
|
||||
can_reach_location(mon, mx, my, fx, fy)
|
||||
struct monst *mon;
|
||||
xchar mx, my, fx, fy;
|
||||
can_reach_location(struct monst *mon, xchar mx, xchar my, xchar fx, xchar fy)
|
||||
{
|
||||
int i, j;
|
||||
int dist;
|
||||
@@ -1329,9 +1306,7 @@ xchar mx, my, fx, fy;
|
||||
|
||||
/* do_clear_area client */
|
||||
static void
|
||||
wantdoor(x, y, distance)
|
||||
int x, y;
|
||||
genericptr_t distance;
|
||||
wantdoor(int x, int y, genericptr_t distance)
|
||||
{
|
||||
int ndist, *dist_ptr = (int *) distance;
|
||||
|
||||
@@ -1361,8 +1336,7 @@ static const struct qmchoices {
|
||||
};
|
||||
|
||||
void
|
||||
finish_meating(mtmp)
|
||||
struct monst *mtmp;
|
||||
finish_meating(struct monst *mtmp)
|
||||
{
|
||||
mtmp->meating = 0;
|
||||
if (M_AP_TYPE(mtmp) && mtmp->mappearance && mtmp->cham == NON_PM) {
|
||||
@@ -1374,8 +1348,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
static void
|
||||
quickmimic(mtmp)
|
||||
struct monst *mtmp;
|
||||
quickmimic(struct monst *mtmp)
|
||||
{
|
||||
int idx = 0, trycnt = 5, spotted, seeloc;
|
||||
char buf[BUFSZ];
|
||||
|
||||
Reference in New Issue
Block a user