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:
44
src/zap.c
44
src/zap.c
@@ -13,12 +13,12 @@
|
||||
#define MAGIC_COOKIE 1000
|
||||
|
||||
static void probe_objchain(struct obj *);
|
||||
static boolean zombie_can_dig(xchar x, xchar y);
|
||||
static boolean zombie_can_dig(coordxy x, coordxy y);
|
||||
static void polyuse(struct obj *, int, int);
|
||||
static void create_polymon(struct obj *, int);
|
||||
static int stone_to_flesh_obj(struct obj *);
|
||||
static boolean zap_updown(struct obj *);
|
||||
static void zhitu(int, int, const char *, xchar, xchar);
|
||||
static void zhitu(int, int, const char *, coordxy, coordxy);
|
||||
static void revive_egg(struct obj *);
|
||||
static boolean zap_steed(struct obj *);
|
||||
static void skiprange(int, int *, int *);
|
||||
@@ -560,7 +560,7 @@ probe_monster(struct monst *mtmp)
|
||||
boolean
|
||||
get_obj_location(
|
||||
struct obj *obj,
|
||||
xchar *xp, xchar *yp,
|
||||
coordxy *xp, coordxy *yp,
|
||||
int locflags)
|
||||
{
|
||||
switch (obj->where) {
|
||||
@@ -598,7 +598,7 @@ get_obj_location(
|
||||
boolean
|
||||
get_mon_location(
|
||||
struct monst *mon,
|
||||
xchar *xp, xchar *yp,
|
||||
coordxy *xp, coordxy *yp,
|
||||
int locflags) /* non-zero means get location even if monster is buried */
|
||||
{
|
||||
if (mon == &g.youmonst || (u.usteed && mon == u.usteed)) {
|
||||
@@ -767,7 +767,7 @@ get_container_location(
|
||||
|
||||
/* can zombie dig the location at x,y */
|
||||
static boolean
|
||||
zombie_can_dig(xchar x, xchar y)
|
||||
zombie_can_dig(coordxy x, coordxy y)
|
||||
{
|
||||
if (isok(x, y)) {
|
||||
schar typ = levl[x][y].typ;
|
||||
@@ -794,7 +794,7 @@ revive(struct obj *corpse, boolean by_hero)
|
||||
struct permonst *mptr;
|
||||
struct obj *container;
|
||||
coord xy;
|
||||
xchar x, y;
|
||||
coordxy x, y;
|
||||
boolean one_of;
|
||||
mmflags_nht mmflags = NO_MINVENT | MM_NOWAIT | MM_NOMSG;
|
||||
int montype, cgend, container_nesting = 0;
|
||||
@@ -1584,7 +1584,7 @@ struct obj *
|
||||
poly_obj(struct obj *obj, int id)
|
||||
{
|
||||
struct obj *otmp;
|
||||
xchar ox = 0, oy = 0;
|
||||
coordxy ox = 0, oy = 0;
|
||||
long old_wornmask, new_wornmask = 0L;
|
||||
boolean can_merge = (id == STRANGE_OBJECT);
|
||||
int obj_location = obj->where;
|
||||
@@ -1856,7 +1856,7 @@ stone_to_flesh_obj(struct obj *obj)
|
||||
struct permonst *ptr;
|
||||
struct monst *mon, *shkp;
|
||||
struct obj *item;
|
||||
xchar oox, ooy;
|
||||
coordxy oox, ooy;
|
||||
boolean smell = FALSE, golem_xform = FALSE;
|
||||
|
||||
if (objects[obj->otyp].oc_material != MINERAL
|
||||
@@ -2171,7 +2171,7 @@ bhito(struct obj *obj, struct obj *otmp)
|
||||
revive_egg(obj);
|
||||
} else if (obj->otyp == CORPSE) {
|
||||
struct monst *mtmp;
|
||||
xchar ox, oy;
|
||||
coordxy ox, oy;
|
||||
unsigned save_norevive;
|
||||
boolean by_u = !g.context.mon_moving;
|
||||
int corpsenm = corpse_revive_type(obj);
|
||||
@@ -3131,7 +3131,7 @@ zap_updown(struct obj *obj) /* wand or spell */
|
||||
case WAN_POLYMORPH:
|
||||
case SPE_POLYMORPH:
|
||||
del_engr(e);
|
||||
make_engr_at(x, y, random_engraving(buf), g.moves, (xchar) 0);
|
||||
make_engr_at(x, y, random_engraving(buf), g.moves, (coordxy) 0);
|
||||
break;
|
||||
case WAN_CANCELLATION:
|
||||
case SPE_CANCELLATION:
|
||||
@@ -3374,7 +3374,7 @@ maybe_explode_trap(struct trap *ttmp, struct obj *otmp)
|
||||
if (!ttmp || !otmp)
|
||||
return;
|
||||
if (otmp->otyp == WAN_CANCELLATION || otmp->otyp == SPE_CANCELLATION) {
|
||||
xchar x = ttmp->tx, y = ttmp->ty;
|
||||
coordxy x = ttmp->tx, y = ttmp->ty;
|
||||
|
||||
if (undestroyable_trap(ttmp->ttyp)) {
|
||||
shieldeff(x, y);
|
||||
@@ -3989,7 +3989,7 @@ zhitm(
|
||||
}
|
||||
|
||||
static void
|
||||
zhitu(int type, int nd, const char *fltxt, xchar sx, xchar sy)
|
||||
zhitu(int type, int nd, const char *fltxt, coordxy sx, coordxy sy)
|
||||
{
|
||||
int dam = 0, abstyp = abs(type);
|
||||
|
||||
@@ -4254,7 +4254,7 @@ disintegrate_mon(struct monst *mon,
|
||||
}
|
||||
|
||||
void
|
||||
buzz(int type, int nd, xchar sx, xchar sy, int dx, int dy)
|
||||
buzz(int type, int nd, coordxy sx, coordxy sy, int dx, int dy)
|
||||
{
|
||||
dobuzz(type, nd, sx, sy, dx, dy, TRUE);
|
||||
}
|
||||
@@ -4272,12 +4272,12 @@ void
|
||||
dobuzz(
|
||||
int type,
|
||||
int nd,
|
||||
xchar sx, xchar sy,
|
||||
coordxy sx, coordxy sy,
|
||||
int dx, int dy,
|
||||
boolean say) /* announce out of sight hit/miss events if true */
|
||||
{
|
||||
int range, abstype = abs(type) % 10;
|
||||
register xchar lsx, lsy;
|
||||
register coordxy lsx, lsy;
|
||||
struct monst *mon;
|
||||
coord save_bhitpos;
|
||||
boolean shopdamage = FALSE;
|
||||
@@ -4546,7 +4546,7 @@ dobuzz(
|
||||
}
|
||||
|
||||
void
|
||||
melt_ice(xchar x, xchar y, const char *msg)
|
||||
melt_ice(coordxy x, coordxy y, const char *msg)
|
||||
{
|
||||
struct rm *lev = &levl[x][y];
|
||||
struct obj *otmp;
|
||||
@@ -4594,7 +4594,7 @@ melt_ice(xchar x, xchar y, const char *msg)
|
||||
* permanent instead.
|
||||
*/
|
||||
void
|
||||
start_melt_ice_timeout(xchar x, xchar y,
|
||||
start_melt_ice_timeout(coordxy x, coordxy y,
|
||||
long min_time) /* <x,y>'s old melt timeout (deleted by
|
||||
time we get here) */
|
||||
{
|
||||
@@ -4627,14 +4627,14 @@ start_melt_ice_timeout(xchar x, xchar y,
|
||||
void
|
||||
melt_ice_away(anything *arg, long timeout UNUSED)
|
||||
{
|
||||
xchar x, y;
|
||||
coordxy x, y;
|
||||
long where = arg->a_long;
|
||||
boolean save_mon_moving = g.context.mon_moving; /* will be False */
|
||||
|
||||
/* melt_ice -> minliquid -> mondead|xkilled shouldn't credit/blame hero */
|
||||
g.context.mon_moving = TRUE; /* hero isn't causing this ice to melt */
|
||||
y = (xchar) (where & 0xFFFF);
|
||||
x = (xchar) ((where >> 16) & 0xFFFF);
|
||||
y = (coordxy) (where & 0xFFFF);
|
||||
x = (coordxy) ((where >> 16) & 0xFFFF);
|
||||
/* melt_ice does newsym when appropriate */
|
||||
melt_ice(x, y, "Some ice melts away.");
|
||||
g.context.mon_moving = save_mon_moving;
|
||||
@@ -4647,7 +4647,7 @@ melt_ice_away(anything *arg, long timeout UNUSED)
|
||||
*/
|
||||
int
|
||||
zap_over_floor(
|
||||
xchar x, xchar y, /* location */
|
||||
coordxy x, coordxy y, /* location */
|
||||
int type, /* damage type plus {wand|spell|breath} info */
|
||||
boolean *shopdamage, /* extra output if shop door is destroyed */
|
||||
short exploding_wand_typ) /* supplied when breaking a wand; or POT_OIL
|
||||
@@ -4977,7 +4977,7 @@ zap_over_floor(
|
||||
void
|
||||
fracture_rock(struct obj *obj) /* no texts here! */
|
||||
{
|
||||
xchar x, y;
|
||||
coordxy x, y;
|
||||
boolean by_you = !g.context.mon_moving;
|
||||
|
||||
if (by_you && get_obj_location(obj, &x, &y, 0) && costly_spot(x, y)) {
|
||||
|
||||
Reference in New Issue
Block a user