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:
@@ -96,8 +96,8 @@ struct monst {
|
||||
uchar m_lev; /* adjusted difficulty level of monster */
|
||||
aligntyp malign; /* alignment of this monster, relative to the
|
||||
player (positive = good to kill) */
|
||||
xchar mx, my;
|
||||
xchar mux, muy; /* where the monster thinks you are */
|
||||
coordxy mx, my;
|
||||
coordxy mux, muy; /* where the monster thinks you are */
|
||||
#define MTSZ 4
|
||||
/* mtrack[0..2] is used to keep extra data when migrating the monster */
|
||||
coord mtrack[MTSZ]; /* monster track */
|
||||
@@ -174,8 +174,8 @@ struct monst {
|
||||
#define STRAT_XMASK 0x00ff0000L
|
||||
#define STRAT_YMASK 0x0000ff00L
|
||||
#define STRAT_GOAL 0x000000ffL
|
||||
#define STRAT_GOALX(s) ((xchar) ((s & STRAT_XMASK) >> 16))
|
||||
#define STRAT_GOALY(s) ((xchar) ((s & STRAT_YMASK) >> 8))
|
||||
#define STRAT_GOALX(s) ((coordxy) ((s & STRAT_XMASK) >> 16))
|
||||
#define STRAT_GOALY(s) ((coordxy) ((s & STRAT_YMASK) >> 8))
|
||||
|
||||
long mtrapseen; /* bitmap of traps we've been trapped in */
|
||||
long mlstmv; /* for catching up with lost time */
|
||||
@@ -185,7 +185,7 @@ struct monst {
|
||||
struct obj *minvent; /* mon's inventory */
|
||||
struct obj *mw; /* mon's weapon */
|
||||
long misc_worn_check; /* mon's wornmask */
|
||||
xchar weapon_check; /* flag for whether to try switching weapons */
|
||||
xint16 weapon_check; /* flag for whether to try switching weapons */
|
||||
|
||||
int meating; /* monster is eating timeout */
|
||||
struct mextra *mextra; /* point to mextra struct */
|
||||
|
||||
Reference in New Issue
Block a user