change xchar to other typedefs

One of the drivers of this change was that screen coordinates require a
type that can hold values greater than 127. Parameters to the window
port routines require a large type in order to be able to have values
a fair bit larger than COLNO and ROWNO passed to them, particularly for
their use to the right of the map window.

This splits the uses of xchar into 3 different situations, and adjusts
their type and size:

                        xchar
                          |
               -----------------------
               |          |          |
            coordxy     xint16     xint8

coordxy: Actual x or y coordinates for various things (moved to 16-bits).

xint16:  Same data size as coordxy, but for non-coordinate use (16-bits).

xint8:   There are only a few use cases initially, where it was very
         plain to see that the variable could remain as 8-bits, rather
         than be bumped to 16-bits.  There are probably more such cases
         that could be changed after additional review.

Note: This first changed all xchar variables to coordxy. Some were
reviewed and got changed to xint16 or xint8 when it became apparent that
their usage was not for coordinates.

This increments EDITLEVEL in patchlevel.h
This commit is contained in:
nhmall
2022-06-30 23:48:18 -04:00
parent 751b6e646f
commit 30b557f7d5
104 changed files with 1016 additions and 996 deletions
+1 -1
View File
@@ -267,7 +267,7 @@ moveloop_core(void)
if (!u.uinvulnerable) {
if (Teleportation && !rn2(85)) {
xchar old_ux = u.ux, old_uy = u.uy;
coordxy old_ux = u.ux, old_uy = u.uy;
tele();
if (u.ux != old_ux || u.uy != old_uy) {
+8 -8
View File
@@ -654,7 +654,7 @@ magic_whistled(struct obj *obj)
}
boolean
um_dist(xchar x, xchar y, xchar n)
um_dist(coordxy x, coordxy y, xint16 n)
{
return (boolean) (abs(u.ux - x) > n || abs(u.uy - y) > n);
}
@@ -889,7 +889,7 @@ next_to_u(void)
}
void
check_leash(xchar x, xchar y)
check_leash(coordxy x, coordxy y)
{
register struct obj *otmp;
register struct monst *mtmp;
@@ -1427,7 +1427,7 @@ snuff_candle(struct obj *otmp)
if ((candle || otmp->otyp == CANDELABRUM_OF_INVOCATION)
&& otmp->lamplit) {
char buf[BUFSZ];
xchar x, y;
coordxy x, y;
boolean many = candle ? (otmp->quan > 1L) : (otmp->spe > 1);
(void) get_obj_location(otmp, &x, &y, 0);
@@ -1447,7 +1447,7 @@ snuff_candle(struct obj *otmp)
boolean
snuff_lit(struct obj *obj)
{
xchar x, y;
coordxy x, y;
if (obj->lamplit) {
if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP
@@ -1491,7 +1491,7 @@ splash_lit(struct obj *obj)
/* don't assume that lit lantern has been swallowed;
a nymph might have stolen it or picked it up */
&& ((mtmp = obj->ocarry), humanoid(mtmp->data))) {
xchar x, y;
coordxy x, y;
useeit = get_obj_location(obj, &x, &y, 0) && cansee(x, y);
uhearit = couldsee(x, y) && distu(x, y) < 5 * 5;
@@ -1525,7 +1525,7 @@ splash_lit(struct obj *obj)
boolean
catch_lit(struct obj *obj)
{
xchar x, y;
coordxy x, y;
if (!obj->lamplit && ignitable(obj) && get_obj_location(obj, &x, &y, 0)) {
if (((obj->otyp == MAGIC_LAMP /* spe==0 => no djinni inside */
@@ -2380,7 +2380,7 @@ fig_transform(anything *arg, long timeout)
static boolean
figurine_location_checks(struct obj *obj, coord *cc, boolean quietly)
{
xchar x, y;
coordxy x, y;
if (carried(obj) && u.uswallow) {
if (!quietly)
@@ -2414,7 +2414,7 @@ static int
use_figurine(struct obj **optr)
{
register struct obj *obj = *optr;
xchar x, y;
coordxy x, y;
coord cc;
if (u.uswallow) {
+3 -3
View File
@@ -57,7 +57,7 @@ struct arti_info {
static struct arti_info artiexist[1 + NROFARTIFACTS];
/* discovery list; for N discovered artifacts, the first N entries are ART_xx
values in discovery order, the remaining (NROFARTIFACTS-N) slots are 0 */
static xchar artidisco[NROFARTIFACTS];
static xint16 artidisco[NROFARTIFACTS];
/* note: artiexist[] and artidisco[] don't need to be in struct g; they
* get explicitly initialized at game start so don't need to be part of
* bulk re-init if game restart ever gets implemented. They are saved
@@ -1001,7 +1001,7 @@ spec_dbon(struct obj *otmp, struct monst *mon, int tmp)
/* add identified artifact to discoveries list */
void
discover_artifact(xchar m)
discover_artifact(xint16 m)
{
int i;
@@ -1019,7 +1019,7 @@ discover_artifact(xchar m)
/* used to decide whether an artifact has been fully identified */
boolean
undiscovered_artifact(xchar m)
undiscovered_artifact(xint16 m)
{
int i;
+1 -1
View File
@@ -1025,7 +1025,7 @@ newhp(void)
hp = 1;
if (u.ulevel < MAXULEV) {
/* remember increment; future level drain could take it away again */
u.uhpinc[u.ulevel] = (xchar) hp;
u.uhpinc[u.ulevel] = (xint16) hp;
} else {
/* after level 30, throttle hit point gains from extra experience;
once max reaches 1200, further increments will be just 1 more */
+8 -8
View File
@@ -431,8 +431,8 @@ set_bc(int already_blind)
* Should not be called while swallowed.
*/
void
move_bc(int before, int control, xchar ballx, xchar bally,
xchar chainx, xchar chainy)
move_bc(int before, int control, coordxy ballx, coordxy bally,
coordxy chainx, coordxy chainy)
{
if (Blind) {
/*
@@ -554,8 +554,8 @@ move_bc(int before, int control, xchar ballx, xchar bally,
/* return TRUE if the caller needs to place the ball and chain down again */
boolean
drag_ball(xchar x, xchar y, int *bc_control,
xchar *ballx, xchar *bally, xchar *chainx, xchar *chainy,
drag_ball(coordxy x, coordxy y, int *bc_control,
coordxy *ballx, coordxy *bally, coordxy *chainx, coordxy *chainy,
boolean *cause_delay, boolean allow_drag)
{
struct trap *t = (struct trap *) 0;
@@ -589,7 +589,7 @@ drag_ball(xchar x, xchar y, int *bc_control,
/* only need to move the chain? */
if (carried(uball) || distmin(x, y, uball->ox, uball->oy) <= 2) {
xchar oldchainx = uchain->ox, oldchainy = uchain->oy;
coordxy oldchainx = uchain->ox, oldchainy = uchain->oy;
*bc_control = BC_CHAIN;
move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy);
@@ -646,7 +646,7 @@ drag_ball(xchar x, xchar y, int *bc_control,
* 0
*/
case 5: {
xchar tempx, tempy, tempx2, tempy2;
coordxy tempx, tempy, tempx2, tempy2;
/* find position closest to current position of chain;
no effect if current position is already OK */
@@ -835,7 +835,7 @@ drag_ball(xchar x, xchar y, int *bc_control,
*ballx = *chainx = x;
*bally = *chainy = y;
} else {
xchar newchainx = u.ux, newchainy = u.uy;
coordxy newchainx = u.ux, newchainy = u.uy;
/*
* Generally, chain moves to hero's previous location and ball
@@ -877,7 +877,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL
* Should not be called while swallowed.
*/
void
drop_ball(xchar x, xchar y)
drop_ball(coordxy x, coordxy y)
{
if (Blind) {
/* get the order */
+1 -1
View File
@@ -82,7 +82,7 @@ resetobjs(struct obj *ochain, boolean restore)
if (otmp->oclass == FOOD_CLASS && otmp->oeaten) {
struct obj *top;
char *p;
xchar ox, oy;
coordxy ox, oy;
for (top = otmp; top->where == OBJ_CONTAINED;
top = top->ocontainer)
+5 -5
View File
@@ -1144,7 +1144,7 @@ static int
wiz_where(void)
{
if (wizard)
(void) print_dungeon(FALSE, (schar *) 0, (xchar *) 0);
(void) print_dungeon(FALSE, (schar *) 0, (xint16 *) 0);
else
pline(unavailcmd, ecname_from_fn(wiz_where));
return ECMD_OK;
@@ -4383,10 +4383,10 @@ int
get_adjacent_loc(
const char *prompt,
const char *emsg,
xchar x, xchar y,
coordxy x, coordxy y,
coord *cc)
{
xchar new_x, new_y;
coordxy new_x, new_y;
if (!getdir(prompt)) {
pline1(Never_mind);
return 0;
@@ -5008,7 +5008,7 @@ there_cmd_menu_next2u(
}
static int
there_cmd_menu_far(winid win, xchar x, xchar y, int mod)
there_cmd_menu_far(winid win, coordxy x, coordxy y, int mod)
{
int K = 0;
@@ -5025,7 +5025,7 @@ there_cmd_menu_far(winid win, xchar x, xchar y, int mod)
static int
there_cmd_menu_common(
winid win,
xchar x UNUSED, xchar y UNUSED,
coordxy x UNUSED, coordxy y UNUSED,
int mod,
int *act UNUSED)
{
+1 -1
View File
@@ -34,7 +34,7 @@ static boolean e_jumps(struct entity *);
static void do_entity(struct entity *);
boolean
is_waterwall(xchar x, xchar y)
is_waterwall(coordxy x, coordxy y)
{
if (isok(x, y) && IS_WATERWALL(levl[x][y].typ))
return TRUE;
+4 -4
View File
@@ -19,7 +19,7 @@ static void map_monst(struct monst *, boolean);
static void do_dknown_of(struct obj *);
static boolean check_map_spot(int, int, char, unsigned);
static boolean clear_stale_map(char, unsigned);
static void sense_trap(struct trap *, xchar, xchar, int);
static void sense_trap(struct trap *, coordxy, coordxy, int);
static int detect_obj_traps(struct obj *, boolean, int);
static void display_trap_map(struct trap *, int);
static int furniture_detect(void);
@@ -837,7 +837,7 @@ monster_detect(struct obj *otmp, /* detecting object (if any) */
}
static void
sense_trap(struct trap *trap, xchar x, xchar y, int src_cursed)
sense_trap(struct trap *trap, coordxy x, coordxy y, int src_cursed)
{
if (Hallucination || src_cursed) {
struct obj obj; /* fake object */
@@ -885,7 +885,7 @@ detect_obj_traps(
int how) /* 1 for misleading map feedback */
{
struct obj *otmp;
xchar x, y;
coordxy x, y;
int result = OTRAP_NONE;
/*
@@ -1776,7 +1776,7 @@ mfind0(struct monst *mtmp, boolean via_warning)
int
dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */
{
xchar x, y;
coordxy x, y;
register struct trap *trap;
register struct monst *mtmp;
+13 -13
View File
@@ -6,7 +6,7 @@
#include "hack.h"
static boolean rm_waslit(void);
static void mkcavepos(xchar, xchar, int, boolean, boolean);
static void mkcavepos(coordxy, coordxy, int, boolean, boolean);
static void mkcavearea(boolean);
static int dig(void);
static void dig_up_grave(coord *);
@@ -28,7 +28,7 @@ enum dig_types {
static boolean
rm_waslit(void)
{
register xchar x, y;
register coordxy x, y;
if (levl[u.ux][u.uy].typ == ROOM && levl[u.ux][u.uy].waslit)
return TRUE;
@@ -44,7 +44,7 @@ rm_waslit(void)
* immediately after the effect is complete.
*/
static void
mkcavepos(xchar x, xchar y, int dist, boolean waslit, boolean rockit)
mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit)
{
register struct rm *lev;
@@ -87,9 +87,9 @@ static void
mkcavearea(boolean rockit)
{
int dist;
xchar xmin = u.ux, xmax = u.ux;
xchar ymin = u.uy, ymax = u.uy;
register xchar i;
coordxy xmin = u.ux, xmax = u.ux;
coordxy ymin = u.uy, ymax = u.uy;
register coordxy i;
register boolean waslit = rm_waslit();
if (rockit)
@@ -135,7 +135,7 @@ mkcavearea(boolean rockit)
/* When digging into location <x,y>, what are you actually digging into? */
int
dig_typ(struct obj *otmp, xchar x, xchar y)
dig_typ(struct obj *otmp, coordxy x, coordxy y)
{
boolean ispick;
@@ -231,7 +231,7 @@ static int
dig(void)
{
struct rm *lev;
xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y;
coordxy dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y;
boolean ispick = uwep && is_pick(uwep);
const char *verb = (!uwep || is_pick(uwep)) ? "dig into" : "chop through";
@@ -734,7 +734,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL
* in apply.c.
*/
void
liquid_flow(xchar x, xchar y, schar typ, struct trap *ttmp,
liquid_flow(coordxy x, coordxy y, schar typ, struct trap *ttmp,
const char *fillmsg)
{
struct obj *objchain;
@@ -773,7 +773,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc)
struct rm *lev;
struct obj *boulder_here;
schar typ, old_typ;
xchar dig_x, dig_y;
coordxy dig_x, dig_y;
boolean nohole, retval = FALSE;
if (!cc) {
@@ -901,7 +901,7 @@ static void
dig_up_grave(coord *cc)
{
struct obj *otmp;
xchar dig_x, dig_y;
coordxy dig_x, dig_y;
if (!cc) {
dig_x = u.ux;
@@ -1220,7 +1220,7 @@ watchman_canseeu(struct monst *mtmp)
* zap == TRUE if wand/spell of digging, FALSE otherwise (chewing)
*/
void
watch_dig(struct monst *mtmp, xchar x, xchar y, boolean zap)
watch_dig(struct monst *mtmp, coordxy x, coordxy y, boolean zap)
{
struct rm *lev = &levl[x][y];
@@ -1985,7 +1985,7 @@ rot_organic(anything *arg, long timeout UNUSED)
void
rot_corpse(anything *arg, long timeout)
{
xchar x = 0, y = 0;
coordxy x = 0, y = 0;
struct obj *obj = arg->a_obj;
boolean on_floor = obj->where == OBJ_FLOOR,
in_invent = obj->where == OBJ_INVENT;
+19 -19
View File
@@ -124,16 +124,16 @@
#include "hack.h"
static void show_mon_or_warn(int, int, int);
static void display_monster(xchar, xchar, struct monst *, int, boolean);
static void display_monster(coordxy, coordxy, struct monst *, int, boolean);
static int swallow_to_glyph(int, int);
static void display_warning(struct monst *);
static int check_pos(int, int, int);
static int get_bk_glyph(xchar x, xchar y);
static int get_bk_glyph(coordxy x, coordxy y);
static int tether_glyph(int, int);
static void mimic_light_blocking(struct monst *);
#ifdef UNBUFFERED_GLYPHINFO
static glyph_info *glyphinfo_at(xchar, xchar, int);
static glyph_info *glyphinfo_at(coordxy, coordxy, int);
#endif
/*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */
@@ -229,7 +229,7 @@ is_safemon(struct monst *mon)
* attention to and correct unexplored, lit ROOM and CORR spots.
*/
void
magic_map_background(xchar x, xchar y, int show)
magic_map_background(coordxy x, coordxy y, int show)
{
int glyph = back_to_glyph(x, y); /* assumes hero can see x,y */
struct rm *lev = &levl[x][y];
@@ -266,7 +266,7 @@ magic_map_background(xchar x, xchar y, int show)
* having to create fake objects and traps. However, I am reluctant to
* make this change.
*/
/* FIXME: some of these use xchars for x and y, and some use ints. Make
/* FIXME: some of these use coordxys for x and y, and some use ints. Make
* this consistent.
*/
@@ -277,7 +277,7 @@ magic_map_background(xchar x, xchar y, int show)
* the hero can physically see the location. Update the screen if directed.
*/
void
map_background(register xchar x, register xchar y, register int show)
map_background(register coordxy x, register coordxy y, register int show)
{
register int glyph = back_to_glyph(x, y);
@@ -341,7 +341,7 @@ map_object(register struct obj *obj, register int show)
* by newsym() if necessary.
*/
void
map_invisible(register xchar x, register xchar y)
map_invisible(register coordxy x, register coordxy y)
{
if (x != u.ux || y != u.uy) { /* don't display I at hero's location */
if (g.level.flags.hero_memory)
@@ -458,7 +458,7 @@ show_mon_or_warn(int x, int y, int monglyph)
*
*/
static void
display_monster(xchar x, xchar y, /* display position */
display_monster(coordxy x, coordxy y, /* display position */
struct monst *mon, /* monster to display */
int sightflags, /* 1 if the monster is physically seen;
2 if detected using Detect_monsters */
@@ -626,7 +626,7 @@ suppress_map_output(void)
* When hero knows what happened to location, even when blind.
*/
void
feel_newsym(xchar x, xchar y)
feel_newsym(coordxy x, coordxy y)
{
if (Blind)
feel_location(x, y);
@@ -646,7 +646,7 @@ feel_newsym(xchar x, xchar y)
* searching only finds one monster per turn so we must check that separately.
*/
void
feel_location(xchar x, xchar y)
feel_location(coordxy x, coordxy y)
{
struct rm *lev;
struct obj *boulder;
@@ -978,7 +978,7 @@ newsym(register int x, register int y)
* pulled into a platform dependent routine for fancier graphics if desired.
*/
void
shieldeff(xchar x, xchar y)
shieldeff(coordxy x, coordxy y)
{
register int i;
@@ -1198,7 +1198,7 @@ flash_glyph_at(int x, int y, int tg, int rpt)
void
swallowed(int first)
{
static xchar lastx, lasty; /* last swallowed position */
static coordxy lastx, lasty; /* last swallowed position */
int swallower, left_ok, rght_ok;
if (first) {
@@ -1261,7 +1261,7 @@ swallowed(int first)
void
under_water(int mode)
{
static xchar lastx, lasty;
static coordxy lastx, lasty;
static boolean dela;
register int x, y;
@@ -1600,7 +1600,7 @@ redraw_map(void)
void
reglyph_darkroom(void)
{
xchar x, y;
coordxy x, y;
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
@@ -1988,7 +1988,7 @@ flush_screen(int cursor_on_u)
* variables.
*/
int
back_to_glyph(xchar x, xchar y)
back_to_glyph(coordxy x, coordxy y)
{
int idx, bypass_glyph = NO_GLYPH;
struct rm *ptr = &(levl[x][y]);
@@ -2170,7 +2170,7 @@ zapdir_to_glyph(int dx, int dy, int beam_type)
* structure, so we must check the "third screen".
*/
int
glyph_at(xchar x, xchar y)
glyph_at(coordxy x, coordxy y)
{
if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO)
return cmap_to_glyph(S_room); /* XXX */
@@ -2179,7 +2179,7 @@ glyph_at(xchar x, xchar y)
#ifdef UNBUFFERED_GLYPHINFO
glyph_info *
glyphinfo_at(xchar x, xchar y, int glyph)
glyphinfo_at(coordxy x, coordxy y, int glyph)
{
map_glyphinfo(x, y, glyph, 0, &ginfo);
return &ginfo;
@@ -2200,7 +2200,7 @@ glyphinfo_at(xchar x, xchar y, int glyph)
*/
static int
get_bk_glyph(xchar x, xchar y)
get_bk_glyph(coordxy x, coordxy y)
{
int idx, bkglyph = GLYPH_UNEXPLORED;
struct rm *lev = &levl[x][y];
@@ -2272,7 +2272,7 @@ get_bk_glyph(xchar x, xchar y)
void
map_glyphinfo(
xchar x, xchar y,
coordxy x, coordxy y,
int glyph,
unsigned mgflags,
glyph_info *glyphinfo)
+5 -5
View File
@@ -18,7 +18,7 @@ static int menu_drop(int);
static NHFILE *currentlevel_rewrite(void);
static void final_level(void);
/* static boolean badspot(xchar,xchar); */
/* static boolean badspot(coordxy,coordxy); */
/* the #drop command: drop one inventory item */
int
@@ -1237,7 +1237,7 @@ save_currentstate(void)
/*
static boolean
badspot(register xchar x, register xchar y)
badspot(register coordxy x, register coordxy y)
{
return (boolean) ((levl[x][y].typ != ROOM
&& levl[x][y].typ != AIR
@@ -1295,7 +1295,7 @@ goto_level(
{
int l_idx, save_mode;
NHFILE *nhfp;
xchar new_ledger;
xint16 new_ledger;
boolean cant_go_back, great_effort,
up = (depth(newlevel) < depth(&u.uz)),
newdungeon = (u.uz.dnum != newlevel->dnum),
@@ -1890,7 +1890,7 @@ revive_corpse(struct obj *corpse)
{
struct monst *mtmp, *mcarry;
boolean is_uwep, chewed;
xchar where;
xint16 where;
char cname[BUFSZ];
struct obj *container = (struct obj *) 0;
int container_where = 0;
@@ -2005,7 +2005,7 @@ revive_mon(anything *arg, long timeout UNUSED)
struct obj *body = arg->a_obj;
struct permonst *mptr = &mons[body->corpsenm];
struct monst *mtmp;
xchar x, y;
coordxy x, y;
/* corpse will revive somewhere else if there is a monster in the way;
Riders get a chance to try to bump the obstacle out of their way */
+10 -8
View File
@@ -66,7 +66,7 @@ pet_type(void)
}
struct monst *
make_familiar(struct obj *otmp, xchar x, xchar y, boolean quietly)
make_familiar(struct obj *otmp, coordxy x, coordxy y, boolean quietly)
{
struct permonst *pm;
struct monst *mtmp = 0;
@@ -302,7 +302,8 @@ void
mon_arrive(struct monst *mtmp, boolean with_you)
{
struct trap *t;
xchar xlocale, ylocale, xyloc, xyflags, wander;
coordxy xlocale, ylocale, xyloc, xyflags;
xint16 wander;
int num_segs;
boolean failed_to_place = FALSE;
stairway *stway;
@@ -366,7 +367,7 @@ mon_arrive(struct monst *mtmp, boolean with_you)
mtmp->mlstmv = g.moves - 1L;
/* let monster move a bit on new level (see placement code below) */
wander = (xchar) min(nmv, 8);
wander = (xint16) min(nmv, 8);
} else
wander = 0;
@@ -716,12 +717,13 @@ keepdogs(
void
migrate_to_level(
struct monst *mtmp,
xchar tolev, /* destination level */
xchar xyloc, /* MIGR_xxx destination xy location: */
xint16 tolev, /* destination level */
xint16 xyloc, /* MIGR_xxx destination xy location: */
coord *cc) /* optional destination coordinates */
{
d_level new_lev;
xchar xyflags, mx = mtmp->mx, my = mtmp->my; /* <mx,my> needed below */
coordxy xyflags;
coordxy mx = mtmp->mx, my = mtmp->my; /* <mx,my> needed below */
int num_segs; /* count of worm segments */
if (mtmp->mleashed) {
@@ -735,8 +737,8 @@ migrate_to_level(
relmon(mtmp, &g.migrating_mons); /* mtmp->mx,my retain their value */
mtmp->mstate |= MON_MIGRATING;
new_lev.dnum = ledger_to_dnum((xchar) tolev);
new_lev.dlevel = ledger_to_dlev((xchar) tolev);
new_lev.dnum = ledger_to_dnum((xint16) tolev);
new_lev.dlevel = ledger_to_dlev((xint16) tolev);
/* overload mtmp->[mx,my], mtmp->[mux,muy], and mtmp->mtrack[] as
destination codes */
xyflags = (depth(&new_lev) < depth(&u.uz)); /* 1 => up */
+9 -9
View File
@@ -18,9 +18,9 @@ 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 boolean can_reach_location(struct monst *, coordxy, coordxy, coordxy,
coordxy);
static boolean could_reach_item(struct monst *, coordxy, coordxy);
static void quickmimic(struct monst *);
/* pick a carried item for pet to drop */
@@ -509,7 +509,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog,
register int omx, omy;
boolean in_masters_sight, dog_has_minvent;
register struct obj *obj;
xchar otyp;
xint16 otyp;
int appr;
/* Steeds don't move on their own will */
@@ -913,12 +913,12 @@ dog_move(register struct monst *mtmp,
int i, j, k;
register struct edog *edog = EDOG(mtmp);
struct obj *obj = (struct obj *) 0;
xchar otyp;
xint16 otyp;
boolean has_edog, cursemsg[9], do_eat = FALSE;
boolean better_with_displacing = FALSE;
xchar nix, niy; /* position mtmp is (considering) moving to */
coordxy nix, niy; /* position mtmp is (considering) moving to */
register int nx, ny; /* temporary coordinates */
xchar cnt, uncursedcnt, chcnt;
xint16 cnt, uncursedcnt, chcnt;
int chi = -1, nidist, ndist;
coord poss[9];
long info[9], allowflags;
@@ -1326,7 +1326,7 @@ dog_move(register struct monst *mtmp,
/* check if a monster could pick up objects from a location */
static boolean
could_reach_item(struct monst *mon, xchar nx, xchar ny)
could_reach_item(struct monst *mon, coordxy nx, coordxy ny)
{
if ((!is_pool(nx, ny) || is_swimmer(mon->data))
&& (!is_lava(nx, ny) || likes_lava(mon->data))
@@ -1343,7 +1343,7 @@ could_reach_item(struct monst *mon, xchar nx, xchar ny)
* calls deep.
*/
static boolean
can_reach_location(struct monst *mon, xchar mx, xchar my, xchar fx, xchar fy)
can_reach_location(struct monst *mon, coordxy mx, coordxy my, coordxy fx, coordxy fy)
{
int i, j;
int dist;
+19 -19
View File
@@ -12,17 +12,17 @@
/* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */
static void kickdmg(struct monst *, boolean);
static boolean maybe_kick_monster(struct monst *, xchar, xchar);
static void kick_monster(struct monst *, xchar, xchar);
static int kick_object(xchar, xchar, char *);
static int really_kick_object(xchar, xchar);
static boolean maybe_kick_monster(struct monst *, coordxy, coordxy);
static void kick_monster(struct monst *, coordxy, coordxy);
static int kick_object(coordxy, coordxy, char *);
static int really_kick_object(coordxy, coordxy);
static char *kickstr(char *, const char *);
static boolean watchman_thief_arrest(struct monst *);
static boolean watchman_door_damage(struct monst *, xchar, xchar);
static boolean watchman_door_damage(struct monst *, coordxy, coordxy);
static void kick_dumb(int, int);
static void kick_ouch(int, int, const char *);
static void otransit_msg(struct obj *, boolean, boolean, long);
static void drop_to(coord *, schar, xchar, xchar);
static void drop_to(coord *, schar, coordxy, coordxy);
static const char kick_passes_thru[] = "kick passes harmlessly through";
@@ -120,7 +120,7 @@ kickdmg(struct monst *mon, boolean clumsy)
}
static boolean
maybe_kick_monster(struct monst *mon, xchar x, xchar y)
maybe_kick_monster(struct monst *mon, coordxy x, coordxy y)
{
if (mon) {
boolean save_forcefight = g.context.forcefight;
@@ -140,7 +140,7 @@ maybe_kick_monster(struct monst *mon, xchar x, xchar y)
}
static void
kick_monster(struct monst *mon, xchar x, xchar y)
kick_monster(struct monst *mon, coordxy x, coordxy y)
{
boolean clumsy = FALSE;
int i, j;
@@ -389,8 +389,8 @@ ghitm(register struct monst *mtmp, register struct obj *gold)
/* container is kicked, dropped, thrown or otherwise impacted by player.
* Assumes container is on floor. Checks contents for possible damage. */
void
container_impact_dmg(struct obj *obj, xchar x,
xchar y) /* coordinates where object was before the impact, not after */
container_impact_dmg(struct obj *obj, coordxy x,
coordxy y) /* coordinates where object was before the impact, not after */
{
struct monst *shkp;
struct obj *otmp, *otmp2;
@@ -456,7 +456,7 @@ container_impact_dmg(struct obj *obj, xchar x,
/* jacket around really_kick_object */
static int
kick_object(xchar x, xchar y, char *kickobjnam)
kick_object(coordxy x, coordxy y, char *kickobjnam)
{
int res = 0;
@@ -474,7 +474,7 @@ kick_object(xchar x, xchar y, char *kickobjnam)
/* guts of kick_object */
static int
really_kick_object(xchar x, xchar y)
really_kick_object(coordxy x, coordxy y)
{
int range;
struct monst *mon, *shkp = 0;
@@ -785,7 +785,7 @@ watchman_thief_arrest(struct monst *mtmp)
}
static boolean
watchman_door_damage(struct monst *mtmp, xchar x, xchar y)
watchman_door_damage(struct monst *mtmp, coordxy x, coordxy y)
{
if (is_watch(mtmp->data) && mtmp->mpeaceful
&& couldsee(mtmp->mx, mtmp->my)) {
@@ -1390,7 +1390,7 @@ dokick(void)
}
static void
drop_to(coord *cc, schar loc, xchar x, xchar y)
drop_to(coord *cc, schar loc, coordxy x, coordxy y)
{
stairway *stway = stairway_at(x, y);
@@ -1428,8 +1428,8 @@ drop_to(coord *cc, schar loc, xchar x, xchar y)
/* player or missile impacts location, causing objects to fall down */
void
impact_drop(struct obj *missile, /* caused impact, won't drop itself */
xchar x, xchar y, /* location affected */
xchar dlev) /* if !0 send to dlev near player */
coordxy x, coordxy y, /* location affected */
xint16 dlev) /* if !0 send to dlev near player */
{
schar toloc;
register struct obj *obj, *obj2;
@@ -1554,10 +1554,10 @@ impact_drop(struct obj *missile, /* caused impact, won't drop itself */
* otmp is either a kicked, dropped, or thrown object.
*/
boolean
ship_object(struct obj *otmp, xchar x, xchar y, boolean shop_floor_obj)
ship_object(struct obj *otmp, coordxy x, coordxy y, boolean shop_floor_obj)
{
schar toloc;
xchar ox, oy;
coordxy ox, oy;
coord cc;
struct obj *obj;
struct trap *t;
@@ -1850,7 +1850,7 @@ otransit_msg(register struct obj *otmp, boolean nodrop, boolean chainthere, long
/* migration destination for objects which fall down to next level */
schar
down_gate(xchar x, xchar y)
down_gate(coordxy x, coordxy y)
{
struct trap *ttmp;
stairway *stway = stairway_at(x, y);
+7 -7
View File
@@ -15,7 +15,7 @@ static struct obj *find_launcher(struct obj *);
static int gem_accept(struct monst *, struct obj *);
static void tmiss(struct obj *, struct monst *, boolean);
static int throw_gold(struct obj *);
static void check_shop_obj(struct obj *, xchar, xchar, boolean);
static void check_shop_obj(struct obj *, coordxy, coordxy, boolean);
static boolean harmless_missile(struct obj *);
static void breakmsg(struct obj *, boolean);
static boolean toss_up(struct obj *, boolean);
@@ -864,7 +864,7 @@ hurtle_step(genericptr_t arg, int x, int y)
if ball is carried we might still need to drag the chain */
if (Punished) {
int bc_control;
xchar ballx, bally, chainx, chainy;
coordxy ballx, bally, chainx, chainy;
boolean cause_delay;
if (drag_ball(x, y, &bc_control, &ballx, &bally, &chainx,
@@ -1100,7 +1100,7 @@ mhurtle(struct monst *mon, int dx, int dy, int range)
}
static void
check_shop_obj(struct obj *obj, xchar x, xchar y, boolean broken)
check_shop_obj(struct obj *obj, coordxy x, coordxy y, boolean broken)
{
boolean costly_xy;
struct monst *shkp = shop_keeper(*u.ushops);
@@ -2198,7 +2198,7 @@ gem_accept(register struct monst *mon, register struct obj *obj)
*/
int
hero_breaks(struct obj *obj,
xchar x, xchar y, /* object location (ox, oy may not be right) */
coordxy x, coordxy y, /* object location (ox, oy may not be right) */
unsigned breakflags)
{
/* from_invent: thrown or dropped by player; maybe on shop bill;
@@ -2225,7 +2225,7 @@ hero_breaks(struct obj *obj,
*/
int
breaks(struct obj *obj,
xchar x, xchar y) /* object location (ox, oy may not be right) */
coordxy x, coordxy y) /* object location (ox, oy may not be right) */
{
boolean in_view = Blind ? FALSE : cansee(x, y);
@@ -2237,7 +2237,7 @@ breaks(struct obj *obj,
}
void
release_camera_demon(struct obj *obj, xchar x, xchar y)
release_camera_demon(struct obj *obj, coordxy x, coordxy y)
{
struct monst *mtmp;
if (!rn2(3)
@@ -2259,7 +2259,7 @@ release_camera_demon(struct obj *obj, xchar x, xchar y)
void
breakobj(
struct obj *obj,
xchar x, xchar y, /* object location (ox, oy may not be right) */
coordxy x, coordxy y, /* object location (ox, oy may not be right) */
boolean hero_caused, /* is this the hero's fault? */
boolean from_invent)
{
+48 -48
View File
@@ -28,25 +28,25 @@ struct lchoice {
int idx;
schar lev[MAXLINFO];
schar playerlev[MAXLINFO];
xchar dgn[MAXLINFO];
xint16 dgn[MAXLINFO];
char menuletter;
};
#if 0
static void Fread(genericptr_t, int, int, dlb *);
#endif
static xchar dname_to_dnum(const char *);
static xint16 dname_to_dnum(const char *);
static int find_branch(const char *, struct proto_dungeon *);
static xchar parent_dnum(const char *, struct proto_dungeon *);
static int level_range(xchar, int, int, int, struct proto_dungeon *,
static xint16 parent_dnum(const char *, struct proto_dungeon *);
static int level_range(xint16, int, int, int, struct proto_dungeon *,
int *);
static xchar parent_dlevel(const char *, struct proto_dungeon *);
static xint16 parent_dlevel(const char *, struct proto_dungeon *);
static int correct_branch_type(struct tmpbranch *);
static branch *add_branch(int, int, struct proto_dungeon *);
static void add_level(s_level *);
static void init_level(int, int, struct proto_dungeon *);
static int possible_places(int, boolean *, struct proto_dungeon *);
static xchar pick_level(boolean *, int);
static xint16 pick_level(boolean *, int);
static boolean place_level(int, struct proto_dungeon *);
static int get_dgn_flags(lua_State *);
static boolean unplaced_floater(struct dungeon *);
@@ -63,7 +63,7 @@ static mapseen *find_mapseen_by_str(const char *);
static void print_mapseen(winid, mapseen *, int, int, boolean);
static boolean interest_mapseen(mapseen *);
static void traverse_mapseenchn(boolean, winid, int, int, int *);
static const char *seen_string(xchar, const char *);
static const char *seen_string(xint16, const char *);
static const char *br_string2(branch *);
static const char *shop_string(int);
static char *tunesuffix(mapseen *, char *, size_t);
@@ -264,10 +264,10 @@ Fread(genericptr_t ptr, int size, int nitems, dlb *stream)
}
#endif
static xchar
static xint16
dname_to_dnum(const char *s)
{
xchar i;
xint16 i;
for (i = 0; i < g.n_dgns; i++)
if (!strcmp(g.dungeons[i].dname, s))
@@ -275,7 +275,7 @@ dname_to_dnum(const char *s)
panic("Couldn't resolve dungeon number for name \"%s\".", s);
/*NOT REACHED*/
return (xchar) 0;
return (xint16) 0;
}
s_level *
@@ -321,12 +321,12 @@ find_branch(const char *s, /* dungeon name */
* Find the "parent" by searching the prototype branch list for the branch
* listing, then figuring out to which dungeon it belongs.
*/
static xchar
static xint16
parent_dnum(const char *s, /* dungeon name */
struct proto_dungeon *pd)
{
int i;
xchar pdnum;
xint16 pdnum;
i = find_branch(s, pd);
/*
@@ -339,7 +339,7 @@ parent_dnum(const char *s, /* dungeon name */
panic("parent_dnum: couldn't resolve branch.");
/*NOT REACHED*/
return (xchar) 0;
return (xint16) 0;
}
/*
@@ -353,7 +353,7 @@ parent_dnum(const char *s, /* dungeon name */
* end of the dungeon.
*/
static int
level_range(xchar dgn, int base, int randc, int chain,
level_range(xint16 dgn, int base, int randc, int chain,
struct proto_dungeon *pd, int *adjusted_base)
{
int lmax = g.dungeons[dgn].num_dunlevs;
@@ -384,7 +384,7 @@ level_range(xchar dgn, int base, int randc, int chain,
return 1;
}
static xchar
static xint16
parent_dlevel(const char *s, struct proto_dungeon *pd)
{
int i, j, num, base, dnum = parent_dnum(s, pd);
@@ -593,14 +593,14 @@ possible_places(int idx, /* prototype index */
}
/* Pick the nth TRUE entry in the given boolean array. */
static xchar
static xint16
pick_level(boolean *map, /* an array MAXLEVEL+1 in size */
int nth)
{
int i;
xint16 i;
for (i = 1; i <= MAXLEVEL; i++)
if (map[i] && !nth--)
return (xchar) i;
return i;
panic("pick_level: ran out of valid levels");
return 0;
}
@@ -1009,9 +1009,9 @@ init_dungeons(void)
free((genericptr) dgn_themerms);
if (dgn_range)
g.dungeons[i].num_dunlevs = (xchar) rn1(dgn_range, dgn_base);
g.dungeons[i].num_dunlevs = (xint16) rn1(dgn_range, dgn_base);
else
g.dungeons[i].num_dunlevs = (xchar) dgn_base;
g.dungeons[i].num_dunlevs = (xint16) dgn_base;
if (!i) {
g.dungeons[i].ledger_start = 0;
@@ -1197,21 +1197,21 @@ init_dungeons(void)
}
/* return the level number for lev in *this* dungeon */
xchar
xint16
dunlev(d_level *lev)
{
return lev->dlevel;
}
/* return the lowest level number for *this* dungeon */
xchar
xint16
dunlevs_in_dungeon(d_level *lev)
{
return g.dungeons[lev->dnum].num_dunlevs;
}
/* return the lowest level explored in the game*/
xchar
xint16
deepest_lev_reached(boolean noquest)
{
/* this function is used for three purposes: to provide a factor
@@ -1231,7 +1231,7 @@ deepest_lev_reached(boolean noquest)
*/
register int i;
d_level tmp;
register schar ret = 0;
xint16 ret = 0;
for (i = 0; i < g.n_dgns; i++) {
if (noquest && i == quest_dnum)
@@ -1243,15 +1243,15 @@ deepest_lev_reached(boolean noquest)
if (depth(&tmp) > ret)
ret = depth(&tmp);
}
return (xchar) ret;
return ret;
}
/* return a bookkeeping level number for purpose of comparisons and
save/restore */
xchar
xint16
ledger_no(d_level *lev)
{
return (xchar) (lev->dlevel + g.dungeons[lev->dnum].ledger_start);
return (xint16) (lev->dlevel + g.dungeons[lev->dnum].ledger_start);
}
/*
@@ -1264,36 +1264,36 @@ ledger_no(d_level *lev)
* not be confused with deepest_lev_reached() -- which returns the lowest
* depth visited by the player.
*/
xchar
xint16
maxledgerno(void)
{
return (xchar) (g.dungeons[g.n_dgns - 1].ledger_start
return (xint16) (g.dungeons[g.n_dgns - 1].ledger_start
+ g.dungeons[g.n_dgns - 1].num_dunlevs);
}
/* return the dungeon that this ledgerno exists in */
xchar
ledger_to_dnum(xchar ledgerno)
xint16
ledger_to_dnum(xint16 ledgerno)
{
register int i;
xint16 i;
/* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */
for (i = 0; i < g.n_dgns; i++)
if (g.dungeons[i].ledger_start < ledgerno
&& (ledgerno
<= g.dungeons[i].ledger_start + g.dungeons[i].num_dunlevs))
return (xchar) i;
return i;
panic("level number out of range [ledger_to_dnum(%d)]", (int) ledgerno);
/*NOT REACHED*/
return (xchar) 0;
return (xint16) 0;
}
/* return the level of the dungeon this ledgerno exists in */
xchar
ledger_to_dlev(xchar ledgerno)
xint16
ledger_to_dlev(xint16 ledgerno)
{
return (xchar) (ledgerno
return (xint16) (ledgerno
- g.dungeons[ledger_to_dnum(ledgerno)].ledger_start);
}
@@ -1599,13 +1599,13 @@ u_on_dnstairs(void)
}
boolean
On_stairs(xchar x, xchar y)
On_stairs(coordxy x, coordxy y)
{
return (stairway_at(x,y) != NULL);
}
boolean
On_ladder(xchar x, xchar y)
On_ladder(coordxy x, coordxy y)
{
stairway *stway = stairway_at(x,y);
@@ -1613,7 +1613,7 @@ On_ladder(xchar x, xchar y)
}
boolean
On_stairs_up(xchar x, xchar y)
On_stairs_up(coordxy x, coordxy y)
{
stairway *stway = stairway_at(x,y);
@@ -1621,7 +1621,7 @@ On_stairs_up(xchar x, xchar y)
}
boolean
On_stairs_dn(xchar x, xchar y)
On_stairs_dn(coordxy x, coordxy y)
{
stairway *stway = stairway_at(x,y);
@@ -1697,7 +1697,7 @@ void
get_level(d_level *newlevel, int levnum)
{
branch *br;
xchar dgn = u.uz.dnum;
xint16 dgn = u.uz.dnum;
if (levnum <= 0) {
/* can only currently happen in endgame */
@@ -1765,7 +1765,7 @@ branch *
dungeon_branch(const char *s)
{
branch *br;
xchar dnum;
xint16 dnum;
dnum = dname_to_dnum(s);
@@ -1918,10 +1918,10 @@ Invocation_lev(d_level *lev)
/* use instead of depth() wherever a degree of difficulty is made
* dependent on the location in the dungeon (eg. monster creation).
*/
xchar
xint16
level_difficulty(void)
{
int res;
xint16 res;
if (In_endgame(&u.uz)) {
res = depth(&sanctum_level) + u.ulevel / 2;
@@ -1972,7 +1972,7 @@ level_difficulty(void)
*/
#endif /*0*/
}
return (xchar) res;
return res;
}
/* Take one word and try to match it to a level.
@@ -2225,7 +2225,7 @@ print_branch(winid win, int dnum, int lower_bound, int upper_bound,
/* Print available dungeon information. */
schar
print_dungeon(boolean bymenu, schar *rlev, xchar *rdgn)
print_dungeon(boolean bymenu, schar *rlev, xint16 *rdgn)
{
int i, last_level, nlev;
char buf[BUFSZ];
@@ -3140,7 +3140,7 @@ traverse_mapseenchn(boolean viewendgame, winid win, int why, int reason,
}
static const char *
seen_string(xchar x, const char *obj)
seen_string(xint16 x, const char *obj)
{
/* players are computer scientists: 0, 1, 2, n */
switch (x) {
+7 -7
View File
@@ -249,7 +249,7 @@ ceiling(int x, int y)
}
struct engr *
engr_at(xchar x, xchar y)
engr_at(coordxy x, coordxy y)
{
register struct engr *ep = head_engr;
@@ -269,7 +269,7 @@ engr_at(xchar x, xchar y)
* present if it is intact and is the entire content of the engraving.
*/
boolean
sengr_at(const char *s, xchar x, xchar y, boolean strict)
sengr_at(const char *s, coordxy x, coordxy y, boolean strict)
{
register struct engr *ep = engr_at(x, y);
@@ -288,7 +288,7 @@ u_wipe_engr(int cnt)
}
void
wipe_engr_at(xchar x, xchar y, xchar cnt, boolean magical)
wipe_engr_at(coordxy x, coordxy y, xint16 cnt, boolean magical)
{
register struct engr *ep = engr_at(x, y);
@@ -384,7 +384,7 @@ read_engr_at(int x, int y)
}
void
make_engr_at(int x, int y, const char *s, long e_time, xchar e_type)
make_engr_at(int x, int y, const char *s, long e_time, xint16 e_type)
{
struct engr *ep;
unsigned smem = Strlen(s) + 1;
@@ -524,8 +524,8 @@ doengrave(void)
boolean ptext = TRUE; /* TRUE if we must prompt for engrave text */
boolean teleengr = FALSE; /* TRUE if we move the old engraving */
boolean zapwand = FALSE; /* TRUE if we remove a wand charge */
xchar type = DUST; /* Type of engraving made */
xchar oetype = 0; /* will be set to type of current engraving */
xint16 type = DUST; /* Type of engraving made */
xint16 oetype = 0; /* will be set to type of current engraving */
char buf[BUFSZ]; /* Buffer for final/poly engraving text */
char ebuf[BUFSZ]; /* Buffer for initial engraving text */
char fbuf[BUFSZ]; /* Buffer for "your fingers" */
@@ -703,7 +703,7 @@ doengrave(void)
case WAN_POLYMORPH:
if (oep) {
if (!Blind) {
type = (xchar) 0; /* random */
type = (xint16) 0; /* random */
(void) random_engraving(buf);
} else {
/* keep the same type so that feels don't
+1 -1
View File
@@ -67,7 +67,7 @@ newpw(void)
en = 1;
if (u.ulevel < MAXULEV) {
/* remember increment; future level drain could take it away again */
u.ueninc[u.ulevel] = (xchar) en;
u.ueninc[u.ulevel] = (xint16) en;
} else {
/* after level 30, throttle energy gains from extra experience;
once max reaches 600, further increments will be just 1 more */
+5 -5
View File
@@ -349,8 +349,8 @@ explode(
/* Affect the floor unless the player caused the explosion from
* inside their engulfer. */
if (!(u.uswallow && !g.context.mon_moving))
(void) zap_over_floor((xchar) (i + x - 1),
(xchar) (j + y - 1), type,
(void) zap_over_floor((coordxy) (i + x - 1),
(coordxy) (j + y - 1), type,
&shopdamage, exploding_wand_typ);
mtmp = m_at(i + x - 1, j + y - 1);
@@ -619,8 +619,8 @@ explode(
struct scatter_chain {
struct scatter_chain *next; /* pointer to next scatter item */
struct obj *obj; /* pointer to the object */
xchar ox; /* location of */
xchar oy; /* item */
coordxy ox; /* location of */
coordxy oy; /* item */
schar dx; /* direction of */
schar dy; /* travel */
int range; /* range of object */
@@ -721,7 +721,7 @@ scatter(int sx, int sy, /* location of objects to scatter */
} else if ((scflags & MAY_DESTROY) != 0
&& (!rn2(10) || (objects[otmp->otyp].oc_material == GLASS
|| otmp->otyp == EGG))) {
if (breaks(otmp, (xchar) sx, (xchar) sy))
if (breaks(otmp, (coordxy) sx, (coordxy) sy))
used_up = TRUE;
}
+5 -5
View File
@@ -3681,7 +3681,7 @@ recover_savefile(void)
{
NHFILE *gnhfp, *lnhfp, *snhfp;
int lev, savelev, hpid, pltmpsiz, filecmc;
xchar levc;
xint16 levc;
struct version_info version_data;
int processed[256];
char savename[SAVESIZE], errbuf[BUFSZ], indicator;
@@ -3820,14 +3820,14 @@ recover_savefile(void)
processed[0] = 1;
for (lev = 1; lev < 256; lev++) {
/* level numbers are kept in xchars in save.c, so the
/* level numbers are kept in xint16s in save.c, so the
* maximum level number (for the endlevel) must be < 256
*/
if (lev != savelev) {
lnhfp = open_levelfile(lev, (char *) 0);
if (lnhfp) {
/* any or all of these may not exist */
levc = (xchar) lev;
levc = (xint16) lev;
write(snhfp->fd, (genericptr_t) &levc, sizeof(levc));
if (!copy_bytes(lnhfp->fd, snhfp->fd)) {
close_nhfile(lnhfp);
@@ -4257,14 +4257,14 @@ choose_passage(int passagecnt, /* total of available passages */
/* collect all of the N indices */
g.context.novel.count = passagecnt;
for (idx = 0; idx < MAXPASSAGES; idx++)
g.context.novel.pasg[idx] = (xchar) ((idx < passagecnt)
g.context.novel.pasg[idx] = (xint16) ((idx < passagecnt)
? idx + 1 : 0);
} else {
/* collect MAXPASSAGES of the N indices */
g.context.novel.count = MAXPASSAGES;
for (idx = i = 0; i < passagecnt; ++i, --range)
if (range > 0 && rn2(range) < limit) {
g.context.novel.pasg[idx++] = (xchar) (i + 1);
g.context.novel.pasg[idx++] = (xint16) (i + 1);
--limit;
}
}
+1 -1
View File
@@ -187,7 +187,7 @@ watchman_warn_fountain(struct monst *mtmp)
}
void
dryup(xchar x, xchar y, boolean isyou)
dryup(coordxy x, coordxy y, boolean isyou)
{
if (IS_FOUNTAIN(levl[x][y].typ)
&& (!rn2(3) || FOUNTAIN_IS_WARNED(x, y))) {
+42 -42
View File
@@ -12,23 +12,23 @@ static int moverock(void);
static void dosinkfall(void);
static boolean findtravelpath(int);
static boolean trapmove(int, int, struct trap *);
static void check_buried_zombies(xchar, xchar);
static schar u_simple_floortyp(xchar, xchar);
static boolean swim_move_danger(xchar, xchar);
static void check_buried_zombies(coordxy, coordxy);
static schar u_simple_floortyp(coordxy, coordxy);
static boolean swim_move_danger(coordxy, coordxy);
static boolean domove_bump_mon(struct monst *, int);
static boolean domove_attackmon_at(struct monst *, xchar, xchar, boolean *);
static boolean domove_fight_ironbars(xchar, xchar);
static boolean domove_swap_with_pet(struct monst *, xchar, xchar);
static boolean domove_fight_empty(xchar, xchar);
static boolean domove_attackmon_at(struct monst *, coordxy, coordxy, boolean *);
static boolean domove_fight_ironbars(coordxy, coordxy);
static boolean domove_swap_with_pet(struct monst *, coordxy, coordxy);
static boolean domove_fight_empty(coordxy, coordxy);
static boolean air_turbulence(void);
static void slippery_ice_fumbling(void);
static boolean impaired_movement(xchar *, xchar *);
static boolean avoid_moving_on_trap(xchar, xchar, boolean);
static boolean avoid_moving_on_liquid(xchar, xchar, boolean);
static boolean avoid_running_into_trap_or_liquid(xchar, xchar);
static boolean move_out_of_bounds(xchar, xchar);
static boolean impaired_movement(coordxy *, coordxy *);
static boolean avoid_moving_on_trap(coordxy, coordxy, boolean);
static boolean avoid_moving_on_liquid(coordxy, coordxy, boolean);
static boolean avoid_running_into_trap_or_liquid(coordxy, coordxy);
static boolean move_out_of_bounds(coordxy, coordxy);
static boolean carrying_too_much(void);
static boolean escape_from_sticky_mon(xchar, xchar);
static boolean escape_from_sticky_mon(coordxy, coordxy);
static void domove_core(void);
static void maybe_smudge_engr(int, int, int, int);
static struct monst *monstinroom(struct permonst *, int);
@@ -139,7 +139,7 @@ could_move_onto_boulder(int sx, int sy)
static int
moverock(void)
{
register xchar rx, ry, sx, sy;
register coordxy rx, ry, sx, sy;
struct obj *otmp;
struct trap *ttmp;
struct monst *mtmp;
@@ -511,7 +511,7 @@ moverock(void)
* Returns TRUE if still eating, FALSE when done.
*/
int
still_chewing(xchar x, xchar y)
still_chewing(coordxy x, coordxy y)
{
struct rm *lev = &levl[x][y];
struct obj *boulder = sobj_at(BOULDER, x, y);
@@ -689,7 +689,7 @@ still_chewing(xchar x, xchar y)
}
void
movobj(struct obj *obj, xchar ox, xchar oy)
movobj(struct obj *obj, coordxy ox, coordxy oy)
{
/* optimize by leaving on the fobj chain? */
remove_object(obj);
@@ -787,7 +787,7 @@ dosinkfall(void)
/* intended to be called only on ROCKs or TREEs */
boolean
may_dig(register xchar x, register xchar y)
may_dig(register coordxy x, register coordxy y)
{
struct rm *lev = &levl[x][y];
@@ -796,14 +796,14 @@ may_dig(register xchar x, register xchar y)
}
boolean
may_passwall(register xchar x, register xchar y)
may_passwall(register coordxy x, register coordxy y)
{
return (boolean) !(IS_STWALL(levl[x][y].typ)
&& (levl[x][y].wall_info & W_NONPASSWALL));
}
boolean
bad_rock(struct permonst *mdat, register xchar x, register xchar y)
bad_rock(struct permonst *mdat, register coordxy x, register coordxy y)
{
return (boolean) ((Sokoban && sobj_at(BOULDER, x, y))
|| (IS_ROCK(levl[x][y].typ)
@@ -843,7 +843,7 @@ cant_squeeze_thru(struct monst *mon)
}
boolean
invocation_pos(xchar x, xchar y)
invocation_pos(coordxy x, coordxy y)
{
return (boolean) (Invocation_lev(&u.uz)
&& x == g.inv_pos.x && y == g.inv_pos.y);
@@ -1121,10 +1121,10 @@ findtravelpath(int mode)
g.context.run = 8;
}
if (u.tx != u.ux || u.ty != u.uy) {
xchar travel[COLNO][ROWNO];
xchar travelstepx[2][COLNO * ROWNO];
xchar travelstepy[2][COLNO * ROWNO];
xchar tx, ty, ux, uy;
coordxy travel[COLNO][ROWNO];
coordxy travelstepx[2][COLNO * ROWNO];
coordxy travelstepy[2][COLNO * ROWNO];
coordxy tx, ty, ux, uy;
int n = 1; /* max offset in travelsteps */
int set = 0; /* two sets current and previous */
int radius = 1; /* search radius */
@@ -1538,7 +1538,7 @@ u_rooted(void)
/* reduce zombification timeout of buried zombies around px, py */
static void
check_buried_zombies(xchar x, xchar y)
check_buried_zombies(coordxy x, coordxy y)
{
struct obj *otmp;
long t;
@@ -1568,7 +1568,7 @@ u_locomotion(const char *def)
/* Return a simplified floor solid/liquid state based on hero's state */
static schar
u_simple_floortyp(xchar x, xchar y)
u_simple_floortyp(coordxy x, coordxy y)
{
boolean u_in_air = (Levitation || Flying || !grounded(g.youmonst.data));
@@ -1585,7 +1585,7 @@ u_simple_floortyp(xchar x, xchar y)
/* Is it dangerous for hero to move to x,y due to water or lava? */
static boolean
swim_move_danger(xchar x, xchar y)
swim_move_danger(coordxy x, coordxy y)
{
schar newtyp = u_simple_floortyp(x, y);
boolean liquid_wall = IS_WATERWALL(newtyp);
@@ -1660,7 +1660,7 @@ domove_bump_mon(struct monst *mtmp, int glyph)
sets displaceu, if hero and monster could swap places instead.
*/
static boolean
domove_attackmon_at(struct monst *mtmp, xchar x, xchar y, boolean *displaceu)
domove_attackmon_at(struct monst *mtmp, coordxy x, coordxy y, boolean *displaceu)
{
/* only attack if we know it's there */
/* or if we used the 'F' command to fight blindly */
@@ -1695,7 +1695,7 @@ domove_attackmon_at(struct monst *mtmp, xchar x, xchar y, boolean *displaceu)
/* force-fight iron bars with your weapon? */
static boolean
domove_fight_ironbars(xchar x, xchar y)
domove_fight_ironbars(coordxy x, coordxy y)
{
if (g.context.forcefight && levl[x][y].typ == IRONBARS && uwep) {
struct obj *obj = uwep;
@@ -1720,7 +1720,7 @@ domove_fight_ironbars(xchar x, xchar y)
/* maybe swap places with a pet? returns TRUE if swapped places */
static boolean
domove_swap_with_pet(struct monst *mtmp, xchar x, xchar y)
domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y)
{
struct trap *trap;
/* if it turns out we can't actually move */
@@ -1839,7 +1839,7 @@ domove_swap_with_pet(struct monst *mtmp, xchar x, xchar y)
/* force-fight (x,y) which doesn't have anything to fight */
static boolean
domove_fight_empty(xchar x, xchar y)
domove_fight_empty(coordxy x, coordxy y)
{
static const char unknown_obstacle[] = "an unknown obstacle";
boolean off_edge = !isok(x, y);
@@ -1972,7 +1972,7 @@ air_turbulence(void)
/* does water disturb the movement? */
static boolean
water_turbulence(xchar *x, xchar *y)
water_turbulence(coordxy *x, coordxy *y)
{
if (u.uinwater) {
int wtcap;
@@ -2028,7 +2028,7 @@ slippery_ice_fumbling(void)
/* change movement dir if impaired. return TRUE if can't move */
static boolean
impaired_movement(xchar *x, xchar *y)
impaired_movement(coordxy *x, coordxy *y)
{
if (Stunned || (Confusion && !rn2(5))) {
register int tries = 0;
@@ -2047,7 +2047,7 @@ impaired_movement(xchar *x, xchar *y)
}
static boolean
avoid_moving_on_trap(xchar x, xchar y, boolean msg)
avoid_moving_on_trap(coordxy x, coordxy y, boolean msg)
{
struct trap *trap;
@@ -2061,7 +2061,7 @@ avoid_moving_on_trap(xchar x, xchar y, boolean msg)
}
static boolean
avoid_moving_on_liquid(xchar x, xchar y, boolean msg)
avoid_moving_on_liquid(coordxy x, coordxy y, boolean msg)
{
if (!Levitation && !Flying && !is_clinger(g.youmonst.data)
&& is_pool_or_lava(x, y) && levl[x][y].seenv) {
@@ -2076,7 +2076,7 @@ avoid_moving_on_liquid(xchar x, xchar y, boolean msg)
/* when running/rushing, avoid stepping on a known trap or pool of liquid.
returns TRUE if avoided. */
static boolean
avoid_running_into_trap_or_liquid(xchar x, xchar y)
avoid_running_into_trap_or_liquid(coordxy x, coordxy y)
{
if (!g.context.run)
return FALSE;
@@ -2096,7 +2096,7 @@ avoid_running_into_trap_or_liquid(xchar x, xchar y)
/* trying to move out-of-bounds? */
static boolean
move_out_of_bounds(xchar x, xchar y)
move_out_of_bounds(coordxy x, coordxy y)
{
if (!isok(x, y)) {
if (g.context.forcefight)
@@ -2149,7 +2149,7 @@ carrying_too_much(void)
/* try to pull free from sticking monster, or you release a monster
you're sticking to. returns TRUE if you lose your movement. */
static boolean
escape_from_sticky_mon(xchar x, xchar y)
escape_from_sticky_mon(coordxy x, coordxy y)
{
if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) {
struct monst *mtmp;
@@ -2220,10 +2220,10 @@ domove_core(void)
{
register struct monst *mtmp;
register struct rm *tmpr;
xchar x, y;
coordxy x, y;
struct trap *trap = NULL;
int glyph;
xchar chainx = 0, chainy = 0,
coordxy chainx = 0, chainy = 0,
ballx = 0, bally = 0; /* ball&chain new positions */
int bc_control = 0; /* control for ball&chain */
boolean cause_delay = FALSE, /* dragging ball will skip a move */
@@ -2852,7 +2852,7 @@ monstinroom(struct permonst *mdat, int roomno)
}
char *
in_rooms(register xchar x, register xchar y, register int typewanted)
in_rooms(register coordxy x, register coordxy y, register int typewanted)
{
static char buf[5];
char rno, *ptr = &buf[4];
@@ -3753,7 +3753,7 @@ money_cnt(struct obj *otmp)
}
void
spot_checks(xchar x, xchar y, schar old_typ)
spot_checks(coordxy x, coordxy y, schar old_typ)
{
schar new_typ = levl[x][y].typ;
boolean db_ice_now = FALSE;
+5 -5
View File
@@ -86,7 +86,7 @@ loot_classify(Loot *sort_item, struct obj *obj)
k = 1 + (int) (p - classorder);
else
k = 1 + (int) strlen(classorder) + (oclass != VENOM_CLASS);
sort_item->orderclass = (xchar) k;
sort_item->orderclass = (coordxy) k;
/* subclass designation; only a few classes have subclasses
and the non-armor ones we use are fairly arbitrary */
switch (oclass) {
@@ -202,13 +202,13 @@ loot_classify(Loot *sort_item, struct obj *obj)
k = 1; /* any non-zero would do */
break;
}
sort_item->subclass = (xchar) k;
sort_item->subclass = (coordxy) k;
/* discovery status */
k = !seen ? 1 /* unseen */
: (discovered || !OBJ_DESCR(objects[otyp])) ? 4
: (objects[otyp].oc_uname) ? 3 /* named (partially discovered) */
: 2; /* undiscovered */
sort_item->disco = (xchar) k;
sort_item->disco = (coordxy) k;
}
/* sortloot() formatting routine; for alphabetizing, not shown to user */
@@ -2283,7 +2283,7 @@ fully_identify_obj(struct obj *otmp)
{
makeknown(otmp->otyp);
if (otmp->oartifact)
discover_artifact((xchar) otmp->oartifact);
discover_artifact((coordxy) otmp->oartifact);
otmp->known = otmp->dknown = otmp->bknown = otmp->rknown = 1;
set_cknown_lknown(otmp); /* set otmp->{cknown,lknown} if applicable */
if (otmp->otyp == EGG && otmp->corpsenm != NON_PM)
@@ -3634,7 +3634,7 @@ count_contents(struct obj *container,
long count = 0L;
if (!everything && !newdrop) {
xchar x, y;
coordxy x, y;
for (topc = container; topc->where == OBJ_CONTAINED;
topc = topc->ocontainer)
+8 -8
View File
@@ -41,27 +41,27 @@
#define LSF_SHOW 0x1 /* display the light source */
#define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */
static light_source *new_light_core(xchar, xchar, int, int, anything *);
static light_source *new_light_core(coordxy, coordxy, int, int, anything *);
static void discard_flashes(void);
static void write_ls(NHFILE *, light_source *);
static int maybe_write_ls(NHFILE *, int, boolean);
/* imported from vision.c, for small circles */
extern xchar circle_data[];
extern xchar circle_start[];
extern coordxy circle_data[];
extern coordxy circle_start[];
/* Create a new light source. Caller (and extern.h) doesn't need to know
anything about type 'light_source'. */
void
new_light_source(xchar x, xchar y, int range, int type, anything *id)
new_light_source(coordxy x, coordxy y, int range, int type, anything *id)
{
(void) new_light_core(x, y, range, type, id);
}
/* Create a new light source and return it. Only used within this file. */
static light_source *
new_light_core(xchar x, xchar y, int range, int type, anything *id)
new_light_core(coordxy x, coordxy y, int range, int type, anything *id)
{
light_source *ls;
@@ -134,13 +134,13 @@ del_light_source(int type, anything *id)
/* Mark locations that are temporarily lit via mobile light sources. */
void
do_light_sources(xchar **cs_rows)
do_light_sources(coordxy **cs_rows)
{
int x, y, min_x, max_x, max_y, offset;
xchar *limits;
coordxy *limits;
short at_hero_range = 0;
light_source *ls;
xchar *row;
coordxy *row;
for (ls = g.light_base; ls; ls = ls->next) {
ls->flags &= ~LSF_SHOW;
+1 -1
View File
@@ -352,7 +352,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL
int
pick_lock(
struct obj *pick,
xchar rx, xchar ry, /* coordinates of door/container, for autounlock:
coordxy rx, coordxy ry, /* coordinates of door/container, for autounlock:
* does not prompt for direction if these are set */
struct obj *container) /* container, for autounlock */
{
+2 -2
View File
@@ -200,7 +200,7 @@ md_start(coord *startp)
startp->y = row;
startp->x = g.viz_rmin[row];
} else if (enexto(&testcc, (xchar) g.viz_rmin[row], row,
} else if (enexto(&testcc, (coordxy) g.viz_rmin[row], row,
(struct permonst *) 0)
&& !cansee(testcc.x, testcc.y)
&& couldsee(testcc.x, testcc.y)) {
@@ -215,7 +215,7 @@ md_start(coord *startp)
startp->y = row;
startp->x = g.viz_rmax[row];
} else if (enexto(&testcc, (xchar) g.viz_rmax[row], row,
} else if (enexto(&testcc, (coordxy) g.viz_rmax[row], row,
(struct permonst *) 0)
&& !cansee(testcc.x, testcc.y)
&& couldsee(testcc.x, testcc.y)) {
+1 -1
View File
@@ -815,7 +815,7 @@ m_initinv(register struct monst *mtmp)
/* Note: for long worms, always call cutworm (cutworm calls clone_mon) */
struct monst *
clone_mon(struct monst *mon,
xchar x, xchar y) /* clone's preferred location or 0 (near mon) */
coordxy x, coordxy y) /* clone's preferred location or 0 (near mon) */
{
coord mm;
struct monst *m2;
+1 -1
View File
@@ -751,7 +751,7 @@ static int
gulpmm(register struct monst *magr, register struct monst *mdef,
register struct attack *mattk)
{
xchar ax, ay, dx, dy;
coordxy ax, ay, dx, dy;
int status;
char buf[BUFSZ];
struct obj *obj;
+1 -1
View File
@@ -1702,7 +1702,7 @@ could_seduce(struct monst *magr, struct monst *mdef,
{
struct permonst *pagr;
boolean agrinvis, defperc;
xchar genagr, gendef;
xint16 genagr, gendef;
int adtyp;
if (is_animal(magr->data))
+24 -24
View File
@@ -21,22 +21,22 @@ static void makevtele(void);
void clear_level_structures(void);
static void fill_ordinary_room(struct mkroom *);
static void makelevel(void);
static boolean bydoor(xchar, xchar);
static boolean bydoor(coordxy, coordxy);
static struct mkroom *find_branch_room(coord *);
static struct mkroom *pos_to_room(xchar, xchar);
static struct mkroom *pos_to_room(coordxy, coordxy);
static boolean place_niche(struct mkroom *, int *, int *, int *);
static void makeniche(int);
static void make_niches(void);
static int QSORTCALLBACK mkroom_cmp(const genericptr, const genericptr);
static void dosdoor(xchar, xchar, struct mkroom *, int);
static void dosdoor(coordxy, coordxy, struct mkroom *, int);
static void join(int, int, boolean);
static void do_room_or_subroom(struct mkroom *, int, int, int, int, boolean,
schar, boolean, boolean);
static void makerooms(void);
static boolean door_into_nonjoined(xchar, xchar);
static boolean finddpos(coord *, xchar, xchar, xchar, xchar);
static void mkinvpos(xchar, xchar, int);
static void mk_knox_portal(xchar, xchar);
static boolean door_into_nonjoined(coordxy, coordxy);
static boolean finddpos(coord *, coordxy, coordxy, coordxy, coordxy);
static void mkinvpos(coordxy, coordxy, int);
static void mk_knox_portal(coordxy, coordxy);
#define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE)
#define init_vault() g.vault_x = -1
@@ -71,9 +71,9 @@ mkroom_cmp(const genericptr vx, const genericptr vy)
* to connect them up to other areas.
*/
static boolean
door_into_nonjoined(xchar x, xchar y)
door_into_nonjoined(coordxy x, coordxy y)
{
xchar tx, ty, i;
coordxy tx, ty, i;
for (i = 0; i < 4; i++) {
tx = x + xdir[dirs_ord[i]];
@@ -91,9 +91,9 @@ door_into_nonjoined(xchar x, xchar y)
}
static boolean
finddpos(coord *cc, xchar xl, xchar yl, xchar xh, xchar yh)
finddpos(coord *cc, coordxy xl, coordxy yl, coordxy xh, coordxy yh)
{
register xchar x, y;
register coordxy x, y;
x = rn1(xh - xl + 1, xl);
y = rn1(yh - yl + 1, yl);
@@ -329,7 +329,7 @@ static void
join(register int a, register int b, boolean nxcor)
{
coord cc, tt, org, dest;
register xchar tx, ty, xx, yy;
register coordxy tx, ty, xx, yy;
register struct mkroom *croom, *troom;
register int dx, dy;
@@ -481,7 +481,7 @@ add_door(register int x, register int y, register struct mkroom *aroom)
}
static void
dosdoor(register xchar x, register xchar y, struct mkroom *aroom, int type)
dosdoor(register coordxy x, register coordxy y, struct mkroom *aroom, int type)
{
boolean shdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE;
@@ -905,7 +905,7 @@ makelevel(void)
/* make a secret treasure vault, not connected to the rest */
if (do_vault()) {
xchar w, h;
coordxy w, h;
debugpline0("trying to make a vault...");
w = 1;
@@ -1222,7 +1222,7 @@ find_branch_room(coord *mp)
/* Find the room for (x,y). Return null if not in a room. */
static struct mkroom *
pos_to_room(xchar x, xchar y)
pos_to_room(coordxy x, coordxy y)
{
int i;
struct mkroom *curr;
@@ -1238,7 +1238,7 @@ pos_to_room(xchar x, xchar y)
void
place_branch(
branch *br, /* branch to place */
xchar x, xchar y) /* location */
coordxy x, coordxy y) /* location */
{
coord m = {0};
d_level *dest;
@@ -1294,7 +1294,7 @@ place_branch(
}
static boolean
bydoor(register xchar x, register xchar y)
bydoor(register coordxy x, register coordxy y)
{
register int typ;
@@ -1323,7 +1323,7 @@ bydoor(register xchar x, register xchar y)
/* see whether it is allowable to create a door at [x,y] */
int
okdoor(xchar x, xchar y)
okdoor(coordxy x, coordxy y)
{
boolean near_door = bydoor(x, y);
@@ -1347,7 +1347,7 @@ dodoor(int x, int y, struct mkroom *aroom)
}
boolean
occupied(xchar x, xchar y)
occupied(coordxy x, coordxy y)
{
return (boolean) (t_at(x, y) || IS_FURNITURE(levl[x][y].typ)
|| is_lava(x, y) || is_pool(x, y)
@@ -1636,7 +1636,7 @@ mktrap(
If force is TRUE, change the terrain to ROOM first */
void
mkstairs(
xchar x, xchar y,
coordxy x, coordxy y,
char up, /* [why 'char' when usage is boolean?] */
struct mkroom *croom UNUSED,
boolean force)
@@ -1884,9 +1884,9 @@ void
mkinvokearea(void)
{
int dist;
xchar xmin = g.inv_pos.x, xmax = g.inv_pos.x,
coordxy xmin = g.inv_pos.x, xmax = g.inv_pos.x,
ymin = g.inv_pos.y, ymax = g.inv_pos.y;
register xchar i;
register coordxy i;
/* slightly odd if levitating, but not wrong */
pline_The("floor shakes violently under you!");
@@ -1940,7 +1940,7 @@ mkinvokearea(void)
* Temporarily overrides vision in the name of a nice effect.
*/
static void
mkinvpos(xchar x, xchar y, int dist)
mkinvpos(coordxy x, coordxy y, int dist)
{
struct trap *ttmp;
struct obj *otmp;
@@ -2035,7 +2035,7 @@ mkinvpos(xchar x, xchar y, int dist)
* Ludios will remain isolated until the branch is corrected by this function.
*/
static void
mk_knox_portal(xchar x, xchar y)
mk_knox_portal(coordxy x, coordxy y)
{
d_level *source;
branch *br;
+1 -1
View File
@@ -433,7 +433,7 @@ mkmap(lev_init* init_lev)
{
schar bg_typ = init_lev->bg, fg_typ = init_lev->fg;
boolean smooth = init_lev->smoothed, join = init_lev->joined;
xchar lit = init_lev->lit, walled = init_lev->walled;
xint16 lit = init_lev->lit, walled = init_lev->walled;
int i;
lit = litstate_rnd(lit);
+23 -23
View File
@@ -13,8 +13,8 @@ static int extend_spine(int[3][3], int, int, int);
static void wall_cleanup(int, int, int, int);
static boolean okay(int, int, int);
static void maze0xy(coord *);
static boolean put_lregion_here(xchar, xchar, xchar, xchar, xchar,
xchar, xchar, boolean, d_level *);
static boolean put_lregion_here(coordxy, coordxy, coordxy, coordxy, coordxy,
coordxy, coordxy, boolean, d_level *);
static void baalz_fixup(void);
static void setup_waterlevel(void);
static void unsetup_waterlevel(void);
@@ -24,7 +24,7 @@ static void migrate_orc(struct monst *, unsigned long);
static void shiny_orc_stuff(struct monst *);
static void stolen_booty(void);
static boolean maze_inbounds(int, int);
static void maze_remove_deadends(xchar);
static void maze_remove_deadends(xint16);
/* adjust a coordinate one step in the specified direction */
#define mz_move(X, Y, dir) \
@@ -69,7 +69,7 @@ is_solid(int x, int y)
/* set map terrain type, handling lava lit, ice melt timers, etc */
boolean
set_levltyp(xchar x, xchar y, schar typ)
set_levltyp(coordxy x, coordxy y, schar typ)
{
if (isok(x, y)) {
if ((typ < MAX_TYPE) && CAN_OVERWRITE_TERRAIN(levl[x][y].typ)) {
@@ -94,7 +94,7 @@ set_levltyp(xchar x, xchar y, schar typ)
/* set map terrain type and light state */
boolean
set_levltyp_lit(xchar x, xchar y, schar typ, schar lit)
set_levltyp_lit(coordxy x, coordxy y, schar typ, schar lit)
{
boolean ret = set_levltyp(x, y, typ);
@@ -209,7 +209,7 @@ fix_wall_spines(int x1, int y1, int x2, int y2)
* so even though this table says VWALL, we actually leave whatever
* typ was there alone.
*/
static xchar spine_array[16] = { VWALL, HWALL, HWALL, HWALL,
static xint16 spine_array[16] = { VWALL, HWALL, HWALL, HWALL,
VWALL, TRCORNER, TLCORNER, TDWALL,
VWALL, BRCORNER, BLCORNER, TUWALL,
VWALL, TLWALL, TRWALL, CROSSWALL };
@@ -289,7 +289,7 @@ maze0xy(coord * cc)
* NOT (pos is corridor and a maze level OR pos is a room OR pos is air)
*/
boolean
bad_location(xchar x, xchar y, xchar lx, xchar ly, xchar hx, xchar hy)
bad_location(coordxy x, coordxy y, coordxy lx, coordxy ly, coordxy hx, coordxy hy)
{
return (boolean) (occupied(x, y)
|| within_bounded_area(x, y, lx, ly, hx, hy)
@@ -302,14 +302,14 @@ bad_location(xchar x, xchar y, xchar lx, xchar ly, xchar hx, xchar hy)
and place something (based on rtype) in that region */
void
place_lregion(
xchar lx, xchar ly, xchar hx, xchar hy,
xchar nlx, xchar nly, xchar nhx,xchar nhy,
xchar rtype,
coordxy lx, coordxy ly, coordxy hx, coordxy hy,
coordxy nlx, coordxy nly, coordxy nhx,coordxy nhy,
xint16 rtype,
d_level *lev)
{
int trycnt;
boolean oneshot;
xchar x, y;
coordxy x, y;
if (!lx) { /* default to whole level */
/*
@@ -349,9 +349,9 @@ place_lregion(
static boolean
put_lregion_here(
xchar x, xchar y,
xchar nlx, xchar nly, xchar nhx, xchar nhy,
xchar rtype,
coordxy x, coordxy y,
coordxy nlx, coordxy nly, coordxy nhx, coordxy nhy,
xint16 rtype,
boolean oneshot,
d_level *lev)
{
@@ -823,7 +823,7 @@ maze_inbounds(int x, int y)
}
static void
maze_remove_deadends(xchar typ)
maze_remove_deadends(xint16 typ)
{
char dirok[4];
int x, y, dir, idx, idx2, dx, dy, dx2, dy2;
@@ -1234,8 +1234,8 @@ mazexy(coord *cc)
x = rnd(g.x_maze_max);
y = rnd(g.y_maze_max);
if (levl[x][y].typ == allowedtyp) {
cc->x = (xchar) x;
cc->y = (xchar) y;
cc->x = (coordxy) x;
cc->y = (coordxy) y;
return;
}
} while (++cpt < 100);
@@ -1243,8 +1243,8 @@ mazexy(coord *cc)
for (x = 1; x <= g.x_maze_max; x++)
for (y = 1; y <= g.y_maze_max; y++)
if (levl[x][y].typ == allowedtyp) {
cc->x = (xchar) x;
cc->y = (xchar) y;
cc->x = (coordxy) x;
cc->y = (coordxy) y;
return;
}
/* every spot on the area of map allowed for mazes has been rejected */
@@ -1356,7 +1356,7 @@ bound_digging(void)
}
void
mkportal(xchar x, xchar y, xchar todnum, xchar todlevel)
mkportal(coordxy x, coordxy y, xint16 todnum, xint16 todlevel)
{
/* a portal "trap" must be matched by a
portal in the destination dungeon/dlevel */
@@ -1376,12 +1376,12 @@ mkportal(xchar x, xchar y, xchar todnum, xchar todlevel)
void
fumaroles(void)
{
xchar n;
xint16 n;
boolean snd = FALSE, loud = FALSE;
for (n = rn2(3) + 2; n; n--) {
xchar x = rn1(COLNO - 4, 3);
xchar y = rn1(ROWNO - 4, 3);
coordxy x = rn1(COLNO - 4, 3);
coordxy y = rn1(ROWNO - 4, 3);
if (levl[x][y].typ == LAVAPOOL) {
NhRegion *r = create_gas_cloud(x, y, rn1(30, 20), rn1(10, 5));
+9 -9
View File
@@ -9,7 +9,7 @@ static void mkbox_cnts(struct obj *);
static unsigned nextoid(struct obj *, struct obj *);
static int item_on_ice(struct obj *);
static void shrinking_glob_gone(struct obj *);
static void obj_timer_checks(struct obj *, xchar, xchar, int);
static void obj_timer_checks(struct obj *, coordxy, coordxy, int);
static void container_weight(struct obj *);
static struct obj *save_mtraits(struct obj *, struct monst *);
static void objlist_sanity(struct obj *, int, const char *);
@@ -677,7 +677,7 @@ static const char *const alteration_verbs[] = {
void
costly_alteration(struct obj *obj, int alter_type)
{
xchar ox, oy;
coordxy ox, oy;
char objroom;
boolean learn_bknown;
const char *those, *them;
@@ -1293,7 +1293,7 @@ static int
item_on_ice(struct obj *item)
{
struct obj *otmp;
xchar ox, oy;
coordxy ox, oy;
otmp = item;
/* if in a container, it might be nested so find outermost one since
@@ -1491,7 +1491,7 @@ shrink_glob(
}
if (gone) {
xchar ox = 0, oy = 0;
coordxy ox = 0, oy = 0;
/* check location for visibility before destroying obj */
boolean seeit = (obj->where == OBJ_FLOOR
&& get_obj_location(obj, &ox, &oy, 0)
@@ -1522,7 +1522,7 @@ shrink_glob(
static void
shrinking_glob_gone(struct obj *obj)
{
xchar owhere = obj->where;
xint16 owhere = obj->where;
if (owhere == OBJ_INVENT) {
if (obj->owornmask) {
@@ -1554,7 +1554,7 @@ void
maybe_adjust_light(struct obj *obj, int old_range)
{
char buf[BUFSZ];
xchar ox, oy;
coordxy ox, oy;
int new_range = arti_light_radius(obj), delta = new_range - old_range;
/* radius of light emitting artifact varies by curse/bless state
@@ -2198,7 +2198,7 @@ peek_at_iced_corpse_age(struct obj *otmp)
static void
obj_timer_checks(
struct obj *otmp,
xchar x, xchar y,
coordxy x, coordxy y,
int force) /* 0 = no force so do checks, <0 = force off, >0 force on */
{
long tleft = 0L;
@@ -2266,8 +2266,8 @@ obj_timer_checks(
void
remove_object(struct obj *otmp)
{
xchar x = otmp->ox;
xchar y = otmp->oy;
coordxy x = otmp->ox;
coordxy y = otmp->oy;
if (otmp->where != OBJ_FLOOR)
panic("remove_object: obj not on floor");
+2 -2
View File
@@ -283,7 +283,7 @@ fill_zoo(struct mkroom* sroom)
(void) somexy(sroom, &mm);
tx = mm.x;
ty = mm.y;
} while (occupied((xchar) tx, (xchar) ty) && --i > 0);
} while (occupied((coordxy) tx, (coordxy) ty) && --i > 0);
throne_placed:
mk_zoo_thronemon(tx, ty);
break;
@@ -654,7 +654,7 @@ somey(struct mkroom* croom)
}
boolean
inside_room(struct mkroom* croom, xchar x, xchar y)
inside_room(struct mkroom* croom, coordxy x, coordxy y)
{
if (croom->irregular) {
int i = (int) ((croom - g.rooms) + ROOMOFFSET);
+16 -16
View File
@@ -19,7 +19,7 @@ static void mon_leaving_level(struct monst *);
static void m_detach(struct monst *, struct permonst *);
static void set_mon_min_mhpmax(struct monst *, int);
static void lifesaved_monster(struct monst *);
static void migrate_mon(struct monst *, xchar, xchar);
static void migrate_mon(struct monst *, coordxy, coordxy);
static boolean ok_to_obliterate(struct monst *);
static void deal_with_overcrowding(struct monst *);
static void m_restartcham(struct monst *);
@@ -1807,7 +1807,7 @@ mfndpos(
{
struct permonst *mdat = mon->data;
register struct trap *ttmp;
xchar x, y, nx, ny;
coordxy x, y, nx, ny;
int cnt = 0;
uchar ntyp;
uchar nowtyp;
@@ -2357,7 +2357,7 @@ m_detach(
struct monst *mtmp,
struct permonst *mptr) /* reflects mtmp->data _prior_ to mtmp's death */
{
xchar mx = mtmp->mx, my = mtmp->my;
coordxy mx = mtmp->mx, my = mtmp->my;
if (mtmp->mleashed)
m_unleash(mtmp, FALSE);
@@ -2790,7 +2790,7 @@ void
monstone(struct monst* mdef)
{
struct obj *otmp, *obj, *oldminvent;
xchar x = mdef->mx, y = mdef->my;
coordxy x = mdef->mx, y = mdef->my;
boolean wasinside = FALSE;
/* vampshifter reverts to vampire;
@@ -3284,14 +3284,14 @@ vamp_stone(struct monst *mtmp)
void
m_into_limbo(struct monst *mtmp)
{
xchar target_lev = ledger_no(&u.uz), xyloc = MIGR_APPROX_XY;
xint16 target_lev = ledger_no(&u.uz), xyloc = MIGR_APPROX_XY;
mtmp->mstate |= MON_LIMBO;
migrate_mon(mtmp, target_lev, xyloc);
}
static void
migrate_mon(struct monst *mtmp, xchar target_lev, xchar xyloc)
migrate_mon(struct monst *mtmp, xint16 target_lev, xint16 xyloc)
{
if (!mtmp->mx) {
/* this was a failed arrival attempt from a prior migration;
@@ -3382,7 +3382,7 @@ elemental_clog(struct monst *mon)
/* last resort - migrate mon to the next plane */
} else if (!Is_astralevel(&u.uz)) {
d_level dest;
xchar target_lev;
coordxy target_lev;
dest = u.uz;
dest.dlevel--;
@@ -3462,13 +3462,13 @@ maybe_mnexto(struct monst* mtmp)
int
mnearto(
register struct monst *mtmp,
xchar x,
xchar y,
coordxy x,
coordxy y,
boolean move_other, /* make sure mtmp gets to x, y! so move m_at(x, y) */
unsigned int rlocflags)
{
struct monst *othermon = (struct monst *) 0;
xchar newx, newy;
coordxy newx, newy;
coord mm;
int res = 1;
@@ -3874,8 +3874,8 @@ get_iter_mons(boolean (*func)(struct monst *))
passing x,y to the function.
if func returns TRUE, stop and return that monster. */
struct monst *
get_iter_mons_xy(boolean (*func)(struct monst *, xchar, xchar),
xchar x, xchar y)
get_iter_mons_xy(boolean (*func)(struct monst *, coordxy, coordxy),
coordxy x, coordxy y)
{
struct monst *mtmp;
@@ -3960,7 +3960,7 @@ restrap(struct monst *mtmp)
/* reveal a monster at x,y hiding under an object,
if there are no objects there */
void
maybe_unhide_at(xchar x, xchar y)
maybe_unhide_at(coordxy x, coordxy y)
{
struct monst *mtmp;
@@ -3978,7 +3978,7 @@ hideunder(struct monst *mtmp)
{
struct trap *t;
boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &g.youmonst);
xchar x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my;
if (mtmp == u.ustuck) {
; /* can't hide if holding you or held by you */
@@ -4021,7 +4021,7 @@ hide_monst(struct monst* mon)
if ((is_hider(mon->data) || hider_under)
&& !(mon->mundetected || M_AP_TYPE(mon))) {
xchar x = mon->mx, y = mon->my;
coordxy x = mon->mx, y = mon->my;
char save_viz = g.viz_array[y][x];
/* override vision, forcing hero to be unable to see monster's spot */
@@ -4541,7 +4541,7 @@ newcham(
*p = '\0';
if (mtmp->wormno) { /* throw tail away */
xchar mx = mtmp->mx, my = mtmp->my;
coordxy mx = mtmp->mx, my = mtmp->my;
wormgone(mtmp); /* discards tail segments, takes head off the map */
/* put the head back; it will morph into mtmp's new form */
+13 -12
View File
@@ -12,8 +12,8 @@ static int disturb(struct monst *);
static void release_hero(struct monst *);
static void distfleeck(struct monst *, int *, int *, int *);
static int m_arrival(struct monst *);
static boolean holds_up_web(xchar, xchar);
static int count_webbing_walls(xchar, xchar);
static boolean holds_up_web(coordxy, coordxy);
static int count_webbing_walls(coordxy, coordxy);
static boolean soko_allow_web(struct monst *);
static boolean leppie_avoidance(struct monst *);
static void leppie_stash(struct monst *);
@@ -812,8 +812,8 @@ should_displace(
coord *poss, /* coord poss[9] */
long *info, /* long info[9] */
int cnt,
xchar gx,
xchar gy)
coordxy gx,
coordxy gy)
{
int shortest_with_displacing = -1;
int shortest_without_displacing = -1;
@@ -845,7 +845,7 @@ should_displace(
}
boolean
m_digweapon_check(struct monst* mtmp, xchar nix, xchar niy)
m_digweapon_check(struct monst* mtmp, coordxy nix, coordxy niy)
{
boolean can_tunnel = 0;
struct obj *mw_tmp = MON_WEP(mtmp);
@@ -940,7 +940,7 @@ m_balks_at_approaching(struct monst* mtmp)
}
static boolean
holds_up_web(xchar x, xchar y)
holds_up_web(coordxy x, coordxy y)
{
stairway *sway;
@@ -957,7 +957,7 @@ holds_up_web(xchar x, xchar y)
/* returns the number of walls in the four cardinal directions that could
hold up a web */
static int
count_webbing_walls(xchar x, xchar y)
count_webbing_walls(coordxy x, coordxy y)
{
return (holds_up_web(x, y - 1) + holds_up_web(x + 1, y)
+ holds_up_web(x, y + 1) + holds_up_web(x - 1, y));
@@ -1018,7 +1018,8 @@ int
m_move(register struct monst* mtmp, register int after)
{
int appr, etmp;
xchar gx, gy, nix, niy, chcnt;
coordxy gx, gy, nix, niy;
xint16 chcnt;
int chi; /* could be schar except for stupid Sun-2 compiler */
boolean likegold = 0, likegems = 0, likeobjs = 0, likemagic = 0,
conceals = 0;
@@ -1076,7 +1077,7 @@ m_move(register struct monst* mtmp, register int after)
/* and the acquisitive monsters get special treatment */
if (is_covetous(ptr)) {
xchar tx = STRAT_GOALX(mtmp->mstrategy),
coordxy tx = STRAT_GOALX(mtmp->mstrategy),
ty = STRAT_GOALY(mtmp->mstrategy);
struct monst *intruder = m_at(tx, ty);
/*
@@ -1723,7 +1724,7 @@ m_move(register struct monst* mtmp, register int after)
* (mtmp died) or 3 (mtmp made its move).
*/
int
m_move_aggress(struct monst* mtmp, xchar x, xchar y)
m_move_aggress(struct monst* mtmp, coordxy x, coordxy y)
{
struct monst *mtmp2;
int mstatus;
@@ -1855,8 +1856,8 @@ set_apparxy(register struct monst* mtmp)
boolean
undesirable_disp(
struct monst *mtmp, /* barging creature */
xchar x,
xchar y) /* spot 'mtmp' is considering moving to */
coordxy x,
coordxy y) /* spot 'mtmp' is considering moving to */
{
boolean is_pet = (mtmp && mtmp->mtame && !mtmp->isminion);
struct trap *trap = t_at(x, y);
+2 -2
View File
@@ -114,7 +114,7 @@ mk_mplayer_armor(struct monst* mon, short typ)
}
struct monst *
mk_mplayer(struct permonst *ptr, xchar x, xchar y, boolean special)
mk_mplayer(struct permonst *ptr, coordxy x, coordxy y, boolean special)
{
struct monst *mtmp;
char nam[PL_NSIZ];
@@ -343,7 +343,7 @@ create_mplayers(register int num, boolean special)
if (tryct > 50)
return;
(void) mk_mplayer(&mons[pm], (xchar) x, (xchar) y, special);
(void) mk_mplayer(&mons[pm], (coordxy) x, (coordxy) y, special);
num--;
}
}
+14 -14
View File
@@ -777,7 +777,7 @@ int
thrwmm(struct monst* mtmp, struct monst* mtarg)
{
struct obj *otmp, *mwep;
register xchar x, y;
register coordxy x, y;
boolean ispole;
/* Polearms won't be applied by monsters against other monsters */
@@ -833,8 +833,8 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg)
}
if (m_lined_up(mtarg, mtmp)) {
boolean utarg = (mtarg == &g.youmonst);
xchar tx = utarg ? mtmp->mux : mtarg->mx;
xchar ty = utarg ? mtmp->muy : mtarg->my;
coordxy tx = utarg ? mtmp->mux : mtarg->mx;
coordxy ty = utarg ? mtmp->muy : mtarg->my;
switch (mattk->adtyp) {
case AD_BLND:
@@ -972,7 +972,7 @@ void
thrwmu(struct monst* mtmp)
{
struct obj *otmp, *mwep;
xchar x, y;
coordxy x, y;
const char *onm;
/* Rearranged beginning so monsters can use polearms not in a line */
@@ -1072,10 +1072,10 @@ breamu(struct monst* mtmp, struct attack* mattk)
Returns TRUE if fnc returned TRUE. */
boolean
linedup_callback(
xchar ax,
xchar ay,
xchar bx,
xchar by,
coordxy ax,
coordxy ay,
coordxy bx,
coordxy by,
boolean (*fnc)(int, int))
{
int dx, dy;
@@ -1110,10 +1110,10 @@ linedup_callback(
boolean
linedup(
register xchar ax,
register xchar ay,
register xchar bx,
register xchar by,
register coordxy ax,
register coordxy ay,
register coordxy bx,
register coordxy by,
int boulderhandling) /* 0=block, 1=ignore, 2=conditionally block */
{
int dx, dy, boulderspots;
@@ -1159,8 +1159,8 @@ static int
m_lined_up(struct monst* mtarg, struct monst* mtmp)
{
boolean utarget = (mtarg == &g.youmonst);
xchar tx = utarget ? mtmp->mux : mtarg->mx;
xchar ty = utarget ? mtmp->muy : mtarg->my;
coordxy tx = utarget ? mtmp->mux : mtarg->mx;
coordxy ty = utarget ? mtmp->muy : mtarg->my;
boolean ignore_boulders = utarget && (throws_rocks(mtmp->data)
|| m_carrying(mtmp, WAN_STRIKING));
+3 -3
View File
@@ -561,14 +561,14 @@ l_obj_bury(lua_State *L)
int argc = lua_gettop(L);
boolean dealloced = FALSE;
struct _lua_obj *lo = l_obj_check(L, 1);
xchar x = 0, y = 0;
coordxy x = 0, y = 0;
if (argc == 1) {
x = lo->obj->ox;
y = lo->obj->oy;
} else if (argc == 3) {
x = (xchar) lua_tointeger(L, 2);
y = (xchar) lua_tointeger(L, 3);
x = (coordxy) lua_tointeger(L, 2);
y = (coordxy) lua_tointeger(L, 3);
} else
nhl_error(L, "l_obj_bury: Wrong args");
+57 -57
View File
@@ -14,7 +14,7 @@ static int l_selection_not(lua_State *);
static int l_selection_filter_percent(lua_State *);
static int l_selection_rndcoord(lua_State *);
static boolean params_sel_2coords(lua_State *, struct selectionvar **,
xchar *, xchar *, xchar *, xchar *);
coordxy *, coordxy *, coordxy *, coordxy *);
static int l_selection_line(lua_State *);
static int l_selection_randline(lua_State *);
static int l_selection_rect(lua_State *);
@@ -136,7 +136,7 @@ static int
l_selection_setpoint(lua_State *L)
{
struct selectionvar *sel = (struct selectionvar *) 0;
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
int val = 1;
int argc = lua_gettop(L);
long crd = 0L;
@@ -146,15 +146,15 @@ l_selection_setpoint(lua_State *L)
} else if (argc == 1) {
sel = l_selection_check(L, 1);
} else if (argc == 2) {
x = (xchar) luaL_checkinteger(L, 1);
y = (xchar) luaL_checkinteger(L, 2);
x = (coordxy) luaL_checkinteger(L, 1);
y = (coordxy) luaL_checkinteger(L, 2);
lua_pop(L, 2);
(void) l_selection_new(L);
sel = l_selection_check(L, 1);
} else {
sel = l_selection_check(L, 1);
x = (xchar) luaL_checkinteger(L, 2);
y = (xchar) luaL_checkinteger(L, 3);
x = (coordxy) luaL_checkinteger(L, 2);
y = (coordxy) luaL_checkinteger(L, 3);
val = (int) luaL_optinteger(L, 4, 1);
}
@@ -180,7 +180,7 @@ static int
l_selection_getpoint(lua_State *L)
{
struct selectionvar *sel = l_selection_check(L, 1);
xchar x, y;
coordxy x, y;
int ix, iy;
int val;
long crd;
@@ -190,8 +190,8 @@ l_selection_getpoint(lua_State *L)
nhl_error(L, "l_selection_getpoint: Incorrect params");
return 0;
}
x = (xchar) ix;
y = (xchar) iy;
x = (coordxy) ix;
y = (coordxy) iy;
if (x == -1 && y == -1)
crd = SP_COORD_PACK_RANDOM(0);
@@ -299,8 +299,8 @@ l_selection_sub(lua_State *L)
for (x = 0; x < selr->wid; x++) {
for (y = 0; y < selr->hei; y++) {
xchar a_pt = selection_getpoint(x, y, sela);
xchar b_pt = selection_getpoint(x, y, selb);
coordxy a_pt = selection_getpoint(x, y, sela);
coordxy b_pt = selection_getpoint(x, y, selb);
int val = (a_pt ^ b_pt) & a_pt;
selection_setpoint(x, y, selr, val);
}
@@ -335,7 +335,7 @@ l_selection_rndcoord(lua_State *L)
{
struct selectionvar *sel = l_selection_check(L, 1);
int removeit = (int) luaL_optinteger(L, 2, 0);
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
selection_rndcoord(sel, &x, &y, removeit);
if (!(x == -1 && y == -1)) {
update_croom();
@@ -362,16 +362,16 @@ l_selection_rndcoord(lua_State *L)
/* selection:function(x1,y1, x2,y2) */
static boolean
params_sel_2coords(lua_State *L, struct selectionvar **sel,
xchar *x1, xchar *y1, xchar *x2, xchar *y2)
coordxy *x1, coordxy *y1, coordxy *x2, coordxy *y2)
{
int argc = lua_gettop(L);
if (argc == 4) {
(void) l_selection_new(L);
*x1 = (xchar) luaL_checkinteger(L, 1);
*y1 = (xchar) luaL_checkinteger(L, 2);
*x2 = (xchar) luaL_checkinteger(L, 3);
*y2 = (xchar) luaL_checkinteger(L, 4);
*x1 = (coordxy) luaL_checkinteger(L, 1);
*y1 = (coordxy) luaL_checkinteger(L, 2);
*x2 = (coordxy) luaL_checkinteger(L, 3);
*y2 = (coordxy) luaL_checkinteger(L, 4);
*sel = l_selection_check(L, 5);
lua_remove(L, 1);
lua_remove(L, 1);
@@ -380,10 +380,10 @@ params_sel_2coords(lua_State *L, struct selectionvar **sel,
return TRUE;
} else if (argc == 5) {
*sel = l_selection_check(L, 1);
*x1 = (xchar) luaL_checkinteger(L, 2);
*y1 = (xchar) luaL_checkinteger(L, 3);
*x2 = (xchar) luaL_checkinteger(L, 4);
*y2 = (xchar) luaL_checkinteger(L, 5);
*x1 = (coordxy) luaL_checkinteger(L, 2);
*y1 = (coordxy) luaL_checkinteger(L, 3);
*x2 = (coordxy) luaL_checkinteger(L, 4);
*y2 = (coordxy) luaL_checkinteger(L, 5);
lua_pop(L, 4);
return TRUE;
}
@@ -397,7 +397,7 @@ static int
l_selection_line(lua_State *L)
{
struct selectionvar *sel = NULL;
xchar x1, y1, x2, y2;
coordxy x1, y1, x2, y2;
if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) {
nhl_error(L, "selection.line: illegal arguments");
@@ -417,7 +417,7 @@ static int
l_selection_rect(lua_State *L)
{
struct selectionvar *sel = NULL;
xchar x1, y1, x2, y2;
coordxy x1, y1, x2, y2;
if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) {
nhl_error(L, "selection.rect: illegal arguments");
@@ -446,7 +446,7 @@ l_selection_fillrect(lua_State *L)
{
struct selectionvar *sel = NULL;
int y;
xchar x1, y1, x2, y2;
coordxy x1, y1, x2, y2;
if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) {
nhl_error(L, "selection.fillrect: illegal arguments");
@@ -478,22 +478,22 @@ l_selection_randline(lua_State *L)
{
int argc = lua_gettop(L);
struct selectionvar *sel = (struct selectionvar *) 0;
xchar x1 = 0, y1 = 0, x2 = 0, y2 = 0;
coordxy x1 = 0, y1 = 0, x2 = 0, y2 = 0;
int roughness = 7;
if (argc == 6) {
sel = l_selection_check(L, 1);
x1 = (xchar) luaL_checkinteger(L, 2);
y1 = (xchar) luaL_checkinteger(L, 3);
x2 = (xchar) luaL_checkinteger(L, 4);
y2 = (xchar) luaL_checkinteger(L, 5);
x1 = (coordxy) luaL_checkinteger(L, 2);
y1 = (coordxy) luaL_checkinteger(L, 3);
x2 = (coordxy) luaL_checkinteger(L, 4);
y2 = (coordxy) luaL_checkinteger(L, 5);
roughness = (int) luaL_checkinteger(L, 6);
lua_pop(L, 5);
} else if (argc == 5 && lua_type(L, 1) == LUA_TNUMBER) {
x1 = (xchar) luaL_checkinteger(L, 1);
y1 = (xchar) luaL_checkinteger(L, 2);
x2 = (xchar) luaL_checkinteger(L, 3);
y2 = (xchar) luaL_checkinteger(L, 4);
x1 = (coordxy) luaL_checkinteger(L, 1);
y1 = (coordxy) luaL_checkinteger(L, 2);
x2 = (coordxy) luaL_checkinteger(L, 3);
y2 = (coordxy) luaL_checkinteger(L, 4);
roughness = (int) luaL_checkinteger(L, 5);
lua_pop(L, 5);
(void) l_selection_new(L);
@@ -540,7 +540,7 @@ l_selection_filter_mapchar(lua_State *L)
int argc = lua_gettop(L);
struct selectionvar *sel = l_selection_check(L, 1);
char *mapchr = dupstr(luaL_checkstring(L, 2));
xchar typ = check_mapchr(mapchr);
coordxy typ = check_mapchr(mapchr);
int lit = (int) luaL_optinteger(L, 3, -2); /* TODO: special lit values */
struct selectionvar *tmp, *tmp2;
@@ -612,12 +612,12 @@ l_selection_flood(lua_State *L)
{
int argc = lua_gettop(L);
struct selectionvar *sel = (struct selectionvar *) 0;
xchar x = 0, y = 0;
coordxy x = 0, y = 0;
boolean diagonals = FALSE;
if (argc == 2 || argc == 3) {
x = (xchar) luaL_checkinteger(L, 1);
y = (xchar) luaL_checkinteger(L, 2);
x = (coordxy) luaL_checkinteger(L, 1);
y = (coordxy) luaL_checkinteger(L, 2);
if (argc == 3)
diagonals = lua_toboolean(L, 3);
lua_pop(L, argc);
@@ -648,20 +648,20 @@ l_selection_circle(lua_State *L)
{
int argc = lua_gettop(L);
struct selectionvar *sel = (struct selectionvar *) 0;
xchar x = 0, y = 0;
coordxy x = 0, y = 0;
int r = 0, filled = 0;
if (argc == 3) {
x = (xchar) luaL_checkinteger(L, 1);
y = (xchar) luaL_checkinteger(L, 2);
x = (coordxy) luaL_checkinteger(L, 1);
y = (coordxy) luaL_checkinteger(L, 2);
r = (int) luaL_checkinteger(L, 3);
lua_pop(L, 3);
(void) l_selection_new(L);
sel = l_selection_check(L, 1);
filled = 0;
} else if (argc == 4 && lua_type(L, 1) == LUA_TNUMBER) {
x = (xchar) luaL_checkinteger(L, 1);
y = (xchar) luaL_checkinteger(L, 2);
x = (coordxy) luaL_checkinteger(L, 1);
y = (coordxy) luaL_checkinteger(L, 2);
r = (int) luaL_checkinteger(L, 3);
filled = (int) luaL_checkinteger(L, 4); /* TODO: boolean*/
lua_pop(L, 4);
@@ -669,8 +669,8 @@ l_selection_circle(lua_State *L)
sel = l_selection_check(L, 1);
} else if (argc == 4 || argc == 5) {
sel = l_selection_check(L, 1);
x = (xchar) luaL_checkinteger(L, 2);
y = (xchar) luaL_checkinteger(L, 3);
x = (coordxy) luaL_checkinteger(L, 2);
y = (coordxy) luaL_checkinteger(L, 3);
r = (int) luaL_checkinteger(L, 4);
filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */
} else {
@@ -696,12 +696,12 @@ l_selection_ellipse(lua_State *L)
{
int argc = lua_gettop(L);
struct selectionvar *sel = (struct selectionvar *) 0;
xchar x = 0, y = 0;
coordxy x = 0, y = 0;
int r1 = 0, r2 = 0, filled = 0;
if (argc == 4) {
x = (xchar) luaL_checkinteger(L, 1);
y = (xchar) luaL_checkinteger(L, 2);
x = (coordxy) luaL_checkinteger(L, 1);
y = (coordxy) luaL_checkinteger(L, 2);
r1 = (int) luaL_checkinteger(L, 3);
r2 = (int) luaL_checkinteger(L, 4);
lua_pop(L, 4);
@@ -709,8 +709,8 @@ l_selection_ellipse(lua_State *L)
sel = l_selection_check(L, 1);
filled = 0;
} else if (argc == 5 && lua_type(L, 1) == LUA_TNUMBER) {
x = (xchar) luaL_checkinteger(L, 1);
y = (xchar) luaL_checkinteger(L, 2);
x = (coordxy) luaL_checkinteger(L, 1);
y = (coordxy) luaL_checkinteger(L, 2);
r1 = (int) luaL_checkinteger(L, 3);
r2 = (int) luaL_checkinteger(L, 4);
filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */
@@ -719,8 +719,8 @@ l_selection_ellipse(lua_State *L)
sel = l_selection_check(L, 1);
} else if (argc == 5 || argc == 6) {
sel = l_selection_check(L, 1);
x = (xchar) luaL_checkinteger(L, 2);
y = (xchar) luaL_checkinteger(L, 3);
x = (coordxy) luaL_checkinteger(L, 2);
y = (coordxy) luaL_checkinteger(L, 3);
r1 = (int) luaL_checkinteger(L, 4);
r2 = (int) luaL_checkinteger(L, 5);
filled = (int) luaL_optinteger(L, 6, 0); /* TODO: boolean */
@@ -750,11 +750,11 @@ l_selection_gradient(lua_State *L)
struct selectionvar *sel = (struct selectionvar *) 0;
/* if x2 and y2 aren't set, the gradient has a single center point of x,y;
* if they are set, the gradient is centered on a (x,y) to (x2,y2) line */
xchar x = 0, y = 0, x2 = -1, y2 = -1;
coordxy x = 0, y = 0, x2 = -1, y2 = -1;
/* points will not be added within mindist of the center; the chance for a
* point between mindist and maxdist to be added to the selection starts at
* 0% at mindist and increases linearly to 100% at maxdist */
xchar mindist = 0, maxdist = 0;
coordxy mindist = 0, maxdist = 0;
/* if limited is true, no points farther than maxdist will be added; if
* false, all points farther than maxdist will be added */
boolean limited = FALSE;
@@ -769,10 +769,10 @@ l_selection_gradient(lua_State *L)
if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) {
lcheck_param_table(L);
type = gradtypes2i[get_table_option(L, "type", "radial", gradtypes)];
x = (xchar) get_table_int(L, "x");
y = (xchar) get_table_int(L, "y");
x2 = (xchar) get_table_int_opt(L, "x2", -1);
y2 = (xchar) get_table_int_opt(L, "y2", -1);
x = (coordxy) get_table_int(L, "x");
y = (coordxy) get_table_int(L, "y");
x2 = (coordxy) get_table_int_opt(L, "x2", -1);
y2 = (coordxy) get_table_int_opt(L, "y2", -1);
/* maxdist is required because there's no obvious default value for it,
* whereas mindist has an obvious defalt of 0 */
maxdist = get_table_int(L, "maxdist");
+7 -7
View File
@@ -213,7 +213,7 @@ schar
get_table_mapchr(lua_State *L, const char *name)
{
char *ter;
xchar typ;
xint8 typ;
ter = get_table_str(L, name);
typ = check_mapchr(ter);
@@ -228,15 +228,15 @@ schar
get_table_mapchr_opt(lua_State *L, const char *name, schar defval)
{
char *ter;
xchar typ;
xint8 typ;
ter = get_table_str_opt(L, name, emptystr);
if (name && *ter) {
typ = check_mapchr(ter);
typ = (xint8) check_mapchr(ter);
if (typ == INVALID_TYPE)
nhl_error(L, "Erroneous map char");
} else
typ = defval;
typ = (xint8) defval;
if (ter)
free(ter);
return typ;
@@ -292,7 +292,7 @@ nhl_add_table_entry_bool(lua_State *L, const char *name, boolean value)
void
nhl_add_table_entry_region(lua_State *L, const char *name,
xchar x1, xchar y1, xchar x2, xchar y2)
coordxy x1, coordxy y1, coordxy x2, coordxy y2)
{
lua_pushstring(L, name);
lua_newtable(L);
@@ -1345,8 +1345,8 @@ nhl_meta_u_index(lua_State *L)
{ "mh", &(u.mh), ANY_INT },
{ "mhmax", &(u.mhmax), ANY_INT },
{ "mtimedone", &(u.mtimedone), ANY_INT },
{ "dlevel", &(u.uz.dlevel), ANY_SCHAR }, /* actually xchar */
{ "dnum", &(u.uz.dnum), ANY_SCHAR }, /* actually xchar */
{ "dlevel", &(u.uz.dlevel), ANY_SCHAR }, /* actually coordxy */
{ "dnum", &(u.uz.dnum), ANY_SCHAR }, /* actually coordxy */
{ "uluck", &(u.uluck), ANY_SCHAR },
{ "uhp", &(u.uhp), ANY_INT },
{ "uhpmax", &(u.uhpmax), ANY_INT },
+1 -1
View File
@@ -301,7 +301,7 @@ distant_name(
char *(*func)(OBJ_P)) /* formatting routine (usually xname or doname) */
{
char *str;
xchar ox = 0, oy = 0;
coordxy ox = 0, oy = 0;
/*
* (r * r): square of the x or y distance;
* (r * r) * 2: sum of squares of both x and y distances
+1 -1
View File
@@ -6852,7 +6852,7 @@ query_attr(const char *prompt)
static const struct {
const char *name;
xchar msgtyp;
xint8 msgtyp;
const char *descr;
} msgtype_names[] = {
{ "show", MSGTYP_NORMAL, "Show message normally" },
+1 -1
View File
@@ -466,7 +466,7 @@ look_at_monster(char *buf,
caller should use it or copy it before calling waterbody_name() again
[3.7: moved here from mkmaze.c] */
const char *
waterbody_name(xchar x, xchar y)
waterbody_name(coordxy x, coordxy y)
{
static char pooltype[40];
struct rm *lev;
+4 -4
View File
@@ -1910,7 +1910,7 @@ do_loot_cont(
if (flags.autounlock) {
struct obj *otmp, *unlocktool = 0;
xchar ox = cobj->ox, oy = cobj->oy;
coordxy ox = cobj->ox, oy = cobj->oy;
u.dz = 0; /* might be non-zero from previous command since
* #loot isn't a move command; pick_lock() cares */
@@ -2622,7 +2622,7 @@ observe_quantum_cat(struct obj *box, boolean makecat, boolean givemsg)
static NEARDATA const char sc[] = "Schroedinger's Cat";
struct obj *deadcat;
struct monst *livecat = 0;
xchar ox, oy;
coordxy ox, oy;
boolean itsalive = !rn2(2);
if (get_obj_location(box, &ox, &oy, 0))
@@ -3431,7 +3431,7 @@ enum tipping_check_values {
static void
tipcontainer(struct obj *box) /* or bag */
{
xchar ox = u.ux, oy = u.uy; /* #tip only works at hero's location */
coordxy ox = u.ux, oy = u.uy; /* #tip only works at hero's location */
boolean empty_it = TRUE, maybeshopgoods;
struct obj *targetbox = (struct obj *) 0;
boolean cancelled = FALSE;
@@ -3655,7 +3655,7 @@ tipcontainer_checks(struct obj *box, boolean allowempty)
boolean bag = box->otyp == BAG_OF_TRICKS;
int old_spe = box->spe, seen = 0;
boolean maybeshopgoods = !carried(box) && costly_spot(box->ox, box->oy);
xchar ox = u.ux, oy = u.uy;
coordxy ox = u.ux, oy = u.uy;
if (get_obj_location(box, &ox, &oy, 0))
box->ox = ox, box->oy = oy;
+1 -1
View File
@@ -2268,7 +2268,7 @@ a_gname(void)
/* returns the name of an altar's deity */
const char *
a_gname_at(xchar x, xchar y)
a_gname_at(coordxy x, coordxy y)
{
if (!IS_ALTAR(levl[x][y].typ))
return (char *) 0;
+7 -7
View File
@@ -9,7 +9,7 @@
#define ALGN_SINNED (-4) /* worse than strayed (-1..-3) */
#define ALGN_PIOUS 14 /* better than fervent (9..13) */
static boolean histemple_at(struct monst *, xchar, xchar);
static boolean histemple_at(struct monst *, coordxy, coordxy);
static boolean has_shrine(struct monst *);
void
@@ -40,9 +40,9 @@ free_epri(struct monst *mtmp)
int
move_special(struct monst *mtmp, boolean in_his_shop, schar appr,
boolean uondoor, boolean avoid,
xchar omx, xchar omy, xchar gx, xchar gy)
coordxy omx, coordxy omy, coordxy gx, coordxy gy)
{
register xchar nx, ny, nix, niy;
register coordxy nx, ny, nix, niy;
register schar i;
schar chcnt, cnt;
coord poss[9];
@@ -146,7 +146,7 @@ temple_occupied(char *array)
}
static boolean
histemple_at(struct monst *priest, xchar x, xchar y)
histemple_at(struct monst *priest, coordxy x, coordxy y)
{
return (boolean) (priest && priest->ispriest
&& (EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE))
@@ -172,7 +172,7 @@ inhistemple(struct monst *priest)
int
pri_move(struct monst *priest)
{
register xchar gx, gy, omx, omy;
register coordxy gx, gy, omx, omy;
schar temple;
boolean avoid = TRUE;
@@ -670,7 +670,7 @@ priest_talk(struct monst *priest)
}
struct monst *
mk_roamer(struct permonst *ptr, aligntyp alignment, xchar x, xchar y,
mk_roamer(struct permonst *ptr, aligntyp alignment, coordxy x, coordxy y,
boolean peaceful)
{
register struct monst *roamer;
@@ -719,7 +719,7 @@ reset_hostility(struct monst *roamer)
boolean
in_your_sanctuary(
struct monst *mon, /* if non-null, <mx,my> overrides <x,y> */
xchar x, xchar y)
coordxy x, coordxy y)
{
register char roomno;
register struct monst *priest;
+13 -13
View File
@@ -31,10 +31,10 @@ void remove_region(NhRegion *);
#if 0
void replace_mon_regions(struct monst *,struct monst *);
void remove_mon_from_regions(struct monst *);
NhRegion *create_msg_region(xchar,xchar,xchar,xchar, const char *,
NhRegion *create_msg_region(coordxy,coordxy,coordxy,coordxy, const char *,
const char *);
boolean enter_force_field(genericptr,genericptr);
NhRegion *create_force_field(xchar,xchar,int,long);
NhRegion *create_force_field(coordxy,coordxy,int,long);
#endif
static void reset_region_mids(NhRegion *);
@@ -427,7 +427,7 @@ run_regions(void)
* check whether player enters/leaves one or more regions.
*/
boolean
in_out_region(xchar x, xchar y)
in_out_region(coordxy x, coordxy y)
{
int i, f_indx = 0;
@@ -480,7 +480,7 @@ in_out_region(xchar x, xchar y)
* check whether a monster enters/leaves one or more regions.
*/
boolean
m_in_out_region(struct monst *mon, xchar x, xchar y)
m_in_out_region(struct monst *mon, coordxy x, coordxy y)
{
int i, f_indx = 0;
@@ -601,7 +601,7 @@ remove_mon_from_regions(struct monst *mon)
* Returns NULL if not, otherwise returns region.
*/
NhRegion *
visible_region_at(xchar x, xchar y)
visible_region_at(coordxy x, coordxy y)
{
register int i;
@@ -615,7 +615,7 @@ visible_region_at(xchar x, xchar y)
}
void
show_region(NhRegion *reg, xchar x, xchar y)
show_region(NhRegion *reg, coordxy x, coordxy y)
{
show_glyph(x, y, reg->glyph);
}
@@ -872,7 +872,7 @@ reset_region_mids(NhRegion *reg)
NhRegion *
create_msg_region(
xchar x, xchar y, xchar w, xchar h,
coordxy x, coordxy y, coordxy w, coordxy h,
const char *msg_enter, const char *msg_leave)
{
NhRect tmprect;
@@ -919,7 +919,7 @@ enter_force_field(genericptr_t p1, genericptr_t p2)
}
NhRegion *
create_force_field(xchar x, xchar y, int radius, long ttl)
create_force_field(coordxy x, coordxy y, int radius, long ttl)
{
int i;
NhRegion *ff;
@@ -966,7 +966,7 @@ expire_gas_cloud(genericptr_t p1, genericptr_t p2 UNUSED)
{
NhRegion *reg;
int damage;
xchar x, y;
coordxy x, y;
reg = (NhRegion *) p1;
damage = reg->arg.a_int;
@@ -1080,15 +1080,15 @@ is_hero_inside_gas_cloud(void)
* damage is how much it deals to afflicted creatures. */
#define MAX_CLOUD_SIZE 150
NhRegion *
create_gas_cloud(xchar x, xchar y, int cloudsize, int damage)
create_gas_cloud(coordxy x, coordxy y, int cloudsize, int damage)
{
NhRegion *cloud;
int i, j;
NhRect tmprect;
/* store visited coords */
xchar xcoords[MAX_CLOUD_SIZE];
xchar ycoords[MAX_CLOUD_SIZE];
coordxy xcoords[MAX_CLOUD_SIZE];
coordxy ycoords[MAX_CLOUD_SIZE];
xcoords[0] = x;
ycoords[0] = y;
int curridx;
@@ -1112,7 +1112,7 @@ create_gas_cloud(xchar x, xchar y, int cloudsize, int damage)
* directions chosen. */
coord dirs[4] = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };
for (i = 4; i > 0; --i) {
xchar swapidx = rn2(i);
coordxy swapidx = rn2(i);
coord tmp = dirs[swapidx];
dirs[swapidx] = dirs[i-1];
dirs[i-1] = tmp;
+8 -8
View File
@@ -29,7 +29,7 @@ static void freefruitchn(struct fruit *);
static void ghostfruit(struct obj *);
static boolean restgamestate(NHFILE *, unsigned int *, unsigned int *);
static void restlevelstate(unsigned int, unsigned int);
static int restlevelfile(xchar);
static int restlevelfile(xint8);
static void rest_bubbles(NHFILE *);
static void restore_gamelog(NHFILE *);
static void restore_msghistory(NHFILE *);
@@ -723,7 +723,7 @@ restlevelstate(unsigned int stuckid, unsigned int steedid)
/*ARGSUSED*/
static int
restlevelfile(xchar ltmp)
restlevelfile(xint8 ltmp)
{
char whynot[BUFSZ];
NHFILE *nhfp = (NHFILE *) 0;
@@ -745,14 +745,14 @@ int
dorecover(NHFILE* nhfp)
{
unsigned int stuckid = 0, steedid = 0; /* not a register */
xchar ltmp = 0;
xint8 ltmp = 0;
int rtmp;
/* suppress map display if some part of the code tries to update that */
g.program_state.restoring = 1;
get_plname_from_file(nhfp, g.plname);
getlev(nhfp, 0, (xchar) 0);
getlev(nhfp, 0, (xint8) 0);
if (!restgamestate(nhfp, &stuckid, &steedid)) {
NHFILE tnhfp;
@@ -835,7 +835,7 @@ dorecover(NHFILE* nhfp)
(void) validate(nhfp, (char *) 0);
get_plname_from_file(nhfp, g.plname);
getlev(nhfp, 0, (xchar) 0);
getlev(nhfp, 0, (xint8) 0);
close_nhfile(nhfp);
restlevelstate(stuckid, steedid);
g.program_state.something_worth_saving = 1; /* useful data now exists */
@@ -999,14 +999,14 @@ trickery(char *reason)
}
void
getlev(NHFILE* nhfp, int pid, xchar lev)
getlev(NHFILE* nhfp, int pid, xint8 lev)
{
register struct trap *trap;
register struct monst *mtmp;
long elapsed;
branch *br;
int hpid = 0;
xchar dlvl = 0;
xint8 dlvl = 0;
int x, y;
boolean ghostly = (nhfp->ftype == NHF_BONESFILE);
#ifdef TOS
@@ -1233,7 +1233,7 @@ get_plname_from_file(NHFILE* nhfp, char *plbuf)
static void
rest_bubbles(NHFILE *nhfp)
{
xchar bbubbly;
xint8 bbubbly;
/* whether or not the Plane of Water's air bubbles or Plane of Air's
clouds are present is recorded during save so that we don't have to
+8 -8
View File
@@ -19,7 +19,7 @@ int dotcnt, dotrow; /* also used in restore */
static void savelevchn(NHFILE *);
static void savelevl(NHFILE *,boolean);
static void savedamage(NHFILE *);
static void save_bubbles(NHFILE *, xchar);
static void save_bubbles(NHFILE *, xint8);
static void save_stairs(NHFILE *);
static void save_bc(NHFILE *);
static void saveobj(NHFILE *,struct obj *);
@@ -29,7 +29,7 @@ static void savemonchn(NHFILE *,struct monst *);
static void savetrapchn(NHFILE *,struct trap *);
static void save_gamelog(NHFILE *);
static void savegamestate(NHFILE *);
static void savelev_core(NHFILE *, xchar);
static void savelev_core(NHFILE *, xint8);
static void save_msghistory(NHFILE *);
#ifdef ZEROCOMP
@@ -78,7 +78,7 @@ int
dosave0(void)
{
const char *fq_save;
xchar ltmp;
xint8 ltmp;
char whynot[BUFSZ];
NHFILE *nhfp, *onhfp;
int res = 0;
@@ -186,7 +186,7 @@ dosave0(void)
set_ustuck((struct monst *) 0);
u.usteed = (struct monst *) 0;
for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) {
for (ltmp = (xint8) 1; ltmp <= maxledgerno(); ltmp++) {
if (ltmp == ledger_no(&g.uz_save))
continue;
if (!(g.level_info[ltmp].flags & LFILE_EXISTS))
@@ -447,7 +447,7 @@ savestateinlock(void)
#endif
void
savelev(NHFILE *nhfp, xchar lev)
savelev(NHFILE *nhfp, xint8 lev)
{
boolean set_uz_save = (g.uz_save.dnum == 0 && g.uz_save.dlevel == 0);
@@ -470,7 +470,7 @@ savelev(NHFILE *nhfp, xchar lev)
}
static void
savelev_core(NHFILE *nhfp, xchar lev)
savelev_core(NHFILE *nhfp, xint8 lev)
{
#ifdef TOS
short tlev;
@@ -636,9 +636,9 @@ savelevl(NHFILE* nhfp, boolean rlecomp)
/* save Plane of Water's air bubbles and Plane of Air's clouds */
static void
save_bubbles(NHFILE *nhfp, xchar lev)
save_bubbles(NHFILE *nhfp, xint8 lev)
{
xchar bbubbly;
xint8 bbubbly;
/* air bubbles and clouds used to be saved as part of game state
because restoring them needs dungeon data that isn't available
+38 -38
View File
@@ -63,9 +63,9 @@ static struct damage *find_damage(struct monst *);
static void discard_damage_struct(struct damage *);
static void discard_damage_owned_by(struct monst *);
static void shk_fixes_damage(struct monst *);
static xchar *litter_getpos(int *, xchar, xchar, struct monst *);
static void litter_scatter(xchar *, int, xchar, xchar, struct monst *);
static void litter_newsyms(xchar *, xchar, xchar);
static coordxy *litter_getpos(int *, coordxy, coordxy, struct monst *);
static void litter_scatter(coordxy *, int, coordxy, coordxy, struct monst *);
static void litter_newsyms(coordxy *, coordxy, coordxy);
static int repair_damage(struct monst *, struct damage *, boolean);
static void sub_one_frombill(struct obj *, struct monst *);
static void add_one_tobill(struct obj *, boolean, struct monst *);
@@ -344,7 +344,7 @@ call_kops(register struct monst* shkp, register boolean nearshop)
{
coord mm;
xchar sx = 0, sy = 0;
coordxy sx = 0, sy = 0;
choose_stairs(&sx, &sy, TRUE);
@@ -374,7 +374,7 @@ call_kops(register struct monst* shkp, register boolean nearshop)
/* x,y is strictly inside shop */
char
inside_shop(register xchar x, register xchar y)
inside_shop(register coordxy x, register coordxy y)
{
register char rno;
@@ -468,7 +468,7 @@ credit_report(struct monst *shkp, int idx, boolean silent)
/* robbery from outside the shop via telekinesis or grappling hook */
void
remote_burglary(xchar x, xchar y)
remote_burglary(coordxy x, coordxy y)
{
struct monst *shkp;
struct eshk *eshkp;
@@ -1045,7 +1045,7 @@ pay(long tmp, register struct monst* shkp)
static void
home_shk(struct monst *shkp, boolean killkops)
{
xchar x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y;
coordxy x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y;
(void) mnearto(shkp, x, y, TRUE, RLOC_NOMSG);
g.level.flags.has_shop = 1;
@@ -1189,7 +1189,7 @@ hot_pursuit(register struct monst* shkp)
the shop. These conditions must be checked by the calling function. */
/*ARGSUSED*/
void
make_angry_shk(struct monst* shkp, xchar ox UNUSED, xchar oy UNUSED)
make_angry_shk(struct monst* shkp, coordxy ox UNUSED, coordxy oy UNUSED)
/* <ox,oy> predate 'noit_Monnam()', let alone Shknam() */
{
struct eshk *eshkp = ESHK(shkp);
@@ -1884,7 +1884,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently)
static void
set_repo_loc(struct monst* shkp)
{
register xchar ox, oy;
register coordxy ox, oy;
struct eshk *eshkp = ESHK(shkp);
/* if you're not in this shk's shop room, or if you're in its doorway
@@ -1992,7 +1992,7 @@ get_cost_of_shop_item(
{
struct monst *shkp;
struct obj *top;
xchar x, y;
coordxy x, y;
boolean freespot;
long cost = 0L;
@@ -2172,7 +2172,7 @@ contained_cost(
boolean unpaid_only)
{
register struct obj *otmp, *top;
xchar x, y;
coordxy x, y;
boolean on_floor, freespot;
for (top = obj; top->where == OBJ_CONTAINED; top = top->ocontainer)
@@ -2433,7 +2433,7 @@ unpaid_cost(
long amt = 0L;
#if 0 /* if two shops share a wall, this might find wrong shk */
xchar ox, oy;
coordxy ox, oy;
if (!get_obj_location(unp_obj, &ox, &oy, BURIED_TOO | CONTAINED_TOO))
ox = u.ux, oy = u.uy; /* (shouldn't happen) */
@@ -2903,8 +2903,8 @@ stolen_container(
long
stolen_value(
struct obj *obj,
xchar x,
xchar y,
coordxy x,
coordxy y,
boolean peaceful,
boolean silent)
{
@@ -3066,7 +3066,7 @@ sellobj_state(int deliberate)
}
void
sellobj(register struct obj* obj, xchar x, xchar y)
sellobj(register struct obj* obj, coordxy x, coordxy y)
{
register struct monst *shkp;
register struct eshk *eshkp;
@@ -3446,7 +3446,7 @@ getprice(register struct obj* obj, boolean shk_buying)
/* shk catches thrown pick-axe */
struct monst *
shkcatch(register struct obj* obj, register xchar x, register xchar y)
shkcatch(register struct obj* obj, register coordxy x, register coordxy y)
{
register struct monst *shkp;
@@ -3479,8 +3479,8 @@ shkcatch(register struct obj* obj, register xchar x, register xchar y)
void
add_damage(
register xchar x,
register xchar y,
register coordxy x,
register coordxy y,
long cost)
{
struct damage *tmp_dam;
@@ -3533,7 +3533,7 @@ shk_impaired(struct monst *shkp)
static boolean
repairable_damage(struct damage *dam, struct monst *shkp)
{
xchar x, y;
coordxy x, y;
struct trap* ttmp;
struct monst *mtmp;
@@ -3614,7 +3614,7 @@ discard_damage_owned_by(struct monst *shkp)
struct damage *dam = g.level.damagelist, *dam2, *prevdam = NULL;
while (dam) {
xchar x = dam->place.x, y = dam->place.y;
coordxy x = dam->place.x, y = dam->place.y;
if (index(in_rooms(x, y, SHOPBASE), ESHK(shkp)->shoproom)) {
dam2 = dam->next;
@@ -3664,10 +3664,10 @@ shk_fixes_damage(struct monst *shkp)
#define horiz(i) ((i % 3) - 1)
#define vert(i) ((i / 3) - 1)
static xchar *
litter_getpos(int *k, xchar x, xchar y, struct monst *shkp)
static coordxy *
litter_getpos(int *k, coordxy x, coordxy y, struct monst *shkp)
{
static xchar litter[9];
static xint16 litter[9];
int i, ix, iy;
(void) memset((genericptr_t) litter, 0, sizeof litter);
@@ -3694,9 +3694,9 @@ litter_getpos(int *k, xchar x, xchar y, struct monst *shkp)
static void
litter_scatter(
xchar *litter,
xint16 *litter,
int k,
xchar x, xchar y,
coordxy x, coordxy y,
struct monst *shkp)
{
struct obj *otmp;
@@ -3755,7 +3755,7 @@ litter_scatter(
}
static void
litter_newsyms(xchar *litter, xchar x, xchar y)
litter_newsyms(xint16 *litter, coordxy x, coordxy y)
{
int i;
@@ -3780,8 +3780,8 @@ repair_damage(
struct damage *tmp_dam,
boolean catchup)
{
xchar x, y;
xchar *litter;
coordxy x, y;
xint16 *litter;
struct obj *otmp;
struct trap *ttmp;
int k, disposition = 1;
@@ -3923,7 +3923,7 @@ fix_shop_damage(void)
int
shk_move(struct monst *shkp)
{
xchar gx, gy, omx, omy;
coordxy gx, gy, omx, omy;
int udist;
schar appr;
struct eshk *eshkp = ESHK(shkp);
@@ -4179,7 +4179,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
char shops_affected[5];
boolean uinshp = (*u.ushops != '\0');
char qbuf[80];
xchar x, y;
coordxy x, y;
boolean dugwall = (!strcmp(dmgstr, "dig into") /* wand */
|| !strcmp(dmgstr, "damage")); /* pick-axe */
boolean animal, pursue;
@@ -4329,7 +4329,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
if (yn(qbuf) != 'n') {
boolean is_seen, was_seen = canseemon(shkp),
was_outside = !inhishop(shkp);
xchar sx = shkp->mx, sy = shkp->my;
coordxy sx = shkp->mx, sy = shkp->my;
cost_of_damage = check_credit(cost_of_damage, shkp);
if (cost_of_damage > 0L) {
@@ -4367,7 +4367,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify)
/* called in dokick.c when we kick an object that might be in a store */
boolean
costly_spot(register xchar x, register xchar y)
costly_spot(register coordxy x, register coordxy y)
{
struct monst *shkp;
struct eshk *eshkp;
@@ -4385,7 +4385,7 @@ costly_spot(register xchar x, register xchar y)
/* called by dotalk(sounds.c) when #chatting; returns obj if location
contains shop goods and shopkeeper is willing & able to speak */
struct obj *
shop_object(register xchar x, register xchar y)
shop_object(register coordxy x, register coordxy y)
{
register struct obj *otmp;
register struct monst *shkp;
@@ -4726,7 +4726,7 @@ check_unpaid(struct obj* otmp)
}
void
costly_gold(xchar x, xchar y, long amount, boolean silent)
costly_gold(coordxy x, coordxy y, long amount, boolean silent)
{
register long delta;
register struct monst *shkp;
@@ -4765,7 +4765,7 @@ costly_gold(xchar x, xchar y, long amount, boolean silent)
/* used in domove to block diagonal shop-exit */
/* x,y should always be a door */
boolean
block_door(register xchar x, register xchar y)
block_door(register coordxy x, register coordxy y)
{
register int roomno = *in_rooms(x, y, SHOPBASE);
register struct monst *shkp;
@@ -4799,9 +4799,9 @@ block_door(register xchar x, register xchar y)
/* used in domove to block diagonal shop-entry;
u.ux, u.uy should always be a door */
boolean
block_entry(register xchar x, register xchar y)
block_entry(register coordxy x, register coordxy y)
{
register xchar sx, sy;
register coordxy sx, sy;
register int roomno;
register struct monst *shkp;
@@ -4860,7 +4860,7 @@ static char *
shk_owns(char *buf, struct obj *obj)
{
struct monst *shkp;
xchar x, y;
coordxy x, y;
if (get_obj_location(obj, &x, &y, 0)
&& (obj->unpaid || (obj->where == OBJ_FLOOR && !obj->no_charge
+92 -92
View File
@@ -18,7 +18,7 @@ typedef void (*select_iter_func)(int, int, genericptr);
extern void mkmap(lev_init *);
static boolean match_maptyps(xchar, xchar);
static boolean match_maptyps(xint16, xint16);
static void solidify_map(void);
static void lvlfill_maze_grid(int, int, int, int, schar);
static void lvlfill_solid(schar, schar);
@@ -28,7 +28,7 @@ static void flip_drawbridge_vertical(struct rm *);
static void flip_visuals(int, int, int, int, int);
static int flip_encoded_direction_bits(int, int);
static void sel_set_wall_property(int, int, genericptr_t);
static void set_wall_property(xchar, xchar, xchar, xchar, int);
static void set_wall_property(coordxy, coordxy, coordxy, coordxy, int);
static void count_features(void);
static void remove_boundary_syms(void);
static void set_door_orientation(int, int);
@@ -37,15 +37,15 @@ static void maybe_add_door(int, int, struct mkroom *);
static void link_doors_rooms(void);
static int rnddoor(void);
static int rndtrap(void);
static void get_location(xchar *, xchar *, getloc_flags_t, struct mkroom *);
static void set_ok_location_func(boolean (*)(xchar, xchar));
static boolean is_ok_location(xchar, xchar, getloc_flags_t);
static void get_location(coordxy *, coordxy *, getloc_flags_t, struct mkroom *);
static void set_ok_location_func(boolean (*)(coordxy, coordxy));
static boolean is_ok_location(coordxy, coordxy, getloc_flags_t);
static unpacked_coord get_unpacked_coord(long, int);
static void get_room_loc(xchar *, xchar *, struct mkroom *);
static void get_free_room_loc(xchar *, xchar *, struct mkroom *,
static void get_room_loc(coordxy *, coordxy *, struct mkroom *);
static void get_free_room_loc(coordxy *, coordxy *, struct mkroom *,
packed_coord);
static boolean create_subroom(struct mkroom *, xchar, xchar, xchar,
xchar, xchar, xchar);
static boolean create_subroom(struct mkroom *, coordxy, coordxy, coordxy,
coordxy, xint16, xint16);
static void create_door(room_door *, struct mkroom *);
static void create_trap(spltrap *, struct mkroom *);
static int noncoalignment(aligntyp);
@@ -55,7 +55,7 @@ static unsigned int sp_amask_to_amask(unsigned int sp_amask);
static void create_monster(monster *, struct mkroom *);
static void create_object(object *, struct mkroom *);
static void create_altar(altar *, struct mkroom *);
static boolean search_door(struct mkroom *, xchar *, xchar *, xchar, int);
static boolean search_door(struct mkroom *, coordxy *, coordxy *, coordxy, int);
static void create_corridor(corridor *);
static struct mkroom *build_room(room *, struct mkroom *);
static void light_region(region *);
@@ -100,10 +100,10 @@ static void get_table_xy_or_coord(lua_State *, lua_Integer *, lua_Integer *);
static int get_table_region(lua_State *, const char *, lua_Integer *,
lua_Integer *, lua_Integer *, lua_Integer *, boolean);
static void set_wallprop_in_selection(lua_State *, int);
static xchar random_wdir(void);
static coordxy random_wdir(void);
static int floodfillchk_match_under(int, int);
static int floodfillchk_match_accessible(int, int);
static boolean sel_flood_havepoint(int, int, xchar *, xchar *, int);
static boolean sel_flood_havepoint(int, int, coordxy *, coordxy *, int);
static long line_dist_coord(long, long, long, long, long, long);
static void l_push_mkroom_table(lua_State *, struct mkroom *);
static int get_table_align(lua_State *);
@@ -200,7 +200,7 @@ static struct monst *invent_carrying_monster = (struct monst *) 0;
/* Does typ match with levl[][].typ, considering special types
MATCH_WALL and MAX_TYPE (aka transparency)? */
static boolean
match_maptyps(xchar typ, xchar levltyp)
match_maptyps(xint16 typ, xint16 levltyp)
{
if ((typ == MATCH_WALL) && !IS_STWALL(levltyp))
return FALSE;
@@ -300,7 +300,7 @@ mapfrag_match(struct mapfragment* mf, int x, int y)
static void
solidify_map(void)
{
xchar x, y;
coordxy x, y;
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++)
@@ -870,9 +870,9 @@ sel_set_wall_property(int x, int y, genericptr_t arg)
* Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able
*/
static void
set_wall_property(xchar x1, xchar y1, xchar x2, xchar y2, int prop)
set_wall_property(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int prop)
{
register xchar x, y;
register coordxy x, y;
x1 = max(x1, 1);
x2 = min(x2, COLNO - 1);
@@ -890,7 +890,7 @@ set_wall_property(xchar x1, xchar y1, xchar x2, xchar y2, int prop)
static void
count_features(void)
{
xchar x, y;
coordxy x, y;
g.level.flags.nfountains = g.level.flags.nsinks = 0;
for (y = 0; y < ROWNO; y++)
@@ -911,7 +911,7 @@ remove_boundary_syms(void)
* are laid out. CROSSWALLS are used to specify "invisible"
* boundaries where DOOR syms look bad or aren't desirable.
*/
xchar x, y;
coordxy x, y;
boolean has_bounds = FALSE;
for (x = 0; x < COLNO - 1; x++)
@@ -1087,7 +1087,7 @@ rndtrap(void)
*/
static void
get_location(
xchar *x, xchar *y,
coordxy *x, coordxy *y,
getloc_flags_t humidity,
struct mkroom *croom)
{
@@ -1155,16 +1155,16 @@ get_location(
}
}
static boolean (*is_ok_location_func)(xchar, xchar) = NULL;
static boolean (*is_ok_location_func)(coordxy, coordxy) = NULL;
static void
set_ok_location_func(boolean (*func)(xchar, xchar))
set_ok_location_func(boolean (*func)(coordxy, coordxy))
{
is_ok_location_func = func;
}
static boolean
is_ok_location(xchar x, xchar y, getloc_flags_t humidity)
is_ok_location(coordxy x, coordxy y, getloc_flags_t humidity)
{
register int typ = levl[x][y].typ;
@@ -1222,7 +1222,7 @@ get_unpacked_coord(long loc, int defhumidity)
void
get_location_coord(
xchar *x, xchar *y,
coordxy *x, coordxy *y,
int humidity,
struct mkroom *croom,
long crd)
@@ -1243,7 +1243,7 @@ get_location_coord(
* negative values for x or y means RANDOM!
*/
static void
get_room_loc(xchar *x, xchar *y, struct mkroom *croom)
get_room_loc(coordxy *x, coordxy *y, struct mkroom *croom)
{
coord c;
@@ -1269,11 +1269,11 @@ get_room_loc(xchar *x, xchar *y, struct mkroom *croom)
*/
static void
get_free_room_loc(
xchar *x, xchar *y,
coordxy *x, coordxy *y,
struct mkroom *croom,
packed_coord pos)
{
xchar try_x, try_y;
coordxy try_x, try_y;
register int trycnt = 0;
get_location_coord(&try_x, &try_y, DRY, croom, pos);
@@ -1291,14 +1291,14 @@ get_free_room_loc(
boolean
check_room(
xchar *lowx, xchar *ddx,
xchar *lowy, xchar *ddy,
coordxy *lowx, coordxy *ddx,
coordxy *lowy, coordxy *ddy,
boolean vault)
{
register int x, y, hix = *lowx + *ddx, hiy = *lowy + *ddy;
register struct rm *lev;
int xlim, ylim, ymax;
xchar s_lowx, s_ddx, s_lowy, s_ddy;
coordxy s_lowx, s_ddx, s_lowy, s_ddy;
s_lowx = *lowx; s_ddx = *ddx;
s_lowy = *lowy; s_ddy = *ddy;
@@ -1370,12 +1370,12 @@ check_room(
*/
boolean
create_room(
xchar x, xchar y,
xchar w, xchar h,
xchar xal, xchar yal,
xchar rtype, xchar rlit)
coordxy x, coordxy y,
coordxy w, coordxy h,
coordxy xal, coordxy yal,
xint16 rtype, xint16 rlit)
{
xchar xabs = 0, yabs = 0;
coordxy xabs = 0, yabs = 0;
int wtmp, htmp, xaltmp, yaltmp, xtmp, ytmp;
NhRect *r1 = 0, r2;
int trycnt = 0;
@@ -1403,7 +1403,7 @@ create_room(
* it up.
*/
do {
xchar xborder, yborder;
coordxy xborder, yborder;
wtmp = w;
htmp = h;
@@ -1416,7 +1416,7 @@ create_room(
if ((xtmp < 0 && ytmp < 0 && wtmp < 0 && xaltmp < 0 && yaltmp < 0)
|| vault) {
xchar hx, hy, lx, ly, dx, dy;
coordxy hx, hy, lx, ly, dx, dy;
r1 = rnd_rect(); /* Get a random rectangle */
@@ -1464,7 +1464,7 @@ create_room(
r2.hy = yabs + htmp;
} else { /* Only some parameters are random */
int rndpos = 0;
xchar dx, dy;
coordxy dx, dy;
if (xtmp < 0 && ytmp < 0) { /* Position is RANDOM */
xtmp = rnd(5);
@@ -1552,11 +1552,11 @@ create_room(
static boolean
create_subroom(
struct mkroom *proom,
xchar x, xchar y,
xchar w, xchar h,
xchar rtype, xchar rlit)
coordxy x, coordxy y,
coordxy w, coordxy h,
xint16 rtype, xint16 rlit)
{
xchar width, height;
coordxy width, height;
width = proom->hx - proom->lx + 1;
height = proom->hy - proom->ly + 1;
@@ -1696,7 +1696,7 @@ create_door(room_door *dd, struct mkroom *broom)
static void
create_trap(spltrap* t, struct mkroom* croom)
{
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
coord tm;
int mktrap_flags = MKTRAP_MAZEFLAG;
@@ -1804,7 +1804,7 @@ static void
create_monster(monster* m, struct mkroom* croom)
{
struct monst *mtmp;
xchar x, y;
coordxy x, y;
char class;
unsigned int amask;
coord cc;
@@ -2053,7 +2053,7 @@ static void
create_object(object* o, struct mkroom* croom)
{
struct obj *otmp;
xchar x, y;
coordxy x, y;
char c;
boolean named; /* has a name been supplied in level description? */
@@ -2297,7 +2297,7 @@ static void
create_altar(altar* a, struct mkroom* croom)
{
schar sproom;
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
unsigned int amask;
boolean croom_is_temple = TRUE;
@@ -2342,8 +2342,8 @@ create_altar(altar* a, struct mkroom* croom)
static boolean
search_door(
struct mkroom* croom,
xchar *x, xchar * y,
xchar wall, int cnt)
coordxy *x, coordxy * y,
xint16 wall, int cnt)
{
int dx, dy;
int xx, yy;
@@ -2652,7 +2652,7 @@ build_room(room *r, struct mkroom* mkr)
{
boolean okroom;
struct mkroom *aroom;
xchar rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM;
xint16 rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM;
if (mkr) {
aroom = &g.subrooms[g.nsubroom];
@@ -2755,9 +2755,9 @@ maze1xy(coord *m, int humidity)
if (--tryct < 0)
break; /* give up */
} while (!(x % 2) || !(y % 2) || SpLev_Map[x][y]
|| !is_ok_location((xchar) x, (xchar) y, humidity));
|| !is_ok_location((coordxy) x, (coordxy) y, humidity));
m->x = (xchar) x, m->y = (xchar) y;
m->x = (coordxy) x, m->y = (coordxy) y;
}
/*
@@ -2771,7 +2771,7 @@ static void
fill_empty_maze(void)
{
int mapcountmax, mapcount, mapfact;
xchar x, y;
coordxy x, y;
coord mm;
mapcountmax = mapcount = (g.x_maze_max - 2) * (g.y_maze_max - 2);
@@ -3643,7 +3643,7 @@ lspo_engraving(lua_State *L)
int etyp = DUST;
char *txt = (char *) 0;
long ecoord;
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
int argc = lua_gettop(L);
create_des_coder();
@@ -3874,7 +3874,7 @@ spo_endroom(struct sp_coder* coder UNUSED)
/* callback for is_ok_location.
stairs generated at random location shouldn't overwrite special terrain */
static boolean
good_stair_loc(xchar x, xchar y)
good_stair_loc(coordxy x, coordxy y)
{
schar typ = levl[x][y].typ;
@@ -3887,7 +3887,7 @@ l_create_stairway(lua_State *L, boolean using_ladder)
static const char *const stairdirs[] = { "down", "up", NULL };
static const int stairdirs2i[] = { 0, 1 };
int argc = lua_gettop(L);
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
struct trap *badtrap;
long scoord;
@@ -3981,7 +3981,7 @@ int
lspo_grave(lua_State *L)
{
int argc = lua_gettop(L);
xchar x, y;
coordxy x, y;
long scoord;
lua_Integer ax,ay;
char *txt;
@@ -4202,7 +4202,7 @@ int
lspo_gold(lua_State *L)
{
int argc = lua_gettop(L);
xchar x, y;
coordxy x, y;
long amount;
long gcoord;
lua_Integer gx, gy;
@@ -4330,7 +4330,7 @@ selection_clone(struct selectionvar* sel)
return tmps;
}
xchar
coordxy
selection_getpoint(int x, int y, struct selectionvar* sel)
{
if (!sel || !sel->map)
@@ -4342,7 +4342,7 @@ selection_getpoint(int x, int y, struct selectionvar* sel)
}
void
selection_setpoint(int x, int y, struct selectionvar* sel, xchar c)
selection_setpoint(int x, int y, struct selectionvar* sel, coordxy c)
{
if (!sel || !sel->map)
return;
@@ -4366,7 +4366,7 @@ selection_not(struct selectionvar* s)
}
struct selectionvar *
selection_filter_mapchar(struct selectionvar* ov, xchar typ, int lit)
selection_filter_mapchar(struct selectionvar* ov, coordxy typ, int lit)
{
int x, y;
struct selectionvar *ret;
@@ -4412,7 +4412,7 @@ selection_filter_percent(struct selectionvar* ov, int percent)
}
int
selection_rndcoord(struct selectionvar* ov, xchar *x, xchar *y, boolean removeit)
selection_rndcoord(struct selectionvar* ov, coordxy *x, coordxy *y, boolean removeit)
{
int idx = 0;
int c;
@@ -4443,10 +4443,10 @@ selection_rndcoord(struct selectionvar* ov, xchar *x, xchar *y, boolean removeit
}
/* Choose a single random W_* direction. */
static xchar
static coordxy
random_wdir(void)
{
static const xchar wdirs[4] = { W_NORTH, W_SOUTH, W_EAST, W_WEST };
static const coordxy wdirs[4] = { W_NORTH, W_SOUTH, W_EAST, W_WEST };
return wdirs[rn2(4)];
}
@@ -4510,7 +4510,7 @@ floodfillchk_match_under(int x, int y)
}
void
set_floodfillchk_match_under(xchar typ)
set_floodfillchk_match_under(coordxy typ)
{
floodfillchk_match_under_typ = typ;
set_selection_floodfillchk(floodfillchk_match_under);
@@ -4526,9 +4526,9 @@ floodfillchk_match_accessible(int x, int y)
/* check whethere <x,y> is already in xs[],ys[] */
static boolean
sel_flood_havepoint(int x, int y, xchar xs[], xchar ys[], int n)
sel_flood_havepoint(int x, int y, coordxy xs[], coordxy ys[], int n)
{
xchar xx = (xchar) x, yy = (xchar) y;
coordxy xx = (coordxy) x, yy = (coordxy) y;
while (n > 0) {
--n;
@@ -4562,8 +4562,8 @@ selection_floodfill(struct selectionvar* ov, int x, int y, boolean diagonals)
} while (0)
static const char floodfill_stack_overrun[] = "floodfill stack overrun";
int idx = 0;
xchar dx[SEL_FLOOD_STACK];
xchar dy[SEL_FLOOD_STACK];
coordxy dx[SEL_FLOOD_STACK];
coordxy dy[SEL_FLOOD_STACK];
if (selection_flood_check_func == (int (*)(int, int)) 0) {
selection_free(tmp, TRUE);
@@ -4767,8 +4767,8 @@ selection_do_gradient(
/* bresenham line algo */
void
selection_do_line(
xchar x1, xchar y1,
xchar x2, xchar y2,
coordxy x1, coordxy y1,
coordxy x2, coordxy y2,
struct selectionvar *ov)
{
int d0, dx, dy, ai, bi, xi, yi;
@@ -4824,8 +4824,8 @@ selection_do_line(
void
selection_do_randline(
xchar x1, xchar y1,
xchar x2, xchar y2,
coordxy x1, coordxy y1,
coordxy x2, coordxy y2,
schar rough,
schar rec,
struct selectionvar *ov)
@@ -4912,8 +4912,8 @@ sel_set_feature(int x, int y, genericptr_t arg)
static void
sel_set_door(int dx, int dy, genericptr_t arg)
{
xchar typ = *(xchar *) arg;
xchar x = dx, y = dy;
coordxy typ = *(coordxy *) arg;
coordxy x = dx, y = dy;
if (!IS_DOOR(levl[x][y].typ) && levl[x][y].typ != SDOOR)
levl[x][y].typ = (typ & D_SECRET) ? SDOOR : DOOR;
@@ -4942,8 +4942,8 @@ lspo_door(lua_State *L)
-1, D_ISOPEN, D_CLOSED, D_LOCKED, D_NODOOR, D_BROKEN, D_SECRET
};
int msk;
xchar x, y;
xchar typ;
coordxy x, y;
coordxy typ;
int argc = lua_gettop(L);
create_des_coder();
@@ -4962,7 +4962,7 @@ lspo_door(lua_State *L)
msk = doorstates2i[get_table_option(L, "state", "random", doorstates)];
}
typ = (msk == -1) ? rnddoor() : (xchar) msk;
typ = (msk == -1) ? rnddoor() : (coordxy) msk;
if (x == -1 && y == -1) {
static const char *const walldirs[] = {
@@ -5020,19 +5020,19 @@ int
nhl_abs_coord(lua_State *L)
{
int argc = lua_gettop(L);
xchar x = -1, y = -1;
coordxy x = -1, y = -1;
if (argc == 2) {
x = (xchar) lua_tointeger(L, 1);
y = (xchar) lua_tointeger(L, 2);
x = (coordxy) lua_tointeger(L, 1);
y = (coordxy) lua_tointeger(L, 2);
x += g.xstart;
y += g.ystart;
lua_pushinteger(L, x);
lua_pushinteger(L, y);
return 2;
} else if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) {
x = (xchar) get_table_int(L, "x");
y = (xchar) get_table_int(L, "y");
x = (coordxy) get_table_int(L, "x");
y = (coordxy) get_table_int(L, "y");
x += g.xstart;
y += g.ystart;
lua_newtable(L);
@@ -5057,7 +5057,7 @@ lspo_feature(lua_State *L)
"throne", "tree", NULL };
static const int features2i[] = { FOUNTAIN, SINK, POOL,
THRONE, TREE, STONE };
xchar x, y;
coordxy x, y;
int typ;
int argc = lua_gettop(L);
boolean can_have_flags = FALSE;
@@ -5132,7 +5132,7 @@ int
lspo_terrain(lua_State *L)
{
terrain tmpterrain;
xchar x = 0, y = 0;
coordxy x = 0, y = 0;
struct selectionvar *sel = NULL;
int argc = lua_gettop(L);
@@ -5199,7 +5199,7 @@ lspo_terrain(lua_State *L)
int
lspo_replace_terrain(lua_State *L)
{
xchar totyp, fromtyp;
coordxy totyp, fromtyp;
struct mapfragment *mf = NULL;
struct selectionvar *sel = NULL;
boolean freesel = FALSE;
@@ -5256,7 +5256,7 @@ lspo_replace_terrain(lua_State *L)
if (x1 == -1 && y1 == -1 && x2 == -1 && y2 == -1) {
(void) selection_not(sel);
} else {
xchar rx1, ry1, rx2, ry2;
coordxy rx1, ry1, rx2, ry2;
rx1 = x1, ry1 = y1, rx2 = x2, ry2 = y2;
get_location(&rx1, &ry1, ANY_LOC, g.coder->croom);
get_location(&rx2, &ry2, ANY_LOC, g.coder->croom);
@@ -5296,7 +5296,7 @@ generate_way_out_method(
WAN_TELEPORTATION, SCR_TELEPORTATION, RIN_TELEPORTATION
};
struct selectionvar *ov2 = selection_new(), *ov3;
xchar x, y;
coordxy x, y;
boolean res = TRUE;
selection_floodfill(ov2, nx, ny, TRUE);
@@ -5648,7 +5648,7 @@ add_doors_to_room(struct mkroom *croom)
int
lspo_region(lua_State *L)
{
xchar dx1, dy1, dx2, dy2;
coordxy dx1, dy1, dx2, dy2;
register struct mkroom *troom;
boolean do_arrival_room = FALSE, room_not_needed,
irregular = FALSE, joined = TRUE;
@@ -5798,7 +5798,7 @@ lspo_drawbridge(lua_State *L)
"open", "closed", "random", NULL
};
static const int dbopens2i[] = { 1, 0, -1, -2 };
xchar x, y;
coordxy x, y;
lua_Integer mx, my;
int dir;
int db_open;
@@ -5838,9 +5838,9 @@ lspo_mazewalk(lua_State *L)
static const int mwdirs2i[] = {
W_NORTH, W_SOUTH, W_EAST, W_WEST, W_RANDOM, -2
};
xchar x, y;
coordxy x, y;
lua_Integer mx, my;
xchar ftyp = ROOM;
coordxy ftyp = ROOM;
int fstocked = 1, dir = -1;
long mcoord;
int argc = lua_gettop(L);
@@ -5936,7 +5936,7 @@ lspo_wall_property(lua_State *L)
{
static const char *const wprops[] = { "nondiggable", "nonpasswall", NULL };
static const int wprop2i[] = { W_NONDIGGABLE, W_NONPASSWALL, -1 };
xchar dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1;
coordxy dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1;
int wprop;
create_des_coder();
@@ -6292,7 +6292,7 @@ TODO: g.coder->croom needs to be updated
g.xsize = COLNO - 1;
g.ysize = ROWNO;
} else {
xchar mptyp;
coordxy mptyp;
/* Themed rooms should never overwrite anything */
if (g.in_mk_themerooms) {
+5 -5
View File
@@ -180,7 +180,7 @@ goodpos(
boolean
enexto(
coord *cc,
xchar xx, xchar yy,
coordxy xx, coordxy yy,
struct permonst *mdat)
{
return (enexto_core(cc, xx, yy, mdat, GP_CHECKSCARY)
@@ -190,7 +190,7 @@ enexto(
boolean
enexto_core(
coord *cc,
xchar xx, xchar yy,
coordxy xx, coordxy yy,
struct permonst *mdat,
mmflags_nht entflags)
{
@@ -411,7 +411,7 @@ teleds(int nux, int nuy, int teleds_flags)
}
if (ball_active && (ball_still_in_range || allow_drag)) {
int bc_control;
xchar ballx, bally, chainx, chainy;
coordxy ballx, bally, chainx, chainy;
boolean cause_delay;
if (drag_ball(nux, nuy, &bc_control, &ballx, &bally, &chainx,
@@ -901,7 +901,7 @@ level_tele(void)
}
if (wizard && !strcmp(buf, "?")) {
schar destlev;
xchar destdnum;
coordxy destdnum;
levTport_menu:
destlev = 0;
@@ -1592,7 +1592,7 @@ mlevel_tele_trap(
boolean
rloco(register struct obj* obj)
{
register xchar tx, ty, otx, oty;
register coordxy tx, ty, otx, oty;
boolean restricted_fall;
int try_limit = 4000;
+8 -8
View File
@@ -899,7 +899,7 @@ hatch_egg(anything *arg, long timeout)
struct obj *egg;
struct monst *mon, *mon2;
coord cc;
xchar x, y;
coordxy x, y;
boolean yours, silent, knows_egg = FALSE;
boolean cansee_hatchspot = FALSE;
int i, mnum, hatchcount = 0;
@@ -1222,7 +1222,7 @@ burn_object(anything *arg, long timeout)
{
struct obj *obj = arg->a_obj;
boolean canseeit, many, menorah, need_newsym, need_invupdate;
xchar x, y;
coordxy x, y;
char whose[BUFSZ];
menorah = obj->otyp == CANDELABRUM_OF_INVOCATION;
@@ -1604,7 +1604,7 @@ begin_burn(struct obj *obj, boolean already_lit)
}
if (obj->lamplit && !already_lit) {
xchar x, y;
coordxy x, y;
if (get_obj_location(obj, &x, &y, CONTAINED_TOO | BURIED_TOO))
new_light_source(x, y, radius, LS_OBJECT, obj_to_any(obj));
@@ -1925,8 +1925,8 @@ timer_sanity_check(void)
}
} else if (curr->kind == TIMER_LEVEL) {
long where = curr->arg.a_long;
xchar x = (xchar) ((where >> 16) & 0xFFFF),
y = (xchar) (where & 0xFFFF);
coordxy x = (coordxy) ((where >> 16) & 0xFFFF),
y = (coordxy) (where & 0xFFFF);
if (!isok(x, y)) {
impossible("timer sanity: spot timer %lu at <%d,%d>",
@@ -2135,7 +2135,7 @@ obj_has_timer(struct obj* object, short timer_type)
*
*/
void
spot_stop_timers(xchar x, xchar y, short func_index)
spot_stop_timers(coordxy x, coordxy y, short func_index)
{
timeout_proc cleanup_func;
timer_element *curr, *prev, *next_timer = 0;
@@ -2163,7 +2163,7 @@ spot_stop_timers(xchar x, xchar y, short func_index)
* Returns 0L if no such timer.
*/
long
spot_time_expires(xchar x, xchar y, short func_index)
spot_time_expires(coordxy x, coordxy y, short func_index)
{
timer_element *curr;
long where = (((long) x << 16) | ((long) y));
@@ -2177,7 +2177,7 @@ spot_time_expires(xchar x, xchar y, short func_index)
}
long
spot_time_left(xchar x, xchar y, short func_index)
spot_time_left(coordxy x, coordxy y, short func_index)
{
long expires = spot_time_expires(x, y, func_index);
return (expires > 0L) ? expires - g.moves : 0L;
+27 -27
View File
@@ -7,7 +7,7 @@
extern const char *const destroy_strings[][3]; /* from zap.c */
static void mk_trap_statue(xchar, xchar);
static void mk_trap_statue(coordxy, coordxy);
static boolean keep_saddle_with_steedcorpse(unsigned, struct obj *,
struct obj *);
static boolean mu_maybe_destroy_web(struct monst *, boolean, struct trap *);
@@ -41,9 +41,9 @@ static int trapeffect_selector(struct monst *, struct trap *, unsigned);
static char *trapnote(struct trap *, boolean);
static int choose_trapnote(struct trap *);
static int steedintrap(struct trap *, struct obj *);
static void launch_drop_spot(struct obj *, xchar, xchar);
static void launch_drop_spot(struct obj *, coordxy, coordxy);
static boolean find_random_launch_coord(struct trap *, coord *);
static int mkroll_launch(struct trap *, xchar, xchar, short, long);
static int mkroll_launch(struct trap *, coordxy, coordxy, short, long);
static boolean isclearpath(coord *, int, schar, schar);
static void dofiretrap(struct obj *);
static void domagictrap(void);
@@ -346,7 +346,7 @@ grease_protect(
/* create a "living" statue at x,y */
static void
mk_trap_statue(xchar x, xchar y)
mk_trap_statue(coordxy x, coordxy y)
{
struct monst *mtmp;
struct obj *otmp, *statue;
@@ -599,8 +599,8 @@ fall_through(
struct monst *
animate_statue(
struct obj *statue,
xchar x,
xchar y,
coordxy x,
coordxy y,
int cause,
int *fail_reason)
{
@@ -779,8 +779,8 @@ animate_statue(
struct monst *
activate_statue_trap(
struct trap *trap,
xchar x,
xchar y,
coordxy x,
coordxy y,
boolean shatter)
{
struct monst *mtmp = (struct monst *) 0;
@@ -821,7 +821,7 @@ keep_saddle_with_steedcorpse(
if (mtmp->m_id == steed_mid) {
/* move saddle */
xchar x, y;
coordxy x, y;
if (get_obj_location(objchn, &x, &y, 0)) {
obj_extract_self(saddle);
place_object(saddle, x, y);
@@ -851,8 +851,8 @@ mu_maybe_destroy_web(
if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr)
|| unsolid(mptr) || mptr == &mons[PM_GELATINOUS_CUBE]) {
xchar x = trap->tx;
xchar y = trap->ty;
coordxy x = trap->tx;
coordxy y = trap->ty;
if (flaming(mptr) || acidic(mptr)) {
if (domsg) {
@@ -2241,7 +2241,7 @@ trapeffect_landmine(
boolean trapkilled = FALSE;
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
struct permonst *mptr = mtmp->data;
xchar tx = trap->tx, ty = trap->ty;
coordxy tx = trap->tx, ty = trap->ty;
if (rn2(3))
return Trap_Effect_Finished; /* monsters usually don't set it off */
@@ -2691,7 +2691,7 @@ blow_up_landmine(struct trap* trap)
}
static void
launch_drop_spot(struct obj* obj, xchar x, xchar y)
launch_drop_spot(struct obj* obj, coordxy x, coordxy y)
{
if (!obj) {
g.launchplace.obj = (struct obj *) 0;
@@ -3038,8 +3038,8 @@ find_random_launch_coord(struct trap *ttmp, coord *cc)
int distance;
int mindist = 4;
int trycount = 0;
xchar dx, dy;
xchar x, y;
coordxy dx, dy;
coordxy x, y;
if (!ttmp || !cc)
return FALSE;
@@ -3092,8 +3092,8 @@ find_random_launch_coord(struct trap *ttmp, coord *cc)
static int
mkroll_launch(
struct trap *ttmp,
xchar x,
xchar y,
coordxy x,
coordxy y,
short otyp,
long ocount)
{
@@ -3134,7 +3134,7 @@ isclearpath(
{
struct trap *t;
uchar typ;
xchar x, y;
coordxy x, y;
x = cc->x;
y = cc->y;
@@ -3855,8 +3855,8 @@ boolean
fire_damage(
struct obj *obj,
boolean force,
xchar x,
xchar y)
coordxy x,
coordxy y)
{
int chance;
struct obj *otmp, *ncobj;
@@ -3947,8 +3947,8 @@ fire_damage_chain(
struct obj *chain,
boolean force,
boolean here,
xchar x,
xchar y)
coordxy x,
coordxy y)
{
struct obj *obj, *nobj;
int num = 0;
@@ -3970,7 +3970,7 @@ fire_damage_chain(
/* obj has been thrown or dropped into lava; damage is worse than mere fire */
boolean
lava_damage(struct obj* obj, xchar x, xchar y)
lava_damage(struct obj* obj, coordxy x, coordxy y)
{
int otyp = obj->otyp, ocls = obj->oclass;
@@ -4212,7 +4212,7 @@ water_damage_chain(
boolean here)
{
struct obj *otmp;
xchar x, y;
coordxy x, y;
if (!obj)
return;
@@ -4602,7 +4602,7 @@ static void
move_into_trap(struct trap *ttmp)
{
int bc = 0;
xchar x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy;
coordxy x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy;
boolean unused;
bx = by = cx = cy = 0; /* lint suppression */
@@ -5499,7 +5499,7 @@ chest_trap(
struct monst *shkp = 0;
long loss = 0L;
boolean costly, insider;
xchar ox = obj->ox, oy = obj->oy;
coordxy ox = obj->ox, oy = obj->oy;
/* the obj location need not be that of player */
costly = (costly_spot(ox, oy)
@@ -6231,7 +6231,7 @@ ignite_items(struct obj* objchn)
}
void
trap_ice_effects(xchar x, xchar y, boolean ice_is_melting)
trap_ice_effects(coordxy x, coordxy y, boolean ice_is_melting)
{
struct trap *ttmp = t_at(x, y);
+8 -8
View File
@@ -10,7 +10,7 @@ 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 boolean find_guard_dest(struct monst *, coordxy *, coordxy *);
static void move_gold(struct obj *, int);
static void wallify_vault(struct monst *);
static void gd_mv_monaway(struct monst *, int, int);
@@ -255,7 +255,7 @@ uleftvault(struct monst *grd)
}
static boolean
find_guard_dest(struct monst *guard, xchar *rx, xchar *ry)
find_guard_dest(struct monst *guard, coordxy *rx, coordxy *ry)
{
register int x, y, dd, lx, ly;
@@ -309,7 +309,7 @@ invault(void)
/* if time ok and no guard now. */
char buf[BUFSZ];
int x, y, gx, gy, typ;
xchar rx, ry;
coordxy rx, ry;
long umoney;
/* first find the goal for the guard */
@@ -535,8 +535,8 @@ invault(void)
dug into an empty doorway (which could subsequently have
been plugged with an intact door by use of locking magic) */
int vlt = EGD(guard)->vroom;
xchar lowx = g.rooms[vlt].lx, hix = g.rooms[vlt].hx;
xchar lowy = g.rooms[vlt].ly, hiy = g.rooms[vlt].hy;
coordxy lowx = g.rooms[vlt].lx, hix = g.rooms[vlt].hx;
coordxy lowy = g.rooms[vlt].ly, hiy = g.rooms[vlt].hy;
if (x == lowx - 1 && y == lowy - 1)
typ = TLCORNER;
@@ -571,7 +571,7 @@ invault(void)
static void
move_gold(struct obj *gold, int vroom)
{
xchar nx, ny;
coordxy nx, ny;
remove_object(gold);
newsym(gold->ox, gold->oy);
@@ -588,7 +588,7 @@ wallify_vault(struct monst *grd)
int x, y, typ;
int vlt = EGD(grd)->vroom;
char tmp_viz;
xchar lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1,
coordxy lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1,
loy = g.rooms[vlt].ly - 1, hiy = g.rooms[vlt].hy + 1;
struct monst *mon;
struct obj *gold, *rocks;
@@ -701,7 +701,7 @@ gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy)
gdelta = distu(guardx, guardy);
if (gdelta > 2 && see_it) { /* skip if player won't see it */
bestdelta = gdelta;
bestcc.x = (xchar) guardx, bestcc.y = (xchar) guardy;
bestcc.x = (coordxy) guardx, bestcc.y = (coordxy) guardy;
tryct = 9;
do {
/* pick an available spot nearest the hero and also try
+42 -42
View File
@@ -23,7 +23,7 @@
* @...X +4
*
*/
const xchar circle_data[] = {
const coordxy circle_data[] = {
/* 0*/ 0,
/* 1*/ 1, 1,
/* 3*/ 2, 2, 1,
@@ -49,7 +49,7 @@ const xchar circle_data[] = {
* used for a single point: temporary light source of a camera flash
* as it traverses its path.
*/
const xchar circle_start[] = {
const coordxy circle_start[] = {
/* 0*/ 0,
/* 1*/ 1,
/* 2*/ 3,
@@ -74,26 +74,26 @@ const xchar circle_start[] = {
/*------ local variables ------*/
static xchar could_see[2][ROWNO][COLNO]; /* vision work space */
static xchar *cs_rows0[ROWNO], *cs_rows1[ROWNO];
static xchar cs_rmin0[ROWNO], cs_rmax0[ROWNO];
static xchar cs_rmin1[ROWNO], cs_rmax1[ROWNO];
static coordxy could_see[2][ROWNO][COLNO]; /* vision work space */
static coordxy *cs_rows0[ROWNO], *cs_rows1[ROWNO];
static coordxy cs_rmin0[ROWNO], cs_rmax0[ROWNO];
static coordxy cs_rmin1[ROWNO], cs_rmax1[ROWNO];
static char viz_clear[ROWNO][COLNO]; /* vision clear/blocked map */
static char *viz_clear_rows[ROWNO];
static xchar left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */
static xchar right_ptrs[ROWNO][COLNO];
static coordxy left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */
static coordxy right_ptrs[ROWNO][COLNO];
/* Forward declarations. */
static void fill_point(int, int);
static void dig_point(int, int);
static void view_init(void);
static void view_from(int, int, xchar **, xchar *, xchar *, int,
static void view_from(int, int, coordxy **, coordxy *, coordxy *, int,
void (*)(int, int, genericptr_t),
genericptr_t);
static void get_unused_cs(xchar ***, xchar **, xchar **);
static void rogue_vision(xchar **, xchar *, xchar *);
static void get_unused_cs(coordxy ***, coordxy **, coordxy **);
static void rogue_vision(coordxy **, coordxy *, coordxy *);
/* Macro definitions that I can't find anywhere. */
#define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0))
@@ -265,10 +265,10 @@ vision_reset(void)
* to the unused vision work area.
*/
static void
get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax)
get_unused_cs(coordxy ***rows, coordxy **rmin, coordxy **rmax)
{
register int row;
register xchar *nrmin, *nrmax;
register coordxy *nrmin, *nrmax;
if (g.viz_array == cs_rows0) {
*rows = cs_rows1;
@@ -284,7 +284,7 @@ get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax)
nrmin = *rmin;
nrmax = *rmax;
(void) memset((genericptr_t) **rows, 0, sizeof(xchar) * (ROWNO * COLNO)); /* see nothing */
(void) memset((genericptr_t) **rows, 0, sizeof(coordxy) * (ROWNO * COLNO)); /* see nothing */
for (row = 0; row < ROWNO; row++) { /* set row min & max */
*nrmin++ = COLNO - 1;
*nrmax++ = 1;
@@ -304,7 +304,7 @@ get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax)
* due to the one-sided lit wall hack.
*/
static void
rogue_vision(xchar **next, xchar *rmin, xchar *rmax)
rogue_vision(coordxy **next, coordxy *rmin, coordxy *rmax)
{
int rnum = levl[u.ux][u.uy].roomno - ROOMOFFSET; /* no SHARED... */
int start, stop, in_door, xhi, xlo, yhi, ylo;
@@ -506,13 +506,13 @@ vision_recalc(int control)
{
extern unsigned char seenv_matrix[3][3]; /* from display.c */
static unsigned char colbump[COLNO + 1]; /* cols to bump sv */
xchar **temp_array; /* points to the old vision array */
xchar **next_array; /* points to the new vision array */
xchar *next_row; /* row pointer for the new array */
xchar *old_row; /* row pointer for the old array */
xchar *next_rmin; /* min pointer for the new array */
xchar *next_rmax; /* max pointer for the new array */
const xchar *ranges; /* circle ranges -- used for xray & night vision */
coordxy **temp_array; /* points to the old vision array */
coordxy **next_array; /* points to the new vision array */
coordxy *next_row; /* row pointer for the new array */
coordxy *old_row; /* row pointer for the old array */
coordxy *next_rmin; /* min pointer for the new array */
coordxy *next_rmax; /* max pointer for the new array */
const coordxy *ranges; /* circle ranges -- used for xray & night vision */
int row = 0; /* row counter (outer loop) */
int start, stop; /* inner loop starting/stopping index */
int dx, dy; /* one step from a lit door or lit wall (see below) */
@@ -1109,9 +1109,9 @@ fill_point(int row, int col)
static int start_row;
static int start_col;
static int step;
static xchar **cs_rows;
static xchar *cs_left;
static xchar *cs_right;
static coordxy **cs_rows;
static coordxy *cs_left;
static coordxy *cs_right;
static void (*vis_func)(int, int, genericptr_t);
static genericptr_t varg;
@@ -1603,8 +1603,8 @@ clear_path(int col1, int row1, int col2, int row2)
/*
* Defines local to Algorithm C.
*/
static void right_side(int, int, int, const xchar *);
static void left_side(int, int, int, const xchar *);
static void right_side(int, int, int, const coordxy *);
static void left_side(int, int, int, const coordxy *);
/* Initialize algorithm C (nothing). */
static void
@@ -1623,7 +1623,7 @@ view_init(void)
* limits points at range limit for current row, or NULL
*/
static void
right_side(int row, int left, int right_mark, const xchar *limits)
right_side(int row, int left, int right_mark, const coordxy *limits)
{
int right; /* right limit of "could see" */
int right_edge; /* right edge of an opening */
@@ -1631,9 +1631,9 @@ right_side(int row, int left, int right_mark, const xchar *limits)
int deeper; /* if TRUE, call self as needed */
int result; /* set by q?_path() */
register int i; /* loop counter */
register xchar *rowp = NULL; /* row optimization */
xchar *row_min = NULL; /* left most [used by macro set_min()] */
xchar *row_max = NULL; /* right most [used by macro set_max()] */
register coordxy *rowp = NULL; /* row optimization */
coordxy *row_min = NULL; /* left most [used by macro set_min()] */
coordxy *row_max = NULL; /* right most [used by macro set_max()] */
int lim_max; /* right most limit of circle */
nrow = row + step;
@@ -1811,13 +1811,13 @@ right_side(int row, int left, int right_mark, const xchar *limits)
* extensive comments.
*/
static void
left_side(int row, int left_mark, int right, const xchar *limits)
left_side(int row, int left_mark, int right, const coordxy *limits)
{
int left, left_edge, nrow, deeper, result;
register int i;
register xchar *rowp = NULL;
xchar *row_min = NULL;
xchar *row_max = NULL;
register coordxy *rowp = NULL;
coordxy *row_min = NULL;
coordxy *row_max = NULL;
int lim_min;
#ifdef GCC_WARN
@@ -1954,16 +1954,16 @@ left_side(int row, int left_mark, int right, const xchar *limits)
* arg argument for func
*/
static void
view_from(int srow, int scol, xchar **loc_cs_rows,
xchar *left_most, xchar *right_most, int range,
view_from(int srow, int scol, coordxy **loc_cs_rows,
coordxy *left_most, coordxy *right_most, int range,
void (*func)(int, int, genericptr_t), genericptr_t arg)
{
register int i; /* loop counter */
xchar *rowp; /* optimization for setting could_see */
coordxy *rowp; /* optimization for setting could_see */
int nrow; /* the next row */
int left; /* the left-most visible column */
int right; /* the right-most visible column */
const xchar *limits; /* range limit for next row */
const coordxy *limits; /* range limit for next row */
/* Set globals for q?_path(), left_side(), and right_side() to use. */
start_col = scol;
@@ -2003,7 +2003,7 @@ view_from(int srow, int scol, xchar **loc_cs_rows,
if (right > scol + range)
right = scol + range;
} else
limits = (xchar *) 0;
limits = (coordxy *) 0;
if (func) {
for (i = left; i <= right; i++)
@@ -2060,12 +2060,12 @@ do_clear_area(int scol, int srow, int range,
{
/* If not centered on hero, do the hard work of figuring the area */
if (scol != u.ux || srow != u.uy) {
view_from(srow, scol, (xchar **) 0, (xchar *) 0, (xchar *) 0, range,
view_from(srow, scol, (coordxy **) 0, (coordxy *) 0, (coordxy *) 0, range,
func, arg);
} else {
register int x;
int y, min_x, max_x, max_y, offset;
const xchar *limits;
const coordxy *limits;
boolean override_vision;
/* vision doesn't pass through water or clouds, detection should
+2 -2
View File
@@ -511,7 +511,7 @@ static void hup_add_menu(winid, const glyph_info *, const anything *, char,
char, int, int, const char *, unsigned int);
static void hup_end_menu(winid, const char *);
static void hup_putstr(winid, int, const char *);
static void hup_print_glyph(winid, xchar, xchar, const glyph_info *,
static void hup_print_glyph(winid, coordxy, coordxy, const glyph_info *,
const glyph_info *);
static void hup_outrip(winid, int, time_t);
static void hup_curs(winid, int, int);
@@ -718,7 +718,7 @@ hup_putstr(winid window UNUSED, int attr UNUSED, const char *text UNUSED)
/*ARGSUSED*/
static void
hup_print_glyph(winid window UNUSED,
xchar x UNUSED, xchar y UNUSED,
coordxy x UNUSED, coordxy y UNUSED,
const glyph_info *glyphinfo UNUSED,
const glyph_info *bkglyphinfo UNUSED)
{
+3 -3
View File
@@ -314,7 +314,7 @@ strategy(struct monst *mtmp)
heal or for guardians (Kops) to congregate at to block hero's progress */
void
choose_stairs(
xchar *sx, xchar *sy, /* output; left as-is if no spot found */
coordxy *sx, coordxy *sy, /* output; left as-is if no spot found */
boolean dir) /* True: forward, False: backtrack (usually up) */
{
stairway *stway;
@@ -353,7 +353,7 @@ int
tactics(struct monst *mtmp)
{
unsigned long strat = strategy(mtmp);
xchar sx = 0, sy = 0, mx, my;
coordxy sx = 0, sy = 0, mx, my;
mtmp->mstrategy =
(mtmp->mstrategy & (STRAT_WAITMASK | STRAT_APPEARMSG)) | strat;
@@ -394,7 +394,7 @@ tactics(struct monst *mtmp)
default: /* kill, maim, pillage! */
{
long where = (strat & STRAT_STRATMASK);
xchar tx = STRAT_GOALX(strat), ty = STRAT_GOALY(strat);
coordxy tx = STRAT_GOALX(strat), ty = STRAT_GOALY(strat);
int targ = (int) (strat & STRAT_GOAL);
struct obj *otmp;
+7 -7
View File
@@ -11,7 +11,7 @@
/* worm segment structure */
struct wseg {
struct wseg *nseg;
xchar wx, wy; /* the segment's position */
coordxy wx, wy; /* the segment's position */
};
static void toss_wsegs(struct wseg *, boolean);
@@ -368,7 +368,7 @@ wormhitu(struct monst *worm)
* that both halves will survive.
*/
void
cutworm(struct monst *worm, xchar x, xchar y,
cutworm(struct monst *worm, coordxy x, coordxy y,
boolean cuttier) /* hit is by wielded blade or axe or by thrown axe */
{
struct wseg *curr, *new_tail;
@@ -621,7 +621,7 @@ place_wsegs(struct monst *worm, struct monst *oldworm)
struct wseg *curr = wtails[worm->wormno];
while (curr != wheads[worm->wormno]) {
xchar x = curr->wx, y = curr->wy;
coordxy x = curr->wx, y = curr->wy;
struct monst *mtmp = m_at(x, y);
if (oldworm && mtmp == oldworm)
@@ -739,7 +739,7 @@ remove_worm(struct monst *worm)
* be, if somehow the head is disjoint from the tail.
*/
void
place_worm_tail_randomly(struct monst *worm, xchar x, xchar y)
place_worm_tail_randomly(struct monst *worm, coordxy x, coordxy y)
{
int wnum = worm->wormno;
struct wseg *curr = wtails[wnum];
@@ -810,8 +810,8 @@ place_worm_tail_randomly(struct monst *worm, xchar x, xchar y)
#endif
{
place_worm_seg(worm, nx, ny);
curr->wx = (xchar) (ox = nx);
curr->wy = (xchar) (oy = ny);
curr->wx = (coordxy) (ox = nx);
curr->wy = (coordxy) (oy = ny);
wtails[wnum] = curr;
curr = curr->nseg;
wtails[wnum]->nseg = new_tail;
@@ -985,7 +985,7 @@ wseg_at(struct monst *worm, int x, int y)
if (worm && worm->wormno && m_at(x, y) == worm) {
struct wseg *curr;
int i, n;
xchar wx = (xchar) x, wy = (xchar) y;
coordxy wx = (coordxy) x, wy = (coordxy) y;
for (i = 0, curr = wtails[worm->wormno]; curr; curr = curr->nseg) {
if (curr->wx == wx && curr->wy == wy)
+22 -22
View File
@@ -13,12 +13,12 @@
#define MAGIC_COOKIE 1000
static void probe_objchain(struct obj *);
static boolean zombie_can_dig(xchar x, xchar y);
static boolean zombie_can_dig(coordxy x, coordxy y);
static void polyuse(struct obj *, int, int);
static void create_polymon(struct obj *, int);
static int stone_to_flesh_obj(struct obj *);
static boolean zap_updown(struct obj *);
static void zhitu(int, int, const char *, xchar, xchar);
static void zhitu(int, int, const char *, coordxy, coordxy);
static void revive_egg(struct obj *);
static boolean zap_steed(struct obj *);
static void skiprange(int, int *, int *);
@@ -560,7 +560,7 @@ probe_monster(struct monst *mtmp)
boolean
get_obj_location(
struct obj *obj,
xchar *xp, xchar *yp,
coordxy *xp, coordxy *yp,
int locflags)
{
switch (obj->where) {
@@ -598,7 +598,7 @@ get_obj_location(
boolean
get_mon_location(
struct monst *mon,
xchar *xp, xchar *yp,
coordxy *xp, coordxy *yp,
int locflags) /* non-zero means get location even if monster is buried */
{
if (mon == &g.youmonst || (u.usteed && mon == u.usteed)) {
@@ -767,7 +767,7 @@ get_container_location(
/* can zombie dig the location at x,y */
static boolean
zombie_can_dig(xchar x, xchar y)
zombie_can_dig(coordxy x, coordxy y)
{
if (isok(x, y)) {
schar typ = levl[x][y].typ;
@@ -794,7 +794,7 @@ revive(struct obj *corpse, boolean by_hero)
struct permonst *mptr;
struct obj *container;
coord xy;
xchar x, y;
coordxy x, y;
boolean one_of;
mmflags_nht mmflags = NO_MINVENT | MM_NOWAIT | MM_NOMSG;
int montype, cgend, container_nesting = 0;
@@ -1584,7 +1584,7 @@ struct obj *
poly_obj(struct obj *obj, int id)
{
struct obj *otmp;
xchar ox = 0, oy = 0;
coordxy ox = 0, oy = 0;
long old_wornmask, new_wornmask = 0L;
boolean can_merge = (id == STRANGE_OBJECT);
int obj_location = obj->where;
@@ -1856,7 +1856,7 @@ stone_to_flesh_obj(struct obj *obj)
struct permonst *ptr;
struct monst *mon, *shkp;
struct obj *item;
xchar oox, ooy;
coordxy oox, ooy;
boolean smell = FALSE, golem_xform = FALSE;
if (objects[obj->otyp].oc_material != MINERAL
@@ -2171,7 +2171,7 @@ bhito(struct obj *obj, struct obj *otmp)
revive_egg(obj);
} else if (obj->otyp == CORPSE) {
struct monst *mtmp;
xchar ox, oy;
coordxy ox, oy;
unsigned save_norevive;
boolean by_u = !g.context.mon_moving;
int corpsenm = corpse_revive_type(obj);
@@ -3131,7 +3131,7 @@ zap_updown(struct obj *obj) /* wand or spell */
case WAN_POLYMORPH:
case SPE_POLYMORPH:
del_engr(e);
make_engr_at(x, y, random_engraving(buf), g.moves, (xchar) 0);
make_engr_at(x, y, random_engraving(buf), g.moves, (coordxy) 0);
break;
case WAN_CANCELLATION:
case SPE_CANCELLATION:
@@ -3374,7 +3374,7 @@ maybe_explode_trap(struct trap *ttmp, struct obj *otmp)
if (!ttmp || !otmp)
return;
if (otmp->otyp == WAN_CANCELLATION || otmp->otyp == SPE_CANCELLATION) {
xchar x = ttmp->tx, y = ttmp->ty;
coordxy x = ttmp->tx, y = ttmp->ty;
if (undestroyable_trap(ttmp->ttyp)) {
shieldeff(x, y);
@@ -3989,7 +3989,7 @@ zhitm(
}
static void
zhitu(int type, int nd, const char *fltxt, xchar sx, xchar sy)
zhitu(int type, int nd, const char *fltxt, coordxy sx, coordxy sy)
{
int dam = 0, abstyp = abs(type);
@@ -4254,7 +4254,7 @@ disintegrate_mon(struct monst *mon,
}
void
buzz(int type, int nd, xchar sx, xchar sy, int dx, int dy)
buzz(int type, int nd, coordxy sx, coordxy sy, int dx, int dy)
{
dobuzz(type, nd, sx, sy, dx, dy, TRUE);
}
@@ -4272,12 +4272,12 @@ void
dobuzz(
int type,
int nd,
xchar sx, xchar sy,
coordxy sx, coordxy sy,
int dx, int dy,
boolean say) /* announce out of sight hit/miss events if true */
{
int range, abstype = abs(type) % 10;
register xchar lsx, lsy;
register coordxy lsx, lsy;
struct monst *mon;
coord save_bhitpos;
boolean shopdamage = FALSE;
@@ -4546,7 +4546,7 @@ dobuzz(
}
void
melt_ice(xchar x, xchar y, const char *msg)
melt_ice(coordxy x, coordxy y, const char *msg)
{
struct rm *lev = &levl[x][y];
struct obj *otmp;
@@ -4594,7 +4594,7 @@ melt_ice(xchar x, xchar y, const char *msg)
* permanent instead.
*/
void
start_melt_ice_timeout(xchar x, xchar y,
start_melt_ice_timeout(coordxy x, coordxy y,
long min_time) /* <x,y>'s old melt timeout (deleted by
time we get here) */
{
@@ -4627,14 +4627,14 @@ start_melt_ice_timeout(xchar x, xchar y,
void
melt_ice_away(anything *arg, long timeout UNUSED)
{
xchar x, y;
coordxy x, y;
long where = arg->a_long;
boolean save_mon_moving = g.context.mon_moving; /* will be False */
/* melt_ice -> minliquid -> mondead|xkilled shouldn't credit/blame hero */
g.context.mon_moving = TRUE; /* hero isn't causing this ice to melt */
y = (xchar) (where & 0xFFFF);
x = (xchar) ((where >> 16) & 0xFFFF);
y = (coordxy) (where & 0xFFFF);
x = (coordxy) ((where >> 16) & 0xFFFF);
/* melt_ice does newsym when appropriate */
melt_ice(x, y, "Some ice melts away.");
g.context.mon_moving = save_mon_moving;
@@ -4647,7 +4647,7 @@ melt_ice_away(anything *arg, long timeout UNUSED)
*/
int
zap_over_floor(
xchar x, xchar y, /* location */
coordxy x, coordxy y, /* location */
int type, /* damage type plus {wand|spell|breath} info */
boolean *shopdamage, /* extra output if shop door is destroyed */
short exploding_wand_typ) /* supplied when breaking a wand; or POT_OIL
@@ -4977,7 +4977,7 @@ zap_over_floor(
void
fracture_rock(struct obj *obj) /* no texts here! */
{
xchar x, y;
coordxy x, y;
boolean by_you = !g.context.mon_moving;
if (by_you && get_obj_location(obj, &x, &y, 0) && costly_spot(x, y)) {