switch source tree from k&r to c99
This commit is contained in:
99
src/vault.c
99
src/vault.c
@@ -5,20 +5,19 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static boolean FDECL(clear_fcorr, (struct monst *, BOOLEAN_P));
|
||||
static void FDECL(blackout, (int, int));
|
||||
static void FDECL(restfakecorr, (struct monst *));
|
||||
static void FDECL(parkguard, (struct monst *));
|
||||
static boolean FDECL(in_fcorridor, (struct monst *, int, int));
|
||||
static boolean FDECL(find_guard_dest, (struct monst *, xchar *, xchar *));
|
||||
static void FDECL(move_gold, (struct obj *, int));
|
||||
static void FDECL(wallify_vault, (struct monst *));
|
||||
static void FDECL(gd_mv_monaway, (struct monst *, int, int));
|
||||
static void FDECL(gd_pick_corridor_gold, (struct monst *, int, int));
|
||||
static boolean clear_fcorr(struct monst *, boolean);
|
||||
static void blackout(int, int);
|
||||
static void restfakecorr(struct monst *);
|
||||
static void parkguard(struct monst *);
|
||||
static boolean in_fcorridor(struct monst *, int, int);
|
||||
static boolean find_guard_dest(struct monst *, xchar *, xchar *);
|
||||
static void move_gold(struct obj *, int);
|
||||
static void wallify_vault(struct monst *);
|
||||
static void gd_mv_monaway(struct monst *, int, int);
|
||||
static void gd_pick_corridor_gold(struct monst *, int, int);
|
||||
|
||||
void
|
||||
newegd(mtmp)
|
||||
struct monst *mtmp;
|
||||
newegd(struct monst *mtmp)
|
||||
{
|
||||
if (!mtmp->mextra)
|
||||
mtmp->mextra = newmextra();
|
||||
@@ -29,8 +28,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
void
|
||||
free_egd(mtmp)
|
||||
struct monst *mtmp;
|
||||
free_egd(struct monst *mtmp)
|
||||
{
|
||||
if (mtmp->mextra && EGD(mtmp)) {
|
||||
free((genericptr_t) EGD(mtmp));
|
||||
@@ -43,9 +41,7 @@ struct monst *mtmp;
|
||||
maintained by guard 'grd'; if guard is still in it, removal will fail,
|
||||
to be tried again later */
|
||||
static boolean
|
||||
clear_fcorr(grd, forceshow)
|
||||
struct monst *grd;
|
||||
boolean forceshow;
|
||||
clear_fcorr(struct monst *grd, boolean forceshow)
|
||||
{
|
||||
register int fcx, fcy, fcbeg;
|
||||
struct monst *mtmp;
|
||||
@@ -119,8 +115,7 @@ boolean forceshow;
|
||||
the corridor, we don't want the light to reappear if/when a new tunnel
|
||||
goes through the same area */
|
||||
static void
|
||||
blackout(x, y)
|
||||
int x, y;
|
||||
blackout(int x, int y)
|
||||
{
|
||||
struct rm *lev;
|
||||
int i, j;
|
||||
@@ -141,8 +136,7 @@ int x, y;
|
||||
}
|
||||
|
||||
static void
|
||||
restfakecorr(grd)
|
||||
struct monst *grd;
|
||||
restfakecorr(struct monst *grd)
|
||||
{
|
||||
/* it seems you left the corridor - let the guard disappear */
|
||||
if (clear_fcorr(grd, FALSE)) {
|
||||
@@ -153,8 +147,7 @@ struct monst *grd;
|
||||
|
||||
/* move guard--dead to alive--to <0,0> until temporary corridor is removed */
|
||||
static void
|
||||
parkguard(grd)
|
||||
struct monst *grd;
|
||||
parkguard(struct monst *grd)
|
||||
{
|
||||
/* either guard is dead or will now be treated as if so;
|
||||
monster traversal loops should skip it */
|
||||
@@ -173,8 +166,7 @@ struct monst *grd;
|
||||
|
||||
/* called in mon.c */
|
||||
boolean
|
||||
grddead(grd)
|
||||
struct monst *grd;
|
||||
grddead(struct monst *grd)
|
||||
{
|
||||
boolean dispose = clear_fcorr(grd, TRUE);
|
||||
|
||||
@@ -191,9 +183,7 @@ struct monst *grd;
|
||||
}
|
||||
|
||||
static boolean
|
||||
in_fcorridor(grd, x, y)
|
||||
struct monst *grd;
|
||||
int x, y;
|
||||
in_fcorridor(struct monst *grd, int x, int y)
|
||||
{
|
||||
register int fci;
|
||||
struct egd *egrd = EGD(grd);
|
||||
@@ -205,7 +195,7 @@ int x, y;
|
||||
}
|
||||
|
||||
struct monst *
|
||||
findgd()
|
||||
findgd(void)
|
||||
{
|
||||
register struct monst *mtmp;
|
||||
|
||||
@@ -219,15 +209,14 @@ findgd()
|
||||
}
|
||||
|
||||
void
|
||||
vault_summon_gd()
|
||||
vault_summon_gd(void)
|
||||
{
|
||||
if (vault_occupied(u.urooms) && !findgd())
|
||||
u.uinvault = (VAULT_GUARD_TIME - 1);
|
||||
}
|
||||
|
||||
char
|
||||
vault_occupied(array)
|
||||
char *array;
|
||||
vault_occupied(char *array)
|
||||
{
|
||||
register char *ptr;
|
||||
|
||||
@@ -239,8 +228,7 @@ char *array;
|
||||
|
||||
/* hero has teleported out of vault while a guard is active */
|
||||
void
|
||||
uleftvault(grd)
|
||||
struct monst *grd;
|
||||
uleftvault(struct monst *grd)
|
||||
{
|
||||
/* only called if caller has checked vault_occupied() and findgd() */
|
||||
if (!grd || !grd->isgd || DEADMONSTER(grd)) {
|
||||
@@ -265,9 +253,7 @@ struct monst *grd;
|
||||
}
|
||||
|
||||
static boolean
|
||||
find_guard_dest(guard, rx, ry)
|
||||
struct monst *guard;
|
||||
xchar *rx, *ry;
|
||||
find_guard_dest(struct monst *guard, xchar *rx, xchar *ry)
|
||||
{
|
||||
register int x, y, dd, lx = 0, ly = 0;
|
||||
|
||||
@@ -303,7 +289,7 @@ xchar *rx, *ry;
|
||||
}
|
||||
|
||||
void
|
||||
invault()
|
||||
invault(void)
|
||||
{
|
||||
struct monst *guard;
|
||||
boolean gsensed;
|
||||
@@ -549,9 +535,7 @@ invault()
|
||||
}
|
||||
|
||||
static void
|
||||
move_gold(gold, vroom)
|
||||
struct obj *gold;
|
||||
int vroom;
|
||||
move_gold(struct obj *gold, int vroom)
|
||||
{
|
||||
xchar nx, ny;
|
||||
|
||||
@@ -565,8 +549,7 @@ int vroom;
|
||||
}
|
||||
|
||||
static void
|
||||
wallify_vault(grd)
|
||||
struct monst *grd;
|
||||
wallify_vault(struct monst *grd)
|
||||
{
|
||||
int x, y, typ;
|
||||
int vlt = EGD(grd)->vroom;
|
||||
@@ -633,9 +616,7 @@ struct monst *grd;
|
||||
}
|
||||
|
||||
static void
|
||||
gd_mv_monaway(grd, nx, ny)
|
||||
register struct monst *grd;
|
||||
int nx, ny;
|
||||
gd_mv_monaway(struct monst *grd, int nx, int ny)
|
||||
{
|
||||
if (MON_AT(nx, ny) && !(nx == grd->mx && ny == grd->my)) {
|
||||
if (!Deaf)
|
||||
@@ -648,9 +629,7 @@ int nx, ny;
|
||||
/* have guard pick gold off the floor, possibly moving to the gold's
|
||||
position before message and back to his current spot after */
|
||||
static void
|
||||
gd_pick_corridor_gold(grd, goldx, goldy)
|
||||
struct monst *grd;
|
||||
int goldx, goldy; /* <gold->ox, gold->oy> */
|
||||
gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy)
|
||||
{
|
||||
struct obj *gold;
|
||||
coord newcc, bestcc;
|
||||
@@ -740,8 +719,7 @@ int goldx, goldy; /* <gold->ox, gold->oy> */
|
||||
* return 1: guard moved, 0: guard didn't, -1: let m_move do it, -2: died
|
||||
*/
|
||||
int
|
||||
gd_move(grd)
|
||||
register struct monst *grd;
|
||||
gd_move(struct monst *grd)
|
||||
{
|
||||
int x, y, nx, ny, m, n;
|
||||
int dx, dy, gx = 0, gy = 0, fci;
|
||||
@@ -1063,8 +1041,7 @@ register struct monst *grd;
|
||||
|
||||
/* Routine when dying or quitting with a vault guard around */
|
||||
void
|
||||
paygd(silently)
|
||||
boolean silently;
|
||||
paygd(boolean silently)
|
||||
{
|
||||
register struct monst *grd = findgd();
|
||||
long umoney = money_cnt(g.invent);
|
||||
@@ -1108,10 +1085,15 @@ boolean silently;
|
||||
return;
|
||||
}
|
||||
|
||||
/* amount of gold in carried containers */
|
||||
/*
|
||||
* amount of gold in carried containers
|
||||
*
|
||||
* even_if_unknown:
|
||||
* True: all gold
|
||||
* False: limit to known contents
|
||||
*/
|
||||
long
|
||||
hidden_gold(even_if_unknown)
|
||||
boolean even_if_unknown; /* True: all gold; False: limit to known contents */
|
||||
hidden_gold(boolean even_if_unknown)
|
||||
{
|
||||
long value = 0L;
|
||||
struct obj *obj;
|
||||
@@ -1126,7 +1108,7 @@ boolean even_if_unknown; /* True: all gold; False: limit to known contents */
|
||||
|
||||
/* prevent "You hear footsteps.." when inappropriate */
|
||||
boolean
|
||||
gd_sound()
|
||||
gd_sound(void)
|
||||
{
|
||||
struct monst *grd = findgd();
|
||||
|
||||
@@ -1137,8 +1119,7 @@ gd_sound()
|
||||
}
|
||||
|
||||
void
|
||||
vault_gd_watching(activity)
|
||||
unsigned int activity;
|
||||
vault_gd_watching(unsigned int activity)
|
||||
{
|
||||
struct monst *guard = findgd();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user