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

@@ -36,7 +36,7 @@ struct obj {
struct obj *cobj; /* contents list for containers */
unsigned o_id;
xchar ox, oy;
coordxy ox, oy;
short otyp; /* object class number */
unsigned owt;
long quan; /* number of items */
@@ -66,7 +66,7 @@ struct obj {
char invlet; /* designation in inventory */
char oartifact; /* artifact array index */
xchar where; /* where the object thinks it is */
xint8 where; /* where the object thinks it is */
#define OBJ_FREE 0 /* object not attached to anything */
#define OBJ_FLOOR 1 /* object on floor */
#define OBJ_CONTAINED 2 /* object in a container */
@@ -77,7 +77,7 @@ struct obj {
#define OBJ_ONBILL 7 /* object on shk bill */
#define OBJ_LUAFREE 8 /* object has been dealloc'd, but is ref'd by lua */
#define NOBJ_STATES 9
xchar timed; /* # of fuses (timers) attached to this obj */
xint16 timed; /* # of fuses (timers) attached to this obj */
Bitfield(cursed, 1);
Bitfield(blessed, 1);
@@ -140,8 +140,8 @@ struct obj {
* overloaded for the destination of migrating
* objects (which can't be worn at same time) */
unsigned lua_ref_cnt; /* # of lua script references for this object */
xchar omigr_from_dnum; /* where obj is migrating from */
xchar omigr_from_dlevel; /* where obj is migrating from */
xint16 omigr_from_dnum; /* where obj is migrating from */
xint16 omigr_from_dlevel; /* where obj is migrating from */
struct oextra *oextra; /* pointer to oextra struct */
};