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

@@ -7,8 +7,8 @@
#define DUNGEON_H
typedef struct d_level { /* basic dungeon level element */
xchar dnum; /* dungeon number */
xchar dlevel; /* level number */
xint16 dnum; /* dungeon number */
xint16 dlevel; /* level number */
} d_level;
#if !defined(MAKEDEFS_C) && !defined(MDLIB_C)
@@ -32,7 +32,7 @@ typedef struct s_level { /* special dungeon level element */
} s_level;
typedef struct stairway { /* basic stairway identifier */
xchar sx, sy; /* x / y location of the stair */
coordxy sx, sy; /* x / y location of the stair */
d_level tolev; /* where does it go */
boolean up; /* up or down? */
boolean isladder; /* ladder or stairway? */
@@ -52,10 +52,10 @@ enum level_region_types {
};
typedef struct dest_area { /* non-stairway level change identifier */
xchar lx, ly; /* "lower" left corner (near [0,0]) */
xchar hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */
xchar nlx, nly; /* outline of invalid area */
xchar nhx, nhy; /* opposite corner of invalid area */
coordxy lx, ly; /* "lower" left corner (near [0,0]) */
coordxy hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */
coordxy nlx, nly; /* outline of invalid area */
coordxy nhx, nhy; /* opposite corner of invalid area */
} dest_area;
typedef struct dungeon { /* basic dungeon identifier */
@@ -65,9 +65,9 @@ typedef struct dungeon { /* basic dungeon identifier */
char themerms[15]; /* lua file name containing themed rooms */
char boneid; /* character to id dungeon in bones files */
d_flags flags; /* dungeon flags */
xchar entry_lev; /* entry level */
xchar num_dunlevs; /* number of levels in this dungeon */
xchar dunlev_ureached; /* how deep you have been in this dungeon */
xint16 entry_lev; /* entry level */
xint16 num_dunlevs; /* number of levels in this dungeon */
xint16 dunlev_ureached; /* how deep you have been in this dungeon */
int ledger_start, /* the starting depth in "real" terms */
depth_start; /* the starting depth in "logical" terms */
} dungeon;