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

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