From: nhmall Date: Fri, 1 Jul 2022 03:48:18 +0000 (-0400) Subject: change xchar to other typedefs X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=30b557f7d5d22d2d99c1b1275f9fb460e91e2fc9;p=nethack 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 --- diff --git a/include/context.h b/include/context.h index 30a0433cc..88f3d93e3 100644 --- a/include/context.h +++ b/include/context.h @@ -70,7 +70,7 @@ struct engrave_info { the possible mutations of this */ char *nextc; /* next character(s) in text[] to engrave */ struct obj *stylus; /* object doing the writing */ - xchar type; /* type of engraving (DUST, MARK, etc) */ + xint8 type; /* type of engraving (DUST, MARK, etc) */ coord pos; /* location the engraving is being placed on */ int actionct; /* nth turn spent engraving */ }; @@ -104,7 +104,7 @@ struct tribute_info { struct novel_tracking { /* for choosing random passage when reading novel */ unsigned id; /* novel oid from previous passage selection */ int count; /* number of passage indices available in pasg[] */ - xchar pasg[30]; /* pasg[0..count-1] are passage indices */ + xint8 pasg[30]; /* pasg[0..count-1] are passage indices */ /* tribute file is allowed to have more than 30 passages for a novel; if it does, reading will first choose a random subset of 30 of them; reading all 30 or switching to a different novel and then back again diff --git a/include/coord.h b/include/coord.h index 9c066db26..f20f74dd7 100644 --- a/include/coord.h +++ b/include/coord.h @@ -7,7 +7,7 @@ #define COORD_H typedef struct nhcoord { - xchar x, y; + coordxy x, y; } coord; #endif /* COORD_H */ diff --git a/include/decl.h b/include/decl.h index c66a98c11..140cde5f9 100644 --- a/include/decl.h +++ b/include/decl.h @@ -32,9 +32,9 @@ struct dgn_topology { /* special dungeon levels for speed */ d_level d_fire_level; d_level d_air_level; d_level d_astral_level; - xchar d_tower_dnum; - xchar d_sokoban_dnum; - xchar d_mines_dnum, d_quest_dnum; + xint16 d_tower_dnum; + xint16 d_sokoban_dnum; + xint16 d_mines_dnum, d_quest_dnum; d_level d_qstart_level, d_qlocate_level, d_nemesis_level; d_level d_knox_level; d_level d_mineend_level; @@ -410,7 +410,7 @@ struct autopickup_exception { }; struct plinemsg_type { - xchar msgtype; /* one of MSGTYP_foo */ + xint16 msgtype; /* one of MSGTYP_foo */ struct nhregex *regex; char *pattern; struct plinemsg_type *next; @@ -545,7 +545,7 @@ struct xlock_s { struct trapinfo { struct obj *tobj; - xchar tx, ty; + coordxy tx, ty; int time_needed; boolean force_bungle; }; @@ -564,8 +564,8 @@ enum vanq_order_modes { }; struct rogueroom { - xchar rlx, rly; - xchar dx, dy; + coordxy rlx, rly; + coordxy dx, dy; boolean real; uchar doortable; int nroom; /* Only meaningful for "real" rooms */ @@ -573,7 +573,7 @@ struct rogueroom { typedef struct ls_t { struct ls_t *next; - xchar x, y; /* source's position */ + coordxy x, y; /* source's position */ short range; /* source's current range */ short flags; short type; /* type of light source */ @@ -582,7 +582,7 @@ typedef struct ls_t { struct container { struct container *next; - xchar x, y; + coordxy x, y; short what; genericptr_t list; }; @@ -597,7 +597,7 @@ enum bubble_contains_types { #define MAX_BMASK 4 struct bubble { - xchar x, y; /* coordinates of the upper left corner */ + coordxy x, y; /* coordinates of the upper left corner */ schar dx, dy; /* the general direction of the bubble's movement */ uchar bm[MAX_BMASK + 2]; /* bubble bit mask */ struct bubble *prev, *next; /* need to traverse the list up and down */ @@ -621,7 +621,7 @@ struct h2o_ctx { struct launchplace { struct obj *obj; - xchar x, y; + coordxy x, y; }; struct repo { /* repossession context */ @@ -862,8 +862,8 @@ struct instance_globals { /* display.c */ gbuf_entry gbuf[ROWNO][COLNO]; - xchar gbuf_start[ROWNO]; - xchar gbuf_stop[ROWNO]; + coordxy gbuf_start[ROWNO]; + coordxy gbuf_stop[ROWNO]; /* do.c */ @@ -884,9 +884,9 @@ struct instance_globals { /* dog.c */ int petname_used; /* user preferred pet name has been used */ - xchar gtyp; /* type of dog's current goal */ - xchar gx; /* x position of dog's current goal */ - xchar gy; /* y position of dog's current goal */ + xint16 gtyp; /* type of dog's current goal */ + coordxy gx; /* x position of dog's current goal */ + coordxy gy; /* y position of dog's current goal */ char dogname[PL_PSIZ]; char catname[PL_PSIZ]; char horsename[PL_PSIZ]; @@ -1000,8 +1000,8 @@ struct instance_globals { /* mklev.c */ genericptr_t luathemes[MAXDUNGEON]; - xchar vault_x; - xchar vault_y; + coordxy vault_x; + coordxy vault_y; boolean made_branch; /* used only during level creation */ /* mkmap.c */ @@ -1202,8 +1202,8 @@ struct instance_globals { lev_region *lregions; int num_lregions; struct sp_coder *coder; - xchar xstart, ystart; - xchar xsize, ysize; + coordxy xstart, ystart; + coordxy xsize, ysize; boolean in_mk_themerooms; boolean themeroom_failed; @@ -1248,9 +1248,9 @@ struct instance_globals { Stormbringer's maliciousness. */ /* vision.c */ - xchar **viz_array; /* used in cansee() and couldsee() macros */ - xchar *viz_rmin; /* min could see indices */ - xchar *viz_rmax; /* max could see indices */ + coordxy **viz_array; /* used in cansee() and couldsee() macros */ + coordxy *viz_rmin; /* min could see indices */ + coordxy *viz_rmax; /* max could see indices */ boolean vision_full_recalc; int seethru; /* 'bubble' debugging: clouds and water don't block light */ diff --git a/include/display.h b/include/display.h index c17fadae4..b32349a19 100644 --- a/include/display.h +++ b/include/display.h @@ -984,7 +984,7 @@ enum glyph_offsets { #define MG_BADXY 0x04000 /* bad coordinates were passed */ typedef struct { - xchar gnew; /* perhaps move this bit into the rm structure. */ + xint8 gnew; /* perhaps move this bit into the rm structure. */ glyph_info glyphinfo; } gbuf_entry; diff --git a/include/dungeon.h b/include/dungeon.h index 4fc6d7cd5..340a67d93 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -7,8 +7,8 @@ #define DUNGEON_H typedef struct d_level { /* basic dungeon level element */ - xchar dnum; /* dungeon number */ - xchar dlevel; /* level number */ + xint16 dnum; /* dungeon number */ + xint16 dlevel; /* level number */ } d_level; #if !defined(MAKEDEFS_C) && !defined(MDLIB_C) @@ -32,7 +32,7 @@ typedef struct s_level { /* special dungeon level element */ } s_level; typedef struct stairway { /* basic stairway identifier */ - xchar sx, sy; /* x / y location of the stair */ + coordxy sx, sy; /* x / y location of the stair */ d_level tolev; /* where does it go */ boolean up; /* up or down? */ boolean isladder; /* ladder or stairway? */ @@ -52,10 +52,10 @@ enum level_region_types { }; typedef struct dest_area { /* non-stairway level change identifier */ - xchar lx, ly; /* "lower" left corner (near [0,0]) */ - xchar hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */ - xchar nlx, nly; /* outline of invalid area */ - xchar nhx, nhy; /* opposite corner of invalid area */ + coordxy lx, ly; /* "lower" left corner (near [0,0]) */ + coordxy hx, hy; /* "upper" right corner (near [COLNO,ROWNO]) */ + coordxy nlx, nly; /* outline of invalid area */ + coordxy nhx, nhy; /* opposite corner of invalid area */ } dest_area; typedef struct dungeon { /* basic dungeon identifier */ @@ -65,9 +65,9 @@ typedef struct dungeon { /* basic dungeon identifier */ char themerms[15]; /* lua file name containing themed rooms */ char boneid; /* character to id dungeon in bones files */ d_flags flags; /* dungeon flags */ - xchar entry_lev; /* entry level */ - xchar num_dunlevs; /* number of levels in this dungeon */ - xchar dunlev_ureached; /* how deep you have been in this dungeon */ + xint16 entry_lev; /* entry level */ + xint16 num_dunlevs; /* number of levels in this dungeon */ + xint16 dunlev_ureached; /* how deep you have been in this dungeon */ int ledger_start, /* the starting depth in "real" terms */ depth_start; /* the starting depth in "logical" terms */ } dungeon; diff --git a/include/engrave.h b/include/engrave.h index f16c66ec1..6af923860 100644 --- a/include/engrave.h +++ b/include/engrave.h @@ -9,10 +9,10 @@ struct engr { struct engr *nxt_engr; char *engr_txt; - xchar engr_x, engr_y; + coordxy engr_x, engr_y; unsigned engr_lth; /* for save & restore; not length of text */ long engr_time; /* moment engraving was (will be) finished */ - xchar engr_type; + xint8 engr_type; #define DUST 1 #define ENGRAVE 2 #define BURN 3 diff --git a/include/extern.h b/include/extern.h index dcdffdbd5..9fc3bb929 100644 --- a/include/extern.h +++ b/include/extern.h @@ -46,8 +46,8 @@ extern boolean leashable(struct monst *); extern boolean next_to_u(void); extern struct obj *get_mleash(struct monst *); extern const char *beautiful(void); -extern void check_leash(xchar, xchar); -extern boolean um_dist(xchar, xchar, xchar); +extern void check_leash(coordxy, coordxy); +extern boolean um_dist(coordxy, coordxy, xint16); extern boolean snuff_candle(struct obj *); extern boolean snuff_lit(struct obj *); extern boolean splash_lit(struct obj *); @@ -87,8 +87,8 @@ extern void set_artifact_intrinsic(struct obj *, boolean, long); extern int touch_artifact(struct obj *, struct monst *); extern int spec_abon(struct obj *, struct monst *); extern int spec_dbon(struct obj *, struct monst *, int); -extern void discover_artifact(xchar); -extern boolean undiscovered_artifact(xchar); +extern void discover_artifact(xint16); +extern boolean undiscovered_artifact(xint16); extern int disp_artifact_discoveries(winid); extern void dump_artifact_info(winid); extern boolean artifact_hit(struct monst *, struct monst *, struct obj *, @@ -155,10 +155,10 @@ extern void lift_covet_and_placebc(int); Lift_covet_and_placebc(x, __FUNCTION__, __LINE__) #endif extern void set_bc(int); -extern void move_bc(int, int, xchar, xchar, xchar, xchar); -extern boolean drag_ball(xchar, xchar, int *, xchar *, xchar *, xchar *, - xchar *, boolean *, boolean); -extern void drop_ball(xchar, xchar); +extern void move_bc(int, int, coordxy, coordxy, coordxy, coordxy); +extern boolean drag_ball(coordxy, coordxy, int *, coordxy *, coordxy *, coordxy *, + coordxy *, boolean *, boolean); +extern void drop_ball(coordxy, coordxy); extern void drag_down(void); extern void bc_sanity_check(void); @@ -284,7 +284,7 @@ extern int getdir(const char *); extern void confdir(void); extern const char *directionname(int); extern int isok(int, int); -extern int get_adjacent_loc(const char *, const char *, xchar, xchar, coord *); +extern int get_adjacent_loc(const char *, const char *, coordxy, coordxy, coord *); extern const char *click_to_cmd(int, int, int); extern char get_count(const char *, char, long, cmdcount_nht *, unsigned); #ifdef HANGUPHANDLING @@ -306,7 +306,7 @@ extern void free_nomakedefs(void); /* ### dbridge.c ### */ -extern boolean is_waterwall(xchar, xchar); +extern boolean is_waterwall(coordxy, coordxy); extern boolean is_pool(int, int); extern boolean is_lava(int, int); extern boolean is_pool_or_lava(int, int); @@ -357,7 +357,7 @@ extern int wiz_mgender(void); /* ### dig.c ### */ -extern int dig_typ(struct obj *, xchar, xchar); +extern int dig_typ(struct obj *, coordxy, coordxy); extern boolean is_digging(void); extern int holetime(void); extern boolean dig_check(struct monst *, boolean, int, int); @@ -367,7 +367,7 @@ extern int use_pick_axe(struct obj *); extern int use_pick_axe2(struct obj *); extern boolean mdig_tunnel(struct monst *); extern void draft_message(boolean); -extern void watch_dig(struct monst *, xchar, xchar, boolean); +extern void watch_dig(struct monst *, coordxy, coordxy, boolean); extern void zap_dig(void); extern struct obj *bury_an_obj(struct obj *, boolean *); extern void bury_objs(int, int); @@ -378,7 +378,7 @@ extern struct obj *buried_ball(coord *); extern void buried_ball_to_punishment(void); extern void buried_ball_to_freedom(void); extern schar fillholetyp(int, int, boolean); -extern void liquid_flow(xchar, xchar, schar, struct trap *, const char *); +extern void liquid_flow(coordxy, coordxy, schar, struct trap *, const char *); extern boolean conjoined_pits(struct trap *, struct trap *, boolean); #if 0 extern void bury_monst(struct monst *); @@ -401,20 +401,20 @@ extern int see_with_infrared(struct monst *); extern int canseemon(struct monst *); extern int knowninvisible(struct monst *); extern int is_safemon(struct monst *); -extern void magic_map_background(xchar, xchar, int); -extern void map_background(xchar, xchar, int); +extern void magic_map_background(coordxy, coordxy, int); +extern void map_background(coordxy, coordxy, int); extern void map_trap(struct trap *, int); extern void map_object(struct obj *, int); -extern void map_invisible(xchar, xchar); +extern void map_invisible(coordxy, coordxy); extern boolean unmap_invisible(int, int); extern void unmap_object(int, int); extern void map_location(int, int, int); extern boolean suppress_map_output(void); -extern void feel_newsym(xchar, xchar); -extern void feel_location(xchar, xchar); +extern void feel_newsym(coordxy, coordxy); +extern void feel_location(coordxy, coordxy); extern void newsym(int, int); extern void newsym_force(int, int); -extern void shieldeff(xchar, xchar); +extern void shieldeff(coordxy, coordxy); extern void tmp_at(int, int); extern void flash_glyph_at(int, int, int, int); extern void swallowed(int); @@ -433,15 +433,15 @@ extern void clear_glyph_buffer(void); extern void row_refresh(int, int, int); extern void cls(void); extern void flush_screen(int); -extern int back_to_glyph(xchar, xchar); +extern int back_to_glyph(coordxy, coordxy); extern int zapdir_to_glyph(int, int, int); -extern int glyph_at(xchar, xchar); +extern int glyph_at(coordxy, coordxy); extern void reglyph_darkroom(void); extern void xy_set_wall_state(int, int); extern void set_wall_state(void); extern void unset_seenv(struct rm *, int, int, int, int); extern int warning_of(struct monst *); -extern void map_glyphinfo(xchar, xchar, int, unsigned, glyph_info *); +extern void map_glyphinfo(coordxy, coordxy, int, unsigned, glyph_info *); extern void reset_glyphmap(enum glyphmap_change_triggers trigger); extern int fn_cmap_to_glyph(int); @@ -588,14 +588,14 @@ extern boolean inaccessible_equipment(struct obj *, const char *, boolean); extern void newedog(struct monst *); extern void free_edog(struct monst *); extern void initedog(struct monst *); -extern struct monst *make_familiar(struct obj *, xchar, xchar, boolean); +extern struct monst *make_familiar(struct obj *, coordxy, coordxy, boolean); extern struct monst *makedog(void); extern void update_mlstmv(void); extern void losedogs(void); extern void mon_arrive(struct monst *, boolean); extern void mon_catchup_elapsed_time(struct monst *, long); extern void keepdogs(boolean); -extern void migrate_to_level(struct monst *, xchar, xchar, coord *); +extern void migrate_to_level(struct monst *, coordxy, coordxy, coord *); extern int dogfood(struct monst *, struct obj *); extern boolean tamedog(struct monst *, struct obj *); extern void abuse_dog(struct monst *); @@ -613,13 +613,13 @@ extern void finish_meating(struct monst *); /* ### dokick.c ### */ extern boolean ghitm(struct monst *, struct obj *); -extern void container_impact_dmg(struct obj *, xchar, xchar); +extern void container_impact_dmg(struct obj *, coordxy, coordxy); extern int dokick(void); -extern boolean ship_object(struct obj *, xchar, xchar, boolean); +extern boolean ship_object(struct obj *, coordxy, coordxy, boolean); extern void obj_delivery(boolean); extern void deliver_obj_to_mon(struct monst *mtmp, int, unsigned long); -extern schar down_gate(xchar, xchar); -extern void impact_drop(struct obj *, xchar, xchar, xchar); +extern schar down_gate(coordxy, coordxy); +extern void impact_drop(struct obj *, coordxy, coordxy, coordxy); /* ### dothrow.c ### */ @@ -634,10 +634,10 @@ extern boolean throwing_weapon(struct obj *); extern void throwit(struct obj *, long, boolean, struct obj *); extern int omon_adj(struct monst *, struct obj *, boolean); extern int thitmonst(struct monst *, struct obj *); -extern int hero_breaks(struct obj *, xchar, xchar, unsigned); -extern int breaks(struct obj *, xchar, xchar); -extern void release_camera_demon(struct obj *, xchar, xchar); -extern void breakobj(struct obj *, xchar, xchar, boolean, boolean); +extern int hero_breaks(struct obj *, coordxy, coordxy, unsigned); +extern int breaks(struct obj *, coordxy, coordxy); +extern void release_camera_demon(struct obj *, coordxy, coordxy); +extern void breakobj(struct obj *, coordxy, coordxy, boolean, boolean); extern boolean breaktest(struct obj *); extern boolean walk_path(coord *, coord *, boolean(*)(void *, int, int), genericptr_t); @@ -660,14 +660,14 @@ extern s_level *find_level(const char *); extern s_level *Is_special(d_level *); extern branch *Is_branchlev(d_level *); extern boolean builds_up(d_level *); -extern xchar ledger_no(d_level *); -extern xchar maxledgerno(void); +extern xint16 ledger_no(d_level *); +extern xint16 maxledgerno(void); extern schar depth(d_level *); -extern xchar dunlev(d_level *); -extern xchar dunlevs_in_dungeon(d_level *); -extern xchar ledger_to_dnum(xchar); -extern xchar ledger_to_dlev(xchar); -extern xchar deepest_lev_reached(boolean); +extern xint16 dunlev(d_level *); +extern xint16 dunlevs_in_dungeon(d_level *); +extern xint16 ledger_to_dnum(xint16); +extern xint16 ledger_to_dlev(xint16); +extern xint16 deepest_lev_reached(boolean); extern boolean on_level(d_level *, d_level *); extern void next_level(boolean); extern void prev_level(boolean); @@ -685,10 +685,10 @@ extern stairway *stairway_find_special_dir(boolean); extern void u_on_sstairs(int); extern void u_on_upstairs(void); extern void u_on_dnstairs(void); -extern boolean On_stairs(xchar, xchar); -extern boolean On_ladder(xchar, xchar); -extern boolean On_stairs_up(xchar, xchar); -extern boolean On_stairs_dn(xchar, xchar); +extern boolean On_stairs(coordxy, coordxy); +extern boolean On_ladder(coordxy, coordxy); +extern boolean On_stairs_up(coordxy, coordxy); +extern boolean On_stairs_dn(coordxy, coordxy); extern void get_level(d_level *, int); extern boolean Is_botlevel(d_level *); extern boolean Can_fall_thru(d_level *); @@ -710,11 +710,11 @@ extern void assign_level(d_level *, d_level *); extern void assign_rnd_level(d_level *, d_level *, int); extern unsigned int induced_align(int); extern boolean Invocation_lev(d_level *); -extern xchar level_difficulty(void); +extern xint16 level_difficulty(void); extern schar lev_by_name(const char *); extern boolean known_branch_stairs(stairway *); extern char *stairs_description(stairway *, char *, boolean); -extern schar print_dungeon(boolean, schar *, xchar *); +extern schar print_dungeon(boolean, schar *, xint16 *); extern char *get_annotation(d_level *); extern int donamelevel(void); extern int dooverview(void); @@ -796,12 +796,12 @@ extern boolean can_reach_floor(boolean); extern void cant_reach_floor(int, int, boolean, boolean); extern const char *surface(int, int); extern const char *ceiling(int, int); -extern struct engr *engr_at(xchar, xchar); -extern boolean sengr_at(const char *, xchar, xchar, boolean); +extern struct engr *engr_at(coordxy, coordxy); +extern boolean sengr_at(const char *, coordxy, coordxy, boolean); extern void u_wipe_engr(int); -extern void wipe_engr_at(xchar, xchar, xchar, boolean); +extern void wipe_engr_at(coordxy, coordxy, coordxy, boolean); extern void read_engr_at(int, int); -extern void make_engr_at(int, int, const char *, long, xchar); +extern void make_engr_at(int, int, const char *, long, xint16); extern void del_engr_at(int, int); extern int freehand(void); extern int doengrave(void); @@ -918,7 +918,7 @@ extern void livelog_add(long ll_type, const char *); extern void floating_above(const char *); extern void dogushforth(int); -extern void dryup(xchar, xchar, boolean); +extern void dryup(coordxy, coordxy, boolean); extern void drinkfountain(void); extern void dipfountain(struct obj *); extern void breaksink(int, int); @@ -932,13 +932,13 @@ extern anything *long_to_any(long); extern anything *monst_to_any(struct monst *); extern anything *obj_to_any(struct obj *); extern boolean revive_nasty(int, int, const char *); -extern int still_chewing(xchar, xchar); -extern void movobj(struct obj *, xchar, xchar); -extern boolean may_dig(xchar, xchar); -extern boolean may_passwall(xchar, xchar); -extern boolean bad_rock(struct permonst *, xchar, xchar); +extern int still_chewing(coordxy, coordxy); +extern void movobj(struct obj *, coordxy, coordxy); +extern boolean may_dig(coordxy, coordxy); +extern boolean may_passwall(coordxy, coordxy); +extern boolean bad_rock(struct permonst *, coordxy, coordxy); extern int cant_squeeze_thru(struct monst *); -extern boolean invocation_pos(xchar, xchar); +extern boolean invocation_pos(coordxy, coordxy); extern boolean test_move(int, int, int, int, int); #ifdef DEBUG extern int wiz_debug_cmd_traveldisplay(void); @@ -954,7 +954,7 @@ extern void switch_terrain(void); extern void set_uinwater(int); extern boolean pooleffects(boolean); extern void spoteffects(boolean); -extern char *in_rooms(xchar, xchar, int); +extern char *in_rooms(coordxy, coordxy, int); extern boolean in_town(int, int); extern void check_special_room(boolean); extern int dopickup(void); @@ -973,7 +973,7 @@ extern int max_capacity(void); extern boolean check_capacity(const char *); extern int inv_cnt(boolean); extern long money_cnt(struct obj *); -extern void spot_checks(xchar, xchar, schar); +extern void spot_checks(coordxy, coordxy, schar); /* ### hacklib.c ### */ @@ -1190,9 +1190,9 @@ extern int dosuspend(void); /* ### light.c ### */ -extern void new_light_source(xchar, xchar, int, int, union any *); +extern void new_light_source(coordxy, coordxy, int, int, union any *); extern void del_light_source(int, union any *); -extern void do_light_sources(xchar **); +extern void do_light_sources(coordxy **); extern void show_transient_light(struct obj *, int, int); extern void transient_light_cleanup(void); extern struct monst *find_mid(unsigned, unsigned); @@ -1222,7 +1222,7 @@ extern void breakchestlock(struct obj *, boolean); extern void reset_pick(void); extern void maybe_reset_pick(struct obj *); extern struct obj *autokey(boolean); -extern int pick_lock(struct obj *, xchar, xchar, struct obj *); +extern int pick_lock(struct obj *, coordxy, coordxy, struct obj *); extern boolean u_have_forceable_weapon(void); extern int doforce(void); extern boolean boxlock(struct obj *, struct obj *); @@ -1257,7 +1257,7 @@ extern void readmail(struct obj *); extern void dealloc_monst(struct monst *); extern boolean is_home_elemental(struct permonst *); -extern struct monst *clone_mon(struct monst *, xchar, xchar); +extern struct monst *clone_mon(struct monst *, coordxy, coordxy); extern int monhp_per_lvl(struct monst *); extern void newmonhp(struct monst *, int); extern struct mextra *newmextra(void); @@ -1369,12 +1369,12 @@ extern void topologize(struct mkroom *, boolean)); #else extern void topologize(struct mkroom *); #endif -extern void place_branch(branch *, xchar, xchar); -extern boolean occupied(xchar, xchar); -extern int okdoor(xchar, xchar); +extern void place_branch(branch *, coordxy, coordxy); +extern boolean occupied(coordxy, coordxy); +extern int okdoor(coordxy, coordxy); extern void dodoor(int, int, struct mkroom *); extern void mktrap(int, int, struct mkroom *, coord *); -extern void mkstairs(xchar, xchar, char, struct mkroom *, boolean); +extern void mkstairs(coordxy, coordxy, char, struct mkroom *, boolean); extern void mkinvokearea(void); extern void mineralize(int, int, int, int, boolean); @@ -1386,8 +1386,8 @@ extern boolean litstate_rnd(int); /* ### mkmaze.c ### */ -extern boolean set_levltyp(xchar, xchar, schar); -extern boolean set_levltyp_lit(xchar, xchar, schar, schar); +extern boolean set_levltyp(coordxy, coordxy, schar); +extern boolean set_levltyp_lit(coordxy, coordxy, schar, schar); extern void create_maze(int, int, boolean); extern void wallification(int, int, int, int); extern void fix_wall_spines(int, int, int, int); @@ -1396,10 +1396,10 @@ extern void makemaz(const char *); extern void mazexy(coord *); extern void get_level_extends(int *, int *, int *, int *); extern void bound_digging(void); -extern void mkportal(xchar, xchar, xchar, xchar); -extern boolean bad_location(xchar, xchar, xchar, xchar, xchar, xchar); -extern void place_lregion(xchar, xchar, xchar, xchar, xchar, xchar, xchar, - xchar, xchar, d_level *); +extern void mkportal(coordxy, coordxy, coordxy, coordxy); +extern boolean bad_location(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy); +extern void place_lregion(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, + coordxy, coordxy, d_level *); extern void fixup_special(void); extern void fumaroles(void); extern void movebubbles(void); @@ -1495,7 +1495,7 @@ extern boolean has_dnstairs(struct mkroom *); extern boolean has_upstairs(struct mkroom *); extern int somex(struct mkroom *); extern int somey(struct mkroom *); -extern boolean inside_room(struct mkroom *, xchar, xchar); +extern boolean inside_room(struct mkroom *, coordxy, coordxy); extern boolean somexy(struct mkroom *, coord *); extern boolean somexyspace(struct mkroom *, coord *); extern void mkundead(coord *, boolean, int); @@ -1549,7 +1549,7 @@ extern void mon_to_stone(struct monst *); extern void m_into_limbo(struct monst *); extern void mnexto(struct monst *, unsigned); extern void maybe_mnexto(struct monst *); -extern int mnearto(struct monst *, xchar, xchar, boolean, unsigned); +extern int mnearto(struct monst *, coordxy, coordxy, boolean, unsigned); extern void m_respond(struct monst *); extern void setmangry(struct monst *, boolean); extern void wake_msg(struct monst *, boolean); @@ -1560,11 +1560,11 @@ extern void seemimic(struct monst *); extern void normal_shape(struct monst *); extern void iter_mons(void (*)(struct monst *)); extern struct monst *get_iter_mons(boolean (*)(struct monst *)); -extern struct monst *get_iter_mons_xy(boolean (*)(struct monst *, xchar, xchar), xchar, xchar); +extern struct monst *get_iter_mons_xy(boolean (*)(struct monst *, coordxy, coordxy), coordxy, coordxy); extern void rescham(void); extern void restartcham(void); extern void restore_cham(struct monst *); -extern void maybe_unhide_at(xchar, xchar); +extern void maybe_unhide_at(coordxy, coordxy); extern boolean hideunder(struct monst *); extern void hide_monst(struct monst *); extern void mon_animal_list(boolean); @@ -1648,18 +1648,18 @@ extern int bee_eat_jelly(struct monst *, struct obj *); extern void monflee(struct monst *, int, boolean, boolean); extern void mon_yells(struct monst *, const char *); extern int dochug(struct monst *); -extern boolean m_digweapon_check(struct monst *, xchar, xchar); +extern boolean m_digweapon_check(struct monst *, coordxy, coordxy); extern int m_move(struct monst *, int); -extern int m_move_aggress(struct monst *, xchar, xchar); +extern int m_move_aggress(struct monst *, coordxy, coordxy); extern void dissolve_bars(int, int); extern boolean closed_door(int, int); extern boolean accessible(int, int); extern void set_apparxy(struct monst *); extern boolean can_ooze(struct monst *); extern boolean can_fog(struct monst *); -extern boolean should_displace(struct monst *, coord *, long *, int, xchar, - xchar); -extern boolean undesirable_disp(struct monst *, xchar, xchar); +extern boolean should_displace(struct monst *, coord *, long *, int, coordxy, + coordxy); +extern boolean undesirable_disp(struct monst *, coordxy, coordxy); /* ### monst.c ### */ @@ -1667,7 +1667,7 @@ extern void monst_globals_init(void); /* ### mplayer.c ### */ -extern struct monst *mk_mplayer(struct permonst *, xchar, xchar, boolean); +extern struct monst *mk_mplayer(struct permonst *, coordxy, coordxy, boolean); extern void create_mplayers(int, boolean); extern void mplayer_talk(struct monst *); @@ -1731,9 +1731,9 @@ extern int ohitmon(struct monst *, struct obj *, int, boolean); extern void thrwmu(struct monst *); extern int spitmu(struct monst *, struct attack *); extern int breamu(struct monst *, struct attack *); -extern boolean linedup_callback(xchar, xchar, xchar, xchar, +extern boolean linedup_callback(coordxy, coordxy, coordxy, coordxy, boolean(*)(int,int)); -extern boolean linedup(xchar, xchar, xchar, xchar, int); +extern boolean linedup(coordxy, coordxy, coordxy, coordxy, int); extern boolean lined_up(struct monst *); extern struct obj *m_carrying(struct monst *, int); extern int thrwmm(struct monst *, struct monst *); @@ -1808,7 +1808,7 @@ extern void nhl_add_table_entry_char(lua_State *, const char *, char); extern void nhl_add_table_entry_str(lua_State *, const char *, const char *); extern void nhl_add_table_entry_bool(lua_State *, const char *, boolean); extern void nhl_add_table_entry_region(lua_State *, const char *, - xchar, xchar, xchar, xchar); + coordxy, coordxy, coordxy, coordxy); extern schar splev_chr2typ(char); extern schar check_mapchr(const char *); extern int get_table_int(lua_State *, const char *); @@ -1991,7 +1991,7 @@ extern char *self_lookat(char *); extern char *monhealthdescr(struct monst *mon, boolean, char *); extern void mhidden_description(struct monst *, boolean, char *); extern boolean object_from_map(int,int,int,struct obj **); -extern const char *waterbody_name(xchar, xchar); +extern const char *waterbody_name(coordxy, coordxy); extern int do_screen_description(coord, boolean, int, char *, const char **, struct permonst **); extern int do_look(int, coord *); @@ -2179,7 +2179,7 @@ extern const char *u_gname(void); extern int doturn(void); extern int altarmask_at(int, int); extern const char *a_gname(void); -extern const char *a_gname_at(xchar x, xchar y); +extern const char *a_gname_at(coordxy x, coordxy y); extern const char *align_gname(aligntyp); extern const char *halu_gname(aligntyp); extern const char *align_gtitle(aligntyp); @@ -2188,7 +2188,7 @@ extern void altar_wrath(int, int); /* ### priest.c ### */ extern int move_special(struct monst *, boolean, schar, boolean, boolean, - xchar, xchar, xchar, xchar); + coordxy, coordxy, coordxy, coordxy); extern char temple_occupied(char *); extern boolean inhistemple(struct monst *); extern int pri_move(struct monst *); @@ -2200,10 +2200,10 @@ extern struct monst *findpriest(char); extern void intemple(int); extern void forget_temple_entry(struct monst *); extern void priest_talk(struct monst *); -extern struct monst *mk_roamer(struct permonst *, aligntyp, xchar, xchar, +extern struct monst *mk_roamer(struct permonst *, aligntyp, coordxy, coordxy, boolean); extern void reset_hostility(struct monst *); -extern boolean in_your_sanctuary(struct monst *, xchar, xchar); +extern boolean in_your_sanctuary(struct monst *, coordxy, coordxy); extern void ghod_hitsu(struct monst *); extern void angry_priest(void); extern void clearpriests(void); @@ -2287,16 +2287,16 @@ extern void split_rects(NhRect *, NhRect *); extern boolean inside_region(NhRegion *, int, int); extern void clear_regions(void); extern void run_regions(void); -extern boolean in_out_region(xchar, xchar); -extern boolean m_in_out_region(struct monst *, xchar, xchar); +extern boolean in_out_region(coordxy, coordxy); +extern boolean m_in_out_region(struct monst *, coordxy, coordxy); extern void update_player_regions(void); extern void update_monster_region(struct monst *); -extern NhRegion *visible_region_at(xchar, xchar); -extern void show_region(NhRegion *, xchar, xchar); +extern NhRegion *visible_region_at(coordxy, coordxy); +extern void show_region(NhRegion *, coordxy, coordxy); extern void save_regions(NHFILE *); extern void rest_regions(NHFILE *); extern void region_stats(const char *, char *, long *, long *); -extern NhRegion *create_gas_cloud(xchar, xchar, int, int); +extern NhRegion *create_gas_cloud(coordxy, coordxy, int, int); extern boolean region_danger(void); extern void region_safety(void); @@ -2306,7 +2306,7 @@ extern void inven_inuse(boolean); extern int dorecover(NHFILE *); extern void restcemetery(NHFILE *, struct cemetery **); extern void trickery(char *); -extern void getlev(NHFILE *, int, xchar); +extern void getlev(NHFILE *, int, xint8); extern void get_plname_from_file(NHFILE *, char *); #ifdef SELECTSAVED extern int restore_menu(winid); @@ -2392,7 +2392,7 @@ extern boolean tricked_fileremoved(NHFILE *, char *); #ifdef INSURANCE extern void savestateinlock(void); #endif -extern void savelev(NHFILE *, xchar); +extern void savelev(NHFILE *, xint8); extern genericptr_t mon_to_buffer(struct monst *, int *); extern boolean close_check(int); extern void savecemetery(NHFILE *, struct cemetery **); @@ -2430,9 +2430,9 @@ extern void shkgone(struct monst *); extern void set_residency(struct monst *, boolean); extern void replshk(struct monst *, struct monst *); extern void restshk(struct monst *, boolean); -extern char inside_shop(xchar, xchar); +extern char inside_shop(coordxy, coordxy); extern void u_left_shop(char *, boolean); -extern void remote_burglary(xchar, xchar); +extern void remote_burglary(coordxy, coordxy); extern void u_entered_shop(char *); extern void pick_pick(struct obj *); extern boolean same_price(struct obj *, struct obj *); @@ -2446,7 +2446,7 @@ extern void obfree(struct obj *, struct obj *); extern void make_happy_shk(struct monst *, boolean); extern void make_happy_shoppers(boolean); extern void hot_pursuit(struct monst *); -extern void make_angry_shk(struct monst *, xchar, xchar); +extern void make_angry_shk(struct monst *, coordxy, coordxy); extern int dopay(void); extern boolean paybill(int, boolean); extern void finish_paybill(void); @@ -2462,30 +2462,30 @@ extern boolean billable(struct monst **, struct obj *, char, boolean); extern void addtobill(struct obj *, boolean, boolean, boolean); extern void splitbill(struct obj *, struct obj *); extern void subfrombill(struct obj *, struct monst *); -extern long stolen_value(struct obj *, xchar, xchar, boolean, boolean); +extern long stolen_value(struct obj *, coordxy, coordxy, boolean, boolean); extern void donate_gold(long, struct monst *, boolean); extern void sellobj_state(int); -extern void sellobj(struct obj *, xchar, xchar); +extern void sellobj(struct obj *, coordxy, coordxy); extern int doinvbill(int); -extern struct monst *shkcatch(struct obj *, xchar, xchar); -extern void add_damage(xchar, xchar, long); +extern struct monst *shkcatch(struct obj *, coordxy, coordxy); +extern void add_damage(coordxy, coordxy, long); extern void fix_shop_damage(void); extern int shk_move(struct monst *); extern void after_shk_move(struct monst *); extern boolean is_fshk(struct monst *); extern void shopdig(int); extern void pay_for_damage(const char *, boolean); -extern boolean costly_spot(xchar, xchar); -extern struct obj *shop_object(xchar, xchar); +extern boolean costly_spot(coordxy, coordxy); +extern struct obj *shop_object(coordxy, coordxy); extern void price_quote(struct obj *); extern void shk_chat(struct monst *); extern void check_unpaid_usage(struct obj *, boolean); extern void check_unpaid(struct obj *); -extern void costly_gold(xchar, xchar, long, boolean); +extern void costly_gold(coordxy, coordxy, long, boolean); extern long get_cost_of_shop_item(struct obj *, int *); extern int oid_price_adjustment(struct obj *, unsigned); -extern boolean block_door(xchar, xchar); -extern boolean block_entry(xchar, xchar); +extern boolean block_door(coordxy, coordxy); +extern boolean block_entry(coordxy, coordxy); extern char *shk_your(char *, struct obj *); extern char *Shk_Your(char *, struct obj *); extern void globby_bill_fixup(struct obj *, struct obj *); @@ -2541,34 +2541,34 @@ extern const char * mapfrag_error(struct mapfragment *); extern boolean mapfrag_match(struct mapfragment *, int, int); extern void flip_level(int, boolean); extern void flip_level_rnd(int, boolean); -extern boolean check_room(xchar *, xchar *, xchar *, xchar *, boolean); -extern boolean create_room(xchar, xchar, xchar, xchar, xchar, xchar, xchar, - xchar); +extern boolean check_room(coordxy *, coordxy *, coordxy *, coordxy *, boolean); +extern boolean create_room(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, xint16, + xint16); extern boolean dig_corridor(coord *, coord *, boolean, schar, schar); extern void fill_special_room(struct mkroom *); extern void wallify_map(int, int, int, int); extern boolean load_special(const char *); -extern xchar selection_getpoint(int, int, struct selectionvar *); +extern coordxy selection_getpoint(int, int, struct selectionvar *); extern struct selectionvar *selection_new(void); extern void selection_free(struct selectionvar *, boolean); extern struct selectionvar *selection_clone(struct selectionvar *); extern void set_selection_floodfillchk(int(*)(int,int)); extern void selection_floodfill(struct selectionvar *, int, int, boolean); extern boolean pm_good_location(int, int, struct permonst *); -extern void get_location_coord(xchar *, xchar *, int, struct mkroom *, long); -extern void selection_setpoint(int, int, struct selectionvar *, xchar); +extern void get_location_coord(coordxy *, coordxy *, int, struct mkroom *, long); +extern void selection_setpoint(int, int, struct selectionvar *, coordxy); extern struct selectionvar * selection_not(struct selectionvar *); extern void selection_filter_percent(struct selectionvar *, int); -extern int selection_rndcoord(struct selectionvar *, xchar *, xchar *, +extern int selection_rndcoord(struct selectionvar *, coordxy *, coordxy *, boolean); extern void selection_do_grow(struct selectionvar *, int); -extern void selection_do_line(xchar, xchar, xchar, xchar, +extern void selection_do_line(coordxy, coordxy, coordxy, coordxy, struct selectionvar *); -extern void selection_do_randline(xchar, xchar, xchar, xchar, schar, schar, +extern void selection_do_randline(coordxy, coordxy, coordxy, coordxy, schar, schar, struct selectionvar *); extern struct selectionvar *selection_filter_mapchar(struct selectionvar *, - xchar, int); -extern void set_floodfillchk_match_under(xchar); + coordxy, int); +extern void set_floodfillchk_match_under(coordxy); extern void selection_do_ellipse(struct selectionvar *, int, int, int, int, int); extern void selection_do_gradient(struct selectionvar *, long, long, long, @@ -2672,8 +2672,8 @@ extern void sysopt_seduce_set(int); extern boolean noteleport_level(struct monst *); extern boolean goodpos(int, int, struct monst *, mmflags_nht); -extern boolean enexto(coord *, xchar, xchar, struct permonst *); -extern boolean enexto_core(coord *, xchar, xchar, struct permonst *, +extern boolean enexto(coord *, coordxy, coordxy, struct permonst *); +extern boolean enexto_core(coord *, coordxy, coordxy, struct permonst *, mmflags_nht); extern void teleds(int, int, int); extern boolean safe_teleds(int); @@ -2724,9 +2724,9 @@ extern void obj_move_timers(struct obj *, struct obj *); extern void obj_split_timers(struct obj *, struct obj *); extern void obj_stop_timers(struct obj *); extern boolean obj_has_timer(struct obj *, short); -extern void spot_stop_timers(xchar, xchar, short); -extern long spot_time_expires(xchar, xchar, short); -extern long spot_time_left(xchar, xchar, short); +extern void spot_stop_timers(coordxy, coordxy, short); +extern long spot_time_expires(coordxy, coordxy, short); +extern long spot_time_left(coordxy, coordxy, short); extern boolean obj_is_local(struct obj *); extern void save_timers(NHFILE *, int); extern void restore_timers(NHFILE *, int, long); @@ -2757,8 +2757,8 @@ extern int erode_obj(struct obj *, const char *, int, int); extern boolean grease_protect(struct obj *, const char *, struct monst *); extern struct trap *maketrap(int, int, int); extern void fall_through(boolean, unsigned); -extern struct monst *animate_statue(struct obj *, xchar, xchar, int, int *); -extern struct monst *activate_statue_trap(struct trap *, xchar, xchar, +extern struct monst *animate_statue(struct obj *, coordxy, coordxy, int, int *); +extern struct monst *activate_statue_trap(struct trap *, coordxy, coordxy, boolean); extern void set_utrap(unsigned, unsigned); extern void reset_utrap(boolean); @@ -2774,9 +2774,9 @@ extern void float_up(void); extern void fill_pit(int, int); extern int float_down(long, long); extern void climb_pit(void); -extern boolean fire_damage(struct obj *, boolean, xchar, xchar); -extern int fire_damage_chain(struct obj *, boolean, boolean, xchar, xchar); -extern boolean lava_damage(struct obj *, xchar, xchar); +extern boolean fire_damage(struct obj *, boolean, coordxy, coordxy); +extern int fire_damage_chain(struct obj *, boolean, boolean, coordxy, coordxy); +extern boolean lava_damage(struct obj *, coordxy, coordxy); extern void acid_damage(struct obj *); extern int water_damage(struct obj *, const char *, boolean); extern void water_damage_chain(struct obj *, boolean); @@ -2807,7 +2807,7 @@ extern void sink_into_lava(void); extern void sokoban_guilt(void); extern const char * trapname(int, boolean); extern void ignite_items(struct obj *); -extern void trap_ice_effects(xchar x, xchar y, boolean ice_is_melting); +extern void trap_ice_effects(coordxy x, coordxy y, boolean ice_is_melting); extern void trap_sanity_check(void); /* ### u_init.c ### */ @@ -3261,7 +3261,7 @@ extern void nethack_enter_windows(void); extern void amulet(void); extern int mon_has_amulet(struct monst *); extern int mon_has_special(struct monst *); -extern void choose_stairs(xchar *, xchar *, boolean); +extern void choose_stairs(coordxy *, coordxy *, boolean); extern int tactics(struct monst *); extern boolean has_aggravatables(struct monst *); extern void aggravate(void); @@ -3281,7 +3281,7 @@ extern void worm_move(struct monst *); extern void worm_nomove(struct monst *); extern void wormgone(struct monst *); extern int wormhitu(struct monst *); -extern void cutworm(struct monst *, xchar, xchar, boolean); +extern void cutworm(struct monst *, coordxy, coordxy, boolean); extern void see_wsegs(struct monst *); extern void detect_wsegs(struct monst *, boolean); extern void save_worm(NHFILE *); @@ -3290,7 +3290,7 @@ extern void place_wsegs(struct monst *, struct monst *); extern void sanity_check_worm(struct monst *); extern void wormno_sanity_check(void); extern void remove_worm(struct monst *); -extern void place_worm_tail_randomly(struct monst *, xchar, xchar); +extern void place_worm_tail_randomly(struct monst *, coordxy, coordxy); extern int size_wseg(struct monst *); extern int count_wsegs(struct monst *); extern boolean worm_known(struct monst *); @@ -3333,8 +3333,8 @@ extern void learnwand(struct obj *); extern int bhitm(struct monst *, struct obj *); extern void release_hold(void); extern void probe_monster(struct monst *); -extern boolean get_obj_location(struct obj *, xchar *, xchar *, int); -extern boolean get_mon_location(struct monst *, xchar *, xchar *, int); +extern boolean get_obj_location(struct obj *, coordxy *, coordxy *, int); +extern boolean get_mon_location(struct monst *, coordxy *, coordxy *, int); extern struct monst *get_container_location(struct obj * obj, int *, int *); extern struct monst *montraits(struct obj *, coord *, boolean); extern struct monst *revive(struct obj *, boolean); @@ -3373,12 +3373,12 @@ extern struct monst *bhit(int, int, int, enum bhit_call_types, extern struct monst *boomhit(struct obj *, int, int); extern int zhitm(struct monst *, int, int, struct obj **); extern int burn_floor_objects(int, int, boolean, boolean); -extern void buzz(int, int, xchar, xchar, int, int); -extern void dobuzz(int, int, xchar, xchar, int, int, boolean); -extern void melt_ice(xchar, xchar, const char *); -extern void start_melt_ice_timeout(xchar, xchar, long); +extern void buzz(int, int, coordxy, coordxy, int, int); +extern void dobuzz(int, int, coordxy, coordxy, int, int, boolean); +extern void melt_ice(coordxy, coordxy, const char *); +extern void start_melt_ice_timeout(coordxy, coordxy, long); extern void melt_ice_away(union any *, long); -extern int zap_over_floor(xchar, xchar, int, boolean *, short); +extern int zap_over_floor(coordxy, coordxy, int, boolean *, short); extern void fracture_rock(struct obj *); extern boolean break_statue(struct obj *); extern boolean u_adtyp_resistance_obj(int); diff --git a/include/global.h b/include/global.h index 358f66a12..fd5a3291c 100644 --- a/include/global.h +++ b/include/global.h @@ -59,17 +59,29 @@ #endif /* DUMB */ /* - * type xchar: small integers (typedef'd as signed char, - * so in the range -127 - 127), usually coordinates. + * type xint8: small integers (typedef'd as signed, + * in the range -127 - 127). */ -typedef schar xchar; +typedef int8_t xint8; +/* + * type coordxy: integers (typedef'd as signed, + * in the range −32768 to 32767), mostly coordinates. + * Note that in 2022, screen coordinates easily + * surpass an upper limit of 127. + */ +typedef int16_t coordxy; +/* + * type xint16: integers (typedef'd as signed, + * in the range −32768 to 32767), non-coordinates. + */ +typedef int16_t xint16; #ifdef __MINGW32__ /* Resolve conflict with Qt 5 and MinGW-w32 */ typedef unsigned char boolean; /* 0 or 1 */ #else #ifndef SKIP_BOOLEAN -typedef xchar boolean; /* 0 or 1 */ +typedef schar boolean; /* 0 or 1 */ #endif #endif diff --git a/include/hack.h b/include/hack.h index 7d2c9a115..7ed89d8bc 100644 --- a/include/hack.h +++ b/include/hack.h @@ -170,13 +170,13 @@ typedef union str_or_len { /* lev_region from sp_lev.h */ typedef struct { struct { - xchar x1, y1, x2, y2; + coordxy x1, y1, x2, y2; } inarea; struct { - xchar x1, y1, x2, y2; + coordxy x1, y1, x2, y2; } delarea; boolean in_islev, del_islev; - xchar rtype, padding; + coordxy rtype, padding; Str_or_Len rname; } lev_region; @@ -251,9 +251,9 @@ struct sortloot_item { char *str; /* result of loot_xname(obj) in some cases, otherwise null */ int indx; /* signed int, because sortloot()'s qsort comparison routine assumes (a->indx - b->indx) might yield a negative result */ - xchar orderclass; /* order rather than object class; 0 => not yet init'd */ - xchar subclass; /* subclass for some classes */ - xchar disco; /* discovery status */ + xint16 orderclass; /* order rather than object class; 0 => not yet init'd */ + xint16 subclass; /* subclass for some classes */ + xint16 disco; /* discovery status */ }; typedef struct sortloot_item Loot; diff --git a/include/mextra.h b/include/mextra.h index ed209e346..177d21446 100644 --- a/include/mextra.h +++ b/include/mextra.h @@ -69,7 +69,7 @@ #define GD_DESTROYGOLD 0x02 struct fakecorridor { - xchar fx, fy; + coordxy fx, fy; schar ftyp; /* from struct rm's typ */ uchar flags; /* also from struct rm; an unsigned 5-bit field there */ }; @@ -77,10 +77,10 @@ struct fakecorridor { struct egd { int fcbeg, fcend; /* fcend: first unused pos */ int vroom; /* room number of the vault */ - xchar gdx, gdy; /* goal of guard's walk */ - xchar ogx, ogy; /* guard's last position */ + coordxy gdx, gdy; /* goal of guard's walk */ + coordxy ogx, ogy; /* guard's last position */ d_level gdlevel; /* level (& dungeon) guard was created in */ - xchar warncnt; /* number of warnings to follow */ + xint16 warncnt; /* number of warnings to follow */ Bitfield(gddone, 1); /* true iff guard has released player */ Bitfield(witness, 2); /* the guard saw you do something */ Bitfield(unused, 5); diff --git a/include/mkroom.h b/include/mkroom.h index e54d6f5b2..c555abcc5 100644 --- a/include/mkroom.h +++ b/include/mkroom.h @@ -9,7 +9,7 @@ /* mkroom.h - types and structures for room and shop initialization */ struct mkroom { - xchar lx, hx, ly, hy; /* usually xchar, but hx may be -1 */ + coordxy lx, hx, ly, hy; /* usually coordxy, but hx may be -1 */ schar rtype; /* type of room (zoo, throne, etc...) */ schar orig_rtype; /* same as rtype, but not zeroed later */ schar rlit; /* is the room lit ? */ diff --git a/include/monst.h b/include/monst.h index 4dc0ccd1f..42d24966a 100644 --- a/include/monst.h +++ b/include/monst.h @@ -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 */ diff --git a/include/obj.h b/include/obj.h index 6ef303f48..7c716d821 100644 --- a/include/obj.h +++ b/include/obj.h @@ -36,7 +36,7 @@ struct obj { struct obj *cobj; /* contents list for containers */ unsigned o_id; - xchar ox, oy; + coordxy ox, oy; short otyp; /* object class number */ unsigned owt; long quan; /* number of items */ @@ -66,7 +66,7 @@ struct obj { char invlet; /* designation in inventory */ char oartifact; /* artifact array index */ - xchar where; /* where the object thinks it is */ + xint8 where; /* where the object thinks it is */ #define OBJ_FREE 0 /* object not attached to anything */ #define OBJ_FLOOR 1 /* object on floor */ #define OBJ_CONTAINED 2 /* object in a container */ @@ -77,7 +77,7 @@ struct obj { #define OBJ_ONBILL 7 /* object on shk bill */ #define OBJ_LUAFREE 8 /* object has been dealloc'd, but is ref'd by lua */ #define NOBJ_STATES 9 - xchar timed; /* # of fuses (timers) attached to this obj */ + xint16 timed; /* # of fuses (timers) attached to this obj */ Bitfield(cursed, 1); Bitfield(blessed, 1); @@ -140,8 +140,8 @@ struct obj { * overloaded for the destination of migrating * objects (which can't be worn at same time) */ unsigned lua_ref_cnt; /* # of lua script references for this object */ - xchar omigr_from_dnum; /* where obj is migrating from */ - xchar omigr_from_dlevel; /* where obj is migrating from */ + xint16 omigr_from_dnum; /* where obj is migrating from */ + xint16 omigr_from_dlevel; /* where obj is migrating from */ struct oextra *oextra; /* pointer to oextra struct */ }; diff --git a/include/patchlevel.h b/include/patchlevel.h index 45acc667d..25a3fc45c 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 59 +#define EDITLEVEL 60 /* * Development status possibilities. diff --git a/include/rect.h b/include/rect.h index cd5cb3b63..b40bac767 100644 --- a/include/rect.h +++ b/include/rect.h @@ -6,8 +6,8 @@ #define RECT_H typedef struct nhrect { - xchar lx, ly; - xchar hx, hy; + coordxy lx, ly; + coordxy hx, hy; } NhRect; #endif /* RECT_H */ diff --git a/include/rm.h b/include/rm.h index 5f2162330..2d674980f 100644 --- a/include/rm.h +++ b/include/rm.h @@ -352,7 +352,7 @@ struct cemetery { /* date+time in string of digits rather than binary */ char when[4 + 2 + 2 + 2 + 2 + 2 + 1]; /* "YYYYMMDDhhmmss\0" */ /* final resting place spot */ - xchar frpx, frpy; + coordxy frpx, frpy; boolean bonesknown; }; diff --git a/include/skills.h b/include/skills.h index 1862238c6..c82dc4c0b 100644 --- a/include/skills.h +++ b/include/skills.h @@ -108,8 +108,8 @@ enum skill_levels { /* The hero's skill in various weapons. */ struct skills { - xchar skill; - xchar max_skill; + xint16 skill; + xint16 max_skill; unsigned short advance; }; @@ -122,8 +122,8 @@ struct skills { /* Initial skill matrix structure; used in u_init.c and weapon.c */ struct def_skill { - xchar skill; - xchar skmax; + xint16 skill; + xint16 skmax; }; #endif /* SKILLS_H */ diff --git a/include/sp_lev.h b/include/sp_lev.h index a55f3bdb0..624dd8158 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -99,31 +99,32 @@ struct sp_coder { #define packed_coord long typedef uint32_t getloc_flags_t; typedef struct { - xchar is_random; + xint16 is_random; getloc_flags_t getloc_flags; int x, y; } unpacked_coord; typedef struct { - xchar init_style; /* one of LVLINIT_foo */ + xint16 init_style; /* one of LVLINIT_foo */ long flags; schar filling; boolean init_present, padding; char fg, bg; boolean smoothed, joined; - xchar lit, walled; + xint16 lit, walled; boolean icedpools; int corrwid, wallthick; boolean rm_deadends; } lev_init; typedef struct { - xchar wall, pos, secret, mask; + xint16 wall, pos, secret, mask; } room_door; typedef struct { packed_coord coord; - xchar x, y, type; + coordxy x, y; + xint16 type; boolean spider_on_web; boolean seen; } spltrap; @@ -133,7 +134,8 @@ typedef struct { short id; unsigned int sp_amask; /* splev amask */ packed_coord coord; - xchar x, y, class, appear; + coordxy x, y; + xint16 class, appear; schar peaceful, asleep; short female, invis, cancelled, revived, avenge, fleeing, blinded, paralyzed, stunned, confused, waiting; @@ -147,7 +149,8 @@ typedef struct { int corpsenm; short id, spe; packed_coord coord; - xchar x, y, class, containment; + coordxy x, y; + xint16 class, containment; schar curse_state; int quan; short buried; @@ -158,34 +161,35 @@ typedef struct { typedef struct { packed_coord coord; - xchar x, y; + coordxy x, y; unsigned int sp_amask; /* splev amask */ - xchar shrine; + xint16 shrine; } altar; typedef struct { - xchar x1, y1, x2, y2; - xchar rtype, rlit, rirreg; + coordxy x1, y1, x2, y2; + xint16 rtype, rlit, rirreg; } region; typedef struct { - xchar ter, tlit; + xint16 ter, tlit; } terrain; typedef struct { struct { - xchar room; - xchar wall; - xchar door; + xint16 room; + xint16 wall; + xint16 door; } src, dest; } corridor; typedef struct _room { Str_or_Len name; Str_or_Len parent; - xchar x, y, w, h; - xchar xalign, yalign; - xchar rtype, chance, rlit, needfill; + coordxy x, y; + xint16 w, h; + xint16 xalign, yalign; + xint16 rtype, chance, rlit, needfill; boolean joined; } room; diff --git a/include/spell.h b/include/spell.h index c3179b36d..a54fa0a9f 100644 --- a/include/spell.h +++ b/include/spell.h @@ -13,7 +13,7 @@ struct spell { short sp_id; /* spell id (== object.otyp) */ - xchar sp_lev; /* power level */ + xint16 sp_lev; /* power level */ int sp_know; /* knowlege of spell */ }; diff --git a/include/tradstdc.h b/include/tradstdc.h index 8c33d55e0..8a0f7a001 100644 --- a/include/tradstdc.h +++ b/include/tradstdc.h @@ -324,7 +324,7 @@ typedef genericptr genericptr_t; /* (void *) or (char *) */ #define CHAR_P char #define SCHAR_P schar #define UCHAR_P uchar -#define XCHAR_P xchar +#define XCHAR_P coordxy #define SHORT_P short #ifndef SKIP_BOOLEAN #define BOOLEAN_P boolean diff --git a/include/trap.h b/include/trap.h index 5a7d431f1..9d16b6cd4 100644 --- a/include/trap.h +++ b/include/trap.h @@ -17,7 +17,7 @@ union vlaunchinfo { struct trap { struct trap *ntrap; - xchar tx, ty; + coordxy tx, ty; d_level dst; /* destination for portals */ coord launch; Bitfield(ttyp, 5); diff --git a/include/winX.h b/include/winX.h index 0b54aec60..fde0e7b8d 100644 --- a/include/winX.h +++ b/include/winX.h @@ -81,7 +81,7 @@ struct tile_map_info_t { struct map_info_t { Dimension viewport_width, /* Saved viewport size, so we can */ viewport_height; /* clip to cursor on a resize. */ - xchar t_start[ROWNO], /* Starting column for new info. */ + coordxy t_start[ROWNO], /* Starting column for new info. */ t_stop[ROWNO]; /* Ending column for new info. */ boolean is_tile; /* true if currently using tiles */ @@ -455,7 +455,7 @@ extern void X11_wait_synch(void); #ifdef CLIPPING extern void X11_cliparound(int, int); #endif -extern void X11_print_glyph(winid, xchar, xchar, const glyph_info *, +extern void X11_print_glyph(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); extern void X11_raw_print(const char *); extern void X11_raw_print_bold(const char *); diff --git a/include/winami.h b/include/winami.h index 77932cc67..b9fbfb65c 100644 --- a/include/winami.h +++ b/include/winami.h @@ -37,13 +37,13 @@ struct amii_menu { * tty-style windows also, then things will need to change. */ /* per-window data */ struct amii_WinDesc { - xchar type; /* type of window */ + xint16 type; /* type of window */ struct amii_menu menu; boolean active; /* true if window is active */ boolean wasup; /* true if menu/text window was already open */ short disprows; /* Rows displayed so far (used for paging in message win) */ - xchar offx, offy; /* offset from topleft of display */ + coordxy offx, offy; /* offset from topleft of display */ short vwx, vwy, vcx, vcy; /* View cursor location */ short rows, cols; /* dimensions */ short curx, cury; /* current cursor position */ diff --git a/include/wincurs.h b/include/wincurs.h index 97380c6fd..02b9ebcfc 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -92,7 +92,7 @@ extern int curses_select_menu(winid wid, int how, MENU_ITEM_P **selected); extern void curses_mark_synch(void); extern void curses_wait_synch(void); extern void curses_cliparound(int x, int y); -extern void curses_print_glyph(winid wid, xchar x, xchar y, +extern void curses_print_glyph(winid wid, coordxy x, coordxy y, const glyph_info *, const glyph_info *); extern void curses_raw_print(const char *str); extern void curses_raw_print_bold(const char *str); diff --git a/include/winprocs.h b/include/winprocs.h index c3dffd3ac..b4426e592 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -54,7 +54,7 @@ struct window_procs { #ifdef POSITIONBAR void (*win_update_positionbar)(char *); #endif - void (*win_print_glyph)(winid, xchar, xchar, + void (*win_print_glyph)(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); void (*win_raw_print)(const char *); void (*win_raw_print_bold)(const char *); @@ -375,7 +375,7 @@ struct chain_procs { #ifdef POSITIONBAR void (*win_update_positionbar)(CARGS, char *); #endif - void (*win_print_glyph)(CARGS, winid, xchar, xchar, + void (*win_print_glyph)(CARGS, winid, coordxy, coordxy, const glyph_info *, const glyph_info *); void (*win_raw_print)(CARGS, const char *); @@ -452,7 +452,7 @@ extern void safe_cliparound(int, int); #ifdef POSITIONBAR extern void safe_update_positionbar(char *); #endif -extern void safe_print_glyph(winid, xchar, xchar, +extern void safe_print_glyph(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); extern void safe_raw_print(const char *); extern void safe_raw_print_bold(const char *); diff --git a/include/wintty.h b/include/wintty.h index 7440543e2..653cbbc81 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -46,7 +46,7 @@ typedef struct tty_mi { /* descriptor for tty-based windows */ struct WinDesc { int flags; /* window flags */ - xchar type; /* type of window */ + xint16 type; /* type of window */ boolean active; /* true if window is active */ short offx, offy; /* offset from topleft of display */ long rows, cols; /* dimensions */ @@ -249,7 +249,7 @@ E void tty_cliparound(int, int); #ifdef POSITIONBAR E void tty_update_positionbar(char *); #endif -E void tty_print_glyph(winid, xchar, xchar, const glyph_info *, +E void tty_print_glyph(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); E void tty_raw_print(const char *); E void tty_raw_print_bold(const char *); diff --git a/include/you.h b/include/you.h index 1062b43bb..25730b56b 100644 --- a/include/you.h +++ b/include/you.h @@ -22,9 +22,9 @@ struct RoleName { struct RoleAdvance { /* "fix" is the fixed amount, "rnd" is the random amount */ - xchar infix, inrnd; /* at character initialization */ - xchar lofix, lornd; /* gained per level < g.urole.xlev */ - xchar hifix, hirnd; /* gained per level >= g.urole.xlev */ + xint16 infix, inrnd; /* at character initialization */ + xint16 lofix, lornd; /* gained per level < g.urole.xlev */ + xint16 hifix, hirnd; /* gained per level >= g.urole.xlev */ }; struct u_have { @@ -198,12 +198,12 @@ struct Role { #define ROLE_CHAOTIC AM_CHAOTIC /*** Attributes (from attrib.c and exper.c) ***/ - xchar attrbase[A_MAX]; /* lowest initial attributes */ - xchar attrdist[A_MAX]; /* distribution of initial attributes */ + xint16 attrbase[A_MAX]; /* lowest initial attributes */ + xint16 attrdist[A_MAX]; /* distribution of initial attributes */ struct RoleAdvance hpadv; /* hit point advancement */ struct RoleAdvance enadv; /* energy advancement */ - xchar xlev; /* cutoff experience level */ - xchar initrecord; /* initial alignment record */ + xint16 xlev; /* cutoff experience level */ + xint16 initrecord; /* initial alignment record */ /*** Spell statistics (from spell.c) ***/ int spelbase; /* base spellcasting penalty */ @@ -258,8 +258,8 @@ struct Race { hatemask; /* bit mask of always hostile */ /*** Attributes ***/ - xchar attrmin[A_MAX]; /* minimum allowable attribute */ - xchar attrmax[A_MAX]; /* maximum allowable attribute */ + xint16 attrmin[A_MAX]; /* minimum allowable attribute */ + xint16 attrmax[A_MAX]; /* maximum allowable attribute */ struct RoleAdvance hpadv; /* hit point advancement */ struct RoleAdvance enadv; /* energy advancement */ #if 0 /* DEFERRED */ @@ -347,11 +347,11 @@ enum utotypes { /*** Information about the player ***/ struct you { - xchar ux, uy; /* current map coordinates */ + coordxy ux, uy; /* current map coordinates */ schar dx, dy, dz; /* direction of move (or zap or ... ) */ schar di; /* direction of FF */ - xchar tx, ty; /* destination of travel */ - xchar ux0, uy0; /* initial position FF */ + coordxy tx, ty; /* destination of travel */ + coordxy ux0, uy0; /* initial position FF */ d_level uz, uz0; /* your level on this and the previous turn */ d_level utolev; /* level monster teleported you to, or uz */ uchar utotype; /* bitmask of goto_level() flags for utolev */ @@ -455,7 +455,7 @@ struct you { uhppeak; /* highest value of uhpmax so far */ int uen, uenmax, /* magical energy, aka spell power */ uenpeak; /* highest value of uenmax so far */ - xchar uhpinc[MAXULEV], /* increases to uhpmax for each level gain */ + xint16 uhpinc[MAXULEV], /* increases to uhpmax for each level gain */ ueninc[MAXULEV]; /* increases to uenmax for each level gain */ int ugangr; /* if the gods are angry at you */ int ugifts; /* number of artifacts bestowed */ @@ -474,7 +474,7 @@ struct you { int ugrave_arise; /* you die and become something aside from a ghost */ int weapon_slots; /* unused skill slots */ int skills_advanced; /* # of advances made so far */ - xchar skill_record[P_SKILL_LIMIT]; /* skill advancements */ + xint16 skill_record[P_SKILL_LIMIT]; /* skill advancements */ struct skills weapon_skills[P_NUM_SKILLS]; boolean twoweap; /* KMH -- Using two-weapon combat */ short mcham; /* vampire mndx if shapeshifted to bat/cloud */ diff --git a/src/allmain.c b/src/allmain.c index c255ba18a..342190545 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -267,7 +267,7 @@ moveloop_core(void) if (!u.uinvulnerable) { if (Teleportation && !rn2(85)) { - xchar old_ux = u.ux, old_uy = u.uy; + coordxy old_ux = u.ux, old_uy = u.uy; tele(); if (u.ux != old_ux || u.uy != old_uy) { diff --git a/src/apply.c b/src/apply.c index 231072cd7..095d7ae75 100644 --- a/src/apply.c +++ b/src/apply.c @@ -654,7 +654,7 @@ magic_whistled(struct obj *obj) } boolean -um_dist(xchar x, xchar y, xchar n) +um_dist(coordxy x, coordxy y, xint16 n) { return (boolean) (abs(u.ux - x) > n || abs(u.uy - y) > n); } @@ -889,7 +889,7 @@ next_to_u(void) } void -check_leash(xchar x, xchar y) +check_leash(coordxy x, coordxy y) { register struct obj *otmp; register struct monst *mtmp; @@ -1427,7 +1427,7 @@ snuff_candle(struct obj *otmp) if ((candle || otmp->otyp == CANDELABRUM_OF_INVOCATION) && otmp->lamplit) { char buf[BUFSZ]; - xchar x, y; + coordxy x, y; boolean many = candle ? (otmp->quan > 1L) : (otmp->spe > 1); (void) get_obj_location(otmp, &x, &y, 0); @@ -1447,7 +1447,7 @@ snuff_candle(struct obj *otmp) boolean snuff_lit(struct obj *obj) { - xchar x, y; + coordxy x, y; if (obj->lamplit) { if (obj->otyp == OIL_LAMP || obj->otyp == MAGIC_LAMP @@ -1491,7 +1491,7 @@ splash_lit(struct obj *obj) /* don't assume that lit lantern has been swallowed; a nymph might have stolen it or picked it up */ && ((mtmp = obj->ocarry), humanoid(mtmp->data))) { - xchar x, y; + coordxy x, y; useeit = get_obj_location(obj, &x, &y, 0) && cansee(x, y); uhearit = couldsee(x, y) && distu(x, y) < 5 * 5; @@ -1525,7 +1525,7 @@ splash_lit(struct obj *obj) boolean catch_lit(struct obj *obj) { - xchar x, y; + coordxy x, y; if (!obj->lamplit && ignitable(obj) && get_obj_location(obj, &x, &y, 0)) { if (((obj->otyp == MAGIC_LAMP /* spe==0 => no djinni inside */ @@ -2380,7 +2380,7 @@ fig_transform(anything *arg, long timeout) static boolean figurine_location_checks(struct obj *obj, coord *cc, boolean quietly) { - xchar x, y; + coordxy x, y; if (carried(obj) && u.uswallow) { if (!quietly) @@ -2414,7 +2414,7 @@ static int use_figurine(struct obj **optr) { register struct obj *obj = *optr; - xchar x, y; + coordxy x, y; coord cc; if (u.uswallow) { diff --git a/src/artifact.c b/src/artifact.c index d6176e9ad..901e743e5 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -57,7 +57,7 @@ struct arti_info { static struct arti_info artiexist[1 + NROFARTIFACTS]; /* discovery list; for N discovered artifacts, the first N entries are ART_xx values in discovery order, the remaining (NROFARTIFACTS-N) slots are 0 */ -static xchar artidisco[NROFARTIFACTS]; +static xint16 artidisco[NROFARTIFACTS]; /* note: artiexist[] and artidisco[] don't need to be in struct g; they * get explicitly initialized at game start so don't need to be part of * bulk re-init if game restart ever gets implemented. They are saved @@ -1001,7 +1001,7 @@ spec_dbon(struct obj *otmp, struct monst *mon, int tmp) /* add identified artifact to discoveries list */ void -discover_artifact(xchar m) +discover_artifact(xint16 m) { int i; @@ -1019,7 +1019,7 @@ discover_artifact(xchar m) /* used to decide whether an artifact has been fully identified */ boolean -undiscovered_artifact(xchar m) +undiscovered_artifact(xint16 m) { int i; diff --git a/src/attrib.c b/src/attrib.c index 1469e9b92..7809d3228 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -1025,7 +1025,7 @@ newhp(void) hp = 1; if (u.ulevel < MAXULEV) { /* remember increment; future level drain could take it away again */ - u.uhpinc[u.ulevel] = (xchar) hp; + u.uhpinc[u.ulevel] = (xint16) hp; } else { /* after level 30, throttle hit point gains from extra experience; once max reaches 1200, further increments will be just 1 more */ diff --git a/src/ball.c b/src/ball.c index b52d923ec..c4fab10ac 100644 --- a/src/ball.c +++ b/src/ball.c @@ -431,8 +431,8 @@ set_bc(int already_blind) * Should not be called while swallowed. */ void -move_bc(int before, int control, xchar ballx, xchar bally, - xchar chainx, xchar chainy) +move_bc(int before, int control, coordxy ballx, coordxy bally, + coordxy chainx, coordxy chainy) { if (Blind) { /* @@ -554,8 +554,8 @@ move_bc(int before, int control, xchar ballx, xchar bally, /* return TRUE if the caller needs to place the ball and chain down again */ boolean -drag_ball(xchar x, xchar y, int *bc_control, - xchar *ballx, xchar *bally, xchar *chainx, xchar *chainy, +drag_ball(coordxy x, coordxy y, int *bc_control, + coordxy *ballx, coordxy *bally, coordxy *chainx, coordxy *chainy, boolean *cause_delay, boolean allow_drag) { struct trap *t = (struct trap *) 0; @@ -589,7 +589,7 @@ drag_ball(xchar x, xchar y, int *bc_control, /* only need to move the chain? */ if (carried(uball) || distmin(x, y, uball->ox, uball->oy) <= 2) { - xchar oldchainx = uchain->ox, oldchainy = uchain->oy; + coordxy oldchainx = uchain->ox, oldchainy = uchain->oy; *bc_control = BC_CHAIN; move_bc(1, *bc_control, *ballx, *bally, *chainx, *chainy); @@ -646,7 +646,7 @@ drag_ball(xchar x, xchar y, int *bc_control, * 0 */ case 5: { - xchar tempx, tempy, tempx2, tempy2; + coordxy tempx, tempy, tempx2, tempy2; /* find position closest to current position of chain; no effect if current position is already OK */ @@ -835,7 +835,7 @@ drag_ball(xchar x, xchar y, int *bc_control, *ballx = *chainx = x; *bally = *chainy = y; } else { - xchar newchainx = u.ux, newchainy = u.uy; + coordxy newchainx = u.ux, newchainy = u.uy; /* * Generally, chain moves to hero's previous location and ball @@ -877,7 +877,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL * Should not be called while swallowed. */ void -drop_ball(xchar x, xchar y) +drop_ball(coordxy x, coordxy y) { if (Blind) { /* get the order */ diff --git a/src/bones.c b/src/bones.c index 39f3d2447..280a6207d 100644 --- a/src/bones.c +++ b/src/bones.c @@ -82,7 +82,7 @@ resetobjs(struct obj *ochain, boolean restore) if (otmp->oclass == FOOD_CLASS && otmp->oeaten) { struct obj *top; char *p; - xchar ox, oy; + coordxy ox, oy; for (top = otmp; top->where == OBJ_CONTAINED; top = top->ocontainer) diff --git a/src/cmd.c b/src/cmd.c index 3056d3830..7f2ad2027 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1144,7 +1144,7 @@ static int wiz_where(void) { if (wizard) - (void) print_dungeon(FALSE, (schar *) 0, (xchar *) 0); + (void) print_dungeon(FALSE, (schar *) 0, (xint16 *) 0); else pline(unavailcmd, ecname_from_fn(wiz_where)); return ECMD_OK; @@ -4383,10 +4383,10 @@ int get_adjacent_loc( const char *prompt, const char *emsg, - xchar x, xchar y, + coordxy x, coordxy y, coord *cc) { - xchar new_x, new_y; + coordxy new_x, new_y; if (!getdir(prompt)) { pline1(Never_mind); return 0; @@ -5008,7 +5008,7 @@ there_cmd_menu_next2u( } static int -there_cmd_menu_far(winid win, xchar x, xchar y, int mod) +there_cmd_menu_far(winid win, coordxy x, coordxy y, int mod) { int K = 0; @@ -5025,7 +5025,7 @@ there_cmd_menu_far(winid win, xchar x, xchar y, int mod) static int there_cmd_menu_common( winid win, - xchar x UNUSED, xchar y UNUSED, + coordxy x UNUSED, coordxy y UNUSED, int mod, int *act UNUSED) { diff --git a/src/dbridge.c b/src/dbridge.c index b75cd16c6..571a46441 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -34,7 +34,7 @@ static boolean e_jumps(struct entity *); static void do_entity(struct entity *); boolean -is_waterwall(xchar x, xchar y) +is_waterwall(coordxy x, coordxy y) { if (isok(x, y) && IS_WATERWALL(levl[x][y].typ)) return TRUE; diff --git a/src/detect.c b/src/detect.c index cbd5f1dec..9699d76a5 100644 --- a/src/detect.c +++ b/src/detect.c @@ -19,7 +19,7 @@ static void map_monst(struct monst *, boolean); static void do_dknown_of(struct obj *); static boolean check_map_spot(int, int, char, unsigned); static boolean clear_stale_map(char, unsigned); -static void sense_trap(struct trap *, xchar, xchar, int); +static void sense_trap(struct trap *, coordxy, coordxy, int); static int detect_obj_traps(struct obj *, boolean, int); static void display_trap_map(struct trap *, int); static int furniture_detect(void); @@ -837,7 +837,7 @@ monster_detect(struct obj *otmp, /* detecting object (if any) */ } static void -sense_trap(struct trap *trap, xchar x, xchar y, int src_cursed) +sense_trap(struct trap *trap, coordxy x, coordxy y, int src_cursed) { if (Hallucination || src_cursed) { struct obj obj; /* fake object */ @@ -885,7 +885,7 @@ detect_obj_traps( int how) /* 1 for misleading map feedback */ { struct obj *otmp; - xchar x, y; + coordxy x, y; int result = OTRAP_NONE; /* @@ -1776,7 +1776,7 @@ mfind0(struct monst *mtmp, boolean via_warning) int dosearch0(int aflag) /* intrinsic autosearch vs explicit searching */ { - xchar x, y; + coordxy x, y; register struct trap *trap; register struct monst *mtmp; diff --git a/src/dig.c b/src/dig.c index 2c76e4e24..b6fbf5b82 100644 --- a/src/dig.c +++ b/src/dig.c @@ -6,7 +6,7 @@ #include "hack.h" static boolean rm_waslit(void); -static void mkcavepos(xchar, xchar, int, boolean, boolean); +static void mkcavepos(coordxy, coordxy, int, boolean, boolean); static void mkcavearea(boolean); static int dig(void); static void dig_up_grave(coord *); @@ -28,7 +28,7 @@ enum dig_types { static boolean rm_waslit(void) { - register xchar x, y; + register coordxy x, y; if (levl[u.ux][u.uy].typ == ROOM && levl[u.ux][u.uy].waslit) return TRUE; @@ -44,7 +44,7 @@ rm_waslit(void) * immediately after the effect is complete. */ static void -mkcavepos(xchar x, xchar y, int dist, boolean waslit, boolean rockit) +mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit) { register struct rm *lev; @@ -87,9 +87,9 @@ static void mkcavearea(boolean rockit) { int dist; - xchar xmin = u.ux, xmax = u.ux; - xchar ymin = u.uy, ymax = u.uy; - register xchar i; + coordxy xmin = u.ux, xmax = u.ux; + coordxy ymin = u.uy, ymax = u.uy; + register coordxy i; register boolean waslit = rm_waslit(); if (rockit) @@ -135,7 +135,7 @@ mkcavearea(boolean rockit) /* When digging into location , what are you actually digging into? */ int -dig_typ(struct obj *otmp, xchar x, xchar y) +dig_typ(struct obj *otmp, coordxy x, coordxy y) { boolean ispick; @@ -231,7 +231,7 @@ static int dig(void) { struct rm *lev; - xchar dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y; + coordxy dpx = g.context.digging.pos.x, dpy = g.context.digging.pos.y; boolean ispick = uwep && is_pick(uwep); const char *verb = (!uwep || is_pick(uwep)) ? "dig into" : "chop through"; @@ -734,7 +734,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL * in apply.c. */ void -liquid_flow(xchar x, xchar y, schar typ, struct trap *ttmp, +liquid_flow(coordxy x, coordxy y, schar typ, struct trap *ttmp, const char *fillmsg) { struct obj *objchain; @@ -773,7 +773,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) struct rm *lev; struct obj *boulder_here; schar typ, old_typ; - xchar dig_x, dig_y; + coordxy dig_x, dig_y; boolean nohole, retval = FALSE; if (!cc) { @@ -901,7 +901,7 @@ static void dig_up_grave(coord *cc) { struct obj *otmp; - xchar dig_x, dig_y; + coordxy dig_x, dig_y; if (!cc) { dig_x = u.ux; @@ -1220,7 +1220,7 @@ watchman_canseeu(struct monst *mtmp) * zap == TRUE if wand/spell of digging, FALSE otherwise (chewing) */ void -watch_dig(struct monst *mtmp, xchar x, xchar y, boolean zap) +watch_dig(struct monst *mtmp, coordxy x, coordxy y, boolean zap) { struct rm *lev = &levl[x][y]; @@ -1985,7 +1985,7 @@ rot_organic(anything *arg, long timeout UNUSED) void rot_corpse(anything *arg, long timeout) { - xchar x = 0, y = 0; + coordxy x = 0, y = 0; struct obj *obj = arg->a_obj; boolean on_floor = obj->where == OBJ_FLOOR, in_invent = obj->where == OBJ_INVENT; diff --git a/src/display.c b/src/display.c index 8cd30df02..f2629078e 100644 --- a/src/display.c +++ b/src/display.c @@ -124,16 +124,16 @@ #include "hack.h" static void show_mon_or_warn(int, int, int); -static void display_monster(xchar, xchar, struct monst *, int, boolean); +static void display_monster(coordxy, coordxy, struct monst *, int, boolean); static int swallow_to_glyph(int, int); static void display_warning(struct monst *); static int check_pos(int, int, int); -static int get_bk_glyph(xchar x, xchar y); +static int get_bk_glyph(coordxy x, coordxy y); static int tether_glyph(int, int); static void mimic_light_blocking(struct monst *); #ifdef UNBUFFERED_GLYPHINFO -static glyph_info *glyphinfo_at(xchar, xchar, int); +static glyph_info *glyphinfo_at(coordxy, coordxy, int); #endif /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ @@ -229,7 +229,7 @@ is_safemon(struct monst *mon) * attention to and correct unexplored, lit ROOM and CORR spots. */ void -magic_map_background(xchar x, xchar y, int show) +magic_map_background(coordxy x, coordxy y, int show) { int glyph = back_to_glyph(x, y); /* assumes hero can see x,y */ struct rm *lev = &levl[x][y]; @@ -266,7 +266,7 @@ magic_map_background(xchar x, xchar y, int show) * having to create fake objects and traps. However, I am reluctant to * make this change. */ -/* FIXME: some of these use xchars for x and y, and some use ints. Make +/* FIXME: some of these use coordxys for x and y, and some use ints. Make * this consistent. */ @@ -277,7 +277,7 @@ magic_map_background(xchar x, xchar y, int show) * the hero can physically see the location. Update the screen if directed. */ void -map_background(register xchar x, register xchar y, register int show) +map_background(register coordxy x, register coordxy y, register int show) { register int glyph = back_to_glyph(x, y); @@ -341,7 +341,7 @@ map_object(register struct obj *obj, register int show) * by newsym() if necessary. */ void -map_invisible(register xchar x, register xchar y) +map_invisible(register coordxy x, register coordxy y) { if (x != u.ux || y != u.uy) { /* don't display I at hero's location */ if (g.level.flags.hero_memory) @@ -458,7 +458,7 @@ show_mon_or_warn(int x, int y, int monglyph) * */ static void -display_monster(xchar x, xchar y, /* display position */ +display_monster(coordxy x, coordxy y, /* display position */ struct monst *mon, /* monster to display */ int sightflags, /* 1 if the monster is physically seen; 2 if detected using Detect_monsters */ @@ -626,7 +626,7 @@ suppress_map_output(void) * When hero knows what happened to location, even when blind. */ void -feel_newsym(xchar x, xchar y) +feel_newsym(coordxy x, coordxy y) { if (Blind) feel_location(x, y); @@ -646,7 +646,7 @@ feel_newsym(xchar x, xchar y) * searching only finds one monster per turn so we must check that separately. */ void -feel_location(xchar x, xchar y) +feel_location(coordxy x, coordxy y) { struct rm *lev; struct obj *boulder; @@ -978,7 +978,7 @@ newsym(register int x, register int y) * pulled into a platform dependent routine for fancier graphics if desired. */ void -shieldeff(xchar x, xchar y) +shieldeff(coordxy x, coordxy y) { register int i; @@ -1198,7 +1198,7 @@ flash_glyph_at(int x, int y, int tg, int rpt) void swallowed(int first) { - static xchar lastx, lasty; /* last swallowed position */ + static coordxy lastx, lasty; /* last swallowed position */ int swallower, left_ok, rght_ok; if (first) { @@ -1261,7 +1261,7 @@ swallowed(int first) void under_water(int mode) { - static xchar lastx, lasty; + static coordxy lastx, lasty; static boolean dela; register int x, y; @@ -1600,7 +1600,7 @@ redraw_map(void) void reglyph_darkroom(void) { - xchar x, y; + coordxy x, y; for (x = 1; x < COLNO; x++) for (y = 0; y < ROWNO; y++) { @@ -1988,7 +1988,7 @@ flush_screen(int cursor_on_u) * variables. */ int -back_to_glyph(xchar x, xchar y) +back_to_glyph(coordxy x, coordxy y) { int idx, bypass_glyph = NO_GLYPH; struct rm *ptr = &(levl[x][y]); @@ -2170,7 +2170,7 @@ zapdir_to_glyph(int dx, int dy, int beam_type) * structure, so we must check the "third screen". */ int -glyph_at(xchar x, xchar y) +glyph_at(coordxy x, coordxy y) { if (x < 0 || y < 0 || x >= COLNO || y >= ROWNO) return cmap_to_glyph(S_room); /* XXX */ @@ -2179,7 +2179,7 @@ glyph_at(xchar x, xchar y) #ifdef UNBUFFERED_GLYPHINFO glyph_info * -glyphinfo_at(xchar x, xchar y, int glyph) +glyphinfo_at(coordxy x, coordxy y, int glyph) { map_glyphinfo(x, y, glyph, 0, &ginfo); return &ginfo; @@ -2200,7 +2200,7 @@ glyphinfo_at(xchar x, xchar y, int glyph) */ static int -get_bk_glyph(xchar x, xchar y) +get_bk_glyph(coordxy x, coordxy y) { int idx, bkglyph = GLYPH_UNEXPLORED; struct rm *lev = &levl[x][y]; @@ -2272,7 +2272,7 @@ get_bk_glyph(xchar x, xchar y) void map_glyphinfo( - xchar x, xchar y, + coordxy x, coordxy y, int glyph, unsigned mgflags, glyph_info *glyphinfo) diff --git a/src/do.c b/src/do.c index 5ab801a6f..046457c9c 100644 --- a/src/do.c +++ b/src/do.c @@ -18,7 +18,7 @@ static int menu_drop(int); static NHFILE *currentlevel_rewrite(void); static void final_level(void); -/* static boolean badspot(xchar,xchar); */ +/* static boolean badspot(coordxy,coordxy); */ /* the #drop command: drop one inventory item */ int @@ -1237,7 +1237,7 @@ save_currentstate(void) /* static boolean -badspot(register xchar x, register xchar y) +badspot(register coordxy x, register coordxy y) { return (boolean) ((levl[x][y].typ != ROOM && levl[x][y].typ != AIR @@ -1295,7 +1295,7 @@ goto_level( { int l_idx, save_mode; NHFILE *nhfp; - xchar new_ledger; + xint16 new_ledger; boolean cant_go_back, great_effort, up = (depth(newlevel) < depth(&u.uz)), newdungeon = (u.uz.dnum != newlevel->dnum), @@ -1890,7 +1890,7 @@ revive_corpse(struct obj *corpse) { struct monst *mtmp, *mcarry; boolean is_uwep, chewed; - xchar where; + xint16 where; char cname[BUFSZ]; struct obj *container = (struct obj *) 0; int container_where = 0; @@ -2005,7 +2005,7 @@ revive_mon(anything *arg, long timeout UNUSED) struct obj *body = arg->a_obj; struct permonst *mptr = &mons[body->corpsenm]; struct monst *mtmp; - xchar x, y; + coordxy x, y; /* corpse will revive somewhere else if there is a monster in the way; Riders get a chance to try to bump the obstacle out of their way */ diff --git a/src/dog.c b/src/dog.c index d4be1a07d..0af7397e9 100644 --- a/src/dog.c +++ b/src/dog.c @@ -66,7 +66,7 @@ pet_type(void) } struct monst * -make_familiar(struct obj *otmp, xchar x, xchar y, boolean quietly) +make_familiar(struct obj *otmp, coordxy x, coordxy y, boolean quietly) { struct permonst *pm; struct monst *mtmp = 0; @@ -302,7 +302,8 @@ void mon_arrive(struct monst *mtmp, boolean with_you) { struct trap *t; - xchar xlocale, ylocale, xyloc, xyflags, wander; + coordxy xlocale, ylocale, xyloc, xyflags; + xint16 wander; int num_segs; boolean failed_to_place = FALSE; stairway *stway; @@ -366,7 +367,7 @@ mon_arrive(struct monst *mtmp, boolean with_you) mtmp->mlstmv = g.moves - 1L; /* let monster move a bit on new level (see placement code below) */ - wander = (xchar) min(nmv, 8); + wander = (xint16) min(nmv, 8); } else wander = 0; @@ -716,12 +717,13 @@ keepdogs( void migrate_to_level( struct monst *mtmp, - xchar tolev, /* destination level */ - xchar xyloc, /* MIGR_xxx destination xy location: */ + xint16 tolev, /* destination level */ + xint16 xyloc, /* MIGR_xxx destination xy location: */ coord *cc) /* optional destination coordinates */ { d_level new_lev; - xchar xyflags, mx = mtmp->mx, my = mtmp->my; /* needed below */ + coordxy xyflags; + coordxy mx = mtmp->mx, my = mtmp->my; /* needed below */ int num_segs; /* count of worm segments */ if (mtmp->mleashed) { @@ -735,8 +737,8 @@ migrate_to_level( relmon(mtmp, &g.migrating_mons); /* mtmp->mx,my retain their value */ mtmp->mstate |= MON_MIGRATING; - new_lev.dnum = ledger_to_dnum((xchar) tolev); - new_lev.dlevel = ledger_to_dlev((xchar) tolev); + new_lev.dnum = ledger_to_dnum((xint16) tolev); + new_lev.dlevel = ledger_to_dlev((xint16) tolev); /* overload mtmp->[mx,my], mtmp->[mux,muy], and mtmp->mtrack[] as destination codes */ xyflags = (depth(&new_lev) < depth(&u.uz)); /* 1 => up */ diff --git a/src/dogmove.c b/src/dogmove.c index 642ac6970..55c430214 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -18,9 +18,9 @@ static struct monst *find_targ(struct monst *, int, int, int); static int find_friends(struct monst *, struct monst *, int); static struct monst *best_target(struct monst *); static long score_targ(struct monst *, struct monst *); -static boolean can_reach_location(struct monst *, xchar, xchar, xchar, - xchar); -static boolean could_reach_item(struct monst *, xchar, xchar); +static boolean can_reach_location(struct monst *, coordxy, coordxy, coordxy, + coordxy); +static boolean could_reach_item(struct monst *, coordxy, coordxy); static void quickmimic(struct monst *); /* pick a carried item for pet to drop */ @@ -509,7 +509,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog, register int omx, omy; boolean in_masters_sight, dog_has_minvent; register struct obj *obj; - xchar otyp; + xint16 otyp; int appr; /* Steeds don't move on their own will */ @@ -913,12 +913,12 @@ dog_move(register struct monst *mtmp, int i, j, k; register struct edog *edog = EDOG(mtmp); struct obj *obj = (struct obj *) 0; - xchar otyp; + xint16 otyp; boolean has_edog, cursemsg[9], do_eat = FALSE; boolean better_with_displacing = FALSE; - xchar nix, niy; /* position mtmp is (considering) moving to */ + coordxy nix, niy; /* position mtmp is (considering) moving to */ register int nx, ny; /* temporary coordinates */ - xchar cnt, uncursedcnt, chcnt; + xint16 cnt, uncursedcnt, chcnt; int chi = -1, nidist, ndist; coord poss[9]; long info[9], allowflags; @@ -1326,7 +1326,7 @@ dog_move(register struct monst *mtmp, /* check if a monster could pick up objects from a location */ static boolean -could_reach_item(struct monst *mon, xchar nx, xchar ny) +could_reach_item(struct monst *mon, coordxy nx, coordxy ny) { if ((!is_pool(nx, ny) || is_swimmer(mon->data)) && (!is_lava(nx, ny) || likes_lava(mon->data)) @@ -1343,7 +1343,7 @@ could_reach_item(struct monst *mon, xchar nx, xchar ny) * calls deep. */ static boolean -can_reach_location(struct monst *mon, xchar mx, xchar my, xchar fx, xchar fy) +can_reach_location(struct monst *mon, coordxy mx, coordxy my, coordxy fx, coordxy fy) { int i, j; int dist; diff --git a/src/dokick.c b/src/dokick.c index 1f3e53164..3e4c153fe 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -12,17 +12,17 @@ /* g.kickedobj (decl.c) tracks a kicked object until placed or destroyed */ static void kickdmg(struct monst *, boolean); -static boolean maybe_kick_monster(struct monst *, xchar, xchar); -static void kick_monster(struct monst *, xchar, xchar); -static int kick_object(xchar, xchar, char *); -static int really_kick_object(xchar, xchar); +static boolean maybe_kick_monster(struct monst *, coordxy, coordxy); +static void kick_monster(struct monst *, coordxy, coordxy); +static int kick_object(coordxy, coordxy, char *); +static int really_kick_object(coordxy, coordxy); static char *kickstr(char *, const char *); static boolean watchman_thief_arrest(struct monst *); -static boolean watchman_door_damage(struct monst *, xchar, xchar); +static boolean watchman_door_damage(struct monst *, coordxy, coordxy); static void kick_dumb(int, int); static void kick_ouch(int, int, const char *); static void otransit_msg(struct obj *, boolean, boolean, long); -static void drop_to(coord *, schar, xchar, xchar); +static void drop_to(coord *, schar, coordxy, coordxy); static const char kick_passes_thru[] = "kick passes harmlessly through"; @@ -120,7 +120,7 @@ kickdmg(struct monst *mon, boolean clumsy) } static boolean -maybe_kick_monster(struct monst *mon, xchar x, xchar y) +maybe_kick_monster(struct monst *mon, coordxy x, coordxy y) { if (mon) { boolean save_forcefight = g.context.forcefight; @@ -140,7 +140,7 @@ maybe_kick_monster(struct monst *mon, xchar x, xchar y) } static void -kick_monster(struct monst *mon, xchar x, xchar y) +kick_monster(struct monst *mon, coordxy x, coordxy y) { boolean clumsy = FALSE; int i, j; @@ -389,8 +389,8 @@ ghitm(register struct monst *mtmp, register struct obj *gold) /* container is kicked, dropped, thrown or otherwise impacted by player. * Assumes container is on floor. Checks contents for possible damage. */ void -container_impact_dmg(struct obj *obj, xchar x, - xchar y) /* coordinates where object was before the impact, not after */ +container_impact_dmg(struct obj *obj, coordxy x, + coordxy y) /* coordinates where object was before the impact, not after */ { struct monst *shkp; struct obj *otmp, *otmp2; @@ -456,7 +456,7 @@ container_impact_dmg(struct obj *obj, xchar x, /* jacket around really_kick_object */ static int -kick_object(xchar x, xchar y, char *kickobjnam) +kick_object(coordxy x, coordxy y, char *kickobjnam) { int res = 0; @@ -474,7 +474,7 @@ kick_object(xchar x, xchar y, char *kickobjnam) /* guts of kick_object */ static int -really_kick_object(xchar x, xchar y) +really_kick_object(coordxy x, coordxy y) { int range; struct monst *mon, *shkp = 0; @@ -785,7 +785,7 @@ watchman_thief_arrest(struct monst *mtmp) } static boolean -watchman_door_damage(struct monst *mtmp, xchar x, xchar y) +watchman_door_damage(struct monst *mtmp, coordxy x, coordxy y) { if (is_watch(mtmp->data) && mtmp->mpeaceful && couldsee(mtmp->mx, mtmp->my)) { @@ -1390,7 +1390,7 @@ dokick(void) } static void -drop_to(coord *cc, schar loc, xchar x, xchar y) +drop_to(coord *cc, schar loc, coordxy x, coordxy y) { stairway *stway = stairway_at(x, y); @@ -1428,8 +1428,8 @@ drop_to(coord *cc, schar loc, xchar x, xchar y) /* player or missile impacts location, causing objects to fall down */ void impact_drop(struct obj *missile, /* caused impact, won't drop itself */ - xchar x, xchar y, /* location affected */ - xchar dlev) /* if !0 send to dlev near player */ + coordxy x, coordxy y, /* location affected */ + xint16 dlev) /* if !0 send to dlev near player */ { schar toloc; register struct obj *obj, *obj2; @@ -1554,10 +1554,10 @@ impact_drop(struct obj *missile, /* caused impact, won't drop itself */ * otmp is either a kicked, dropped, or thrown object. */ boolean -ship_object(struct obj *otmp, xchar x, xchar y, boolean shop_floor_obj) +ship_object(struct obj *otmp, coordxy x, coordxy y, boolean shop_floor_obj) { schar toloc; - xchar ox, oy; + coordxy ox, oy; coord cc; struct obj *obj; struct trap *t; @@ -1850,7 +1850,7 @@ otransit_msg(register struct obj *otmp, boolean nodrop, boolean chainthere, long /* migration destination for objects which fall down to next level */ schar -down_gate(xchar x, xchar y) +down_gate(coordxy x, coordxy y) { struct trap *ttmp; stairway *stway = stairway_at(x, y); diff --git a/src/dothrow.c b/src/dothrow.c index 76a4652bc..2bfbc4adf 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -15,7 +15,7 @@ static struct obj *find_launcher(struct obj *); static int gem_accept(struct monst *, struct obj *); static void tmiss(struct obj *, struct monst *, boolean); static int throw_gold(struct obj *); -static void check_shop_obj(struct obj *, xchar, xchar, boolean); +static void check_shop_obj(struct obj *, coordxy, coordxy, boolean); static boolean harmless_missile(struct obj *); static void breakmsg(struct obj *, boolean); static boolean toss_up(struct obj *, boolean); @@ -864,7 +864,7 @@ hurtle_step(genericptr_t arg, int x, int y) if ball is carried we might still need to drag the chain */ if (Punished) { int bc_control; - xchar ballx, bally, chainx, chainy; + coordxy ballx, bally, chainx, chainy; boolean cause_delay; if (drag_ball(x, y, &bc_control, &ballx, &bally, &chainx, @@ -1100,7 +1100,7 @@ mhurtle(struct monst *mon, int dx, int dy, int range) } static void -check_shop_obj(struct obj *obj, xchar x, xchar y, boolean broken) +check_shop_obj(struct obj *obj, coordxy x, coordxy y, boolean broken) { boolean costly_xy; struct monst *shkp = shop_keeper(*u.ushops); @@ -2198,7 +2198,7 @@ gem_accept(register struct monst *mon, register struct obj *obj) */ int hero_breaks(struct obj *obj, - xchar x, xchar y, /* object location (ox, oy may not be right) */ + coordxy x, coordxy y, /* object location (ox, oy may not be right) */ unsigned breakflags) { /* from_invent: thrown or dropped by player; maybe on shop bill; @@ -2225,7 +2225,7 @@ hero_breaks(struct obj *obj, */ int breaks(struct obj *obj, - xchar x, xchar y) /* object location (ox, oy may not be right) */ + coordxy x, coordxy y) /* object location (ox, oy may not be right) */ { boolean in_view = Blind ? FALSE : cansee(x, y); @@ -2237,7 +2237,7 @@ breaks(struct obj *obj, } void -release_camera_demon(struct obj *obj, xchar x, xchar y) +release_camera_demon(struct obj *obj, coordxy x, coordxy y) { struct monst *mtmp; if (!rn2(3) @@ -2259,7 +2259,7 @@ release_camera_demon(struct obj *obj, xchar x, xchar y) void breakobj( struct obj *obj, - xchar x, xchar y, /* object location (ox, oy may not be right) */ + coordxy x, coordxy y, /* object location (ox, oy may not be right) */ boolean hero_caused, /* is this the hero's fault? */ boolean from_invent) { diff --git a/src/dungeon.c b/src/dungeon.c index eeebf445b..eb61c1f5f 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -28,25 +28,25 @@ struct lchoice { int idx; schar lev[MAXLINFO]; schar playerlev[MAXLINFO]; - xchar dgn[MAXLINFO]; + xint16 dgn[MAXLINFO]; char menuletter; }; #if 0 static void Fread(genericptr_t, int, int, dlb *); #endif -static xchar dname_to_dnum(const char *); +static xint16 dname_to_dnum(const char *); static int find_branch(const char *, struct proto_dungeon *); -static xchar parent_dnum(const char *, struct proto_dungeon *); -static int level_range(xchar, int, int, int, struct proto_dungeon *, +static xint16 parent_dnum(const char *, struct proto_dungeon *); +static int level_range(xint16, int, int, int, struct proto_dungeon *, int *); -static xchar parent_dlevel(const char *, struct proto_dungeon *); +static xint16 parent_dlevel(const char *, struct proto_dungeon *); static int correct_branch_type(struct tmpbranch *); static branch *add_branch(int, int, struct proto_dungeon *); static void add_level(s_level *); static void init_level(int, int, struct proto_dungeon *); static int possible_places(int, boolean *, struct proto_dungeon *); -static xchar pick_level(boolean *, int); +static xint16 pick_level(boolean *, int); static boolean place_level(int, struct proto_dungeon *); static int get_dgn_flags(lua_State *); static boolean unplaced_floater(struct dungeon *); @@ -63,7 +63,7 @@ static mapseen *find_mapseen_by_str(const char *); static void print_mapseen(winid, mapseen *, int, int, boolean); static boolean interest_mapseen(mapseen *); static void traverse_mapseenchn(boolean, winid, int, int, int *); -static const char *seen_string(xchar, const char *); +static const char *seen_string(xint16, const char *); static const char *br_string2(branch *); static const char *shop_string(int); static char *tunesuffix(mapseen *, char *, size_t); @@ -264,10 +264,10 @@ Fread(genericptr_t ptr, int size, int nitems, dlb *stream) } #endif -static xchar +static xint16 dname_to_dnum(const char *s) { - xchar i; + xint16 i; for (i = 0; i < g.n_dgns; i++) if (!strcmp(g.dungeons[i].dname, s)) @@ -275,7 +275,7 @@ dname_to_dnum(const char *s) panic("Couldn't resolve dungeon number for name \"%s\".", s); /*NOT REACHED*/ - return (xchar) 0; + return (xint16) 0; } s_level * @@ -321,12 +321,12 @@ find_branch(const char *s, /* dungeon name */ * Find the "parent" by searching the prototype branch list for the branch * listing, then figuring out to which dungeon it belongs. */ -static xchar +static xint16 parent_dnum(const char *s, /* dungeon name */ struct proto_dungeon *pd) { int i; - xchar pdnum; + xint16 pdnum; i = find_branch(s, pd); /* @@ -339,7 +339,7 @@ parent_dnum(const char *s, /* dungeon name */ panic("parent_dnum: couldn't resolve branch."); /*NOT REACHED*/ - return (xchar) 0; + return (xint16) 0; } /* @@ -353,7 +353,7 @@ parent_dnum(const char *s, /* dungeon name */ * end of the dungeon. */ static int -level_range(xchar dgn, int base, int randc, int chain, +level_range(xint16 dgn, int base, int randc, int chain, struct proto_dungeon *pd, int *adjusted_base) { int lmax = g.dungeons[dgn].num_dunlevs; @@ -384,7 +384,7 @@ level_range(xchar dgn, int base, int randc, int chain, return 1; } -static xchar +static xint16 parent_dlevel(const char *s, struct proto_dungeon *pd) { int i, j, num, base, dnum = parent_dnum(s, pd); @@ -593,14 +593,14 @@ possible_places(int idx, /* prototype index */ } /* Pick the nth TRUE entry in the given boolean array. */ -static xchar +static xint16 pick_level(boolean *map, /* an array MAXLEVEL+1 in size */ int nth) { - int i; + xint16 i; for (i = 1; i <= MAXLEVEL; i++) if (map[i] && !nth--) - return (xchar) i; + return i; panic("pick_level: ran out of valid levels"); return 0; } @@ -1009,9 +1009,9 @@ init_dungeons(void) free((genericptr) dgn_themerms); if (dgn_range) - g.dungeons[i].num_dunlevs = (xchar) rn1(dgn_range, dgn_base); + g.dungeons[i].num_dunlevs = (xint16) rn1(dgn_range, dgn_base); else - g.dungeons[i].num_dunlevs = (xchar) dgn_base; + g.dungeons[i].num_dunlevs = (xint16) dgn_base; if (!i) { g.dungeons[i].ledger_start = 0; @@ -1197,21 +1197,21 @@ init_dungeons(void) } /* return the level number for lev in *this* dungeon */ -xchar +xint16 dunlev(d_level *lev) { return lev->dlevel; } /* return the lowest level number for *this* dungeon */ -xchar +xint16 dunlevs_in_dungeon(d_level *lev) { return g.dungeons[lev->dnum].num_dunlevs; } /* return the lowest level explored in the game*/ -xchar +xint16 deepest_lev_reached(boolean noquest) { /* this function is used for three purposes: to provide a factor @@ -1231,7 +1231,7 @@ deepest_lev_reached(boolean noquest) */ register int i; d_level tmp; - register schar ret = 0; + xint16 ret = 0; for (i = 0; i < g.n_dgns; i++) { if (noquest && i == quest_dnum) @@ -1243,15 +1243,15 @@ deepest_lev_reached(boolean noquest) if (depth(&tmp) > ret) ret = depth(&tmp); } - return (xchar) ret; + return ret; } /* return a bookkeeping level number for purpose of comparisons and save/restore */ -xchar +xint16 ledger_no(d_level *lev) { - return (xchar) (lev->dlevel + g.dungeons[lev->dnum].ledger_start); + return (xint16) (lev->dlevel + g.dungeons[lev->dnum].ledger_start); } /* @@ -1264,36 +1264,36 @@ ledger_no(d_level *lev) * not be confused with deepest_lev_reached() -- which returns the lowest * depth visited by the player. */ -xchar +xint16 maxledgerno(void) { - return (xchar) (g.dungeons[g.n_dgns - 1].ledger_start + return (xint16) (g.dungeons[g.n_dgns - 1].ledger_start + g.dungeons[g.n_dgns - 1].num_dunlevs); } /* return the dungeon that this ledgerno exists in */ -xchar -ledger_to_dnum(xchar ledgerno) +xint16 +ledger_to_dnum(xint16 ledgerno) { - register int i; + xint16 i; /* find i such that (i->base + 1) <= ledgerno <= (i->base + i->count) */ for (i = 0; i < g.n_dgns; i++) if (g.dungeons[i].ledger_start < ledgerno && (ledgerno <= g.dungeons[i].ledger_start + g.dungeons[i].num_dunlevs)) - return (xchar) i; + return i; panic("level number out of range [ledger_to_dnum(%d)]", (int) ledgerno); /*NOT REACHED*/ - return (xchar) 0; + return (xint16) 0; } /* return the level of the dungeon this ledgerno exists in */ -xchar -ledger_to_dlev(xchar ledgerno) +xint16 +ledger_to_dlev(xint16 ledgerno) { - return (xchar) (ledgerno + return (xint16) (ledgerno - g.dungeons[ledger_to_dnum(ledgerno)].ledger_start); } @@ -1599,13 +1599,13 @@ u_on_dnstairs(void) } boolean -On_stairs(xchar x, xchar y) +On_stairs(coordxy x, coordxy y) { return (stairway_at(x,y) != NULL); } boolean -On_ladder(xchar x, xchar y) +On_ladder(coordxy x, coordxy y) { stairway *stway = stairway_at(x,y); @@ -1613,7 +1613,7 @@ On_ladder(xchar x, xchar y) } boolean -On_stairs_up(xchar x, xchar y) +On_stairs_up(coordxy x, coordxy y) { stairway *stway = stairway_at(x,y); @@ -1621,7 +1621,7 @@ On_stairs_up(xchar x, xchar y) } boolean -On_stairs_dn(xchar x, xchar y) +On_stairs_dn(coordxy x, coordxy y) { stairway *stway = stairway_at(x,y); @@ -1697,7 +1697,7 @@ void get_level(d_level *newlevel, int levnum) { branch *br; - xchar dgn = u.uz.dnum; + xint16 dgn = u.uz.dnum; if (levnum <= 0) { /* can only currently happen in endgame */ @@ -1765,7 +1765,7 @@ branch * dungeon_branch(const char *s) { branch *br; - xchar dnum; + xint16 dnum; dnum = dname_to_dnum(s); @@ -1918,10 +1918,10 @@ Invocation_lev(d_level *lev) /* use instead of depth() wherever a degree of difficulty is made * dependent on the location in the dungeon (eg. monster creation). */ -xchar +xint16 level_difficulty(void) { - int res; + xint16 res; if (In_endgame(&u.uz)) { res = depth(&sanctum_level) + u.ulevel / 2; @@ -1972,7 +1972,7 @@ level_difficulty(void) */ #endif /*0*/ } - return (xchar) res; + return res; } /* Take one word and try to match it to a level. @@ -2225,7 +2225,7 @@ print_branch(winid win, int dnum, int lower_bound, int upper_bound, /* Print available dungeon information. */ schar -print_dungeon(boolean bymenu, schar *rlev, xchar *rdgn) +print_dungeon(boolean bymenu, schar *rlev, xint16 *rdgn) { int i, last_level, nlev; char buf[BUFSZ]; @@ -3140,7 +3140,7 @@ traverse_mapseenchn(boolean viewendgame, winid win, int why, int reason, } static const char * -seen_string(xchar x, const char *obj) +seen_string(xint16 x, const char *obj) { /* players are computer scientists: 0, 1, 2, n */ switch (x) { diff --git a/src/engrave.c b/src/engrave.c index 29ed7947b..d945c846f 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -249,7 +249,7 @@ ceiling(int x, int y) } struct engr * -engr_at(xchar x, xchar y) +engr_at(coordxy x, coordxy y) { register struct engr *ep = head_engr; @@ -269,7 +269,7 @@ engr_at(xchar x, xchar y) * present if it is intact and is the entire content of the engraving. */ boolean -sengr_at(const char *s, xchar x, xchar y, boolean strict) +sengr_at(const char *s, coordxy x, coordxy y, boolean strict) { register struct engr *ep = engr_at(x, y); @@ -288,7 +288,7 @@ u_wipe_engr(int cnt) } void -wipe_engr_at(xchar x, xchar y, xchar cnt, boolean magical) +wipe_engr_at(coordxy x, coordxy y, xint16 cnt, boolean magical) { register struct engr *ep = engr_at(x, y); @@ -384,7 +384,7 @@ read_engr_at(int x, int y) } void -make_engr_at(int x, int y, const char *s, long e_time, xchar e_type) +make_engr_at(int x, int y, const char *s, long e_time, xint16 e_type) { struct engr *ep; unsigned smem = Strlen(s) + 1; @@ -524,8 +524,8 @@ doengrave(void) boolean ptext = TRUE; /* TRUE if we must prompt for engrave text */ boolean teleengr = FALSE; /* TRUE if we move the old engraving */ boolean zapwand = FALSE; /* TRUE if we remove a wand charge */ - xchar type = DUST; /* Type of engraving made */ - xchar oetype = 0; /* will be set to type of current engraving */ + xint16 type = DUST; /* Type of engraving made */ + xint16 oetype = 0; /* will be set to type of current engraving */ char buf[BUFSZ]; /* Buffer for final/poly engraving text */ char ebuf[BUFSZ]; /* Buffer for initial engraving text */ char fbuf[BUFSZ]; /* Buffer for "your fingers" */ @@ -703,7 +703,7 @@ doengrave(void) case WAN_POLYMORPH: if (oep) { if (!Blind) { - type = (xchar) 0; /* random */ + type = (xint16) 0; /* random */ (void) random_engraving(buf); } else { /* keep the same type so that feels don't diff --git a/src/exper.c b/src/exper.c index 868e90c76..51c29b0b2 100644 --- a/src/exper.c +++ b/src/exper.c @@ -67,7 +67,7 @@ newpw(void) en = 1; if (u.ulevel < MAXULEV) { /* remember increment; future level drain could take it away again */ - u.ueninc[u.ulevel] = (xchar) en; + u.ueninc[u.ulevel] = (xint16) en; } else { /* after level 30, throttle energy gains from extra experience; once max reaches 600, further increments will be just 1 more */ diff --git a/src/explode.c b/src/explode.c index b8347fa8a..740ebb9aa 100644 --- a/src/explode.c +++ b/src/explode.c @@ -349,8 +349,8 @@ explode( /* Affect the floor unless the player caused the explosion from * inside their engulfer. */ if (!(u.uswallow && !g.context.mon_moving)) - (void) zap_over_floor((xchar) (i + x - 1), - (xchar) (j + y - 1), type, + (void) zap_over_floor((coordxy) (i + x - 1), + (coordxy) (j + y - 1), type, &shopdamage, exploding_wand_typ); mtmp = m_at(i + x - 1, j + y - 1); @@ -619,8 +619,8 @@ explode( struct scatter_chain { struct scatter_chain *next; /* pointer to next scatter item */ struct obj *obj; /* pointer to the object */ - xchar ox; /* location of */ - xchar oy; /* item */ + coordxy ox; /* location of */ + coordxy oy; /* item */ schar dx; /* direction of */ schar dy; /* travel */ int range; /* range of object */ @@ -721,7 +721,7 @@ scatter(int sx, int sy, /* location of objects to scatter */ } else if ((scflags & MAY_DESTROY) != 0 && (!rn2(10) || (objects[otmp->otyp].oc_material == GLASS || otmp->otyp == EGG))) { - if (breaks(otmp, (xchar) sx, (xchar) sy)) + if (breaks(otmp, (coordxy) sx, (coordxy) sy)) used_up = TRUE; } diff --git a/src/files.c b/src/files.c index e3dc1716d..d49b7b470 100644 --- a/src/files.c +++ b/src/files.c @@ -3681,7 +3681,7 @@ recover_savefile(void) { NHFILE *gnhfp, *lnhfp, *snhfp; int lev, savelev, hpid, pltmpsiz, filecmc; - xchar levc; + xint16 levc; struct version_info version_data; int processed[256]; char savename[SAVESIZE], errbuf[BUFSZ], indicator; @@ -3820,14 +3820,14 @@ recover_savefile(void) processed[0] = 1; for (lev = 1; lev < 256; lev++) { - /* level numbers are kept in xchars in save.c, so the + /* level numbers are kept in xint16s in save.c, so the * maximum level number (for the endlevel) must be < 256 */ if (lev != savelev) { lnhfp = open_levelfile(lev, (char *) 0); if (lnhfp) { /* any or all of these may not exist */ - levc = (xchar) lev; + levc = (xint16) lev; write(snhfp->fd, (genericptr_t) &levc, sizeof(levc)); if (!copy_bytes(lnhfp->fd, snhfp->fd)) { close_nhfile(lnhfp); @@ -4257,14 +4257,14 @@ choose_passage(int passagecnt, /* total of available passages */ /* collect all of the N indices */ g.context.novel.count = passagecnt; for (idx = 0; idx < MAXPASSAGES; idx++) - g.context.novel.pasg[idx] = (xchar) ((idx < passagecnt) + g.context.novel.pasg[idx] = (xint16) ((idx < passagecnt) ? idx + 1 : 0); } else { /* collect MAXPASSAGES of the N indices */ g.context.novel.count = MAXPASSAGES; for (idx = i = 0; i < passagecnt; ++i, --range) if (range > 0 && rn2(range) < limit) { - g.context.novel.pasg[idx++] = (xchar) (i + 1); + g.context.novel.pasg[idx++] = (xint16) (i + 1); --limit; } } diff --git a/src/fountain.c b/src/fountain.c index 46a0b8eb1..020ca5564 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -187,7 +187,7 @@ watchman_warn_fountain(struct monst *mtmp) } void -dryup(xchar x, xchar y, boolean isyou) +dryup(coordxy x, coordxy y, boolean isyou) { if (IS_FOUNTAIN(levl[x][y].typ) && (!rn2(3) || FOUNTAIN_IS_WARNED(x, y))) { diff --git a/src/hack.c b/src/hack.c index 966e691a1..7a185a85d 100644 --- a/src/hack.c +++ b/src/hack.c @@ -12,23 +12,23 @@ static int moverock(void); static void dosinkfall(void); static boolean findtravelpath(int); static boolean trapmove(int, int, struct trap *); -static void check_buried_zombies(xchar, xchar); -static schar u_simple_floortyp(xchar, xchar); -static boolean swim_move_danger(xchar, xchar); +static void check_buried_zombies(coordxy, coordxy); +static schar u_simple_floortyp(coordxy, coordxy); +static boolean swim_move_danger(coordxy, coordxy); static boolean domove_bump_mon(struct monst *, int); -static boolean domove_attackmon_at(struct monst *, xchar, xchar, boolean *); -static boolean domove_fight_ironbars(xchar, xchar); -static boolean domove_swap_with_pet(struct monst *, xchar, xchar); -static boolean domove_fight_empty(xchar, xchar); +static boolean domove_attackmon_at(struct monst *, coordxy, coordxy, boolean *); +static boolean domove_fight_ironbars(coordxy, coordxy); +static boolean domove_swap_with_pet(struct monst *, coordxy, coordxy); +static boolean domove_fight_empty(coordxy, coordxy); static boolean air_turbulence(void); static void slippery_ice_fumbling(void); -static boolean impaired_movement(xchar *, xchar *); -static boolean avoid_moving_on_trap(xchar, xchar, boolean); -static boolean avoid_moving_on_liquid(xchar, xchar, boolean); -static boolean avoid_running_into_trap_or_liquid(xchar, xchar); -static boolean move_out_of_bounds(xchar, xchar); +static boolean impaired_movement(coordxy *, coordxy *); +static boolean avoid_moving_on_trap(coordxy, coordxy, boolean); +static boolean avoid_moving_on_liquid(coordxy, coordxy, boolean); +static boolean avoid_running_into_trap_or_liquid(coordxy, coordxy); +static boolean move_out_of_bounds(coordxy, coordxy); static boolean carrying_too_much(void); -static boolean escape_from_sticky_mon(xchar, xchar); +static boolean escape_from_sticky_mon(coordxy, coordxy); static void domove_core(void); static void maybe_smudge_engr(int, int, int, int); static struct monst *monstinroom(struct permonst *, int); @@ -139,7 +139,7 @@ could_move_onto_boulder(int sx, int sy) static int moverock(void) { - register xchar rx, ry, sx, sy; + register coordxy rx, ry, sx, sy; struct obj *otmp; struct trap *ttmp; struct monst *mtmp; @@ -511,7 +511,7 @@ moverock(void) * Returns TRUE if still eating, FALSE when done. */ int -still_chewing(xchar x, xchar y) +still_chewing(coordxy x, coordxy y) { struct rm *lev = &levl[x][y]; struct obj *boulder = sobj_at(BOULDER, x, y); @@ -689,7 +689,7 @@ still_chewing(xchar x, xchar y) } void -movobj(struct obj *obj, xchar ox, xchar oy) +movobj(struct obj *obj, coordxy ox, coordxy oy) { /* optimize by leaving on the fobj chain? */ remove_object(obj); @@ -787,7 +787,7 @@ dosinkfall(void) /* intended to be called only on ROCKs or TREEs */ boolean -may_dig(register xchar x, register xchar y) +may_dig(register coordxy x, register coordxy y) { struct rm *lev = &levl[x][y]; @@ -796,14 +796,14 @@ may_dig(register xchar x, register xchar y) } boolean -may_passwall(register xchar x, register xchar y) +may_passwall(register coordxy x, register coordxy y) { return (boolean) !(IS_STWALL(levl[x][y].typ) && (levl[x][y].wall_info & W_NONPASSWALL)); } boolean -bad_rock(struct permonst *mdat, register xchar x, register xchar y) +bad_rock(struct permonst *mdat, register coordxy x, register coordxy y) { return (boolean) ((Sokoban && sobj_at(BOULDER, x, y)) || (IS_ROCK(levl[x][y].typ) @@ -843,7 +843,7 @@ cant_squeeze_thru(struct monst *mon) } boolean -invocation_pos(xchar x, xchar y) +invocation_pos(coordxy x, coordxy y) { return (boolean) (Invocation_lev(&u.uz) && x == g.inv_pos.x && y == g.inv_pos.y); @@ -1121,10 +1121,10 @@ findtravelpath(int mode) g.context.run = 8; } if (u.tx != u.ux || u.ty != u.uy) { - xchar travel[COLNO][ROWNO]; - xchar travelstepx[2][COLNO * ROWNO]; - xchar travelstepy[2][COLNO * ROWNO]; - xchar tx, ty, ux, uy; + coordxy travel[COLNO][ROWNO]; + coordxy travelstepx[2][COLNO * ROWNO]; + coordxy travelstepy[2][COLNO * ROWNO]; + coordxy tx, ty, ux, uy; int n = 1; /* max offset in travelsteps */ int set = 0; /* two sets current and previous */ int radius = 1; /* search radius */ @@ -1538,7 +1538,7 @@ u_rooted(void) /* reduce zombification timeout of buried zombies around px, py */ static void -check_buried_zombies(xchar x, xchar y) +check_buried_zombies(coordxy x, coordxy y) { struct obj *otmp; long t; @@ -1568,7 +1568,7 @@ u_locomotion(const char *def) /* Return a simplified floor solid/liquid state based on hero's state */ static schar -u_simple_floortyp(xchar x, xchar y) +u_simple_floortyp(coordxy x, coordxy y) { boolean u_in_air = (Levitation || Flying || !grounded(g.youmonst.data)); @@ -1585,7 +1585,7 @@ u_simple_floortyp(xchar x, xchar y) /* Is it dangerous for hero to move to x,y due to water or lava? */ static boolean -swim_move_danger(xchar x, xchar y) +swim_move_danger(coordxy x, coordxy y) { schar newtyp = u_simple_floortyp(x, y); boolean liquid_wall = IS_WATERWALL(newtyp); @@ -1660,7 +1660,7 @@ domove_bump_mon(struct monst *mtmp, int glyph) sets displaceu, if hero and monster could swap places instead. */ static boolean -domove_attackmon_at(struct monst *mtmp, xchar x, xchar y, boolean *displaceu) +domove_attackmon_at(struct monst *mtmp, coordxy x, coordxy y, boolean *displaceu) { /* only attack if we know it's there */ /* or if we used the 'F' command to fight blindly */ @@ -1695,7 +1695,7 @@ domove_attackmon_at(struct monst *mtmp, xchar x, xchar y, boolean *displaceu) /* force-fight iron bars with your weapon? */ static boolean -domove_fight_ironbars(xchar x, xchar y) +domove_fight_ironbars(coordxy x, coordxy y) { if (g.context.forcefight && levl[x][y].typ == IRONBARS && uwep) { struct obj *obj = uwep; @@ -1720,7 +1720,7 @@ domove_fight_ironbars(xchar x, xchar y) /* maybe swap places with a pet? returns TRUE if swapped places */ static boolean -domove_swap_with_pet(struct monst *mtmp, xchar x, xchar y) +domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y) { struct trap *trap; /* if it turns out we can't actually move */ @@ -1839,7 +1839,7 @@ domove_swap_with_pet(struct monst *mtmp, xchar x, xchar y) /* force-fight (x,y) which doesn't have anything to fight */ static boolean -domove_fight_empty(xchar x, xchar y) +domove_fight_empty(coordxy x, coordxy y) { static const char unknown_obstacle[] = "an unknown obstacle"; boolean off_edge = !isok(x, y); @@ -1972,7 +1972,7 @@ air_turbulence(void) /* does water disturb the movement? */ static boolean -water_turbulence(xchar *x, xchar *y) +water_turbulence(coordxy *x, coordxy *y) { if (u.uinwater) { int wtcap; @@ -2028,7 +2028,7 @@ slippery_ice_fumbling(void) /* change movement dir if impaired. return TRUE if can't move */ static boolean -impaired_movement(xchar *x, xchar *y) +impaired_movement(coordxy *x, coordxy *y) { if (Stunned || (Confusion && !rn2(5))) { register int tries = 0; @@ -2047,7 +2047,7 @@ impaired_movement(xchar *x, xchar *y) } static boolean -avoid_moving_on_trap(xchar x, xchar y, boolean msg) +avoid_moving_on_trap(coordxy x, coordxy y, boolean msg) { struct trap *trap; @@ -2061,7 +2061,7 @@ avoid_moving_on_trap(xchar x, xchar y, boolean msg) } static boolean -avoid_moving_on_liquid(xchar x, xchar y, boolean msg) +avoid_moving_on_liquid(coordxy x, coordxy y, boolean msg) { if (!Levitation && !Flying && !is_clinger(g.youmonst.data) && is_pool_or_lava(x, y) && levl[x][y].seenv) { @@ -2076,7 +2076,7 @@ avoid_moving_on_liquid(xchar x, xchar y, boolean msg) /* when running/rushing, avoid stepping on a known trap or pool of liquid. returns TRUE if avoided. */ static boolean -avoid_running_into_trap_or_liquid(xchar x, xchar y) +avoid_running_into_trap_or_liquid(coordxy x, coordxy y) { if (!g.context.run) return FALSE; @@ -2096,7 +2096,7 @@ avoid_running_into_trap_or_liquid(xchar x, xchar y) /* trying to move out-of-bounds? */ static boolean -move_out_of_bounds(xchar x, xchar y) +move_out_of_bounds(coordxy x, coordxy y) { if (!isok(x, y)) { if (g.context.forcefight) @@ -2149,7 +2149,7 @@ carrying_too_much(void) /* try to pull free from sticking monster, or you release a monster you're sticking to. returns TRUE if you lose your movement. */ static boolean -escape_from_sticky_mon(xchar x, xchar y) +escape_from_sticky_mon(coordxy x, coordxy y) { if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) { struct monst *mtmp; @@ -2220,10 +2220,10 @@ domove_core(void) { register struct monst *mtmp; register struct rm *tmpr; - xchar x, y; + coordxy x, y; struct trap *trap = NULL; int glyph; - xchar chainx = 0, chainy = 0, + coordxy chainx = 0, chainy = 0, ballx = 0, bally = 0; /* ball&chain new positions */ int bc_control = 0; /* control for ball&chain */ boolean cause_delay = FALSE, /* dragging ball will skip a move */ @@ -2852,7 +2852,7 @@ monstinroom(struct permonst *mdat, int roomno) } char * -in_rooms(register xchar x, register xchar y, register int typewanted) +in_rooms(register coordxy x, register coordxy y, register int typewanted) { static char buf[5]; char rno, *ptr = &buf[4]; @@ -3753,7 +3753,7 @@ money_cnt(struct obj *otmp) } void -spot_checks(xchar x, xchar y, schar old_typ) +spot_checks(coordxy x, coordxy y, schar old_typ) { schar new_typ = levl[x][y].typ; boolean db_ice_now = FALSE; diff --git a/src/invent.c b/src/invent.c index 7ead2c4b7..d7963493d 100644 --- a/src/invent.c +++ b/src/invent.c @@ -86,7 +86,7 @@ loot_classify(Loot *sort_item, struct obj *obj) k = 1 + (int) (p - classorder); else k = 1 + (int) strlen(classorder) + (oclass != VENOM_CLASS); - sort_item->orderclass = (xchar) k; + sort_item->orderclass = (coordxy) k; /* subclass designation; only a few classes have subclasses and the non-armor ones we use are fairly arbitrary */ switch (oclass) { @@ -202,13 +202,13 @@ loot_classify(Loot *sort_item, struct obj *obj) k = 1; /* any non-zero would do */ break; } - sort_item->subclass = (xchar) k; + sort_item->subclass = (coordxy) k; /* discovery status */ k = !seen ? 1 /* unseen */ : (discovered || !OBJ_DESCR(objects[otyp])) ? 4 : (objects[otyp].oc_uname) ? 3 /* named (partially discovered) */ : 2; /* undiscovered */ - sort_item->disco = (xchar) k; + sort_item->disco = (coordxy) k; } /* sortloot() formatting routine; for alphabetizing, not shown to user */ @@ -2283,7 +2283,7 @@ fully_identify_obj(struct obj *otmp) { makeknown(otmp->otyp); if (otmp->oartifact) - discover_artifact((xchar) otmp->oartifact); + discover_artifact((coordxy) otmp->oartifact); otmp->known = otmp->dknown = otmp->bknown = otmp->rknown = 1; set_cknown_lknown(otmp); /* set otmp->{cknown,lknown} if applicable */ if (otmp->otyp == EGG && otmp->corpsenm != NON_PM) @@ -3634,7 +3634,7 @@ count_contents(struct obj *container, long count = 0L; if (!everything && !newdrop) { - xchar x, y; + coordxy x, y; for (topc = container; topc->where == OBJ_CONTAINED; topc = topc->ocontainer) diff --git a/src/light.c b/src/light.c index b57693a1f..89144aa4d 100644 --- a/src/light.c +++ b/src/light.c @@ -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; diff --git a/src/lock.c b/src/lock.c index 4d051b04e..b61a09022 100644 --- a/src/lock.c +++ b/src/lock.c @@ -352,7 +352,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL int pick_lock( struct obj *pick, - xchar rx, xchar ry, /* coordinates of door/container, for autounlock: + coordxy rx, coordxy ry, /* coordinates of door/container, for autounlock: * does not prompt for direction if these are set */ struct obj *container) /* container, for autounlock */ { diff --git a/src/mail.c b/src/mail.c index 06431ad3d..fb04317c0 100644 --- a/src/mail.c +++ b/src/mail.c @@ -200,7 +200,7 @@ md_start(coord *startp) startp->y = row; startp->x = g.viz_rmin[row]; - } else if (enexto(&testcc, (xchar) g.viz_rmin[row], row, + } else if (enexto(&testcc, (coordxy) g.viz_rmin[row], row, (struct permonst *) 0) && !cansee(testcc.x, testcc.y) && couldsee(testcc.x, testcc.y)) { @@ -215,7 +215,7 @@ md_start(coord *startp) startp->y = row; startp->x = g.viz_rmax[row]; - } else if (enexto(&testcc, (xchar) g.viz_rmax[row], row, + } else if (enexto(&testcc, (coordxy) g.viz_rmax[row], row, (struct permonst *) 0) && !cansee(testcc.x, testcc.y) && couldsee(testcc.x, testcc.y)) { diff --git a/src/makemon.c b/src/makemon.c index d4e85d342..19f7085f3 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -815,7 +815,7 @@ m_initinv(register struct monst *mtmp) /* Note: for long worms, always call cutworm (cutworm calls clone_mon) */ struct monst * clone_mon(struct monst *mon, - xchar x, xchar y) /* clone's preferred location or 0 (near mon) */ + coordxy x, coordxy y) /* clone's preferred location or 0 (near mon) */ { coord mm; struct monst *m2; diff --git a/src/mhitm.c b/src/mhitm.c index 3eef6b1f9..b2bbf6526 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -751,7 +751,7 @@ static int gulpmm(register struct monst *magr, register struct monst *mdef, register struct attack *mattk) { - xchar ax, ay, dx, dy; + coordxy ax, ay, dx, dy; int status; char buf[BUFSZ]; struct obj *obj; diff --git a/src/mhitu.c b/src/mhitu.c index fbf8f0dca..e8682d489 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1702,7 +1702,7 @@ could_seduce(struct monst *magr, struct monst *mdef, { struct permonst *pagr; boolean agrinvis, defperc; - xchar genagr, gendef; + xint16 genagr, gendef; int adtyp; if (is_animal(magr->data)) diff --git a/src/mklev.c b/src/mklev.c index 0736752f8..033665063 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -21,22 +21,22 @@ static void makevtele(void); void clear_level_structures(void); static void fill_ordinary_room(struct mkroom *); static void makelevel(void); -static boolean bydoor(xchar, xchar); +static boolean bydoor(coordxy, coordxy); static struct mkroom *find_branch_room(coord *); -static struct mkroom *pos_to_room(xchar, xchar); +static struct mkroom *pos_to_room(coordxy, coordxy); static boolean place_niche(struct mkroom *, int *, int *, int *); static void makeniche(int); static void make_niches(void); static int QSORTCALLBACK mkroom_cmp(const genericptr, const genericptr); -static void dosdoor(xchar, xchar, struct mkroom *, int); +static void dosdoor(coordxy, coordxy, struct mkroom *, int); static void join(int, int, boolean); static void do_room_or_subroom(struct mkroom *, int, int, int, int, boolean, schar, boolean, boolean); static void makerooms(void); -static boolean door_into_nonjoined(xchar, xchar); -static boolean finddpos(coord *, xchar, xchar, xchar, xchar); -static void mkinvpos(xchar, xchar, int); -static void mk_knox_portal(xchar, xchar); +static boolean door_into_nonjoined(coordxy, coordxy); +static boolean finddpos(coord *, coordxy, coordxy, coordxy, coordxy); +static void mkinvpos(coordxy, coordxy, int); +static void mk_knox_portal(coordxy, coordxy); #define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE) #define init_vault() g.vault_x = -1 @@ -71,9 +71,9 @@ mkroom_cmp(const genericptr vx, const genericptr vy) * to connect them up to other areas. */ static boolean -door_into_nonjoined(xchar x, xchar y) +door_into_nonjoined(coordxy x, coordxy y) { - xchar tx, ty, i; + coordxy tx, ty, i; for (i = 0; i < 4; i++) { tx = x + xdir[dirs_ord[i]]; @@ -91,9 +91,9 @@ door_into_nonjoined(xchar x, xchar y) } static boolean -finddpos(coord *cc, xchar xl, xchar yl, xchar xh, xchar yh) +finddpos(coord *cc, coordxy xl, coordxy yl, coordxy xh, coordxy yh) { - register xchar x, y; + register coordxy x, y; x = rn1(xh - xl + 1, xl); y = rn1(yh - yl + 1, yl); @@ -329,7 +329,7 @@ static void join(register int a, register int b, boolean nxcor) { coord cc, tt, org, dest; - register xchar tx, ty, xx, yy; + register coordxy tx, ty, xx, yy; register struct mkroom *croom, *troom; register int dx, dy; @@ -481,7 +481,7 @@ add_door(register int x, register int y, register struct mkroom *aroom) } static void -dosdoor(register xchar x, register xchar y, struct mkroom *aroom, int type) +dosdoor(register coordxy x, register coordxy y, struct mkroom *aroom, int type) { boolean shdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE; @@ -905,7 +905,7 @@ makelevel(void) /* make a secret treasure vault, not connected to the rest */ if (do_vault()) { - xchar w, h; + coordxy w, h; debugpline0("trying to make a vault..."); w = 1; @@ -1222,7 +1222,7 @@ find_branch_room(coord *mp) /* Find the room for (x,y). Return null if not in a room. */ static struct mkroom * -pos_to_room(xchar x, xchar y) +pos_to_room(coordxy x, coordxy y) { int i; struct mkroom *curr; @@ -1238,7 +1238,7 @@ pos_to_room(xchar x, xchar y) void place_branch( branch *br, /* branch to place */ - xchar x, xchar y) /* location */ + coordxy x, coordxy y) /* location */ { coord m = {0}; d_level *dest; @@ -1294,7 +1294,7 @@ place_branch( } static boolean -bydoor(register xchar x, register xchar y) +bydoor(register coordxy x, register coordxy y) { register int typ; @@ -1323,7 +1323,7 @@ bydoor(register xchar x, register xchar y) /* see whether it is allowable to create a door at [x,y] */ int -okdoor(xchar x, xchar y) +okdoor(coordxy x, coordxy y) { boolean near_door = bydoor(x, y); @@ -1347,7 +1347,7 @@ dodoor(int x, int y, struct mkroom *aroom) } boolean -occupied(xchar x, xchar y) +occupied(coordxy x, coordxy y) { return (boolean) (t_at(x, y) || IS_FURNITURE(levl[x][y].typ) || is_lava(x, y) || is_pool(x, y) @@ -1636,7 +1636,7 @@ mktrap( If force is TRUE, change the terrain to ROOM first */ void mkstairs( - xchar x, xchar y, + coordxy x, coordxy y, char up, /* [why 'char' when usage is boolean?] */ struct mkroom *croom UNUSED, boolean force) @@ -1884,9 +1884,9 @@ void mkinvokearea(void) { int dist; - xchar xmin = g.inv_pos.x, xmax = g.inv_pos.x, + coordxy xmin = g.inv_pos.x, xmax = g.inv_pos.x, ymin = g.inv_pos.y, ymax = g.inv_pos.y; - register xchar i; + register coordxy i; /* slightly odd if levitating, but not wrong */ pline_The("floor shakes violently under you!"); @@ -1940,7 +1940,7 @@ mkinvokearea(void) * Temporarily overrides vision in the name of a nice effect. */ static void -mkinvpos(xchar x, xchar y, int dist) +mkinvpos(coordxy x, coordxy y, int dist) { struct trap *ttmp; struct obj *otmp; @@ -2035,7 +2035,7 @@ mkinvpos(xchar x, xchar y, int dist) * Ludios will remain isolated until the branch is corrected by this function. */ static void -mk_knox_portal(xchar x, xchar y) +mk_knox_portal(coordxy x, coordxy y) { d_level *source; branch *br; diff --git a/src/mkmap.c b/src/mkmap.c index 4096a9be2..4fca1c126 100644 --- a/src/mkmap.c +++ b/src/mkmap.c @@ -433,7 +433,7 @@ mkmap(lev_init* init_lev) { schar bg_typ = init_lev->bg, fg_typ = init_lev->fg; boolean smooth = init_lev->smoothed, join = init_lev->joined; - xchar lit = init_lev->lit, walled = init_lev->walled; + xint16 lit = init_lev->lit, walled = init_lev->walled; int i; lit = litstate_rnd(lit); diff --git a/src/mkmaze.c b/src/mkmaze.c index ae0961413..409c13ca1 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -13,8 +13,8 @@ static int extend_spine(int[3][3], int, int, int); static void wall_cleanup(int, int, int, int); static boolean okay(int, int, int); static void maze0xy(coord *); -static boolean put_lregion_here(xchar, xchar, xchar, xchar, xchar, - xchar, xchar, boolean, d_level *); +static boolean put_lregion_here(coordxy, coordxy, coordxy, coordxy, coordxy, + coordxy, coordxy, boolean, d_level *); static void baalz_fixup(void); static void setup_waterlevel(void); static void unsetup_waterlevel(void); @@ -24,7 +24,7 @@ static void migrate_orc(struct monst *, unsigned long); static void shiny_orc_stuff(struct monst *); static void stolen_booty(void); static boolean maze_inbounds(int, int); -static void maze_remove_deadends(xchar); +static void maze_remove_deadends(xint16); /* adjust a coordinate one step in the specified direction */ #define mz_move(X, Y, dir) \ @@ -69,7 +69,7 @@ is_solid(int x, int y) /* set map terrain type, handling lava lit, ice melt timers, etc */ boolean -set_levltyp(xchar x, xchar y, schar typ) +set_levltyp(coordxy x, coordxy y, schar typ) { if (isok(x, y)) { if ((typ < MAX_TYPE) && CAN_OVERWRITE_TERRAIN(levl[x][y].typ)) { @@ -94,7 +94,7 @@ set_levltyp(xchar x, xchar y, schar typ) /* set map terrain type and light state */ boolean -set_levltyp_lit(xchar x, xchar y, schar typ, schar lit) +set_levltyp_lit(coordxy x, coordxy y, schar typ, schar lit) { boolean ret = set_levltyp(x, y, typ); @@ -209,7 +209,7 @@ fix_wall_spines(int x1, int y1, int x2, int y2) * so even though this table says VWALL, we actually leave whatever * typ was there alone. */ - static xchar spine_array[16] = { VWALL, HWALL, HWALL, HWALL, + static xint16 spine_array[16] = { VWALL, HWALL, HWALL, HWALL, VWALL, TRCORNER, TLCORNER, TDWALL, VWALL, BRCORNER, BLCORNER, TUWALL, VWALL, TLWALL, TRWALL, CROSSWALL }; @@ -289,7 +289,7 @@ maze0xy(coord * cc) * NOT (pos is corridor and a maze level OR pos is a room OR pos is air) */ boolean -bad_location(xchar x, xchar y, xchar lx, xchar ly, xchar hx, xchar hy) +bad_location(coordxy x, coordxy y, coordxy lx, coordxy ly, coordxy hx, coordxy hy) { return (boolean) (occupied(x, y) || within_bounded_area(x, y, lx, ly, hx, hy) @@ -302,14 +302,14 @@ bad_location(xchar x, xchar y, xchar lx, xchar ly, xchar hx, xchar hy) and place something (based on rtype) in that region */ void place_lregion( - xchar lx, xchar ly, xchar hx, xchar hy, - xchar nlx, xchar nly, xchar nhx,xchar nhy, - xchar rtype, + coordxy lx, coordxy ly, coordxy hx, coordxy hy, + coordxy nlx, coordxy nly, coordxy nhx,coordxy nhy, + xint16 rtype, d_level *lev) { int trycnt; boolean oneshot; - xchar x, y; + coordxy x, y; if (!lx) { /* default to whole level */ /* @@ -349,9 +349,9 @@ place_lregion( static boolean put_lregion_here( - xchar x, xchar y, - xchar nlx, xchar nly, xchar nhx, xchar nhy, - xchar rtype, + coordxy x, coordxy y, + coordxy nlx, coordxy nly, coordxy nhx, coordxy nhy, + xint16 rtype, boolean oneshot, d_level *lev) { @@ -823,7 +823,7 @@ maze_inbounds(int x, int y) } static void -maze_remove_deadends(xchar typ) +maze_remove_deadends(xint16 typ) { char dirok[4]; int x, y, dir, idx, idx2, dx, dy, dx2, dy2; @@ -1234,8 +1234,8 @@ mazexy(coord *cc) x = rnd(g.x_maze_max); y = rnd(g.y_maze_max); if (levl[x][y].typ == allowedtyp) { - cc->x = (xchar) x; - cc->y = (xchar) y; + cc->x = (coordxy) x; + cc->y = (coordxy) y; return; } } while (++cpt < 100); @@ -1243,8 +1243,8 @@ mazexy(coord *cc) for (x = 1; x <= g.x_maze_max; x++) for (y = 1; y <= g.y_maze_max; y++) if (levl[x][y].typ == allowedtyp) { - cc->x = (xchar) x; - cc->y = (xchar) y; + cc->x = (coordxy) x; + cc->y = (coordxy) y; return; } /* every spot on the area of map allowed for mazes has been rejected */ @@ -1356,7 +1356,7 @@ bound_digging(void) } void -mkportal(xchar x, xchar y, xchar todnum, xchar todlevel) +mkportal(coordxy x, coordxy y, xint16 todnum, xint16 todlevel) { /* a portal "trap" must be matched by a portal in the destination dungeon/dlevel */ @@ -1376,12 +1376,12 @@ mkportal(xchar x, xchar y, xchar todnum, xchar todlevel) void fumaroles(void) { - xchar n; + xint16 n; boolean snd = FALSE, loud = FALSE; for (n = rn2(3) + 2; n; n--) { - xchar x = rn1(COLNO - 4, 3); - xchar y = rn1(ROWNO - 4, 3); + coordxy x = rn1(COLNO - 4, 3); + coordxy y = rn1(ROWNO - 4, 3); if (levl[x][y].typ == LAVAPOOL) { NhRegion *r = create_gas_cloud(x, y, rn1(30, 20), rn1(10, 5)); diff --git a/src/mkobj.c b/src/mkobj.c index e2e80ebd3..a536af90b 100644 --- a/src/mkobj.c +++ b/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"); diff --git a/src/mkroom.c b/src/mkroom.c index ed6d7b03a..a1f0b3e33 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -283,7 +283,7 @@ fill_zoo(struct mkroom* sroom) (void) somexy(sroom, &mm); tx = mm.x; ty = mm.y; - } while (occupied((xchar) tx, (xchar) ty) && --i > 0); + } while (occupied((coordxy) tx, (coordxy) ty) && --i > 0); throne_placed: mk_zoo_thronemon(tx, ty); break; @@ -654,7 +654,7 @@ somey(struct mkroom* croom) } boolean -inside_room(struct mkroom* croom, xchar x, xchar y) +inside_room(struct mkroom* croom, coordxy x, coordxy y) { if (croom->irregular) { int i = (int) ((croom - g.rooms) + ROOMOFFSET); diff --git a/src/mon.c b/src/mon.c index 6d781bad9..b4d348c2e 100644 --- a/src/mon.c +++ b/src/mon.c @@ -19,7 +19,7 @@ static void mon_leaving_level(struct monst *); static void m_detach(struct monst *, struct permonst *); static void set_mon_min_mhpmax(struct monst *, int); static void lifesaved_monster(struct monst *); -static void migrate_mon(struct monst *, xchar, xchar); +static void migrate_mon(struct monst *, coordxy, coordxy); static boolean ok_to_obliterate(struct monst *); static void deal_with_overcrowding(struct monst *); static void m_restartcham(struct monst *); @@ -1807,7 +1807,7 @@ mfndpos( { struct permonst *mdat = mon->data; register struct trap *ttmp; - xchar x, y, nx, ny; + coordxy x, y, nx, ny; int cnt = 0; uchar ntyp; uchar nowtyp; @@ -2357,7 +2357,7 @@ m_detach( struct monst *mtmp, struct permonst *mptr) /* reflects mtmp->data _prior_ to mtmp's death */ { - xchar mx = mtmp->mx, my = mtmp->my; + coordxy mx = mtmp->mx, my = mtmp->my; if (mtmp->mleashed) m_unleash(mtmp, FALSE); @@ -2790,7 +2790,7 @@ void monstone(struct monst* mdef) { struct obj *otmp, *obj, *oldminvent; - xchar x = mdef->mx, y = mdef->my; + coordxy x = mdef->mx, y = mdef->my; boolean wasinside = FALSE; /* vampshifter reverts to vampire; @@ -3284,14 +3284,14 @@ vamp_stone(struct monst *mtmp) void m_into_limbo(struct monst *mtmp) { - xchar target_lev = ledger_no(&u.uz), xyloc = MIGR_APPROX_XY; + xint16 target_lev = ledger_no(&u.uz), xyloc = MIGR_APPROX_XY; mtmp->mstate |= MON_LIMBO; migrate_mon(mtmp, target_lev, xyloc); } static void -migrate_mon(struct monst *mtmp, xchar target_lev, xchar xyloc) +migrate_mon(struct monst *mtmp, xint16 target_lev, xint16 xyloc) { if (!mtmp->mx) { /* this was a failed arrival attempt from a prior migration; @@ -3382,7 +3382,7 @@ elemental_clog(struct monst *mon) /* last resort - migrate mon to the next plane */ } else if (!Is_astralevel(&u.uz)) { d_level dest; - xchar target_lev; + coordxy target_lev; dest = u.uz; dest.dlevel--; @@ -3462,13 +3462,13 @@ maybe_mnexto(struct monst* mtmp) int mnearto( register struct monst *mtmp, - xchar x, - xchar y, + coordxy x, + coordxy y, boolean move_other, /* make sure mtmp gets to x, y! so move m_at(x, y) */ unsigned int rlocflags) { struct monst *othermon = (struct monst *) 0; - xchar newx, newy; + coordxy newx, newy; coord mm; int res = 1; @@ -3874,8 +3874,8 @@ get_iter_mons(boolean (*func)(struct monst *)) passing x,y to the function. if func returns TRUE, stop and return that monster. */ struct monst * -get_iter_mons_xy(boolean (*func)(struct monst *, xchar, xchar), - xchar x, xchar y) +get_iter_mons_xy(boolean (*func)(struct monst *, coordxy, coordxy), + coordxy x, coordxy y) { struct monst *mtmp; @@ -3960,7 +3960,7 @@ restrap(struct monst *mtmp) /* reveal a monster at x,y hiding under an object, if there are no objects there */ void -maybe_unhide_at(xchar x, xchar y) +maybe_unhide_at(coordxy x, coordxy y) { struct monst *mtmp; @@ -3978,7 +3978,7 @@ hideunder(struct monst *mtmp) { struct trap *t; boolean oldundetctd, undetected = FALSE, is_u = (mtmp == &g.youmonst); - xchar x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my; + coordxy x = is_u ? u.ux : mtmp->mx, y = is_u ? u.uy : mtmp->my; if (mtmp == u.ustuck) { ; /* can't hide if holding you or held by you */ @@ -4021,7 +4021,7 @@ hide_monst(struct monst* mon) if ((is_hider(mon->data) || hider_under) && !(mon->mundetected || M_AP_TYPE(mon))) { - xchar x = mon->mx, y = mon->my; + coordxy x = mon->mx, y = mon->my; char save_viz = g.viz_array[y][x]; /* override vision, forcing hero to be unable to see monster's spot */ @@ -4541,7 +4541,7 @@ newcham( *p = '\0'; if (mtmp->wormno) { /* throw tail away */ - xchar mx = mtmp->mx, my = mtmp->my; + coordxy mx = mtmp->mx, my = mtmp->my; wormgone(mtmp); /* discards tail segments, takes head off the map */ /* put the head back; it will morph into mtmp's new form */ diff --git a/src/monmove.c b/src/monmove.c index b00757dcb..fde3a8672 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -12,8 +12,8 @@ static int disturb(struct monst *); static void release_hero(struct monst *); static void distfleeck(struct monst *, int *, int *, int *); static int m_arrival(struct monst *); -static boolean holds_up_web(xchar, xchar); -static int count_webbing_walls(xchar, xchar); +static boolean holds_up_web(coordxy, coordxy); +static int count_webbing_walls(coordxy, coordxy); static boolean soko_allow_web(struct monst *); static boolean leppie_avoidance(struct monst *); static void leppie_stash(struct monst *); @@ -812,8 +812,8 @@ should_displace( coord *poss, /* coord poss[9] */ long *info, /* long info[9] */ int cnt, - xchar gx, - xchar gy) + coordxy gx, + coordxy gy) { int shortest_with_displacing = -1; int shortest_without_displacing = -1; @@ -845,7 +845,7 @@ should_displace( } boolean -m_digweapon_check(struct monst* mtmp, xchar nix, xchar niy) +m_digweapon_check(struct monst* mtmp, coordxy nix, coordxy niy) { boolean can_tunnel = 0; struct obj *mw_tmp = MON_WEP(mtmp); @@ -940,7 +940,7 @@ m_balks_at_approaching(struct monst* mtmp) } static boolean -holds_up_web(xchar x, xchar y) +holds_up_web(coordxy x, coordxy y) { stairway *sway; @@ -957,7 +957,7 @@ holds_up_web(xchar x, xchar y) /* returns the number of walls in the four cardinal directions that could hold up a web */ static int -count_webbing_walls(xchar x, xchar y) +count_webbing_walls(coordxy x, coordxy y) { return (holds_up_web(x, y - 1) + holds_up_web(x + 1, y) + holds_up_web(x, y + 1) + holds_up_web(x - 1, y)); @@ -1018,7 +1018,8 @@ int m_move(register struct monst* mtmp, register int after) { int appr, etmp; - xchar gx, gy, nix, niy, chcnt; + coordxy gx, gy, nix, niy; + xint16 chcnt; int chi; /* could be schar except for stupid Sun-2 compiler */ boolean likegold = 0, likegems = 0, likeobjs = 0, likemagic = 0, conceals = 0; @@ -1076,7 +1077,7 @@ m_move(register struct monst* mtmp, register int after) /* and the acquisitive monsters get special treatment */ if (is_covetous(ptr)) { - xchar tx = STRAT_GOALX(mtmp->mstrategy), + coordxy tx = STRAT_GOALX(mtmp->mstrategy), ty = STRAT_GOALY(mtmp->mstrategy); struct monst *intruder = m_at(tx, ty); /* @@ -1723,7 +1724,7 @@ m_move(register struct monst* mtmp, register int after) * (mtmp died) or 3 (mtmp made its move). */ int -m_move_aggress(struct monst* mtmp, xchar x, xchar y) +m_move_aggress(struct monst* mtmp, coordxy x, coordxy y) { struct monst *mtmp2; int mstatus; @@ -1855,8 +1856,8 @@ set_apparxy(register struct monst* mtmp) boolean undesirable_disp( struct monst *mtmp, /* barging creature */ - xchar x, - xchar y) /* spot 'mtmp' is considering moving to */ + coordxy x, + coordxy y) /* spot 'mtmp' is considering moving to */ { boolean is_pet = (mtmp && mtmp->mtame && !mtmp->isminion); struct trap *trap = t_at(x, y); diff --git a/src/mplayer.c b/src/mplayer.c index a088219bc..5def5e45c 100644 --- a/src/mplayer.c +++ b/src/mplayer.c @@ -114,7 +114,7 @@ mk_mplayer_armor(struct monst* mon, short typ) } struct monst * -mk_mplayer(struct permonst *ptr, xchar x, xchar y, boolean special) +mk_mplayer(struct permonst *ptr, coordxy x, coordxy y, boolean special) { struct monst *mtmp; char nam[PL_NSIZ]; @@ -343,7 +343,7 @@ create_mplayers(register int num, boolean special) if (tryct > 50) return; - (void) mk_mplayer(&mons[pm], (xchar) x, (xchar) y, special); + (void) mk_mplayer(&mons[pm], (coordxy) x, (coordxy) y, special); num--; } } diff --git a/src/mthrowu.c b/src/mthrowu.c index 02b7dea49..eb6af27e7 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -777,7 +777,7 @@ int thrwmm(struct monst* mtmp, struct monst* mtarg) { struct obj *otmp, *mwep; - register xchar x, y; + register coordxy x, y; boolean ispole; /* Polearms won't be applied by monsters against other monsters */ @@ -833,8 +833,8 @@ spitmm(struct monst* mtmp, struct attack* mattk, struct monst* mtarg) } if (m_lined_up(mtarg, mtmp)) { boolean utarg = (mtarg == &g.youmonst); - xchar tx = utarg ? mtmp->mux : mtarg->mx; - xchar ty = utarg ? mtmp->muy : mtarg->my; + coordxy tx = utarg ? mtmp->mux : mtarg->mx; + coordxy ty = utarg ? mtmp->muy : mtarg->my; switch (mattk->adtyp) { case AD_BLND: @@ -972,7 +972,7 @@ void thrwmu(struct monst* mtmp) { struct obj *otmp, *mwep; - xchar x, y; + coordxy x, y; const char *onm; /* Rearranged beginning so monsters can use polearms not in a line */ @@ -1072,10 +1072,10 @@ breamu(struct monst* mtmp, struct attack* mattk) Returns TRUE if fnc returned TRUE. */ boolean linedup_callback( - xchar ax, - xchar ay, - xchar bx, - xchar by, + coordxy ax, + coordxy ay, + coordxy bx, + coordxy by, boolean (*fnc)(int, int)) { int dx, dy; @@ -1110,10 +1110,10 @@ linedup_callback( boolean linedup( - register xchar ax, - register xchar ay, - register xchar bx, - register xchar by, + register coordxy ax, + register coordxy ay, + register coordxy bx, + register coordxy by, int boulderhandling) /* 0=block, 1=ignore, 2=conditionally block */ { int dx, dy, boulderspots; @@ -1159,8 +1159,8 @@ static int m_lined_up(struct monst* mtarg, struct monst* mtmp) { boolean utarget = (mtarg == &g.youmonst); - xchar tx = utarget ? mtmp->mux : mtarg->mx; - xchar ty = utarget ? mtmp->muy : mtarg->my; + coordxy tx = utarget ? mtmp->mux : mtarg->mx; + coordxy ty = utarget ? mtmp->muy : mtarg->my; boolean ignore_boulders = utarget && (throws_rocks(mtmp->data) || m_carrying(mtmp, WAN_STRIKING)); diff --git a/src/nhlobj.c b/src/nhlobj.c index 3cbc08fc1..5d1bba0e8 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -561,14 +561,14 @@ l_obj_bury(lua_State *L) int argc = lua_gettop(L); boolean dealloced = FALSE; struct _lua_obj *lo = l_obj_check(L, 1); - xchar x = 0, y = 0; + coordxy x = 0, y = 0; if (argc == 1) { x = lo->obj->ox; y = lo->obj->oy; } else if (argc == 3) { - x = (xchar) lua_tointeger(L, 2); - y = (xchar) lua_tointeger(L, 3); + x = (coordxy) lua_tointeger(L, 2); + y = (coordxy) lua_tointeger(L, 3); } else nhl_error(L, "l_obj_bury: Wrong args"); diff --git a/src/nhlsel.c b/src/nhlsel.c index db8463643..77270298b 100644 --- a/src/nhlsel.c +++ b/src/nhlsel.c @@ -14,7 +14,7 @@ static int l_selection_not(lua_State *); static int l_selection_filter_percent(lua_State *); static int l_selection_rndcoord(lua_State *); static boolean params_sel_2coords(lua_State *, struct selectionvar **, - xchar *, xchar *, xchar *, xchar *); + coordxy *, coordxy *, coordxy *, coordxy *); static int l_selection_line(lua_State *); static int l_selection_randline(lua_State *); static int l_selection_rect(lua_State *); @@ -136,7 +136,7 @@ static int l_selection_setpoint(lua_State *L) { struct selectionvar *sel = (struct selectionvar *) 0; - xchar x = -1, y = -1; + coordxy x = -1, y = -1; int val = 1; int argc = lua_gettop(L); long crd = 0L; @@ -146,15 +146,15 @@ l_selection_setpoint(lua_State *L) } else if (argc == 1) { sel = l_selection_check(L, 1); } else if (argc == 2) { - x = (xchar) luaL_checkinteger(L, 1); - y = (xchar) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); lua_pop(L, 2); (void) l_selection_new(L); sel = l_selection_check(L, 1); } else { sel = l_selection_check(L, 1); - x = (xchar) luaL_checkinteger(L, 2); - y = (xchar) luaL_checkinteger(L, 3); + x = (coordxy) luaL_checkinteger(L, 2); + y = (coordxy) luaL_checkinteger(L, 3); val = (int) luaL_optinteger(L, 4, 1); } @@ -180,7 +180,7 @@ static int l_selection_getpoint(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); - xchar x, y; + coordxy x, y; int ix, iy; int val; long crd; @@ -190,8 +190,8 @@ l_selection_getpoint(lua_State *L) nhl_error(L, "l_selection_getpoint: Incorrect params"); return 0; } - x = (xchar) ix; - y = (xchar) iy; + x = (coordxy) ix; + y = (coordxy) iy; if (x == -1 && y == -1) crd = SP_COORD_PACK_RANDOM(0); @@ -299,8 +299,8 @@ l_selection_sub(lua_State *L) for (x = 0; x < selr->wid; x++) { for (y = 0; y < selr->hei; y++) { - xchar a_pt = selection_getpoint(x, y, sela); - xchar b_pt = selection_getpoint(x, y, selb); + coordxy a_pt = selection_getpoint(x, y, sela); + coordxy b_pt = selection_getpoint(x, y, selb); int val = (a_pt ^ b_pt) & a_pt; selection_setpoint(x, y, selr, val); } @@ -335,7 +335,7 @@ l_selection_rndcoord(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); int removeit = (int) luaL_optinteger(L, 2, 0); - xchar x = -1, y = -1; + coordxy x = -1, y = -1; selection_rndcoord(sel, &x, &y, removeit); if (!(x == -1 && y == -1)) { update_croom(); @@ -362,16 +362,16 @@ l_selection_rndcoord(lua_State *L) /* selection:function(x1,y1, x2,y2) */ static boolean params_sel_2coords(lua_State *L, struct selectionvar **sel, - xchar *x1, xchar *y1, xchar *x2, xchar *y2) + coordxy *x1, coordxy *y1, coordxy *x2, coordxy *y2) { int argc = lua_gettop(L); if (argc == 4) { (void) l_selection_new(L); - *x1 = (xchar) luaL_checkinteger(L, 1); - *y1 = (xchar) luaL_checkinteger(L, 2); - *x2 = (xchar) luaL_checkinteger(L, 3); - *y2 = (xchar) luaL_checkinteger(L, 4); + *x1 = (coordxy) luaL_checkinteger(L, 1); + *y1 = (coordxy) luaL_checkinteger(L, 2); + *x2 = (coordxy) luaL_checkinteger(L, 3); + *y2 = (coordxy) luaL_checkinteger(L, 4); *sel = l_selection_check(L, 5); lua_remove(L, 1); lua_remove(L, 1); @@ -380,10 +380,10 @@ params_sel_2coords(lua_State *L, struct selectionvar **sel, return TRUE; } else if (argc == 5) { *sel = l_selection_check(L, 1); - *x1 = (xchar) luaL_checkinteger(L, 2); - *y1 = (xchar) luaL_checkinteger(L, 3); - *x2 = (xchar) luaL_checkinteger(L, 4); - *y2 = (xchar) luaL_checkinteger(L, 5); + *x1 = (coordxy) luaL_checkinteger(L, 2); + *y1 = (coordxy) luaL_checkinteger(L, 3); + *x2 = (coordxy) luaL_checkinteger(L, 4); + *y2 = (coordxy) luaL_checkinteger(L, 5); lua_pop(L, 4); return TRUE; } @@ -397,7 +397,7 @@ static int l_selection_line(lua_State *L) { struct selectionvar *sel = NULL; - xchar x1, y1, x2, y2; + coordxy x1, y1, x2, y2; if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) { nhl_error(L, "selection.line: illegal arguments"); @@ -417,7 +417,7 @@ static int l_selection_rect(lua_State *L) { struct selectionvar *sel = NULL; - xchar x1, y1, x2, y2; + coordxy x1, y1, x2, y2; if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) { nhl_error(L, "selection.rect: illegal arguments"); @@ -446,7 +446,7 @@ l_selection_fillrect(lua_State *L) { struct selectionvar *sel = NULL; int y; - xchar x1, y1, x2, y2; + coordxy x1, y1, x2, y2; if (!params_sel_2coords(L, &sel, &x1, &y1, &x2, &y2)) { nhl_error(L, "selection.fillrect: illegal arguments"); @@ -478,22 +478,22 @@ l_selection_randline(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; - xchar x1 = 0, y1 = 0, x2 = 0, y2 = 0; + coordxy x1 = 0, y1 = 0, x2 = 0, y2 = 0; int roughness = 7; if (argc == 6) { sel = l_selection_check(L, 1); - x1 = (xchar) luaL_checkinteger(L, 2); - y1 = (xchar) luaL_checkinteger(L, 3); - x2 = (xchar) luaL_checkinteger(L, 4); - y2 = (xchar) luaL_checkinteger(L, 5); + x1 = (coordxy) luaL_checkinteger(L, 2); + y1 = (coordxy) luaL_checkinteger(L, 3); + x2 = (coordxy) luaL_checkinteger(L, 4); + y2 = (coordxy) luaL_checkinteger(L, 5); roughness = (int) luaL_checkinteger(L, 6); lua_pop(L, 5); } else if (argc == 5 && lua_type(L, 1) == LUA_TNUMBER) { - x1 = (xchar) luaL_checkinteger(L, 1); - y1 = (xchar) luaL_checkinteger(L, 2); - x2 = (xchar) luaL_checkinteger(L, 3); - y2 = (xchar) luaL_checkinteger(L, 4); + x1 = (coordxy) luaL_checkinteger(L, 1); + y1 = (coordxy) luaL_checkinteger(L, 2); + x2 = (coordxy) luaL_checkinteger(L, 3); + y2 = (coordxy) luaL_checkinteger(L, 4); roughness = (int) luaL_checkinteger(L, 5); lua_pop(L, 5); (void) l_selection_new(L); @@ -540,7 +540,7 @@ l_selection_filter_mapchar(lua_State *L) int argc = lua_gettop(L); struct selectionvar *sel = l_selection_check(L, 1); char *mapchr = dupstr(luaL_checkstring(L, 2)); - xchar typ = check_mapchr(mapchr); + coordxy typ = check_mapchr(mapchr); int lit = (int) luaL_optinteger(L, 3, -2); /* TODO: special lit values */ struct selectionvar *tmp, *tmp2; @@ -612,12 +612,12 @@ l_selection_flood(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; - xchar x = 0, y = 0; + coordxy x = 0, y = 0; boolean diagonals = FALSE; if (argc == 2 || argc == 3) { - x = (xchar) luaL_checkinteger(L, 1); - y = (xchar) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); if (argc == 3) diagonals = lua_toboolean(L, 3); lua_pop(L, argc); @@ -648,20 +648,20 @@ l_selection_circle(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; - xchar x = 0, y = 0; + coordxy x = 0, y = 0; int r = 0, filled = 0; if (argc == 3) { - x = (xchar) luaL_checkinteger(L, 1); - y = (xchar) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); r = (int) luaL_checkinteger(L, 3); lua_pop(L, 3); (void) l_selection_new(L); sel = l_selection_check(L, 1); filled = 0; } else if (argc == 4 && lua_type(L, 1) == LUA_TNUMBER) { - x = (xchar) luaL_checkinteger(L, 1); - y = (xchar) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); r = (int) luaL_checkinteger(L, 3); filled = (int) luaL_checkinteger(L, 4); /* TODO: boolean*/ lua_pop(L, 4); @@ -669,8 +669,8 @@ l_selection_circle(lua_State *L) sel = l_selection_check(L, 1); } else if (argc == 4 || argc == 5) { sel = l_selection_check(L, 1); - x = (xchar) luaL_checkinteger(L, 2); - y = (xchar) luaL_checkinteger(L, 3); + x = (coordxy) luaL_checkinteger(L, 2); + y = (coordxy) luaL_checkinteger(L, 3); r = (int) luaL_checkinteger(L, 4); filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */ } else { @@ -696,12 +696,12 @@ l_selection_ellipse(lua_State *L) { int argc = lua_gettop(L); struct selectionvar *sel = (struct selectionvar *) 0; - xchar x = 0, y = 0; + coordxy x = 0, y = 0; int r1 = 0, r2 = 0, filled = 0; if (argc == 4) { - x = (xchar) luaL_checkinteger(L, 1); - y = (xchar) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); r1 = (int) luaL_checkinteger(L, 3); r2 = (int) luaL_checkinteger(L, 4); lua_pop(L, 4); @@ -709,8 +709,8 @@ l_selection_ellipse(lua_State *L) sel = l_selection_check(L, 1); filled = 0; } else if (argc == 5 && lua_type(L, 1) == LUA_TNUMBER) { - x = (xchar) luaL_checkinteger(L, 1); - y = (xchar) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); r1 = (int) luaL_checkinteger(L, 3); r2 = (int) luaL_checkinteger(L, 4); filled = (int) luaL_optinteger(L, 5, 0); /* TODO: boolean */ @@ -719,8 +719,8 @@ l_selection_ellipse(lua_State *L) sel = l_selection_check(L, 1); } else if (argc == 5 || argc == 6) { sel = l_selection_check(L, 1); - x = (xchar) luaL_checkinteger(L, 2); - y = (xchar) luaL_checkinteger(L, 3); + x = (coordxy) luaL_checkinteger(L, 2); + y = (coordxy) luaL_checkinteger(L, 3); r1 = (int) luaL_checkinteger(L, 4); r2 = (int) luaL_checkinteger(L, 5); filled = (int) luaL_optinteger(L, 6, 0); /* TODO: boolean */ @@ -750,11 +750,11 @@ l_selection_gradient(lua_State *L) struct selectionvar *sel = (struct selectionvar *) 0; /* if x2 and y2 aren't set, the gradient has a single center point of x,y; * if they are set, the gradient is centered on a (x,y) to (x2,y2) line */ - xchar x = 0, y = 0, x2 = -1, y2 = -1; + coordxy x = 0, y = 0, x2 = -1, y2 = -1; /* points will not be added within mindist of the center; the chance for a * point between mindist and maxdist to be added to the selection starts at * 0% at mindist and increases linearly to 100% at maxdist */ - xchar mindist = 0, maxdist = 0; + coordxy mindist = 0, maxdist = 0; /* if limited is true, no points farther than maxdist will be added; if * false, all points farther than maxdist will be added */ boolean limited = FALSE; @@ -769,10 +769,10 @@ l_selection_gradient(lua_State *L) if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) { lcheck_param_table(L); type = gradtypes2i[get_table_option(L, "type", "radial", gradtypes)]; - x = (xchar) get_table_int(L, "x"); - y = (xchar) get_table_int(L, "y"); - x2 = (xchar) get_table_int_opt(L, "x2", -1); - y2 = (xchar) get_table_int_opt(L, "y2", -1); + x = (coordxy) get_table_int(L, "x"); + y = (coordxy) get_table_int(L, "y"); + x2 = (coordxy) get_table_int_opt(L, "x2", -1); + y2 = (coordxy) get_table_int_opt(L, "y2", -1); /* maxdist is required because there's no obvious default value for it, * whereas mindist has an obvious defalt of 0 */ maxdist = get_table_int(L, "maxdist"); diff --git a/src/nhlua.c b/src/nhlua.c index a8b1905f1..6f85011ea 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -213,7 +213,7 @@ schar get_table_mapchr(lua_State *L, const char *name) { char *ter; - xchar typ; + xint8 typ; ter = get_table_str(L, name); typ = check_mapchr(ter); @@ -228,15 +228,15 @@ schar get_table_mapchr_opt(lua_State *L, const char *name, schar defval) { char *ter; - xchar typ; + xint8 typ; ter = get_table_str_opt(L, name, emptystr); if (name && *ter) { - typ = check_mapchr(ter); + typ = (xint8) check_mapchr(ter); if (typ == INVALID_TYPE) nhl_error(L, "Erroneous map char"); } else - typ = defval; + typ = (xint8) defval; if (ter) free(ter); return typ; @@ -292,7 +292,7 @@ nhl_add_table_entry_bool(lua_State *L, const char *name, boolean value) void nhl_add_table_entry_region(lua_State *L, const char *name, - xchar x1, xchar y1, xchar x2, xchar y2) + coordxy x1, coordxy y1, coordxy x2, coordxy y2) { lua_pushstring(L, name); lua_newtable(L); @@ -1345,8 +1345,8 @@ nhl_meta_u_index(lua_State *L) { "mh", &(u.mh), ANY_INT }, { "mhmax", &(u.mhmax), ANY_INT }, { "mtimedone", &(u.mtimedone), ANY_INT }, - { "dlevel", &(u.uz.dlevel), ANY_SCHAR }, /* actually xchar */ - { "dnum", &(u.uz.dnum), ANY_SCHAR }, /* actually xchar */ + { "dlevel", &(u.uz.dlevel), ANY_SCHAR }, /* actually coordxy */ + { "dnum", &(u.uz.dnum), ANY_SCHAR }, /* actually coordxy */ { "uluck", &(u.uluck), ANY_SCHAR }, { "uhp", &(u.uhp), ANY_INT }, { "uhpmax", &(u.uhpmax), ANY_INT }, diff --git a/src/objnam.c b/src/objnam.c index c6baa6664..77358685e 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -301,7 +301,7 @@ distant_name( char *(*func)(OBJ_P)) /* formatting routine (usually xname or doname) */ { char *str; - xchar ox = 0, oy = 0; + coordxy ox = 0, oy = 0; /* * (r * r): square of the x or y distance; * (r * r) * 2: sum of squares of both x and y distances diff --git a/src/options.c b/src/options.c index 919e565a8..42da3e524 100644 --- a/src/options.c +++ b/src/options.c @@ -6852,7 +6852,7 @@ query_attr(const char *prompt) static const struct { const char *name; - xchar msgtyp; + xint8 msgtyp; const char *descr; } msgtype_names[] = { { "show", MSGTYP_NORMAL, "Show message normally" }, diff --git a/src/pager.c b/src/pager.c index c7c99d31e..f897bf33f 100644 --- a/src/pager.c +++ b/src/pager.c @@ -466,7 +466,7 @@ look_at_monster(char *buf, caller should use it or copy it before calling waterbody_name() again [3.7: moved here from mkmaze.c] */ const char * -waterbody_name(xchar x, xchar y) +waterbody_name(coordxy x, coordxy y) { static char pooltype[40]; struct rm *lev; diff --git a/src/pickup.c b/src/pickup.c index 4d1efe517..14742ac86 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1910,7 +1910,7 @@ do_loot_cont( if (flags.autounlock) { struct obj *otmp, *unlocktool = 0; - xchar ox = cobj->ox, oy = cobj->oy; + coordxy ox = cobj->ox, oy = cobj->oy; u.dz = 0; /* might be non-zero from previous command since * #loot isn't a move command; pick_lock() cares */ @@ -2622,7 +2622,7 @@ observe_quantum_cat(struct obj *box, boolean makecat, boolean givemsg) static NEARDATA const char sc[] = "Schroedinger's Cat"; struct obj *deadcat; struct monst *livecat = 0; - xchar ox, oy; + coordxy ox, oy; boolean itsalive = !rn2(2); if (get_obj_location(box, &ox, &oy, 0)) @@ -3431,7 +3431,7 @@ enum tipping_check_values { static void tipcontainer(struct obj *box) /* or bag */ { - xchar ox = u.ux, oy = u.uy; /* #tip only works at hero's location */ + coordxy ox = u.ux, oy = u.uy; /* #tip only works at hero's location */ boolean empty_it = TRUE, maybeshopgoods; struct obj *targetbox = (struct obj *) 0; boolean cancelled = FALSE; @@ -3655,7 +3655,7 @@ tipcontainer_checks(struct obj *box, boolean allowempty) boolean bag = box->otyp == BAG_OF_TRICKS; int old_spe = box->spe, seen = 0; boolean maybeshopgoods = !carried(box) && costly_spot(box->ox, box->oy); - xchar ox = u.ux, oy = u.uy; + coordxy ox = u.ux, oy = u.uy; if (get_obj_location(box, &ox, &oy, 0)) box->ox = ox, box->oy = oy; diff --git a/src/pray.c b/src/pray.c index a6335ec30..a16b74f9b 100644 --- a/src/pray.c +++ b/src/pray.c @@ -2268,7 +2268,7 @@ a_gname(void) /* returns the name of an altar's deity */ const char * -a_gname_at(xchar x, xchar y) +a_gname_at(coordxy x, coordxy y) { if (!IS_ALTAR(levl[x][y].typ)) return (char *) 0; diff --git a/src/priest.c b/src/priest.c index 5afdd7817..afa4e14ed 100644 --- a/src/priest.c +++ b/src/priest.c @@ -9,7 +9,7 @@ #define ALGN_SINNED (-4) /* worse than strayed (-1..-3) */ #define ALGN_PIOUS 14 /* better than fervent (9..13) */ -static boolean histemple_at(struct monst *, xchar, xchar); +static boolean histemple_at(struct monst *, coordxy, coordxy); static boolean has_shrine(struct monst *); void @@ -40,9 +40,9 @@ free_epri(struct monst *mtmp) int move_special(struct monst *mtmp, boolean in_his_shop, schar appr, boolean uondoor, boolean avoid, - xchar omx, xchar omy, xchar gx, xchar gy) + coordxy omx, coordxy omy, coordxy gx, coordxy gy) { - register xchar nx, ny, nix, niy; + register coordxy nx, ny, nix, niy; register schar i; schar chcnt, cnt; coord poss[9]; @@ -146,7 +146,7 @@ temple_occupied(char *array) } static boolean -histemple_at(struct monst *priest, xchar x, xchar y) +histemple_at(struct monst *priest, coordxy x, coordxy y) { return (boolean) (priest && priest->ispriest && (EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE)) @@ -172,7 +172,7 @@ inhistemple(struct monst *priest) int pri_move(struct monst *priest) { - register xchar gx, gy, omx, omy; + register coordxy gx, gy, omx, omy; schar temple; boolean avoid = TRUE; @@ -670,7 +670,7 @@ priest_talk(struct monst *priest) } struct monst * -mk_roamer(struct permonst *ptr, aligntyp alignment, xchar x, xchar y, +mk_roamer(struct permonst *ptr, aligntyp alignment, coordxy x, coordxy y, boolean peaceful) { register struct monst *roamer; @@ -719,7 +719,7 @@ reset_hostility(struct monst *roamer) boolean in_your_sanctuary( struct monst *mon, /* if non-null, overrides */ - xchar x, xchar y) + coordxy x, coordxy y) { register char roomno; register struct monst *priest; diff --git a/src/region.c b/src/region.c index 70266fd3c..a96657d24 100644 --- a/src/region.c +++ b/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; diff --git a/src/restore.c b/src/restore.c index 2a89b8ca1..e328f9084 100644 --- a/src/restore.c +++ b/src/restore.c @@ -29,7 +29,7 @@ static void freefruitchn(struct fruit *); static void ghostfruit(struct obj *); static boolean restgamestate(NHFILE *, unsigned int *, unsigned int *); static void restlevelstate(unsigned int, unsigned int); -static int restlevelfile(xchar); +static int restlevelfile(xint8); static void rest_bubbles(NHFILE *); static void restore_gamelog(NHFILE *); static void restore_msghistory(NHFILE *); @@ -723,7 +723,7 @@ restlevelstate(unsigned int stuckid, unsigned int steedid) /*ARGSUSED*/ static int -restlevelfile(xchar ltmp) +restlevelfile(xint8 ltmp) { char whynot[BUFSZ]; NHFILE *nhfp = (NHFILE *) 0; @@ -745,14 +745,14 @@ int dorecover(NHFILE* nhfp) { unsigned int stuckid = 0, steedid = 0; /* not a register */ - xchar ltmp = 0; + xint8 ltmp = 0; int rtmp; /* suppress map display if some part of the code tries to update that */ g.program_state.restoring = 1; get_plname_from_file(nhfp, g.plname); - getlev(nhfp, 0, (xchar) 0); + getlev(nhfp, 0, (xint8) 0); if (!restgamestate(nhfp, &stuckid, &steedid)) { NHFILE tnhfp; @@ -835,7 +835,7 @@ dorecover(NHFILE* nhfp) (void) validate(nhfp, (char *) 0); get_plname_from_file(nhfp, g.plname); - getlev(nhfp, 0, (xchar) 0); + getlev(nhfp, 0, (xint8) 0); close_nhfile(nhfp); restlevelstate(stuckid, steedid); g.program_state.something_worth_saving = 1; /* useful data now exists */ @@ -999,14 +999,14 @@ trickery(char *reason) } void -getlev(NHFILE* nhfp, int pid, xchar lev) +getlev(NHFILE* nhfp, int pid, xint8 lev) { register struct trap *trap; register struct monst *mtmp; long elapsed; branch *br; int hpid = 0; - xchar dlvl = 0; + xint8 dlvl = 0; int x, y; boolean ghostly = (nhfp->ftype == NHF_BONESFILE); #ifdef TOS @@ -1233,7 +1233,7 @@ get_plname_from_file(NHFILE* nhfp, char *plbuf) static void rest_bubbles(NHFILE *nhfp) { - xchar bbubbly; + xint8 bbubbly; /* whether or not the Plane of Water's air bubbles or Plane of Air's clouds are present is recorded during save so that we don't have to diff --git a/src/save.c b/src/save.c index 690c5f2f3..ddf39c207 100644 --- a/src/save.c +++ b/src/save.c @@ -19,7 +19,7 @@ int dotcnt, dotrow; /* also used in restore */ static void savelevchn(NHFILE *); static void savelevl(NHFILE *,boolean); static void savedamage(NHFILE *); -static void save_bubbles(NHFILE *, xchar); +static void save_bubbles(NHFILE *, xint8); static void save_stairs(NHFILE *); static void save_bc(NHFILE *); static void saveobj(NHFILE *,struct obj *); @@ -29,7 +29,7 @@ static void savemonchn(NHFILE *,struct monst *); static void savetrapchn(NHFILE *,struct trap *); static void save_gamelog(NHFILE *); static void savegamestate(NHFILE *); -static void savelev_core(NHFILE *, xchar); +static void savelev_core(NHFILE *, xint8); static void save_msghistory(NHFILE *); #ifdef ZEROCOMP @@ -78,7 +78,7 @@ int dosave0(void) { const char *fq_save; - xchar ltmp; + xint8 ltmp; char whynot[BUFSZ]; NHFILE *nhfp, *onhfp; int res = 0; @@ -186,7 +186,7 @@ dosave0(void) set_ustuck((struct monst *) 0); u.usteed = (struct monst *) 0; - for (ltmp = (xchar) 1; ltmp <= maxledgerno(); ltmp++) { + for (ltmp = (xint8) 1; ltmp <= maxledgerno(); ltmp++) { if (ltmp == ledger_no(&g.uz_save)) continue; if (!(g.level_info[ltmp].flags & LFILE_EXISTS)) @@ -447,7 +447,7 @@ savestateinlock(void) #endif void -savelev(NHFILE *nhfp, xchar lev) +savelev(NHFILE *nhfp, xint8 lev) { boolean set_uz_save = (g.uz_save.dnum == 0 && g.uz_save.dlevel == 0); @@ -470,7 +470,7 @@ savelev(NHFILE *nhfp, xchar lev) } static void -savelev_core(NHFILE *nhfp, xchar lev) +savelev_core(NHFILE *nhfp, xint8 lev) { #ifdef TOS short tlev; @@ -636,9 +636,9 @@ savelevl(NHFILE* nhfp, boolean rlecomp) /* save Plane of Water's air bubbles and Plane of Air's clouds */ static void -save_bubbles(NHFILE *nhfp, xchar lev) +save_bubbles(NHFILE *nhfp, xint8 lev) { - xchar bbubbly; + xint8 bbubbly; /* air bubbles and clouds used to be saved as part of game state because restoring them needs dungeon data that isn't available diff --git a/src/shk.c b/src/shk.c index ff843f853..0b8733947 100644 --- a/src/shk.c +++ b/src/shk.c @@ -63,9 +63,9 @@ static struct damage *find_damage(struct monst *); static void discard_damage_struct(struct damage *); static void discard_damage_owned_by(struct monst *); static void shk_fixes_damage(struct monst *); -static xchar *litter_getpos(int *, xchar, xchar, struct monst *); -static void litter_scatter(xchar *, int, xchar, xchar, struct monst *); -static void litter_newsyms(xchar *, xchar, xchar); +static coordxy *litter_getpos(int *, coordxy, coordxy, struct monst *); +static void litter_scatter(coordxy *, int, coordxy, coordxy, struct monst *); +static void litter_newsyms(coordxy *, coordxy, coordxy); static int repair_damage(struct monst *, struct damage *, boolean); static void sub_one_frombill(struct obj *, struct monst *); static void add_one_tobill(struct obj *, boolean, struct monst *); @@ -344,7 +344,7 @@ call_kops(register struct monst* shkp, register boolean nearshop) { coord mm; - xchar sx = 0, sy = 0; + coordxy sx = 0, sy = 0; choose_stairs(&sx, &sy, TRUE); @@ -374,7 +374,7 @@ call_kops(register struct monst* shkp, register boolean nearshop) /* x,y is strictly inside shop */ char -inside_shop(register xchar x, register xchar y) +inside_shop(register coordxy x, register coordxy y) { register char rno; @@ -468,7 +468,7 @@ credit_report(struct monst *shkp, int idx, boolean silent) /* robbery from outside the shop via telekinesis or grappling hook */ void -remote_burglary(xchar x, xchar y) +remote_burglary(coordxy x, coordxy y) { struct monst *shkp; struct eshk *eshkp; @@ -1045,7 +1045,7 @@ pay(long tmp, register struct monst* shkp) static void home_shk(struct monst *shkp, boolean killkops) { - xchar x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y; + coordxy x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y; (void) mnearto(shkp, x, y, TRUE, RLOC_NOMSG); g.level.flags.has_shop = 1; @@ -1189,7 +1189,7 @@ hot_pursuit(register struct monst* shkp) the shop. These conditions must be checked by the calling function. */ /*ARGSUSED*/ void -make_angry_shk(struct monst* shkp, xchar ox UNUSED, xchar oy UNUSED) +make_angry_shk(struct monst* shkp, coordxy ox UNUSED, coordxy oy UNUSED) /* predate 'noit_Monnam()', let alone Shknam() */ { struct eshk *eshkp = ESHK(shkp); @@ -1884,7 +1884,7 @@ inherits(struct monst* shkp, int numsk, int croaked, boolean silently) static void set_repo_loc(struct monst* shkp) { - register xchar ox, oy; + register coordxy ox, oy; struct eshk *eshkp = ESHK(shkp); /* if you're not in this shk's shop room, or if you're in its doorway @@ -1992,7 +1992,7 @@ get_cost_of_shop_item( { struct monst *shkp; struct obj *top; - xchar x, y; + coordxy x, y; boolean freespot; long cost = 0L; @@ -2172,7 +2172,7 @@ contained_cost( boolean unpaid_only) { register struct obj *otmp, *top; - xchar x, y; + coordxy x, y; boolean on_floor, freespot; for (top = obj; top->where == OBJ_CONTAINED; top = top->ocontainer) @@ -2433,7 +2433,7 @@ unpaid_cost( long amt = 0L; #if 0 /* if two shops share a wall, this might find wrong shk */ - xchar ox, oy; + coordxy ox, oy; if (!get_obj_location(unp_obj, &ox, &oy, BURIED_TOO | CONTAINED_TOO)) ox = u.ux, oy = u.uy; /* (shouldn't happen) */ @@ -2903,8 +2903,8 @@ stolen_container( long stolen_value( struct obj *obj, - xchar x, - xchar y, + coordxy x, + coordxy y, boolean peaceful, boolean silent) { @@ -3066,7 +3066,7 @@ sellobj_state(int deliberate) } void -sellobj(register struct obj* obj, xchar x, xchar y) +sellobj(register struct obj* obj, coordxy x, coordxy y) { register struct monst *shkp; register struct eshk *eshkp; @@ -3446,7 +3446,7 @@ getprice(register struct obj* obj, boolean shk_buying) /* shk catches thrown pick-axe */ struct monst * -shkcatch(register struct obj* obj, register xchar x, register xchar y) +shkcatch(register struct obj* obj, register coordxy x, register coordxy y) { register struct monst *shkp; @@ -3479,8 +3479,8 @@ shkcatch(register struct obj* obj, register xchar x, register xchar y) void add_damage( - register xchar x, - register xchar y, + register coordxy x, + register coordxy y, long cost) { struct damage *tmp_dam; @@ -3533,7 +3533,7 @@ shk_impaired(struct monst *shkp) static boolean repairable_damage(struct damage *dam, struct monst *shkp) { - xchar x, y; + coordxy x, y; struct trap* ttmp; struct monst *mtmp; @@ -3614,7 +3614,7 @@ discard_damage_owned_by(struct monst *shkp) struct damage *dam = g.level.damagelist, *dam2, *prevdam = NULL; while (dam) { - xchar x = dam->place.x, y = dam->place.y; + coordxy x = dam->place.x, y = dam->place.y; if (index(in_rooms(x, y, SHOPBASE), ESHK(shkp)->shoproom)) { dam2 = dam->next; @@ -3664,10 +3664,10 @@ shk_fixes_damage(struct monst *shkp) #define horiz(i) ((i % 3) - 1) #define vert(i) ((i / 3) - 1) -static xchar * -litter_getpos(int *k, xchar x, xchar y, struct monst *shkp) +static coordxy * +litter_getpos(int *k, coordxy x, coordxy y, struct monst *shkp) { - static xchar litter[9]; + static xint16 litter[9]; int i, ix, iy; (void) memset((genericptr_t) litter, 0, sizeof litter); @@ -3694,9 +3694,9 @@ litter_getpos(int *k, xchar x, xchar y, struct monst *shkp) static void litter_scatter( - xchar *litter, + xint16 *litter, int k, - xchar x, xchar y, + coordxy x, coordxy y, struct monst *shkp) { struct obj *otmp; @@ -3755,7 +3755,7 @@ litter_scatter( } static void -litter_newsyms(xchar *litter, xchar x, xchar y) +litter_newsyms(xint16 *litter, coordxy x, coordxy y) { int i; @@ -3780,8 +3780,8 @@ repair_damage( struct damage *tmp_dam, boolean catchup) { - xchar x, y; - xchar *litter; + coordxy x, y; + xint16 *litter; struct obj *otmp; struct trap *ttmp; int k, disposition = 1; @@ -3923,7 +3923,7 @@ fix_shop_damage(void) int shk_move(struct monst *shkp) { - xchar gx, gy, omx, omy; + coordxy gx, gy, omx, omy; int udist; schar appr; struct eshk *eshkp = ESHK(shkp); @@ -4179,7 +4179,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify) char shops_affected[5]; boolean uinshp = (*u.ushops != '\0'); char qbuf[80]; - xchar x, y; + coordxy x, y; boolean dugwall = (!strcmp(dmgstr, "dig into") /* wand */ || !strcmp(dmgstr, "damage")); /* pick-axe */ boolean animal, pursue; @@ -4329,7 +4329,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify) if (yn(qbuf) != 'n') { boolean is_seen, was_seen = canseemon(shkp), was_outside = !inhishop(shkp); - xchar sx = shkp->mx, sy = shkp->my; + coordxy sx = shkp->mx, sy = shkp->my; cost_of_damage = check_credit(cost_of_damage, shkp); if (cost_of_damage > 0L) { @@ -4367,7 +4367,7 @@ pay_for_damage(const char* dmgstr, boolean cant_mollify) /* called in dokick.c when we kick an object that might be in a store */ boolean -costly_spot(register xchar x, register xchar y) +costly_spot(register coordxy x, register coordxy y) { struct monst *shkp; struct eshk *eshkp; @@ -4385,7 +4385,7 @@ costly_spot(register xchar x, register xchar y) /* called by dotalk(sounds.c) when #chatting; returns obj if location contains shop goods and shopkeeper is willing & able to speak */ struct obj * -shop_object(register xchar x, register xchar y) +shop_object(register coordxy x, register coordxy y) { register struct obj *otmp; register struct monst *shkp; @@ -4726,7 +4726,7 @@ check_unpaid(struct obj* otmp) } void -costly_gold(xchar x, xchar y, long amount, boolean silent) +costly_gold(coordxy x, coordxy y, long amount, boolean silent) { register long delta; register struct monst *shkp; @@ -4765,7 +4765,7 @@ costly_gold(xchar x, xchar y, long amount, boolean silent) /* used in domove to block diagonal shop-exit */ /* x,y should always be a door */ boolean -block_door(register xchar x, register xchar y) +block_door(register coordxy x, register coordxy y) { register int roomno = *in_rooms(x, y, SHOPBASE); register struct monst *shkp; @@ -4799,9 +4799,9 @@ block_door(register xchar x, register xchar y) /* used in domove to block diagonal shop-entry; u.ux, u.uy should always be a door */ boolean -block_entry(register xchar x, register xchar y) +block_entry(register coordxy x, register coordxy y) { - register xchar sx, sy; + register coordxy sx, sy; register int roomno; register struct monst *shkp; @@ -4860,7 +4860,7 @@ static char * shk_owns(char *buf, struct obj *obj) { struct monst *shkp; - xchar x, y; + coordxy x, y; if (get_obj_location(obj, &x, &y, 0) && (obj->unpaid || (obj->where == OBJ_FLOOR && !obj->no_charge diff --git a/src/sp_lev.c b/src/sp_lev.c index e47fa92da..71bc99fe4 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -18,7 +18,7 @@ typedef void (*select_iter_func)(int, int, genericptr); extern void mkmap(lev_init *); -static boolean match_maptyps(xchar, xchar); +static boolean match_maptyps(xint16, xint16); static void solidify_map(void); static void lvlfill_maze_grid(int, int, int, int, schar); static void lvlfill_solid(schar, schar); @@ -28,7 +28,7 @@ static void flip_drawbridge_vertical(struct rm *); static void flip_visuals(int, int, int, int, int); static int flip_encoded_direction_bits(int, int); static void sel_set_wall_property(int, int, genericptr_t); -static void set_wall_property(xchar, xchar, xchar, xchar, int); +static void set_wall_property(coordxy, coordxy, coordxy, coordxy, int); static void count_features(void); static void remove_boundary_syms(void); static void set_door_orientation(int, int); @@ -37,15 +37,15 @@ static void maybe_add_door(int, int, struct mkroom *); static void link_doors_rooms(void); static int rnddoor(void); static int rndtrap(void); -static void get_location(xchar *, xchar *, getloc_flags_t, struct mkroom *); -static void set_ok_location_func(boolean (*)(xchar, xchar)); -static boolean is_ok_location(xchar, xchar, getloc_flags_t); +static void get_location(coordxy *, coordxy *, getloc_flags_t, struct mkroom *); +static void set_ok_location_func(boolean (*)(coordxy, coordxy)); +static boolean is_ok_location(coordxy, coordxy, getloc_flags_t); static unpacked_coord get_unpacked_coord(long, int); -static void get_room_loc(xchar *, xchar *, struct mkroom *); -static void get_free_room_loc(xchar *, xchar *, struct mkroom *, +static void get_room_loc(coordxy *, coordxy *, struct mkroom *); +static void get_free_room_loc(coordxy *, coordxy *, struct mkroom *, packed_coord); -static boolean create_subroom(struct mkroom *, xchar, xchar, xchar, - xchar, xchar, xchar); +static boolean create_subroom(struct mkroom *, coordxy, coordxy, coordxy, + coordxy, xint16, xint16); static void create_door(room_door *, struct mkroom *); static void create_trap(spltrap *, struct mkroom *); static int noncoalignment(aligntyp); @@ -55,7 +55,7 @@ static unsigned int sp_amask_to_amask(unsigned int sp_amask); static void create_monster(monster *, struct mkroom *); static void create_object(object *, struct mkroom *); static void create_altar(altar *, struct mkroom *); -static boolean search_door(struct mkroom *, xchar *, xchar *, xchar, int); +static boolean search_door(struct mkroom *, coordxy *, coordxy *, coordxy, int); static void create_corridor(corridor *); static struct mkroom *build_room(room *, struct mkroom *); static void light_region(region *); @@ -100,10 +100,10 @@ static void get_table_xy_or_coord(lua_State *, lua_Integer *, lua_Integer *); static int get_table_region(lua_State *, const char *, lua_Integer *, lua_Integer *, lua_Integer *, lua_Integer *, boolean); static void set_wallprop_in_selection(lua_State *, int); -static xchar random_wdir(void); +static coordxy random_wdir(void); static int floodfillchk_match_under(int, int); static int floodfillchk_match_accessible(int, int); -static boolean sel_flood_havepoint(int, int, xchar *, xchar *, int); +static boolean sel_flood_havepoint(int, int, coordxy *, coordxy *, int); static long line_dist_coord(long, long, long, long, long, long); static void l_push_mkroom_table(lua_State *, struct mkroom *); static int get_table_align(lua_State *); @@ -200,7 +200,7 @@ static struct monst *invent_carrying_monster = (struct monst *) 0; /* Does typ match with levl[][].typ, considering special types MATCH_WALL and MAX_TYPE (aka transparency)? */ static boolean -match_maptyps(xchar typ, xchar levltyp) +match_maptyps(xint16 typ, xint16 levltyp) { if ((typ == MATCH_WALL) && !IS_STWALL(levltyp)) return FALSE; @@ -300,7 +300,7 @@ mapfrag_match(struct mapfragment* mf, int x, int y) static void solidify_map(void) { - xchar x, y; + coordxy x, y; for (x = 0; x < COLNO; x++) for (y = 0; y < ROWNO; y++) @@ -870,9 +870,9 @@ sel_set_wall_property(int x, int y, genericptr_t arg) * Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able */ static void -set_wall_property(xchar x1, xchar y1, xchar x2, xchar y2, int prop) +set_wall_property(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int prop) { - register xchar x, y; + register coordxy x, y; x1 = max(x1, 1); x2 = min(x2, COLNO - 1); @@ -890,7 +890,7 @@ set_wall_property(xchar x1, xchar y1, xchar x2, xchar y2, int prop) static void count_features(void) { - xchar x, y; + coordxy x, y; g.level.flags.nfountains = g.level.flags.nsinks = 0; for (y = 0; y < ROWNO; y++) @@ -911,7 +911,7 @@ remove_boundary_syms(void) * are laid out. CROSSWALLS are used to specify "invisible" * boundaries where DOOR syms look bad or aren't desirable. */ - xchar x, y; + coordxy x, y; boolean has_bounds = FALSE; for (x = 0; x < COLNO - 1; x++) @@ -1087,7 +1087,7 @@ rndtrap(void) */ static void get_location( - xchar *x, xchar *y, + coordxy *x, coordxy *y, getloc_flags_t humidity, struct mkroom *croom) { @@ -1155,16 +1155,16 @@ get_location( } } -static boolean (*is_ok_location_func)(xchar, xchar) = NULL; +static boolean (*is_ok_location_func)(coordxy, coordxy) = NULL; static void -set_ok_location_func(boolean (*func)(xchar, xchar)) +set_ok_location_func(boolean (*func)(coordxy, coordxy)) { is_ok_location_func = func; } static boolean -is_ok_location(xchar x, xchar y, getloc_flags_t humidity) +is_ok_location(coordxy x, coordxy y, getloc_flags_t humidity) { register int typ = levl[x][y].typ; @@ -1222,7 +1222,7 @@ get_unpacked_coord(long loc, int defhumidity) void get_location_coord( - xchar *x, xchar *y, + coordxy *x, coordxy *y, int humidity, struct mkroom *croom, long crd) @@ -1243,7 +1243,7 @@ get_location_coord( * negative values for x or y means RANDOM! */ static void -get_room_loc(xchar *x, xchar *y, struct mkroom *croom) +get_room_loc(coordxy *x, coordxy *y, struct mkroom *croom) { coord c; @@ -1269,11 +1269,11 @@ get_room_loc(xchar *x, xchar *y, struct mkroom *croom) */ static void get_free_room_loc( - xchar *x, xchar *y, + coordxy *x, coordxy *y, struct mkroom *croom, packed_coord pos) { - xchar try_x, try_y; + coordxy try_x, try_y; register int trycnt = 0; get_location_coord(&try_x, &try_y, DRY, croom, pos); @@ -1291,14 +1291,14 @@ get_free_room_loc( boolean check_room( - xchar *lowx, xchar *ddx, - xchar *lowy, xchar *ddy, + coordxy *lowx, coordxy *ddx, + coordxy *lowy, coordxy *ddy, boolean vault) { register int x, y, hix = *lowx + *ddx, hiy = *lowy + *ddy; register struct rm *lev; int xlim, ylim, ymax; - xchar s_lowx, s_ddx, s_lowy, s_ddy; + coordxy s_lowx, s_ddx, s_lowy, s_ddy; s_lowx = *lowx; s_ddx = *ddx; s_lowy = *lowy; s_ddy = *ddy; @@ -1370,12 +1370,12 @@ check_room( */ boolean create_room( - xchar x, xchar y, - xchar w, xchar h, - xchar xal, xchar yal, - xchar rtype, xchar rlit) + coordxy x, coordxy y, + coordxy w, coordxy h, + coordxy xal, coordxy yal, + xint16 rtype, xint16 rlit) { - xchar xabs = 0, yabs = 0; + coordxy xabs = 0, yabs = 0; int wtmp, htmp, xaltmp, yaltmp, xtmp, ytmp; NhRect *r1 = 0, r2; int trycnt = 0; @@ -1403,7 +1403,7 @@ create_room( * it up. */ do { - xchar xborder, yborder; + coordxy xborder, yborder; wtmp = w; htmp = h; @@ -1416,7 +1416,7 @@ create_room( if ((xtmp < 0 && ytmp < 0 && wtmp < 0 && xaltmp < 0 && yaltmp < 0) || vault) { - xchar hx, hy, lx, ly, dx, dy; + coordxy hx, hy, lx, ly, dx, dy; r1 = rnd_rect(); /* Get a random rectangle */ @@ -1464,7 +1464,7 @@ create_room( r2.hy = yabs + htmp; } else { /* Only some parameters are random */ int rndpos = 0; - xchar dx, dy; + coordxy dx, dy; if (xtmp < 0 && ytmp < 0) { /* Position is RANDOM */ xtmp = rnd(5); @@ -1552,11 +1552,11 @@ create_room( static boolean create_subroom( struct mkroom *proom, - xchar x, xchar y, - xchar w, xchar h, - xchar rtype, xchar rlit) + coordxy x, coordxy y, + coordxy w, coordxy h, + xint16 rtype, xint16 rlit) { - xchar width, height; + coordxy width, height; width = proom->hx - proom->lx + 1; height = proom->hy - proom->ly + 1; @@ -1696,7 +1696,7 @@ create_door(room_door *dd, struct mkroom *broom) static void create_trap(spltrap* t, struct mkroom* croom) { - xchar x = -1, y = -1; + coordxy x = -1, y = -1; coord tm; int mktrap_flags = MKTRAP_MAZEFLAG; @@ -1804,7 +1804,7 @@ static void create_monster(monster* m, struct mkroom* croom) { struct monst *mtmp; - xchar x, y; + coordxy x, y; char class; unsigned int amask; coord cc; @@ -2053,7 +2053,7 @@ static void create_object(object* o, struct mkroom* croom) { struct obj *otmp; - xchar x, y; + coordxy x, y; char c; boolean named; /* has a name been supplied in level description? */ @@ -2297,7 +2297,7 @@ static void create_altar(altar* a, struct mkroom* croom) { schar sproom; - xchar x = -1, y = -1; + coordxy x = -1, y = -1; unsigned int amask; boolean croom_is_temple = TRUE; @@ -2342,8 +2342,8 @@ create_altar(altar* a, struct mkroom* croom) static boolean search_door( struct mkroom* croom, - xchar *x, xchar * y, - xchar wall, int cnt) + coordxy *x, coordxy * y, + xint16 wall, int cnt) { int dx, dy; int xx, yy; @@ -2652,7 +2652,7 @@ build_room(room *r, struct mkroom* mkr) { boolean okroom; struct mkroom *aroom; - xchar rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM; + xint16 rtype = (!r->chance || rn2(100) < r->chance) ? r->rtype : OROOM; if (mkr) { aroom = &g.subrooms[g.nsubroom]; @@ -2755,9 +2755,9 @@ maze1xy(coord *m, int humidity) if (--tryct < 0) break; /* give up */ } while (!(x % 2) || !(y % 2) || SpLev_Map[x][y] - || !is_ok_location((xchar) x, (xchar) y, humidity)); + || !is_ok_location((coordxy) x, (coordxy) y, humidity)); - m->x = (xchar) x, m->y = (xchar) y; + m->x = (coordxy) x, m->y = (coordxy) y; } /* @@ -2771,7 +2771,7 @@ static void fill_empty_maze(void) { int mapcountmax, mapcount, mapfact; - xchar x, y; + coordxy x, y; coord mm; mapcountmax = mapcount = (g.x_maze_max - 2) * (g.y_maze_max - 2); @@ -3643,7 +3643,7 @@ lspo_engraving(lua_State *L) int etyp = DUST; char *txt = (char *) 0; long ecoord; - xchar x = -1, y = -1; + coordxy x = -1, y = -1; int argc = lua_gettop(L); create_des_coder(); @@ -3874,7 +3874,7 @@ spo_endroom(struct sp_coder* coder UNUSED) /* callback for is_ok_location. stairs generated at random location shouldn't overwrite special terrain */ static boolean -good_stair_loc(xchar x, xchar y) +good_stair_loc(coordxy x, coordxy y) { schar typ = levl[x][y].typ; @@ -3887,7 +3887,7 @@ l_create_stairway(lua_State *L, boolean using_ladder) static const char *const stairdirs[] = { "down", "up", NULL }; static const int stairdirs2i[] = { 0, 1 }; int argc = lua_gettop(L); - xchar x = -1, y = -1; + coordxy x = -1, y = -1; struct trap *badtrap; long scoord; @@ -3981,7 +3981,7 @@ int lspo_grave(lua_State *L) { int argc = lua_gettop(L); - xchar x, y; + coordxy x, y; long scoord; lua_Integer ax,ay; char *txt; @@ -4202,7 +4202,7 @@ int lspo_gold(lua_State *L) { int argc = lua_gettop(L); - xchar x, y; + coordxy x, y; long amount; long gcoord; lua_Integer gx, gy; @@ -4330,7 +4330,7 @@ selection_clone(struct selectionvar* sel) return tmps; } -xchar +coordxy selection_getpoint(int x, int y, struct selectionvar* sel) { if (!sel || !sel->map) @@ -4342,7 +4342,7 @@ selection_getpoint(int x, int y, struct selectionvar* sel) } void -selection_setpoint(int x, int y, struct selectionvar* sel, xchar c) +selection_setpoint(int x, int y, struct selectionvar* sel, coordxy c) { if (!sel || !sel->map) return; @@ -4366,7 +4366,7 @@ selection_not(struct selectionvar* s) } struct selectionvar * -selection_filter_mapchar(struct selectionvar* ov, xchar typ, int lit) +selection_filter_mapchar(struct selectionvar* ov, coordxy typ, int lit) { int x, y; struct selectionvar *ret; @@ -4412,7 +4412,7 @@ selection_filter_percent(struct selectionvar* ov, int percent) } int -selection_rndcoord(struct selectionvar* ov, xchar *x, xchar *y, boolean removeit) +selection_rndcoord(struct selectionvar* ov, coordxy *x, coordxy *y, boolean removeit) { int idx = 0; int c; @@ -4443,10 +4443,10 @@ selection_rndcoord(struct selectionvar* ov, xchar *x, xchar *y, boolean removeit } /* Choose a single random W_* direction. */ -static xchar +static coordxy random_wdir(void) { - static const xchar wdirs[4] = { W_NORTH, W_SOUTH, W_EAST, W_WEST }; + static const coordxy wdirs[4] = { W_NORTH, W_SOUTH, W_EAST, W_WEST }; return wdirs[rn2(4)]; } @@ -4510,7 +4510,7 @@ floodfillchk_match_under(int x, int y) } void -set_floodfillchk_match_under(xchar typ) +set_floodfillchk_match_under(coordxy typ) { floodfillchk_match_under_typ = typ; set_selection_floodfillchk(floodfillchk_match_under); @@ -4526,9 +4526,9 @@ floodfillchk_match_accessible(int x, int y) /* check whethere is already in xs[],ys[] */ static boolean -sel_flood_havepoint(int x, int y, xchar xs[], xchar ys[], int n) +sel_flood_havepoint(int x, int y, coordxy xs[], coordxy ys[], int n) { - xchar xx = (xchar) x, yy = (xchar) y; + coordxy xx = (coordxy) x, yy = (coordxy) y; while (n > 0) { --n; @@ -4562,8 +4562,8 @@ selection_floodfill(struct selectionvar* ov, int x, int y, boolean diagonals) } while (0) static const char floodfill_stack_overrun[] = "floodfill stack overrun"; int idx = 0; - xchar dx[SEL_FLOOD_STACK]; - xchar dy[SEL_FLOOD_STACK]; + coordxy dx[SEL_FLOOD_STACK]; + coordxy dy[SEL_FLOOD_STACK]; if (selection_flood_check_func == (int (*)(int, int)) 0) { selection_free(tmp, TRUE); @@ -4767,8 +4767,8 @@ selection_do_gradient( /* bresenham line algo */ void selection_do_line( - xchar x1, xchar y1, - xchar x2, xchar y2, + coordxy x1, coordxy y1, + coordxy x2, coordxy y2, struct selectionvar *ov) { int d0, dx, dy, ai, bi, xi, yi; @@ -4824,8 +4824,8 @@ selection_do_line( void selection_do_randline( - xchar x1, xchar y1, - xchar x2, xchar y2, + coordxy x1, coordxy y1, + coordxy x2, coordxy y2, schar rough, schar rec, struct selectionvar *ov) @@ -4912,8 +4912,8 @@ sel_set_feature(int x, int y, genericptr_t arg) static void sel_set_door(int dx, int dy, genericptr_t arg) { - xchar typ = *(xchar *) arg; - xchar x = dx, y = dy; + coordxy typ = *(coordxy *) arg; + coordxy x = dx, y = dy; if (!IS_DOOR(levl[x][y].typ) && levl[x][y].typ != SDOOR) levl[x][y].typ = (typ & D_SECRET) ? SDOOR : DOOR; @@ -4942,8 +4942,8 @@ lspo_door(lua_State *L) -1, D_ISOPEN, D_CLOSED, D_LOCKED, D_NODOOR, D_BROKEN, D_SECRET }; int msk; - xchar x, y; - xchar typ; + coordxy x, y; + coordxy typ; int argc = lua_gettop(L); create_des_coder(); @@ -4962,7 +4962,7 @@ lspo_door(lua_State *L) msk = doorstates2i[get_table_option(L, "state", "random", doorstates)]; } - typ = (msk == -1) ? rnddoor() : (xchar) msk; + typ = (msk == -1) ? rnddoor() : (coordxy) msk; if (x == -1 && y == -1) { static const char *const walldirs[] = { @@ -5020,19 +5020,19 @@ int nhl_abs_coord(lua_State *L) { int argc = lua_gettop(L); - xchar x = -1, y = -1; + coordxy x = -1, y = -1; if (argc == 2) { - x = (xchar) lua_tointeger(L, 1); - y = (xchar) lua_tointeger(L, 2); + x = (coordxy) lua_tointeger(L, 1); + y = (coordxy) lua_tointeger(L, 2); x += g.xstart; y += g.ystart; lua_pushinteger(L, x); lua_pushinteger(L, y); return 2; } else if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) { - x = (xchar) get_table_int(L, "x"); - y = (xchar) get_table_int(L, "y"); + x = (coordxy) get_table_int(L, "x"); + y = (coordxy) get_table_int(L, "y"); x += g.xstart; y += g.ystart; lua_newtable(L); @@ -5057,7 +5057,7 @@ lspo_feature(lua_State *L) "throne", "tree", NULL }; static const int features2i[] = { FOUNTAIN, SINK, POOL, THRONE, TREE, STONE }; - xchar x, y; + coordxy x, y; int typ; int argc = lua_gettop(L); boolean can_have_flags = FALSE; @@ -5132,7 +5132,7 @@ int lspo_terrain(lua_State *L) { terrain tmpterrain; - xchar x = 0, y = 0; + coordxy x = 0, y = 0; struct selectionvar *sel = NULL; int argc = lua_gettop(L); @@ -5199,7 +5199,7 @@ lspo_terrain(lua_State *L) int lspo_replace_terrain(lua_State *L) { - xchar totyp, fromtyp; + coordxy totyp, fromtyp; struct mapfragment *mf = NULL; struct selectionvar *sel = NULL; boolean freesel = FALSE; @@ -5256,7 +5256,7 @@ lspo_replace_terrain(lua_State *L) if (x1 == -1 && y1 == -1 && x2 == -1 && y2 == -1) { (void) selection_not(sel); } else { - xchar rx1, ry1, rx2, ry2; + coordxy rx1, ry1, rx2, ry2; rx1 = x1, ry1 = y1, rx2 = x2, ry2 = y2; get_location(&rx1, &ry1, ANY_LOC, g.coder->croom); get_location(&rx2, &ry2, ANY_LOC, g.coder->croom); @@ -5296,7 +5296,7 @@ generate_way_out_method( WAN_TELEPORTATION, SCR_TELEPORTATION, RIN_TELEPORTATION }; struct selectionvar *ov2 = selection_new(), *ov3; - xchar x, y; + coordxy x, y; boolean res = TRUE; selection_floodfill(ov2, nx, ny, TRUE); @@ -5648,7 +5648,7 @@ add_doors_to_room(struct mkroom *croom) int lspo_region(lua_State *L) { - xchar dx1, dy1, dx2, dy2; + coordxy dx1, dy1, dx2, dy2; register struct mkroom *troom; boolean do_arrival_room = FALSE, room_not_needed, irregular = FALSE, joined = TRUE; @@ -5798,7 +5798,7 @@ lspo_drawbridge(lua_State *L) "open", "closed", "random", NULL }; static const int dbopens2i[] = { 1, 0, -1, -2 }; - xchar x, y; + coordxy x, y; lua_Integer mx, my; int dir; int db_open; @@ -5838,9 +5838,9 @@ lspo_mazewalk(lua_State *L) static const int mwdirs2i[] = { W_NORTH, W_SOUTH, W_EAST, W_WEST, W_RANDOM, -2 }; - xchar x, y; + coordxy x, y; lua_Integer mx, my; - xchar ftyp = ROOM; + coordxy ftyp = ROOM; int fstocked = 1, dir = -1; long mcoord; int argc = lua_gettop(L); @@ -5936,7 +5936,7 @@ lspo_wall_property(lua_State *L) { static const char *const wprops[] = { "nondiggable", "nonpasswall", NULL }; static const int wprop2i[] = { W_NONDIGGABLE, W_NONPASSWALL, -1 }; - xchar dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1; + coordxy dx1 = -1, dy1 = -1, dx2 = -1, dy2 = -1; int wprop; create_des_coder(); @@ -6292,7 +6292,7 @@ TODO: g.coder->croom needs to be updated g.xsize = COLNO - 1; g.ysize = ROWNO; } else { - xchar mptyp; + coordxy mptyp; /* Themed rooms should never overwrite anything */ if (g.in_mk_themerooms) { diff --git a/src/teleport.c b/src/teleport.c index a92fbe72f..6ef02d1af 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -180,7 +180,7 @@ goodpos( boolean enexto( coord *cc, - xchar xx, xchar yy, + coordxy xx, coordxy yy, struct permonst *mdat) { return (enexto_core(cc, xx, yy, mdat, GP_CHECKSCARY) @@ -190,7 +190,7 @@ enexto( boolean enexto_core( coord *cc, - xchar xx, xchar yy, + coordxy xx, coordxy yy, struct permonst *mdat, mmflags_nht entflags) { @@ -411,7 +411,7 @@ teleds(int nux, int nuy, int teleds_flags) } if (ball_active && (ball_still_in_range || allow_drag)) { int bc_control; - xchar ballx, bally, chainx, chainy; + coordxy ballx, bally, chainx, chainy; boolean cause_delay; if (drag_ball(nux, nuy, &bc_control, &ballx, &bally, &chainx, @@ -901,7 +901,7 @@ level_tele(void) } if (wizard && !strcmp(buf, "?")) { schar destlev; - xchar destdnum; + coordxy destdnum; levTport_menu: destlev = 0; @@ -1592,7 +1592,7 @@ mlevel_tele_trap( boolean rloco(register struct obj* obj) { - register xchar tx, ty, otx, oty; + register coordxy tx, ty, otx, oty; boolean restricted_fall; int try_limit = 4000; diff --git a/src/timeout.c b/src/timeout.c index 2631e523b..998e1388f 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -899,7 +899,7 @@ hatch_egg(anything *arg, long timeout) struct obj *egg; struct monst *mon, *mon2; coord cc; - xchar x, y; + coordxy x, y; boolean yours, silent, knows_egg = FALSE; boolean cansee_hatchspot = FALSE; int i, mnum, hatchcount = 0; @@ -1222,7 +1222,7 @@ burn_object(anything *arg, long timeout) { struct obj *obj = arg->a_obj; boolean canseeit, many, menorah, need_newsym, need_invupdate; - xchar x, y; + coordxy x, y; char whose[BUFSZ]; menorah = obj->otyp == CANDELABRUM_OF_INVOCATION; @@ -1604,7 +1604,7 @@ begin_burn(struct obj *obj, boolean already_lit) } if (obj->lamplit && !already_lit) { - xchar x, y; + coordxy x, y; if (get_obj_location(obj, &x, &y, CONTAINED_TOO | BURIED_TOO)) new_light_source(x, y, radius, LS_OBJECT, obj_to_any(obj)); @@ -1925,8 +1925,8 @@ timer_sanity_check(void) } } else if (curr->kind == TIMER_LEVEL) { long where = curr->arg.a_long; - xchar x = (xchar) ((where >> 16) & 0xFFFF), - y = (xchar) (where & 0xFFFF); + coordxy x = (coordxy) ((where >> 16) & 0xFFFF), + y = (coordxy) (where & 0xFFFF); if (!isok(x, y)) { impossible("timer sanity: spot timer %lu at <%d,%d>", @@ -2135,7 +2135,7 @@ obj_has_timer(struct obj* object, short timer_type) * */ void -spot_stop_timers(xchar x, xchar y, short func_index) +spot_stop_timers(coordxy x, coordxy y, short func_index) { timeout_proc cleanup_func; timer_element *curr, *prev, *next_timer = 0; @@ -2163,7 +2163,7 @@ spot_stop_timers(xchar x, xchar y, short func_index) * Returns 0L if no such timer. */ long -spot_time_expires(xchar x, xchar y, short func_index) +spot_time_expires(coordxy x, coordxy y, short func_index) { timer_element *curr; long where = (((long) x << 16) | ((long) y)); @@ -2177,7 +2177,7 @@ spot_time_expires(xchar x, xchar y, short func_index) } long -spot_time_left(xchar x, xchar y, short func_index) +spot_time_left(coordxy x, coordxy y, short func_index) { long expires = spot_time_expires(x, y, func_index); return (expires > 0L) ? expires - g.moves : 0L; diff --git a/src/trap.c b/src/trap.c index b841debdb..7d73c8fe6 100644 --- a/src/trap.c +++ b/src/trap.c @@ -7,7 +7,7 @@ extern const char *const destroy_strings[][3]; /* from zap.c */ -static void mk_trap_statue(xchar, xchar); +static void mk_trap_statue(coordxy, coordxy); static boolean keep_saddle_with_steedcorpse(unsigned, struct obj *, struct obj *); static boolean mu_maybe_destroy_web(struct monst *, boolean, struct trap *); @@ -41,9 +41,9 @@ static int trapeffect_selector(struct monst *, struct trap *, unsigned); static char *trapnote(struct trap *, boolean); static int choose_trapnote(struct trap *); static int steedintrap(struct trap *, struct obj *); -static void launch_drop_spot(struct obj *, xchar, xchar); +static void launch_drop_spot(struct obj *, coordxy, coordxy); static boolean find_random_launch_coord(struct trap *, coord *); -static int mkroll_launch(struct trap *, xchar, xchar, short, long); +static int mkroll_launch(struct trap *, coordxy, coordxy, short, long); static boolean isclearpath(coord *, int, schar, schar); static void dofiretrap(struct obj *); static void domagictrap(void); @@ -346,7 +346,7 @@ grease_protect( /* create a "living" statue at x,y */ static void -mk_trap_statue(xchar x, xchar y) +mk_trap_statue(coordxy x, coordxy y) { struct monst *mtmp; struct obj *otmp, *statue; @@ -599,8 +599,8 @@ fall_through( struct monst * animate_statue( struct obj *statue, - xchar x, - xchar y, + coordxy x, + coordxy y, int cause, int *fail_reason) { @@ -779,8 +779,8 @@ animate_statue( struct monst * activate_statue_trap( struct trap *trap, - xchar x, - xchar y, + coordxy x, + coordxy y, boolean shatter) { struct monst *mtmp = (struct monst *) 0; @@ -821,7 +821,7 @@ keep_saddle_with_steedcorpse( if (mtmp->m_id == steed_mid) { /* move saddle */ - xchar x, y; + coordxy x, y; if (get_obj_location(objchn, &x, &y, 0)) { obj_extract_self(saddle); place_object(saddle, x, y); @@ -851,8 +851,8 @@ mu_maybe_destroy_web( if (amorphous(mptr) || is_whirly(mptr) || flaming(mptr) || unsolid(mptr) || mptr == &mons[PM_GELATINOUS_CUBE]) { - xchar x = trap->tx; - xchar y = trap->ty; + coordxy x = trap->tx; + coordxy y = trap->ty; if (flaming(mptr) || acidic(mptr)) { if (domsg) { @@ -2241,7 +2241,7 @@ trapeffect_landmine( boolean trapkilled = FALSE; boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); struct permonst *mptr = mtmp->data; - xchar tx = trap->tx, ty = trap->ty; + coordxy tx = trap->tx, ty = trap->ty; if (rn2(3)) return Trap_Effect_Finished; /* monsters usually don't set it off */ @@ -2691,7 +2691,7 @@ blow_up_landmine(struct trap* trap) } static void -launch_drop_spot(struct obj* obj, xchar x, xchar y) +launch_drop_spot(struct obj* obj, coordxy x, coordxy y) { if (!obj) { g.launchplace.obj = (struct obj *) 0; @@ -3038,8 +3038,8 @@ find_random_launch_coord(struct trap *ttmp, coord *cc) int distance; int mindist = 4; int trycount = 0; - xchar dx, dy; - xchar x, y; + coordxy dx, dy; + coordxy x, y; if (!ttmp || !cc) return FALSE; @@ -3092,8 +3092,8 @@ find_random_launch_coord(struct trap *ttmp, coord *cc) static int mkroll_launch( struct trap *ttmp, - xchar x, - xchar y, + coordxy x, + coordxy y, short otyp, long ocount) { @@ -3134,7 +3134,7 @@ isclearpath( { struct trap *t; uchar typ; - xchar x, y; + coordxy x, y; x = cc->x; y = cc->y; @@ -3855,8 +3855,8 @@ boolean fire_damage( struct obj *obj, boolean force, - xchar x, - xchar y) + coordxy x, + coordxy y) { int chance; struct obj *otmp, *ncobj; @@ -3947,8 +3947,8 @@ fire_damage_chain( struct obj *chain, boolean force, boolean here, - xchar x, - xchar y) + coordxy x, + coordxy y) { struct obj *obj, *nobj; int num = 0; @@ -3970,7 +3970,7 @@ fire_damage_chain( /* obj has been thrown or dropped into lava; damage is worse than mere fire */ boolean -lava_damage(struct obj* obj, xchar x, xchar y) +lava_damage(struct obj* obj, coordxy x, coordxy y) { int otyp = obj->otyp, ocls = obj->oclass; @@ -4212,7 +4212,7 @@ water_damage_chain( boolean here) { struct obj *otmp; - xchar x, y; + coordxy x, y; if (!obj) return; @@ -4602,7 +4602,7 @@ static void move_into_trap(struct trap *ttmp) { int bc = 0; - xchar x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy; + coordxy x = ttmp->tx, y = ttmp->ty, bx, by, cx, cy; boolean unused; bx = by = cx = cy = 0; /* lint suppression */ @@ -5499,7 +5499,7 @@ chest_trap( struct monst *shkp = 0; long loss = 0L; boolean costly, insider; - xchar ox = obj->ox, oy = obj->oy; + coordxy ox = obj->ox, oy = obj->oy; /* the obj location need not be that of player */ costly = (costly_spot(ox, oy) @@ -6231,7 +6231,7 @@ ignite_items(struct obj* objchn) } void -trap_ice_effects(xchar x, xchar y, boolean ice_is_melting) +trap_ice_effects(coordxy x, coordxy y, boolean ice_is_melting) { struct trap *ttmp = t_at(x, y); diff --git a/src/vault.c b/src/vault.c index 231d389c8..4cedf6589 100644 --- a/src/vault.c +++ b/src/vault.c @@ -10,7 +10,7 @@ static void blackout(int, int); static void restfakecorr(struct monst *); static void parkguard(struct monst *); static boolean in_fcorridor(struct monst *, int, int); -static boolean find_guard_dest(struct monst *, xchar *, xchar *); +static boolean find_guard_dest(struct monst *, coordxy *, coordxy *); static void move_gold(struct obj *, int); static void wallify_vault(struct monst *); static void gd_mv_monaway(struct monst *, int, int); @@ -255,7 +255,7 @@ uleftvault(struct monst *grd) } static boolean -find_guard_dest(struct monst *guard, xchar *rx, xchar *ry) +find_guard_dest(struct monst *guard, coordxy *rx, coordxy *ry) { register int x, y, dd, lx, ly; @@ -309,7 +309,7 @@ invault(void) /* if time ok and no guard now. */ char buf[BUFSZ]; int x, y, gx, gy, typ; - xchar rx, ry; + coordxy rx, ry; long umoney; /* first find the goal for the guard */ @@ -535,8 +535,8 @@ invault(void) dug into an empty doorway (which could subsequently have been plugged with an intact door by use of locking magic) */ int vlt = EGD(guard)->vroom; - xchar lowx = g.rooms[vlt].lx, hix = g.rooms[vlt].hx; - xchar lowy = g.rooms[vlt].ly, hiy = g.rooms[vlt].hy; + coordxy lowx = g.rooms[vlt].lx, hix = g.rooms[vlt].hx; + coordxy lowy = g.rooms[vlt].ly, hiy = g.rooms[vlt].hy; if (x == lowx - 1 && y == lowy - 1) typ = TLCORNER; @@ -571,7 +571,7 @@ invault(void) static void move_gold(struct obj *gold, int vroom) { - xchar nx, ny; + coordxy nx, ny; remove_object(gold); newsym(gold->ox, gold->oy); @@ -588,7 +588,7 @@ wallify_vault(struct monst *grd) int x, y, typ; int vlt = EGD(grd)->vroom; char tmp_viz; - xchar lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1, + coordxy lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1, loy = g.rooms[vlt].ly - 1, hiy = g.rooms[vlt].hy + 1; struct monst *mon; struct obj *gold, *rocks; @@ -701,7 +701,7 @@ gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy) gdelta = distu(guardx, guardy); if (gdelta > 2 && see_it) { /* skip if player won't see it */ bestdelta = gdelta; - bestcc.x = (xchar) guardx, bestcc.y = (xchar) guardy; + bestcc.x = (coordxy) guardx, bestcc.y = (coordxy) guardy; tryct = 9; do { /* pick an available spot nearest the hero and also try diff --git a/src/vision.c b/src/vision.c index ae8dbf0e5..cbc6c5c52 100644 --- a/src/vision.c +++ b/src/vision.c @@ -23,7 +23,7 @@ * @...X +4 * */ -const xchar circle_data[] = { +const coordxy circle_data[] = { /* 0*/ 0, /* 1*/ 1, 1, /* 3*/ 2, 2, 1, @@ -49,7 +49,7 @@ const xchar circle_data[] = { * used for a single point: temporary light source of a camera flash * as it traverses its path. */ -const xchar circle_start[] = { +const coordxy circle_start[] = { /* 0*/ 0, /* 1*/ 1, /* 2*/ 3, @@ -74,26 +74,26 @@ const xchar circle_start[] = { /*------ local variables ------*/ -static xchar could_see[2][ROWNO][COLNO]; /* vision work space */ -static xchar *cs_rows0[ROWNO], *cs_rows1[ROWNO]; -static xchar cs_rmin0[ROWNO], cs_rmax0[ROWNO]; -static xchar cs_rmin1[ROWNO], cs_rmax1[ROWNO]; +static coordxy could_see[2][ROWNO][COLNO]; /* vision work space */ +static coordxy *cs_rows0[ROWNO], *cs_rows1[ROWNO]; +static coordxy cs_rmin0[ROWNO], cs_rmax0[ROWNO]; +static coordxy cs_rmin1[ROWNO], cs_rmax1[ROWNO]; static char viz_clear[ROWNO][COLNO]; /* vision clear/blocked map */ static char *viz_clear_rows[ROWNO]; -static xchar left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */ -static xchar right_ptrs[ROWNO][COLNO]; +static coordxy left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */ +static coordxy right_ptrs[ROWNO][COLNO]; /* Forward declarations. */ static void fill_point(int, int); static void dig_point(int, int); static void view_init(void); -static void view_from(int, int, xchar **, xchar *, xchar *, int, +static void view_from(int, int, coordxy **, coordxy *, coordxy *, int, void (*)(int, int, genericptr_t), genericptr_t); -static void get_unused_cs(xchar ***, xchar **, xchar **); -static void rogue_vision(xchar **, xchar *, xchar *); +static void get_unused_cs(coordxy ***, coordxy **, coordxy **); +static void rogue_vision(coordxy **, coordxy *, coordxy *); /* Macro definitions that I can't find anywhere. */ #define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0)) @@ -265,10 +265,10 @@ vision_reset(void) * to the unused vision work area. */ static void -get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax) +get_unused_cs(coordxy ***rows, coordxy **rmin, coordxy **rmax) { register int row; - register xchar *nrmin, *nrmax; + register coordxy *nrmin, *nrmax; if (g.viz_array == cs_rows0) { *rows = cs_rows1; @@ -284,7 +284,7 @@ get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax) nrmin = *rmin; nrmax = *rmax; - (void) memset((genericptr_t) **rows, 0, sizeof(xchar) * (ROWNO * COLNO)); /* see nothing */ + (void) memset((genericptr_t) **rows, 0, sizeof(coordxy) * (ROWNO * COLNO)); /* see nothing */ for (row = 0; row < ROWNO; row++) { /* set row min & max */ *nrmin++ = COLNO - 1; *nrmax++ = 1; @@ -304,7 +304,7 @@ get_unused_cs(xchar ***rows, xchar **rmin, xchar **rmax) * due to the one-sided lit wall hack. */ static void -rogue_vision(xchar **next, xchar *rmin, xchar *rmax) +rogue_vision(coordxy **next, coordxy *rmin, coordxy *rmax) { int rnum = levl[u.ux][u.uy].roomno - ROOMOFFSET; /* no SHARED... */ int start, stop, in_door, xhi, xlo, yhi, ylo; @@ -506,13 +506,13 @@ vision_recalc(int control) { extern unsigned char seenv_matrix[3][3]; /* from display.c */ static unsigned char colbump[COLNO + 1]; /* cols to bump sv */ - xchar **temp_array; /* points to the old vision array */ - xchar **next_array; /* points to the new vision array */ - xchar *next_row; /* row pointer for the new array */ - xchar *old_row; /* row pointer for the old array */ - xchar *next_rmin; /* min pointer for the new array */ - xchar *next_rmax; /* max pointer for the new array */ - const xchar *ranges; /* circle ranges -- used for xray & night vision */ + coordxy **temp_array; /* points to the old vision array */ + coordxy **next_array; /* points to the new vision array */ + coordxy *next_row; /* row pointer for the new array */ + coordxy *old_row; /* row pointer for the old array */ + coordxy *next_rmin; /* min pointer for the new array */ + coordxy *next_rmax; /* max pointer for the new array */ + const coordxy *ranges; /* circle ranges -- used for xray & night vision */ int row = 0; /* row counter (outer loop) */ int start, stop; /* inner loop starting/stopping index */ int dx, dy; /* one step from a lit door or lit wall (see below) */ @@ -1109,9 +1109,9 @@ fill_point(int row, int col) static int start_row; static int start_col; static int step; -static xchar **cs_rows; -static xchar *cs_left; -static xchar *cs_right; +static coordxy **cs_rows; +static coordxy *cs_left; +static coordxy *cs_right; static void (*vis_func)(int, int, genericptr_t); static genericptr_t varg; @@ -1603,8 +1603,8 @@ clear_path(int col1, int row1, int col2, int row2) /* * Defines local to Algorithm C. */ -static void right_side(int, int, int, const xchar *); -static void left_side(int, int, int, const xchar *); +static void right_side(int, int, int, const coordxy *); +static void left_side(int, int, int, const coordxy *); /* Initialize algorithm C (nothing). */ static void @@ -1623,7 +1623,7 @@ view_init(void) * limits points at range limit for current row, or NULL */ static void -right_side(int row, int left, int right_mark, const xchar *limits) +right_side(int row, int left, int right_mark, const coordxy *limits) { int right; /* right limit of "could see" */ int right_edge; /* right edge of an opening */ @@ -1631,9 +1631,9 @@ right_side(int row, int left, int right_mark, const xchar *limits) int deeper; /* if TRUE, call self as needed */ int result; /* set by q?_path() */ register int i; /* loop counter */ - register xchar *rowp = NULL; /* row optimization */ - xchar *row_min = NULL; /* left most [used by macro set_min()] */ - xchar *row_max = NULL; /* right most [used by macro set_max()] */ + register coordxy *rowp = NULL; /* row optimization */ + coordxy *row_min = NULL; /* left most [used by macro set_min()] */ + coordxy *row_max = NULL; /* right most [used by macro set_max()] */ int lim_max; /* right most limit of circle */ nrow = row + step; @@ -1811,13 +1811,13 @@ right_side(int row, int left, int right_mark, const xchar *limits) * extensive comments. */ static void -left_side(int row, int left_mark, int right, const xchar *limits) +left_side(int row, int left_mark, int right, const coordxy *limits) { int left, left_edge, nrow, deeper, result; register int i; - register xchar *rowp = NULL; - xchar *row_min = NULL; - xchar *row_max = NULL; + register coordxy *rowp = NULL; + coordxy *row_min = NULL; + coordxy *row_max = NULL; int lim_min; #ifdef GCC_WARN @@ -1954,16 +1954,16 @@ left_side(int row, int left_mark, int right, const xchar *limits) * arg argument for func */ static void -view_from(int srow, int scol, xchar **loc_cs_rows, - xchar *left_most, xchar *right_most, int range, +view_from(int srow, int scol, coordxy **loc_cs_rows, + coordxy *left_most, coordxy *right_most, int range, void (*func)(int, int, genericptr_t), genericptr_t arg) { register int i; /* loop counter */ - xchar *rowp; /* optimization for setting could_see */ + coordxy *rowp; /* optimization for setting could_see */ int nrow; /* the next row */ int left; /* the left-most visible column */ int right; /* the right-most visible column */ - const xchar *limits; /* range limit for next row */ + const coordxy *limits; /* range limit for next row */ /* Set globals for q?_path(), left_side(), and right_side() to use. */ start_col = scol; @@ -2003,7 +2003,7 @@ view_from(int srow, int scol, xchar **loc_cs_rows, if (right > scol + range) right = scol + range; } else - limits = (xchar *) 0; + limits = (coordxy *) 0; if (func) { for (i = left; i <= right; i++) @@ -2060,12 +2060,12 @@ do_clear_area(int scol, int srow, int range, { /* If not centered on hero, do the hard work of figuring the area */ if (scol != u.ux || srow != u.uy) { - view_from(srow, scol, (xchar **) 0, (xchar *) 0, (xchar *) 0, range, + view_from(srow, scol, (coordxy **) 0, (coordxy *) 0, (coordxy *) 0, range, func, arg); } else { register int x; int y, min_x, max_x, max_y, offset; - const xchar *limits; + const coordxy *limits; boolean override_vision; /* vision doesn't pass through water or clouds, detection should diff --git a/src/windows.c b/src/windows.c index 53462868c..79ac18cd8 100644 --- a/src/windows.c +++ b/src/windows.c @@ -511,7 +511,7 @@ static void hup_add_menu(winid, const glyph_info *, const anything *, char, char, int, int, const char *, unsigned int); static void hup_end_menu(winid, const char *); static void hup_putstr(winid, int, const char *); -static void hup_print_glyph(winid, xchar, xchar, const glyph_info *, +static void hup_print_glyph(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); static void hup_outrip(winid, int, time_t); static void hup_curs(winid, int, int); @@ -718,7 +718,7 @@ hup_putstr(winid window UNUSED, int attr UNUSED, const char *text UNUSED) /*ARGSUSED*/ static void hup_print_glyph(winid window UNUSED, - xchar x UNUSED, xchar y UNUSED, + coordxy x UNUSED, coordxy y UNUSED, const glyph_info *glyphinfo UNUSED, const glyph_info *bkglyphinfo UNUSED) { diff --git a/src/wizard.c b/src/wizard.c index 9f450acba..3f4acf884 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -314,7 +314,7 @@ strategy(struct monst *mtmp) heal or for guardians (Kops) to congregate at to block hero's progress */ void choose_stairs( - xchar *sx, xchar *sy, /* output; left as-is if no spot found */ + coordxy *sx, coordxy *sy, /* output; left as-is if no spot found */ boolean dir) /* True: forward, False: backtrack (usually up) */ { stairway *stway; @@ -353,7 +353,7 @@ int tactics(struct monst *mtmp) { unsigned long strat = strategy(mtmp); - xchar sx = 0, sy = 0, mx, my; + coordxy sx = 0, sy = 0, mx, my; mtmp->mstrategy = (mtmp->mstrategy & (STRAT_WAITMASK | STRAT_APPEARMSG)) | strat; @@ -394,7 +394,7 @@ tactics(struct monst *mtmp) default: /* kill, maim, pillage! */ { long where = (strat & STRAT_STRATMASK); - xchar tx = STRAT_GOALX(strat), ty = STRAT_GOALY(strat); + coordxy tx = STRAT_GOALX(strat), ty = STRAT_GOALY(strat); int targ = (int) (strat & STRAT_GOAL); struct obj *otmp; diff --git a/src/worm.c b/src/worm.c index b25f68b68..0b36e1028 100644 --- a/src/worm.c +++ b/src/worm.c @@ -11,7 +11,7 @@ /* worm segment structure */ struct wseg { struct wseg *nseg; - xchar wx, wy; /* the segment's position */ + coordxy wx, wy; /* the segment's position */ }; static void toss_wsegs(struct wseg *, boolean); @@ -368,7 +368,7 @@ wormhitu(struct monst *worm) * that both halves will survive. */ void -cutworm(struct monst *worm, xchar x, xchar y, +cutworm(struct monst *worm, coordxy x, coordxy y, boolean cuttier) /* hit is by wielded blade or axe or by thrown axe */ { struct wseg *curr, *new_tail; @@ -621,7 +621,7 @@ place_wsegs(struct monst *worm, struct monst *oldworm) struct wseg *curr = wtails[worm->wormno]; while (curr != wheads[worm->wormno]) { - xchar x = curr->wx, y = curr->wy; + coordxy x = curr->wx, y = curr->wy; struct monst *mtmp = m_at(x, y); if (oldworm && mtmp == oldworm) @@ -739,7 +739,7 @@ remove_worm(struct monst *worm) * be, if somehow the head is disjoint from the tail. */ void -place_worm_tail_randomly(struct monst *worm, xchar x, xchar y) +place_worm_tail_randomly(struct monst *worm, coordxy x, coordxy y) { int wnum = worm->wormno; struct wseg *curr = wtails[wnum]; @@ -810,8 +810,8 @@ place_worm_tail_randomly(struct monst *worm, xchar x, xchar y) #endif { place_worm_seg(worm, nx, ny); - curr->wx = (xchar) (ox = nx); - curr->wy = (xchar) (oy = ny); + curr->wx = (coordxy) (ox = nx); + curr->wy = (coordxy) (oy = ny); wtails[wnum] = curr; curr = curr->nseg; wtails[wnum]->nseg = new_tail; @@ -985,7 +985,7 @@ wseg_at(struct monst *worm, int x, int y) if (worm && worm->wormno && m_at(x, y) == worm) { struct wseg *curr; int i, n; - xchar wx = (xchar) x, wy = (xchar) y; + coordxy wx = (coordxy) x, wy = (coordxy) y; for (i = 0, curr = wtails[worm->wormno]; curr; curr = curr->nseg) { if (curr->wx == wx && curr->wy == wy) diff --git a/src/zap.c b/src/zap.c index 5792b5cd6..aa92c9803 100644 --- a/src/zap.c +++ b/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) /* '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)) { diff --git a/util/recover.c b/util/recover.c index 5e6b79f5a..2909d2dfa 100644 --- a/util/recover.c +++ b/util/recover.c @@ -208,7 +208,7 @@ restore_savefile(char *basename) { int gfd, lfd, sfd; int res = 0, lev, savelev, hpid, pltmpsiz, filecmc; - xchar levc; + coordxy levc; struct version_info version_data; struct savefile_info sfi; char plbuf[PL_NSIZ], indicator; @@ -345,14 +345,14 @@ restore_savefile(char *basename) (void) unlink(lock); for (lev = 1; lev < 256 && res == 0; lev++) { - /* level numbers are kept in xchars in save.c, so the + /* level numbers are kept in coordxys in save.c, so the * maximum level number (for the endlevel) must be < 256 */ if (lev != savelev) { lfd = open_levelfile(lev); if (lfd >= 0) { /* any or all of these may not exist */ - levc = (xchar) lev; + levc = (coordxy) lev; if (write(sfd, (genericptr_t) &levc, sizeof levc) != sizeof levc) res = -1; diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 577ec978f..1e3c6669b 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -522,7 +522,7 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y) } void NetHackQtBind::qt_print_glyph( - winid wid, xchar x, xchar y, + winid wid, coordxy x, coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED) { @@ -533,7 +533,7 @@ void NetHackQtBind::qt_print_glyph( #if 0 void NetHackQtBind::qt_print_glyph_compose( - winid wid, xchar x, xchar y, int glyph1, int glyph2) + winid wid, coordxy x, coordxy y, int glyph1, int glyph2) { NetHackQtWindow *window = id_to_window[(int) wid]; window->PrintGlyphCompose(x, y, glyph1, glyph2); diff --git a/win/Qt/qt_bind.h b/win/Qt/qt_bind.h index 5a6396014..4b3bc492b 100644 --- a/win/Qt/qt_bind.h +++ b/win/Qt/qt_bind.h @@ -63,7 +63,7 @@ public: static void qt_cliparound(int x, int y); static void qt_cliparound_window(winid wid, int x, int y); - static void qt_print_glyph(winid wid, xchar x, xchar y, + static void qt_print_glyph(winid wid, coordxy x, coordxy y, const glyph_info *glyphingo, const glyph_info *bkglyphinfo); static void qt_raw_print(const char *str); diff --git a/win/X11/winmap.c b/win/X11/winmap.c index c959e868c..f07f7a3a6 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -73,7 +73,7 @@ static void display_cursor(struct xwindow *); void X11_print_glyph( winid window, - xchar x, xchar y, + coordxy x, coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED) { @@ -894,7 +894,7 @@ display_map_window(struct xwindow *wp) check_cursor_visibility(wp); highlight_yn(TRUE); /* change fg/bg to match map */ } else if (wp->prevx != wp->cursx || wp->prevy != wp->cursy) { - register xchar x = wp->prevx, y = wp->prevy; + register coordxy x = wp->prevx, y = wp->prevy; /* * Previous cursor position is not the same as the current diff --git a/win/chain/wc_chainin.c b/win/chain/wc_chainin.c index 4cef23475..a5162581e 100644 --- a/win/chain/wc_chainin.c +++ b/win/chain/wc_chainin.c @@ -37,7 +37,7 @@ void chainin_cliparound(int, int); #ifdef POSITIONBAR void chainin_update_positionbar(char *); #endif -void chainin_print_glyph(winid, xchar, xchar, +void chainin_print_glyph(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); void chainin_raw_print(const char *); void chainin_raw_print_bold(const char *); @@ -345,8 +345,8 @@ chainin_update_positionbar(char *posbar) void chainin_print_glyph( winid window, - xchar x, - xchar y, + coordxy x, + coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo) { diff --git a/win/chain/wc_chainout.c b/win/chain/wc_chainout.c index 4fd855a03..a4f75a4c7 100644 --- a/win/chain/wc_chainout.c +++ b/win/chain/wc_chainout.c @@ -37,7 +37,7 @@ void chainout_cliparound(void *,int, int); #ifdef POSITIONBAR void chainout_update_positionbar(void *,char *); #endif -void chainout_print_glyph(void *,winid, xchar, xchar, +void chainout_print_glyph(void *,winid, coordxy, coordxy, const glyph_info *, const glyph_info *); void chainout_raw_print(void *,const char *); void chainout_raw_print_bold(void *,const char *); @@ -404,8 +404,8 @@ void chainout_print_glyph( void *vp, winid window, - xchar x, - xchar y, + coordxy x, + coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo) { diff --git a/win/chain/wc_trace.c b/win/chain/wc_trace.c index f19c043a5..7f6680a0d 100644 --- a/win/chain/wc_trace.c +++ b/win/chain/wc_trace.c @@ -64,7 +64,7 @@ void trace_cliparound(void *,int, int); #ifdef POSITIONBAR void trace_update_positionbar(void *,char *); #endif -void trace_print_glyph(void *,winid, xchar, xchar, +void trace_print_glyph(void *,winid, coordxy, coordxy, const glyph_info *, const glyph_info *); void trace_raw_print(void *,const char *); void trace_raw_print_bold(void *,const char *); @@ -645,8 +645,8 @@ void trace_print_glyph( void *vp, winid window, - xchar x, - xchar y, + coordxy x, + coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo) { diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 36612937c..0dc8d4c2f 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -771,7 +771,7 @@ print_glyph(window, x, y, glyphinfo, bkglyphinfo) */ void -curses_print_glyph(winid wid, xchar x, xchar y, +curses_print_glyph(winid wid, coordxy x, coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED) { int glyph; diff --git a/win/curses/cursstat.c b/win/curses/cursstat.c index a47abb287..791398205 100644 --- a/win/curses/cursstat.c +++ b/win/curses/cursstat.c @@ -289,7 +289,7 @@ draw_horizontal(boolean border) blPAD, blPAD, blPAD, blPAD } }; const enum statusfields (*fieldorder)[15]; - xchar spacing[MAXBLSTATS], valline[MAXBLSTATS]; + coordxy spacing[MAXBLSTATS], valline[MAXBLSTATS]; enum statusfields fld, prev_fld; char *text, *p, cbuf[BUFSZ], ebuf[STATVAL_WIDTH]; #ifdef SCORE_ON_BOTL @@ -690,7 +690,7 @@ draw_vertical(boolean border) BL_STR, BL_SCORE, BL_TIME, BL_LEVELDESC, BL_HP, BL_CONDITION, BL_CAP, BL_HUNGER }; - xchar spacing[MAXBLSTATS]; + coordxy spacing[MAXBLSTATS]; int i, fld, cap_and_hunger, time_and_score, cond_count, per_line; char *text; #ifdef STATUS_HILITES diff --git a/win/share/safeproc.c b/win/share/safeproc.c index 292aa3874..03131a1c4 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -298,8 +298,8 @@ safe_cliparound(int x, int y) void safe_print_glyph( winid window UNUSED, - xchar x UNUSED, - xchar y UNUSED, + coordxy x UNUSED, + coordxy y UNUSED, const glyph_info *glyphinfo UNUSED, const glyph_info *bkglyphinfo UNUSED) { diff --git a/win/shim/winshim.c b/win/shim/winshim.c index 3785a01e9..191f7c5b9 100644 --- a/win/shim/winshim.c +++ b/win/shim/winshim.c @@ -141,7 +141,7 @@ VDECLCB(shim_mark_synch,(void), "v") VDECLCB(shim_wait_synch,(void), "v") VDECLCB(shim_cliparound,(int x, int y), "vii", A2P x, A2P y) VDECLCB(shim_update_positionbar,(char *posbar), "vp", P2V posbar) -VDECLCB(shim_print_glyph,(winid w, xchar x, xchar y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo), "viiipp", A2P w, A2P x, A2P y, P2V glyphinfo, P2V bkglyphinfo) +VDECLCB(shim_print_glyph,(winid w, coordxy x, coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo), "viiipp", A2P w, A2P x, A2P y, P2V glyphinfo, P2V bkglyphinfo) VDECLCB(shim_raw_print,(const char *str), "vs", P2V str) VDECLCB(shim_raw_print_bold,(const char *str), "vs", P2V str) DECLCB(int, shim_nhgetch,(void), "i") diff --git a/win/tty/wintty.c b/win/tty/wintty.c index c82845ea8..fc4fc08ad 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -2774,8 +2774,7 @@ tty_destroy_nhwindow(winid window) } void -tty_curs( - winid window, +tty_curs(winid window, register int x, register int y) /* not xchar: perhaps xchar is unsigned * then curx-x would be unsigned too */ { @@ -3720,6 +3719,8 @@ tty_update_invent_slot( cell->refresh = 0; } } + tty_curs(window, 1, 0); + ttyDisplay->curx = 1; calling_from_update_inventory = FALSE; break; default: @@ -4156,7 +4157,7 @@ tty_cliparound(int x, int y) void tty_print_glyph( winid window, - xchar x, xchar y, + coordxy x, coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo UNUSED) { diff --git a/win/win32/mhmsg.h b/win/win32/mhmsg.h index 097b4fa37..9ccd1bd2d 100644 --- a/win/win32/mhmsg.h +++ b/win/win32/mhmsg.h @@ -34,8 +34,8 @@ typedef struct mswin_nhmsg_putstr { } MSNHMsgPutstr, *PMSNHMsgPutstr; typedef struct mswin_nhmsg_print_glyph { - xchar x; - xchar y; + coordxy x; + coordxy y; glyph_info glyphinfo; glyph_info bkglyphinfo; } MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph; diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 61e6c4ed7..077ea64f4 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1315,7 +1315,7 @@ print_glyph(window, x, y, glyphinfo, bkglyphinfo) */ void -mswin_print_glyph(winid wid, xchar x, xchar y, +mswin_print_glyph(winid wid, coordxy x, coordxy y, const glyph_info *glyphinfo, const glyph_info *bkglyphinfo) { logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", diff --git a/win/win32/winMS.h b/win/win32/winMS.h index 5c4b81f38..53a1fe70f 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -164,7 +164,7 @@ int mswin_select_menu(winid wid, int how, MENU_ITEM_P **selected); void mswin_mark_synch(void); void mswin_wait_synch(void); void mswin_cliparound(int x, int y); -void mswin_print_glyph(winid wid, xchar x, xchar y, +void mswin_print_glyph(winid wid, coordxy x, coordxy y, const glyph_info *glyph, const glyph_info *bkglyph); void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str);