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

@@ -41,27 +41,27 @@
#define LSF_SHOW 0x1 /* display the light source */
#define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */
static light_source *new_light_core(xchar, xchar, int, int, anything *);
static light_source *new_light_core(coordxy, coordxy, int, int, anything *);
static void discard_flashes(void);
static void write_ls(NHFILE *, light_source *);
static int maybe_write_ls(NHFILE *, int, boolean);
/* imported from vision.c, for small circles */
extern xchar circle_data[];
extern xchar circle_start[];
extern coordxy circle_data[];
extern coordxy circle_start[];
/* Create a new light source. Caller (and extern.h) doesn't need to know
anything about type 'light_source'. */
void
new_light_source(xchar x, xchar y, int range, int type, anything *id)
new_light_source(coordxy x, coordxy y, int range, int type, anything *id)
{
(void) new_light_core(x, y, range, type, id);
}
/* Create a new light source and return it. Only used within this file. */
static light_source *
new_light_core(xchar x, xchar y, int range, int type, anything *id)
new_light_core(coordxy x, coordxy y, int range, int type, anything *id)
{
light_source *ls;
@@ -134,13 +134,13 @@ del_light_source(int type, anything *id)
/* Mark locations that are temporarily lit via mobile light sources. */
void
do_light_sources(xchar **cs_rows)
do_light_sources(coordxy **cs_rows)
{
int x, y, min_x, max_x, max_y, offset;
xchar *limits;
coordxy *limits;
short at_hero_range = 0;
light_source *ls;
xchar *row;
coordxy *row;
for (ls = g.light_base; ls; ls = ls->next) {
ls->flags &= ~LSF_SHOW;