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

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;