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

@@ -1910,7 +1910,7 @@ do_loot_cont(
if (flags.autounlock) {
struct obj *otmp, *unlocktool = 0;
xchar ox = cobj->ox, oy = cobj->oy;
coordxy ox = cobj->ox, oy = cobj->oy;
u.dz = 0; /* might be non-zero from previous command since
* #loot isn't a move command; pick_lock() cares */
@@ -2622,7 +2622,7 @@ observe_quantum_cat(struct obj *box, boolean makecat, boolean givemsg)
static NEARDATA const char sc[] = "Schroedinger's Cat";
struct obj *deadcat;
struct monst *livecat = 0;
xchar ox, oy;
coordxy ox, oy;
boolean itsalive = !rn2(2);
if (get_obj_location(box, &ox, &oy, 0))
@@ -3431,7 +3431,7 @@ enum tipping_check_values {
static void
tipcontainer(struct obj *box) /* or bag */
{
xchar ox = u.ux, oy = u.uy; /* #tip only works at hero's location */
coordxy ox = u.ux, oy = u.uy; /* #tip only works at hero's location */
boolean empty_it = TRUE, maybeshopgoods;
struct obj *targetbox = (struct obj *) 0;
boolean cancelled = FALSE;
@@ -3655,7 +3655,7 @@ tipcontainer_checks(struct obj *box, boolean allowempty)
boolean bag = box->otyp == BAG_OF_TRICKS;
int old_spe = box->spe, seen = 0;
boolean maybeshopgoods = !carried(box) && costly_spot(box->ox, box->oy);
xchar ox = u.ux, oy = u.uy;
coordxy ox = u.ux, oy = u.uy;
if (get_obj_location(box, &ox, &oy, 0))
box->ox = ox, box->oy = oy;