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:
26
src/region.c
26
src/region.c
@@ -31,10 +31,10 @@ void remove_region(NhRegion *);
|
||||
#if 0
|
||||
void replace_mon_regions(struct monst *,struct monst *);
|
||||
void remove_mon_from_regions(struct monst *);
|
||||
NhRegion *create_msg_region(xchar,xchar,xchar,xchar, const char *,
|
||||
NhRegion *create_msg_region(coordxy,coordxy,coordxy,coordxy, const char *,
|
||||
const char *);
|
||||
boolean enter_force_field(genericptr,genericptr);
|
||||
NhRegion *create_force_field(xchar,xchar,int,long);
|
||||
NhRegion *create_force_field(coordxy,coordxy,int,long);
|
||||
#endif
|
||||
|
||||
static void reset_region_mids(NhRegion *);
|
||||
@@ -427,7 +427,7 @@ run_regions(void)
|
||||
* check whether player enters/leaves one or more regions.
|
||||
*/
|
||||
boolean
|
||||
in_out_region(xchar x, xchar y)
|
||||
in_out_region(coordxy x, coordxy y)
|
||||
{
|
||||
int i, f_indx = 0;
|
||||
|
||||
@@ -480,7 +480,7 @@ in_out_region(xchar x, xchar y)
|
||||
* check whether a monster enters/leaves one or more regions.
|
||||
*/
|
||||
boolean
|
||||
m_in_out_region(struct monst *mon, xchar x, xchar y)
|
||||
m_in_out_region(struct monst *mon, coordxy x, coordxy y)
|
||||
{
|
||||
int i, f_indx = 0;
|
||||
|
||||
@@ -601,7 +601,7 @@ remove_mon_from_regions(struct monst *mon)
|
||||
* Returns NULL if not, otherwise returns region.
|
||||
*/
|
||||
NhRegion *
|
||||
visible_region_at(xchar x, xchar y)
|
||||
visible_region_at(coordxy x, coordxy y)
|
||||
{
|
||||
register int i;
|
||||
|
||||
@@ -615,7 +615,7 @@ visible_region_at(xchar x, xchar y)
|
||||
}
|
||||
|
||||
void
|
||||
show_region(NhRegion *reg, xchar x, xchar y)
|
||||
show_region(NhRegion *reg, coordxy x, coordxy y)
|
||||
{
|
||||
show_glyph(x, y, reg->glyph);
|
||||
}
|
||||
@@ -872,7 +872,7 @@ reset_region_mids(NhRegion *reg)
|
||||
|
||||
NhRegion *
|
||||
create_msg_region(
|
||||
xchar x, xchar y, xchar w, xchar h,
|
||||
coordxy x, coordxy y, coordxy w, coordxy h,
|
||||
const char *msg_enter, const char *msg_leave)
|
||||
{
|
||||
NhRect tmprect;
|
||||
@@ -919,7 +919,7 @@ enter_force_field(genericptr_t p1, genericptr_t p2)
|
||||
}
|
||||
|
||||
NhRegion *
|
||||
create_force_field(xchar x, xchar y, int radius, long ttl)
|
||||
create_force_field(coordxy x, coordxy y, int radius, long ttl)
|
||||
{
|
||||
int i;
|
||||
NhRegion *ff;
|
||||
@@ -966,7 +966,7 @@ expire_gas_cloud(genericptr_t p1, genericptr_t p2 UNUSED)
|
||||
{
|
||||
NhRegion *reg;
|
||||
int damage;
|
||||
xchar x, y;
|
||||
coordxy x, y;
|
||||
|
||||
reg = (NhRegion *) p1;
|
||||
damage = reg->arg.a_int;
|
||||
@@ -1080,15 +1080,15 @@ is_hero_inside_gas_cloud(void)
|
||||
* damage is how much it deals to afflicted creatures. */
|
||||
#define MAX_CLOUD_SIZE 150
|
||||
NhRegion *
|
||||
create_gas_cloud(xchar x, xchar y, int cloudsize, int damage)
|
||||
create_gas_cloud(coordxy x, coordxy y, int cloudsize, int damage)
|
||||
{
|
||||
NhRegion *cloud;
|
||||
int i, j;
|
||||
NhRect tmprect;
|
||||
|
||||
/* store visited coords */
|
||||
xchar xcoords[MAX_CLOUD_SIZE];
|
||||
xchar ycoords[MAX_CLOUD_SIZE];
|
||||
coordxy xcoords[MAX_CLOUD_SIZE];
|
||||
coordxy ycoords[MAX_CLOUD_SIZE];
|
||||
xcoords[0] = x;
|
||||
ycoords[0] = y;
|
||||
int curridx;
|
||||
@@ -1112,7 +1112,7 @@ create_gas_cloud(xchar x, xchar y, int cloudsize, int damage)
|
||||
* directions chosen. */
|
||||
coord dirs[4] = { {0, -1}, {0, 1}, {-1, 0}, {1, 0} };
|
||||
for (i = 4; i > 0; --i) {
|
||||
xchar swapidx = rn2(i);
|
||||
coordxy swapidx = rn2(i);
|
||||
coord tmp = dirs[swapidx];
|
||||
dirs[swapidx] = dirs[i-1];
|
||||
dirs[i-1] = tmp;
|
||||
|
||||
Reference in New Issue
Block a user