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

@@ -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;