switch source tree from k&r to c99
This commit is contained in:
115
src/dbridge.c
115
src/dbridge.c
@@ -19,23 +19,22 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static void FDECL(get_wall_for_db, (int *, int *));
|
||||
static struct entity *FDECL(e_at, (int, int));
|
||||
static void FDECL(m_to_e, (struct monst *, int, int, struct entity *));
|
||||
static void FDECL(u_to_e, (struct entity *));
|
||||
static void FDECL(set_entity, (int, int, struct entity *));
|
||||
static const char *FDECL(e_nam, (struct entity *));
|
||||
static const char *FDECL(E_phrase, (struct entity *, const char *));
|
||||
static boolean FDECL(e_survives_at, (struct entity *, int, int));
|
||||
static void FDECL(e_died, (struct entity *, int, int));
|
||||
static boolean FDECL(automiss, (struct entity *));
|
||||
static boolean FDECL(e_missed, (struct entity *, BOOLEAN_P));
|
||||
static boolean FDECL(e_jumps, (struct entity *));
|
||||
static void FDECL(do_entity, (struct entity *));
|
||||
static void get_wall_for_db(int *, int *);
|
||||
static struct entity *e_at(int, int);
|
||||
static void m_to_e(struct monst *, int, int, struct entity *);
|
||||
static void u_to_e(struct entity *);
|
||||
static void set_entity(int, int, struct entity *);
|
||||
static const char *e_nam(struct entity *);
|
||||
static const char *E_phrase(struct entity *, const char *);
|
||||
static boolean e_survives_at(struct entity *, int, int);
|
||||
static void e_died(struct entity *, int, int);
|
||||
static boolean automiss(struct entity *);
|
||||
static boolean e_missed(struct entity *, boolean);
|
||||
static boolean e_jumps(struct entity *);
|
||||
static void do_entity(struct entity *);
|
||||
|
||||
boolean
|
||||
is_pool(x, y)
|
||||
int x, y;
|
||||
is_pool(int x, int y)
|
||||
{
|
||||
schar ltyp;
|
||||
|
||||
@@ -51,8 +50,7 @@ int x, y;
|
||||
}
|
||||
|
||||
boolean
|
||||
is_lava(x, y)
|
||||
int x, y;
|
||||
is_lava(int x, int y)
|
||||
{
|
||||
schar ltyp;
|
||||
|
||||
@@ -67,8 +65,7 @@ int x, y;
|
||||
}
|
||||
|
||||
boolean
|
||||
is_pool_or_lava(x, y)
|
||||
int x, y;
|
||||
is_pool_or_lava(int x, int y)
|
||||
{
|
||||
if (is_pool(x, y) || is_lava(x, y))
|
||||
return TRUE;
|
||||
@@ -77,8 +74,7 @@ int x, y;
|
||||
}
|
||||
|
||||
boolean
|
||||
is_ice(x, y)
|
||||
int x, y;
|
||||
is_ice(int x, int y)
|
||||
{
|
||||
schar ltyp;
|
||||
|
||||
@@ -92,8 +88,7 @@ int x, y;
|
||||
}
|
||||
|
||||
boolean
|
||||
is_moat(x, y)
|
||||
int x, y;
|
||||
is_moat(int x, int y)
|
||||
{
|
||||
schar ltyp;
|
||||
|
||||
@@ -109,8 +104,7 @@ int x, y;
|
||||
}
|
||||
|
||||
schar
|
||||
db_under_typ(mask)
|
||||
int mask;
|
||||
db_under_typ(int mask)
|
||||
{
|
||||
switch (mask & DB_UNDER) {
|
||||
case DB_ICE:
|
||||
@@ -132,8 +126,7 @@ int mask;
|
||||
*/
|
||||
|
||||
int
|
||||
is_drawbridge_wall(x, y)
|
||||
int x, y;
|
||||
is_drawbridge_wall(int x, int y)
|
||||
{
|
||||
struct rm *lev;
|
||||
|
||||
@@ -163,8 +156,7 @@ int x, y;
|
||||
* (instead of UP or DOWN, as with is_drawbridge_wall).
|
||||
*/
|
||||
boolean
|
||||
is_db_wall(x, y)
|
||||
int x, y;
|
||||
is_db_wall(int x, int y)
|
||||
{
|
||||
return (boolean) (levl[x][y].typ == DBWALL);
|
||||
}
|
||||
@@ -174,8 +166,7 @@ int x, y;
|
||||
* a drawbridge or drawbridge wall.
|
||||
*/
|
||||
boolean
|
||||
find_drawbridge(x, y)
|
||||
int *x, *y;
|
||||
find_drawbridge(int *x, int *y)
|
||||
{
|
||||
int dir;
|
||||
|
||||
@@ -206,8 +197,7 @@ int *x, *y;
|
||||
* Find the drawbridge wall associated with a drawbridge.
|
||||
*/
|
||||
static void
|
||||
get_wall_for_db(x, y)
|
||||
int *x, *y;
|
||||
get_wall_for_db(int *x, int *y)
|
||||
{
|
||||
switch (levl[*x][*y].drawbridgemask & DB_DIR) {
|
||||
case DB_NORTH:
|
||||
@@ -231,9 +221,7 @@ int *x, *y;
|
||||
* flag must be put to TRUE if we want the drawbridge to be opened.
|
||||
*/
|
||||
boolean
|
||||
create_drawbridge(x, y, dir, flag)
|
||||
int x, y, dir;
|
||||
boolean flag;
|
||||
create_drawbridge(int x, int y, int dir, boolean flag)
|
||||
{
|
||||
int x2, y2;
|
||||
boolean horiz;
|
||||
@@ -282,10 +270,8 @@ boolean flag;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
struct entity *
|
||||
e_at(x, y)
|
||||
int x, y;
|
||||
static struct entity *
|
||||
e_at(int x, int y)
|
||||
{
|
||||
int entitycnt;
|
||||
|
||||
@@ -302,10 +288,7 @@ int x, y;
|
||||
}
|
||||
|
||||
static void
|
||||
m_to_e(mtmp, x, y, etmp)
|
||||
struct monst *mtmp;
|
||||
int x, y;
|
||||
struct entity *etmp;
|
||||
m_to_e(struct monst *mtmp, int x, int y, struct entity *etmp)
|
||||
{
|
||||
etmp->emon = mtmp;
|
||||
if (mtmp) {
|
||||
@@ -320,8 +303,7 @@ struct entity *etmp;
|
||||
}
|
||||
|
||||
static void
|
||||
u_to_e(etmp)
|
||||
struct entity *etmp;
|
||||
u_to_e(struct entity *etmp)
|
||||
{
|
||||
etmp->emon = &g.youmonst;
|
||||
etmp->ex = u.ux;
|
||||
@@ -330,9 +312,7 @@ struct entity *etmp;
|
||||
}
|
||||
|
||||
static void
|
||||
set_entity(x, y, etmp)
|
||||
int x, y;
|
||||
struct entity *etmp;
|
||||
set_entity(int x, int y, struct entity *etmp)
|
||||
{
|
||||
if ((x == u.ux) && (y == u.uy))
|
||||
u_to_e(etmp);
|
||||
@@ -354,8 +334,7 @@ struct entity *etmp;
|
||||
/* #define e_strg(etmp, func) (is_u(etmp)? (char *)0 : func(etmp->emon)) */
|
||||
|
||||
static const char *
|
||||
e_nam(etmp)
|
||||
struct entity *etmp;
|
||||
e_nam(struct entity *etmp)
|
||||
{
|
||||
return is_u(etmp) ? "you" : mon_nam(etmp->emon);
|
||||
}
|
||||
@@ -365,9 +344,7 @@ struct entity *etmp;
|
||||
* verb, where necessary.
|
||||
*/
|
||||
static const char *
|
||||
E_phrase(etmp, verb)
|
||||
struct entity *etmp;
|
||||
const char *verb;
|
||||
E_phrase(struct entity *etmp, const char *verb)
|
||||
{
|
||||
static char wholebuf[80];
|
||||
|
||||
@@ -386,9 +363,7 @@ const char *verb;
|
||||
* Simple-minded "can it be here?" routine
|
||||
*/
|
||||
static boolean
|
||||
e_survives_at(etmp, x, y)
|
||||
struct entity *etmp;
|
||||
int x, y;
|
||||
e_survives_at(struct entity *etmp, int x, int y)
|
||||
{
|
||||
if (noncorporeal(etmp->edata))
|
||||
return TRUE;
|
||||
@@ -410,9 +385,7 @@ int x, y;
|
||||
}
|
||||
|
||||
static void
|
||||
e_died(etmp, xkill_flags, how)
|
||||
struct entity *etmp;
|
||||
int xkill_flags, how;
|
||||
e_died(struct entity *etmp, int xkill_flags, int how)
|
||||
{
|
||||
if (is_u(etmp)) {
|
||||
if (how == DROWNING) {
|
||||
@@ -474,8 +447,7 @@ int xkill_flags, how;
|
||||
* These are never directly affected by a bridge or portcullis.
|
||||
*/
|
||||
static boolean
|
||||
automiss(etmp)
|
||||
struct entity *etmp;
|
||||
automiss(struct entity *etmp)
|
||||
{
|
||||
return (boolean) ((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata))
|
||||
|| noncorporeal(etmp->edata));
|
||||
@@ -485,9 +457,7 @@ struct entity *etmp;
|
||||
* Does falling drawbridge or portcullis miss etmp?
|
||||
*/
|
||||
static boolean
|
||||
e_missed(etmp, chunks)
|
||||
struct entity *etmp;
|
||||
boolean chunks;
|
||||
e_missed(struct entity *etmp, boolean chunks)
|
||||
{
|
||||
int misses;
|
||||
|
||||
@@ -522,8 +492,7 @@ boolean chunks;
|
||||
* Can etmp jump from death?
|
||||
*/
|
||||
static boolean
|
||||
e_jumps(etmp)
|
||||
struct entity *etmp;
|
||||
e_jumps(struct entity *etmp)
|
||||
{
|
||||
int tmp = 4; /* out of 10 */
|
||||
|
||||
@@ -546,8 +515,7 @@ struct entity *etmp;
|
||||
}
|
||||
|
||||
static void
|
||||
do_entity(etmp)
|
||||
struct entity *etmp;
|
||||
do_entity(struct entity *etmp)
|
||||
{
|
||||
int newx, newy, at_portcullis, oldx, oldy;
|
||||
boolean must_jump = FALSE, relocates = FALSE, e_inview;
|
||||
@@ -756,8 +724,7 @@ struct entity *etmp;
|
||||
* Close the drawbridge located at x,y
|
||||
*/
|
||||
void
|
||||
close_drawbridge(x, y)
|
||||
int x, y;
|
||||
close_drawbridge(int x, int y)
|
||||
{
|
||||
register struct rm *lev1, *lev2;
|
||||
struct trap *t;
|
||||
@@ -818,8 +785,7 @@ int x, y;
|
||||
* Open the drawbridge located at x,y
|
||||
*/
|
||||
void
|
||||
open_drawbridge(x, y)
|
||||
int x, y;
|
||||
open_drawbridge(int x, int y)
|
||||
{
|
||||
register struct rm *lev1, *lev2;
|
||||
struct trap *t;
|
||||
@@ -865,8 +831,7 @@ int x, y;
|
||||
* Let's destroy the drawbridge located at x,y
|
||||
*/
|
||||
void
|
||||
destroy_drawbridge(x, y)
|
||||
int x, y;
|
||||
destroy_drawbridge(int x, int y)
|
||||
{
|
||||
register struct rm *lev1, *lev2;
|
||||
struct trap *t;
|
||||
|
||||
Reference in New Issue
Block a user