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

@@ -22,9 +22,9 @@ struct RoleName {
struct RoleAdvance {
/* "fix" is the fixed amount, "rnd" is the random amount */
xchar infix, inrnd; /* at character initialization */
xchar lofix, lornd; /* gained per level < g.urole.xlev */
xchar hifix, hirnd; /* gained per level >= g.urole.xlev */
xint16 infix, inrnd; /* at character initialization */
xint16 lofix, lornd; /* gained per level < g.urole.xlev */
xint16 hifix, hirnd; /* gained per level >= g.urole.xlev */
};
struct u_have {
@@ -198,12 +198,12 @@ struct Role {
#define ROLE_CHAOTIC AM_CHAOTIC
/*** Attributes (from attrib.c and exper.c) ***/
xchar attrbase[A_MAX]; /* lowest initial attributes */
xchar attrdist[A_MAX]; /* distribution of initial attributes */
xint16 attrbase[A_MAX]; /* lowest initial attributes */
xint16 attrdist[A_MAX]; /* distribution of initial attributes */
struct RoleAdvance hpadv; /* hit point advancement */
struct RoleAdvance enadv; /* energy advancement */
xchar xlev; /* cutoff experience level */
xchar initrecord; /* initial alignment record */
xint16 xlev; /* cutoff experience level */
xint16 initrecord; /* initial alignment record */
/*** Spell statistics (from spell.c) ***/
int spelbase; /* base spellcasting penalty */
@@ -258,8 +258,8 @@ struct Race {
hatemask; /* bit mask of always hostile */
/*** Attributes ***/
xchar attrmin[A_MAX]; /* minimum allowable attribute */
xchar attrmax[A_MAX]; /* maximum allowable attribute */
xint16 attrmin[A_MAX]; /* minimum allowable attribute */
xint16 attrmax[A_MAX]; /* maximum allowable attribute */
struct RoleAdvance hpadv; /* hit point advancement */
struct RoleAdvance enadv; /* energy advancement */
#if 0 /* DEFERRED */
@@ -347,11 +347,11 @@ enum utotypes {
/*** Information about the player ***/
struct you {
xchar ux, uy; /* current map coordinates */
coordxy ux, uy; /* current map coordinates */
schar dx, dy, dz; /* direction of move (or zap or ... ) */
schar di; /* direction of FF */
xchar tx, ty; /* destination of travel */
xchar ux0, uy0; /* initial position FF */
coordxy tx, ty; /* destination of travel */
coordxy ux0, uy0; /* initial position FF */
d_level uz, uz0; /* your level on this and the previous turn */
d_level utolev; /* level monster teleported you to, or uz */
uchar utotype; /* bitmask of goto_level() flags for utolev */
@@ -455,7 +455,7 @@ struct you {
uhppeak; /* highest value of uhpmax so far */
int uen, uenmax, /* magical energy, aka spell power */
uenpeak; /* highest value of uenmax so far */
xchar uhpinc[MAXULEV], /* increases to uhpmax for each level gain */
xint16 uhpinc[MAXULEV], /* increases to uhpmax for each level gain */
ueninc[MAXULEV]; /* increases to uenmax for each level gain */
int ugangr; /* if the gods are angry at you */
int ugifts; /* number of artifacts bestowed */
@@ -474,7 +474,7 @@ struct you {
int ugrave_arise; /* you die and become something aside from a ghost */
int weapon_slots; /* unused skill slots */
int skills_advanced; /* # of advances made so far */
xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */
xint16 skill_record[P_SKILL_LIMIT]; /* skill advancements */
struct skills weapon_skills[P_NUM_SKILLS];
boolean twoweap; /* KMH -- Using two-weapon combat */
short mcham; /* vampire mndx if shapeshifted to bat/cloud */