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:
18
src/mkobj.c
18
src/mkobj.c
@@ -9,7 +9,7 @@ static void mkbox_cnts(struct obj *);
|
||||
static unsigned nextoid(struct obj *, struct obj *);
|
||||
static int item_on_ice(struct obj *);
|
||||
static void shrinking_glob_gone(struct obj *);
|
||||
static void obj_timer_checks(struct obj *, xchar, xchar, int);
|
||||
static void obj_timer_checks(struct obj *, coordxy, coordxy, int);
|
||||
static void container_weight(struct obj *);
|
||||
static struct obj *save_mtraits(struct obj *, struct monst *);
|
||||
static void objlist_sanity(struct obj *, int, const char *);
|
||||
@@ -677,7 +677,7 @@ static const char *const alteration_verbs[] = {
|
||||
void
|
||||
costly_alteration(struct obj *obj, int alter_type)
|
||||
{
|
||||
xchar ox, oy;
|
||||
coordxy ox, oy;
|
||||
char objroom;
|
||||
boolean learn_bknown;
|
||||
const char *those, *them;
|
||||
@@ -1293,7 +1293,7 @@ static int
|
||||
item_on_ice(struct obj *item)
|
||||
{
|
||||
struct obj *otmp;
|
||||
xchar ox, oy;
|
||||
coordxy ox, oy;
|
||||
|
||||
otmp = item;
|
||||
/* if in a container, it might be nested so find outermost one since
|
||||
@@ -1491,7 +1491,7 @@ shrink_glob(
|
||||
}
|
||||
|
||||
if (gone) {
|
||||
xchar ox = 0, oy = 0;
|
||||
coordxy ox = 0, oy = 0;
|
||||
/* check location for visibility before destroying obj */
|
||||
boolean seeit = (obj->where == OBJ_FLOOR
|
||||
&& get_obj_location(obj, &ox, &oy, 0)
|
||||
@@ -1522,7 +1522,7 @@ shrink_glob(
|
||||
static void
|
||||
shrinking_glob_gone(struct obj *obj)
|
||||
{
|
||||
xchar owhere = obj->where;
|
||||
xint16 owhere = obj->where;
|
||||
|
||||
if (owhere == OBJ_INVENT) {
|
||||
if (obj->owornmask) {
|
||||
@@ -1554,7 +1554,7 @@ void
|
||||
maybe_adjust_light(struct obj *obj, int old_range)
|
||||
{
|
||||
char buf[BUFSZ];
|
||||
xchar ox, oy;
|
||||
coordxy ox, oy;
|
||||
int new_range = arti_light_radius(obj), delta = new_range - old_range;
|
||||
|
||||
/* radius of light emitting artifact varies by curse/bless state
|
||||
@@ -2198,7 +2198,7 @@ peek_at_iced_corpse_age(struct obj *otmp)
|
||||
static void
|
||||
obj_timer_checks(
|
||||
struct obj *otmp,
|
||||
xchar x, xchar y,
|
||||
coordxy x, coordxy y,
|
||||
int force) /* 0 = no force so do checks, <0 = force off, >0 force on */
|
||||
{
|
||||
long tleft = 0L;
|
||||
@@ -2266,8 +2266,8 @@ obj_timer_checks(
|
||||
void
|
||||
remove_object(struct obj *otmp)
|
||||
{
|
||||
xchar x = otmp->ox;
|
||||
xchar y = otmp->oy;
|
||||
coordxy x = otmp->ox;
|
||||
coordxy y = otmp->oy;
|
||||
|
||||
if (otmp->where != OBJ_FLOOR)
|
||||
panic("remove_object: obj not on floor");
|
||||
|
||||
Reference in New Issue
Block a user