Skip to content

Commit 3004cf2

Browse files
committed
be more consistent with coordinates
1 parent 0bd5b3d commit 3004cf2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+831
-746
lines changed

include/extern.h

Lines changed: 141 additions & 140 deletions
Large diffs are not rendered by default.

include/winX.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ extern void X11_print_glyph(winid, coordxy, coordxy, const glyph_info *,
460460
extern void X11_raw_print(const char *);
461461
extern void X11_raw_print_bold(const char *);
462462
extern int X11_nhgetch(void);
463-
extern int X11_nh_poskey(int *, int *, int *);
463+
extern int X11_nh_poskey(coordxy *, coordxy *, int *);
464464
extern void X11_nhbell(void);
465465
extern int X11_doprev_message(void);
466466
extern char X11_yn_function_core(const char *, const char *, char, unsigned);

include/wincurs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ extern void curses_print_glyph(winid wid, coordxy x, coordxy y,
9797
extern void curses_raw_print(const char *str);
9898
extern void curses_raw_print_bold(const char *str);
9999
extern int curses_nhgetch(void);
100-
extern int curses_nh_poskey(int *x, int *y, int *mod);
100+
extern int curses_nh_poskey(coordxy *x, coordxy *y, int *mod);
101101
extern void curses_nhbell(void);
102102
extern int curses_doprev_message(void);
103103
extern char curses_yn_function(const char *question, const char *choices,
@@ -174,7 +174,7 @@ extern int curses_convert_attr(int attr);
174174
extern int curses_read_attrs(const char *attrs);
175175
extern char *curses_fmt_attrs(char *);
176176
extern int curses_convert_keys(int key);
177-
extern int curses_get_mouse(int *mousex, int *mousey, int *mod);
177+
extern int curses_get_mouse(coordxy *mousex, coordxy *mousey, int *mod);
178178
extern void curses_mouse_support(int);
179179

180180
/* cursdial.c */

include/winprocs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct window_procs {
5959
void (*win_raw_print)(const char *);
6060
void (*win_raw_print_bold)(const char *);
6161
int (*win_nhgetch)(void);
62-
int (*win_nh_poskey)(int *, int *, int *);
62+
int (*win_nh_poskey)(coordxy *, coordxy *, int *);
6363
void (*win_nhbell)(void);
6464
int (*win_doprev_message)(void);
6565
char (*win_yn_function)(const char *, const char *, char);
@@ -381,7 +381,7 @@ struct chain_procs {
381381
void (*win_raw_print)(CARGS, const char *);
382382
void (*win_raw_print_bold)(CARGS, const char *);
383383
int (*win_nhgetch)(CARGS);
384-
int (*win_nh_poskey)(CARGS, int *, int *, int *);
384+
int (*win_nh_poskey)(CARGS, coordxy *, coordxy *, int *);
385385
void (*win_nhbell)(CARGS);
386386
int (*win_doprev_message)(CARGS);
387387
char (*win_yn_function)
@@ -457,7 +457,7 @@ extern void safe_print_glyph(winid, coordxy, coordxy,
457457
extern void safe_raw_print(const char *);
458458
extern void safe_raw_print_bold(const char *);
459459
extern int safe_nhgetch(void);
460-
extern int safe_nh_poskey(int *, int *, int *);
460+
extern int safe_nh_poskey(coordxy *, coordxy *, int *);
461461
extern void safe_nhbell(void);
462462
extern int safe_doprev_message(void);
463463
extern char safe_yn_function(const char *, const char *, char);

include/wintty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ E void tty_print_glyph(winid, coordxy, coordxy, const glyph_info *,
254254
E void tty_raw_print(const char *);
255255
E void tty_raw_print_bold(const char *);
256256
E int tty_nhgetch(void);
257-
E int tty_nh_poskey(int *, int *, int *);
257+
E int tty_nh_poskey(coordxy *, coordxy *, int *);
258258
E void tty_nhbell(void);
259259
E int tty_doprev_message(void);
260260
E char tty_yn_function(const char *, const char *, char);

include/wintype.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ typedef union any {
1515
struct obj *a_obj;
1616
struct monst *a_monst;
1717
int a_int;
18+
int a_xint16;
19+
int a_xint8;
1820
char a_char;
1921
schar a_schar;
2022
uchar a_uchar;
2123
unsigned int a_uint;
2224
long a_long;
2325
unsigned long a_ulong;
26+
coordxy a_coordxy;
2427
int *a_iptr;
28+
xint16 *a_xint16ptr;
29+
xint8 *a_xint8ptr;
2530
long *a_lptr;
31+
coordxy *a_coordxyptr;
2632
unsigned long *a_ulptr;
2733
unsigned *a_uptr;
2834
const char *a_string;

src/apply.c

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
static int use_camera(struct obj *);
99
static int use_towel(struct obj *);
10-
static boolean its_dead(int, int, int *);
10+
static boolean its_dead(coordxy, coordxy, int *);
1111
static int use_stethoscope(struct obj *);
1212
static void use_whistle(struct obj *);
1313
static void use_magic_whistle(struct obj *);
@@ -39,10 +39,10 @@ static int do_break_wand(struct obj *);
3939
static int apply_ok(struct obj *);
4040
static int flip_through_book(struct obj *);
4141
static boolean figurine_location_checks(struct obj *, coord *, boolean);
42-
static boolean check_jump(genericptr_t, int, int);
43-
static boolean is_valid_jump_pos(int, int, int, boolean);
44-
static boolean get_valid_jump_position(int, int);
45-
static boolean get_valid_polearm_position(int, int);
42+
static boolean check_jump(genericptr_t, coordxy, coordxy);
43+
static boolean is_valid_jump_pos(coordxy, coordxy, int, boolean);
44+
static boolean get_valid_jump_position(coordxy, coordxy);
45+
static boolean get_valid_polearm_position(coordxy, coordxy);
4646
static boolean find_poleable_mon(coord *, int, int);
4747

4848
static const char no_elbow_room[] =
@@ -177,7 +177,7 @@ use_towel(struct obj *obj)
177177

178178
/* maybe give a stethoscope message based on floor objects */
179179
static boolean
180-
its_dead(int rx, int ry, int *resp)
180+
its_dead(coordxy rx, coordxy ry, int *resp)
181181
{
182182
char buf[BUFSZ];
183183
boolean more_corpses;
@@ -302,7 +302,8 @@ use_stethoscope(struct obj *obj)
302302
{
303303
struct monst *mtmp;
304304
struct rm *lev;
305-
int rx, ry, res;
305+
int res;
306+
coordxy rx, ry;
306307
boolean interference = (u.uswallow && is_whirly(u.ustuck->data)
307308
&& !rn2(Role_if(PM_HEALER) ? 10 : 3));
308309

@@ -1769,7 +1770,7 @@ enum jump_trajectory {
17691770

17701771
/* callback routine for walk_path() */
17711772
static boolean
1772-
check_jump(genericptr arg, int x, int y)
1773+
check_jump(genericptr arg, coordxy x, coordxy y)
17731774
{
17741775
int traj = *(int *) arg;
17751776
struct rm *lev = &levl[x][y];
@@ -1800,7 +1801,7 @@ check_jump(genericptr arg, int x, int y)
18001801
}
18011802

18021803
static boolean
1803-
is_valid_jump_pos(int x, int y, int magic, boolean showmsg)
1804+
is_valid_jump_pos(coordxy x, coordxy y, int magic, boolean showmsg)
18041805
{
18051806
if (!magic && !(HJumping & ~INTRINSIC) && !EJumping && distu(x, y) != 5) {
18061807
/* The Knight jumping restriction still applies when riding a
@@ -1828,9 +1829,9 @@ is_valid_jump_pos(int x, int y, int magic, boolean showmsg)
18281829
passage through doorways: horizonal, vertical, or diagonal;
18291830
since knight's jump and other irregular directions are
18301831
possible, we flatten those out to simplify door checks */
1831-
int diag, traj,
1832-
dx = x - u.ux, dy = y - u.uy,
1833-
ax = abs(dx), ay = abs(dy);
1832+
int diag, traj;
1833+
coordxy dx = x - u.ux, dy = y - u.uy,
1834+
ax = abs(dx), ay = abs(dy);
18341835

18351836
/* diag: any non-orthogonal destination classifed as diagonal */
18361837
diag = (magic || Passes_walls || (!dx && !dy)) ? jAny
@@ -1866,7 +1867,7 @@ is_valid_jump_pos(int x, int y, int magic, boolean showmsg)
18661867
}
18671868

18681869
static boolean
1869-
get_valid_jump_position(int x, int y)
1870+
get_valid_jump_position(coordxy x, coordxy y)
18701871
{
18711872
return (isok(x, y)
18721873
&& (ACCESSIBLE(levl[x][y].typ) || Passes_walls)
@@ -1879,12 +1880,12 @@ display_jump_positions(int state)
18791880
if (state == 0) {
18801881
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
18811882
} else if (state == 1) {
1882-
int x, y, dx, dy;
1883+
coordxy x, y, dx, dy;
18831884

18841885
for (dx = -4; dx <= 4; dx++)
18851886
for (dy = -4; dy <= 4; dy++) {
1886-
x = dx + (int) u.ux;
1887-
y = dy + (int) u.uy;
1887+
x = dx + (coordxy) u.ux;
1888+
y = dy + (coordxy) u.uy;
18881889
if (get_valid_jump_position(x, y))
18891890
tmp_at(x, y);
18901891
}
@@ -3143,7 +3144,8 @@ find_poleable_mon(coord *pos, int min_range, int max_range)
31433144
struct monst *mtmp;
31443145
coord mpos;
31453146
boolean impaired;
3146-
int x, y, lo_x, hi_x, lo_y, hi_y, rt, glyph;
3147+
coordxy x, y, lo_x, hi_x, lo_y, hi_y, rt;
3148+
int glyph;
31473149

31483150
impaired = (Confusion || Stunned || Hallucination);
31493151
mpos.x = mpos.y = 0; /* no candidate location yet */
@@ -3176,7 +3178,7 @@ find_poleable_mon(coord *pos, int min_range, int max_range)
31763178
}
31773179

31783180
static boolean
3179-
get_valid_polearm_position(int x, int y)
3181+
get_valid_polearm_position(coordxy x, coordxy y)
31803182
{
31813183
int glyph;
31823184

@@ -3194,7 +3196,7 @@ display_polearm_positions(int state)
31943196
if (state == 0) {
31953197
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
31963198
} else if (state == 1) {
3197-
int x, y, dx, dy;
3199+
coordxy x, y, dx, dy;
31983200

31993201
for (dx = -4; dx <= 4; dx++)
32003202
for (dy = -4; dy <= 4; dy++) {
@@ -3622,7 +3624,8 @@ static int
36223624
do_break_wand(struct obj *obj)
36233625
{
36243626
static const char nothing_else_happens[] = "But nothing else happens...";
3625-
register int i, x, y;
3627+
register int i;
3628+
coordxy x, y;
36263629
register struct monst *mon;
36273630
int dmg, damage;
36283631
boolean affects_objects;

src/artifact.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static unsigned long abil_to_spfx(long *);
2727
static uchar abil_to_adtyp(long *);
2828
static int glow_strength(int);
2929
static boolean untouchable(struct obj *, boolean);
30-
static int count_surround_traps(int, int);
30+
static int count_surround_traps(coordxy, coordxy);
3131

3232
/* The amount added to the victim's total hit points to insure that the
3333
victim will be killed even after damage bonus/penalty adjustments.
@@ -2347,12 +2347,13 @@ retouch_equipment(int dropflag) /* 0==don't drop, 1==drop all, 2==drop weapon */
23472347
}
23482348

23492349
static int
2350-
count_surround_traps(int x, int y)
2350+
count_surround_traps(coordxy x, coordxy y)
23512351
{
23522352
struct rm *levp;
23532353
struct obj *otmp;
23542354
struct trap *ttmp;
2355-
int dx, dy, glyph, ret = 0;
2355+
coordxy dx, dy;
2356+
int glyph, ret = 0;
23562357

23572358
for (dx = x - 1; dx < x + 2; ++dx)
23582359
for (dy = y - 1; dy < y + 2; ++dy) {

src/bones.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
static boolean no_bones_level(d_level *);
99
static void goodfruit(int);
1010
static void resetobjs(struct obj *, boolean);
11-
static void give_to_nearby_mon(struct obj *, int, int);
11+
static void give_to_nearby_mon(struct obj *, coordxy, coordxy);
1212
static boolean fixuporacle(struct monst *);
1313
static void remove_mon_from_bones(struct monst *);
1414

@@ -220,7 +220,7 @@ sanitize_name(char *namebuf)
220220
but skipping hero's location.
221221
If no such monster, place object on floor at x,y. */
222222
static void
223-
give_to_nearby_mon(struct obj *otmp, int x, int y)
223+
give_to_nearby_mon(struct obj *otmp, coordxy x, coordxy y)
224224
{
225225
struct monst *mtmp;
226226
struct monst *selected = (struct monst *) 0;
@@ -256,7 +256,7 @@ void
256256
drop_upon_death(
257257
struct monst *mtmp, /* monster if hero rises as one (non ghost) */
258258
struct obj *cont, /* container if hero is turned into a statue */
259-
int x, int y)
259+
coordxy x, coordxy y)
260260
{
261261
struct obj *otmp;
262262

@@ -399,7 +399,7 @@ remove_mon_from_bones(struct monst *mtmp)
399399
void
400400
savebones(int how, time_t when, struct obj *corpse)
401401
{
402-
int x, y;
402+
coordxy x, y;
403403
struct trap *ttmp;
404404
struct monst *mtmp;
405405
struct fruit *f;

0 commit comments

Comments
 (0)