From: nhmall Date: Sat, 2 Jul 2022 13:10:03 +0000 (-0400) Subject: be more consistent with coordinates X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3004cf2d345e3efec9164a9640cccaa385d5d76a;p=nethack be more consistent with coordinates --- diff --git a/include/extern.h b/include/extern.h index 711a0d621..36bf0ed39 100644 --- a/include/extern.h +++ b/include/extern.h @@ -165,7 +165,7 @@ extern void bc_sanity_check(void); /* ### bones.c ### */ extern void sanitize_name(char *); -extern void drop_upon_death(struct monst *, struct obj *, int, int); +extern void drop_upon_death(struct monst *, struct obj *, coordxy, coordxy); extern boolean can_make_bones(void); extern void savebones(int, time_t, struct obj *); extern int getbones(void); @@ -276,23 +276,23 @@ extern int extcmd_via_menu(void); extern int enter_explore_mode(void); extern boolean bind_key(uchar, const char *); extern void dokeylist(void); -extern int xytod(schar, schar); +extern coordxy xytod(coordxy, coordxy); extern void dtoxy(coord *, int); extern int movecmd(char, int); extern int dxdy_moveok(void); extern int getdir(const char *); extern void confdir(void); extern const char *directionname(int); -extern int isok(int, int); +extern int isok(coordxy, coordxy); extern int get_adjacent_loc(const char *, const char *, coordxy, coordxy, coord *); -extern const char *click_to_cmd(int, int, int); +extern const char *click_to_cmd(coordxy, coordxy, int); extern char get_count(const char *, char, long, cmdcount_nht *, unsigned); #ifdef HANGUPHANDLING extern void hangup(int); extern void end_of_input(void); #endif extern char readchar(void); -extern char readchar_poskey(int *, int *, int *); +extern char readchar_poskey(coordxy *, coordxy *, int *); extern void sanity_check(void); extern char* key2txt(uchar, char *); extern char yn_function(const char *, const char *, char); @@ -307,19 +307,19 @@ extern void free_nomakedefs(void); /* ### dbridge.c ### */ 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); -extern boolean is_ice(int, int); -extern boolean is_moat(int, int); +extern boolean is_pool(coordxy, coordxy); +extern boolean is_lava(coordxy, coordxy); +extern boolean is_pool_or_lava(coordxy, coordxy); +extern boolean is_ice(coordxy, coordxy); +extern boolean is_moat(coordxy, coordxy); extern schar db_under_typ(int); -extern int is_drawbridge_wall(int, int); -extern boolean is_db_wall(int, int); -extern boolean find_drawbridge(int *, int *); -extern boolean create_drawbridge(int, int, int, boolean); -extern void open_drawbridge(int, int); -extern void close_drawbridge(int, int); -extern void destroy_drawbridge(int, int); +extern int is_drawbridge_wall(coordxy, coordxy); +extern boolean is_db_wall(coordxy, coordxy); +extern boolean find_drawbridge(coordxy *, coordxy *); +extern boolean create_drawbridge(coordxy, coordxy, int, boolean); +extern void open_drawbridge(coordxy, coordxy); +extern void close_drawbridge(coordxy, coordxy); +extern void destroy_drawbridge(coordxy, coordxy); /* ### decl.c ### */ @@ -327,8 +327,8 @@ extern void decl_globals_init(void); /* ### detect.c ### */ -extern boolean trapped_chest_at(int, int, int); -extern boolean trapped_door_at(int, int, int); +extern boolean trapped_chest_at(int, coordxy, coordxy); +extern boolean trapped_door_at(int, coordxy, coordxy); extern struct obj *o_in(struct obj *, char); extern struct obj *o_material(struct obj *, unsigned); extern int gold_detect(struct obj *); @@ -343,7 +343,7 @@ extern void do_vicinity_map(struct obj *); extern void cvt_sdoor_to_door(struct rm *); extern int findit(void); extern int openit(void); -extern boolean detecting(void(*)(int, int, void *)); +extern boolean detecting(void(*)(coordxy, coordxy, void *)); extern void find_trap(struct trap *); extern void warnreveal(void); extern int dosearch0(int); @@ -360,8 +360,8 @@ extern int wiz_mgender(void); 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); -extern void digactualhole(int, int, struct monst *, int); +extern boolean dig_check(struct monst *, boolean, coordxy, coordxy); +extern void digactualhole(coordxy, coordxy, struct monst *, int); extern boolean dighole(boolean, boolean, coord *); extern int use_pick_axe(struct obj *); extern int use_pick_axe2(struct obj *); @@ -377,7 +377,7 @@ extern void rot_corpse(union any *, long); 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 schar fillholetyp(coordxy, coordxy, boolean); extern void liquid_flow(coordxy, coordxy, schar, struct trap *, const char *); extern boolean conjoined_pits(struct trap *, struct trap *, boolean); #if 0 @@ -406,17 +406,17 @@ 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(coordxy, coordxy); -extern boolean unmap_invisible(int, int); -extern void unmap_object(int, int); -extern void map_location(int, int, int); +extern boolean unmap_invisible(coordxy, coordxy); +extern void unmap_object(coordxy, coordxy); +extern void map_location(coordxy, coordxy, int); extern boolean suppress_map_output(void); 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 newsym(coordxy, coordxy); +extern void newsym_force(coordxy, coordxy); extern void shieldeff(coordxy, coordxy); -extern void tmp_at(int, int); -extern void flash_glyph_at(int, int, int, int); +extern void tmp_at(coordxy, coordxy); +extern void flash_glyph_at(coordxy, coordxy, int, int); extern void swallowed(int); extern void under_ground(int); extern void under_water(int); @@ -428,18 +428,18 @@ extern void curs_on_u(void); extern int doredraw(void); extern void docrt(void); extern void redraw_map(void); -extern void show_glyph(int, int, int); +extern void show_glyph(coordxy, coordxy, int); extern void clear_glyph_buffer(void); -extern void row_refresh(int, int, int); +extern void row_refresh(coordxy, coordxy, coordxy); extern void cls(void); extern void flush_screen(int); extern int back_to_glyph(coordxy, coordxy); extern int zapdir_to_glyph(int, int, int); extern int glyph_at(coordxy, coordxy); extern void reglyph_darkroom(void); -extern void xy_set_wall_state(int, int); +extern void xy_set_wall_state(coordxy, coordxy); extern void set_wall_state(void); -extern void unset_seenv(struct rm *, int, int, int, int); +extern void unset_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy); extern int warning_of(struct monst *); extern void map_glyphinfo(coordxy, coordxy, int, unsigned, glyph_info *); extern void reset_glyphmap(enum glyphmap_change_triggers trigger); @@ -448,8 +448,8 @@ extern int fn_cmap_to_glyph(int); /* ### do.c ### */ extern int dodrop(void); -extern boolean boulder_hits_pool(struct obj *, int, int, boolean); -extern boolean flooreffects(struct obj *, int, int, const char *); +extern boolean boulder_hits_pool(struct obj *, coordxy, coordxy, boolean); +extern boolean flooreffects(struct obj *, coordxy, coordxy, const char *); extern void doaltarobj(struct obj *); extern void trycall(struct obj *); extern boolean canletgo(struct obj *, const char *); @@ -481,11 +481,11 @@ extern void heal_legs(int); /* ### do_name.c ### */ -extern char *dxdy_to_dist_descr(int, int, boolean); -extern char *coord_desc(int, int, char *, char); +extern char *dxdy_to_dist_descr(coordxy, coordxy, boolean); +extern char *coord_desc(coordxy, coordxy, char *, char); extern boolean getpos_menu(coord *, int); extern int getpos(coord *, boolean, const char *); -extern void getpos_sethilite(void(*f)(int), boolean(*d)(int,int)); +extern void getpos_sethilite(void(*f)(int), boolean(*d)(coordxy,coordxy)); extern void new_mgivenname(struct monst *, int); extern void free_mgivenname(struct monst *); extern void new_oname(struct obj *, int); @@ -603,10 +603,10 @@ extern void wary_dog(struct monst *, boolean); /* ### dogmove.c ### */ -extern boolean cursed_object_at(int, int); +extern boolean cursed_object_at(coordxy, coordxy); extern struct obj *droppables(struct monst *); extern int dog_nutrition(struct monst *, struct obj *); -extern int dog_eat(struct monst *, struct obj *, int, int, boolean); +extern int dog_eat(struct monst *, struct obj *, coordxy, coordxy, boolean); extern int dog_move(struct monst *, int); extern void finish_meating(struct monst *); @@ -639,10 +639,10 @@ 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), +extern boolean walk_path(coord *, coord *, boolean(*)(void *, coordxy, coordxy), genericptr_t); -extern boolean hurtle_jump(genericptr_t, int, int); -extern boolean hurtle_step(genericptr_t, int, int); +extern boolean hurtle_jump(genericptr_t, coordxy, coordxy); +extern boolean hurtle_step(genericptr_t, coordxy, coordxy); /* ### drawing.c ### */ @@ -671,12 +671,12 @@ extern xint16 deepest_lev_reached(boolean); extern boolean on_level(d_level *, d_level *); extern void next_level(boolean); extern void prev_level(boolean); -extern void u_on_newpos(int, int); +extern void u_on_newpos(coordxy, coordxy); extern void u_on_rndspot(int); -extern void stairway_add(int,int, boolean, boolean, d_level *); +extern void stairway_add(coordxy, coordxy, boolean, boolean, d_level *); extern void stairway_print(void); extern void stairway_free_all(void); -extern stairway *stairway_at(int, int); +extern stairway *stairway_at(coordxy, coordxy); extern stairway *stairway_find(d_level *); extern stairway *stairway_find_from(d_level *, boolean); extern stairway *stairway_find_dir(boolean); @@ -693,7 +693,7 @@ extern void get_level(d_level *, int); extern boolean Is_botlevel(d_level *); extern boolean Can_fall_thru(d_level *); extern boolean Can_dig_down(d_level *); -extern boolean Can_rise_up(int, int, d_level *); +extern boolean Can_rise_up(coordxy, coordxy, d_level *); extern boolean has_ceiling(d_level *); extern boolean In_quest(d_level *); extern boolean In_mines(d_level *); @@ -702,7 +702,7 @@ extern boolean at_dgn_entrance(const char *); extern boolean In_hell(d_level *); extern boolean In_V_tower(d_level *); extern boolean On_W_tower_level(d_level *); -extern boolean In_W_tower(int, int, d_level *); +extern boolean In_W_tower(coordxy, coordxy, d_level *); extern void find_hell(d_level *); extern void goto_hell(boolean, boolean); extern boolean single_level_branch(d_level *); @@ -793,16 +793,16 @@ extern void panictrace_setsignals(boolean); extern char *random_engraving(char *); extern void wipeout_text(char *, int, unsigned); 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 void cant_reach_floor(coordxy, coordxy, boolean, boolean); +extern const char *surface(coordxy, coordxy); +extern const char *ceiling(coordxy, coordxy); 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(coordxy, coordxy, coordxy, boolean); -extern void read_engr_at(int, int); -extern void make_engr_at(int, int, const char *, long, xint16); -extern void del_engr_at(int, int); +extern void read_engr_at(coordxy, coordxy); +extern void make_engr_at(coordxy, coordxy, const char *, long, xint16); +extern void del_engr_at(coordxy, coordxy); extern int freehand(void); extern int doengrave(void); extern void sanitize_engravings(void); @@ -811,7 +811,7 @@ extern void rest_engravings(NHFILE *); extern void engr_stats(const char *, char *, long *, long *); extern void del_engr(struct engr *); extern void rloc_engr(struct engr *); -extern void make_grave(int, int, const char *); +extern void make_grave(coordxy, coordxy, const char *); /* ### exper.c ### */ @@ -826,17 +826,17 @@ extern long rndexp(boolean); /* ### explode.c ### */ -extern void explode(int, int, int, int, char, int); -extern long scatter(int, int, int, unsigned int, struct obj *); -extern void splatter_burning_oil(int, int, boolean); -extern void explode_oil(struct obj *, int, int); +extern void explode(coordxy, coordxy, int, int, char, int); +extern long scatter(coordxy, coordxy, int, unsigned int, struct obj *); +extern void splatter_burning_oil(coordxy, coordxy, boolean); +extern void explode_oil(struct obj *, coordxy, coordxy); extern int adtyp_to_expltype(const int); extern void mon_explodes(struct monst *, struct attack *); /* ### extralev.c ### */ extern void makeroguerooms(void); -extern void corr(int, int); +extern void corr(coordxy, coordxy); extern void makerogueghost(void); /* ### files.c ### */ @@ -921,17 +921,17 @@ extern void dogushforth(int); extern void dryup(coordxy, coordxy, boolean); extern void drinkfountain(void); extern void dipfountain(struct obj *); -extern void breaksink(int, int); +extern void breaksink(coordxy, coordxy); extern void drinksink(void); /* ### hack.c ### */ -extern boolean is_valid_travelpt(int,int); +extern boolean is_valid_travelpt(coordxy, coordxy); extern anything *uint_to_any(unsigned); 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 boolean revive_nasty(coordxy, coordxy, const char *); extern int still_chewing(coordxy, coordxy); extern void movobj(struct obj *, coordxy, coordxy); extern boolean may_dig(coordxy, coordxy); @@ -939,7 +939,7 @@ 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(coordxy, coordxy); -extern boolean test_move(int, int, int, int, int); +extern boolean test_move(coordxy, coordxy, coordxy, coordxy, int); #ifdef DEBUG extern int wiz_debug_cmd_traveldisplay(void); #endif @@ -955,11 +955,11 @@ extern void set_uinwater(int); extern boolean pooleffects(boolean); extern void spoteffects(boolean); extern char *in_rooms(coordxy, coordxy, int); -extern boolean in_town(int, int); +extern boolean in_town(coordxy, coordxy); extern void check_special_room(boolean); extern int dopickup(void); extern void lookaround(void); -extern boolean crawl_destination(int, int); +extern boolean crawl_destination(coordxy, coordxy); extern int monster_nearby(void); extern void end_running(boolean); extern void nomul(int); @@ -1011,9 +1011,9 @@ extern const char *ordin(int); extern char *sitoa(int); extern int sgn(int); extern int rounddiv(long, int); -extern int dist2(int, int, int, int); +extern int dist2(coordxy, coordxy, coordxy, coordxy); extern int isqrt(int); -extern int distmin(int, int, int, int); +extern int distmin(coordxy, coordxy, coordxy, coordxy); extern boolean online2(int, int, int, int); extern boolean pmatch(const char *, const char *); extern boolean pmatchi(const char *, const char *); @@ -1107,20 +1107,20 @@ extern void useup(struct obj *); extern void consume_obj_charge(struct obj *, boolean); extern void freeinv_core(struct obj *); extern void freeinv(struct obj *); -extern void delallobj(int, int); +extern void delallobj(coordxy, coordxy); extern void delobj(struct obj *); extern void delobj_core(struct obj *, boolean); -extern struct obj *sobj_at(int, int, int); +extern struct obj *sobj_at(int, coordxy, coordxy); extern struct obj *nxtobj(struct obj *, int, boolean); extern struct obj *carrying(int); extern boolean have_lizard(void); extern struct obj *u_carried_gloves(void); extern struct obj *u_have_novel(void); extern struct obj *o_on(unsigned int, struct obj *); -extern boolean obj_here(struct obj *, int, int); +extern boolean obj_here(struct obj *, coordxy, coordxy); extern boolean wearing_armor(void); extern boolean is_worn(struct obj *); -extern struct obj *g_at(int, int); +extern struct obj *g_at(coordxy, coordxy); extern boolean splittable(struct obj *); extern int any_obj_ok(struct obj *); extern struct obj *getobj(const char *, int(*)(struct obj *), unsigned int); @@ -1140,11 +1140,11 @@ extern void prinv(const char *, struct obj *, long); extern char *xprname(struct obj *, const char *, char, boolean, long, long); extern int ddoinv(void); extern char display_inventory(const char *, boolean); -extern int display_binventory(int, int, boolean); +extern int display_binventory(coordxy, coordxy, boolean); extern struct obj *display_cinventory(struct obj *); extern struct obj *display_minventory(struct monst *, int, char *); extern int dotypeinv(void); -extern const char *dfeature_at(int, int, char *); +extern const char *dfeature_at(coordxy, coordxy, char *); extern int look_here(int, unsigned); extern int dolook(void); extern boolean will_feel_cockatrice(struct obj *, boolean); @@ -1193,7 +1193,7 @@ extern int dosuspend(void); extern void new_light_source(coordxy, coordxy, int, int, union any *); extern void del_light_source(int, union any *); extern void do_light_sources(coordxy **); -extern void show_transient_light(struct obj *, int, int); +extern void show_transient_light(struct obj *, coordxy, coordxy); extern void transient_light_cleanup(void); extern struct monst *find_mid(unsigned, unsigned); extern void save_light_sources(NHFILE *, int); @@ -1203,7 +1203,7 @@ extern void relink_light_sources(boolean); extern void light_sources_sanity_check(void); extern void obj_move_light_source(struct obj *, struct obj *); extern boolean any_light_source(void); -extern void snuff_light_source(int, int); +extern void snuff_light_source(coordxy, coordxy); extern boolean obj_sheds_light(struct obj *); extern boolean obj_is_burning(struct obj *); extern void obj_split_light_source(struct obj *, struct obj *); @@ -1216,8 +1216,8 @@ extern int wiz_light_sources(void); /* ### lock.c ### */ -extern boolean picking_lock(int *, int *); -extern boolean picking_at(int, int); +extern boolean picking_lock(coordxy *, coordxy *); +extern boolean picking_at(coordxy, coordxy); extern void breakchestlock(struct obj *, boolean); extern void reset_pick(void); extern void maybe_reset_pick(struct obj *); @@ -1226,10 +1226,10 @@ 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 *); -extern boolean doorlock(struct obj *, int, int); +extern boolean doorlock(struct obj *, coordxy, coordxy); extern int doopen(void); -extern boolean stumble_on_door_mimic(int, int); -extern int doopen_indir(int, int); +extern boolean stumble_on_door_mimic(coordxy, coordxy); +extern int doopen_indir(coordxy, coordxy); extern int doclose(void); #ifdef MAC @@ -1263,7 +1263,7 @@ extern void newmonhp(struct monst *, int); extern struct mextra *newmextra(void); extern void copy_mextra(struct monst *, struct monst *); extern void dealloc_mextra(struct monst *); -extern struct monst *makemon(struct permonst *, int, int, mmflags_nht); +extern struct monst *makemon(struct permonst *, coordxy, coordxy, mmflags_nht); extern struct monst *unmakemon(struct monst *, mmflags_nht); extern boolean create_critters(int, struct permonst *, boolean); extern struct permonst *rndmonst(void); @@ -1360,7 +1360,7 @@ extern void add_subroom(struct mkroom *, int, int, int, int, boolean, schar, boolean); extern void free_luathemes(boolean); extern void makecorridors(void); -extern void add_door(int, int, struct mkroom *); +extern void add_door(coordxy, coordxy, struct mkroom *); extern void clear_level_structures(void); extern void level_finalize_topology(void); extern void mklev(void); @@ -1372,7 +1372,7 @@ extern void topologize(struct mkroom *); 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 dodoor(coordxy, coordxy, struct mkroom *); extern void mktrap(int, int, struct mkroom *, coord *); extern void mkstairs(coordxy, coordxy, char, struct mkroom *, boolean); extern void mkinvokearea(void); @@ -1389,12 +1389,12 @@ extern boolean litstate_rnd(int); 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); -extern void walkfrom(int, int, schar); +extern void wallification(coordxy, coordxy, coordxy, coordxy); +extern void fix_wall_spines(coordxy, coordxy, coordxy, coordxy); +extern void walkfrom(coordxy, coordxy, schar); extern void makemaz(const char *); extern void mazexy(coord *); -extern void get_level_extends(int *, int *, int *, int *); +extern void get_level_extends(coordxy *, coordxy *, coordxy *, coordxy *); extern void bound_digging(void); extern void mkportal(coordxy, coordxy, coordxy, coordxy); extern boolean bad_location(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy); @@ -1420,8 +1420,8 @@ extern void newolong(struct obj *); extern void free_olong(struct obj *); extern void new_omailcmd(struct obj *, const char *); extern void free_omailcmd(struct obj *); -extern struct obj *mkobj_at(char, int, int, boolean); -extern struct obj *mksobj_at(int, int, int, boolean, boolean); +extern struct obj *mkobj_at(char, coordxy, coordxy, boolean); +extern struct obj *mksobj_at(int, coordxy, coordxy, boolean, boolean); extern struct obj *mksobj_migr_to_species(int, unsigned, boolean, boolean); extern struct obj *mkobj(int, boolean); extern int rndmonnum(void); @@ -1439,16 +1439,17 @@ extern void unknow_object(struct obj *); extern struct obj *mksobj(int, boolean, boolean); extern int bcsign(struct obj *); extern int weight(struct obj *); -extern struct obj *mkgold(long, int, int); -extern struct obj *mkcorpstat(int, struct monst *, struct permonst *, int, - int, unsigned); +extern struct obj *mkgold(long, coordxy, coordxy); +extern struct obj *mkcorpstat(int, struct monst *, struct permonst *, + coordxy, coordxy, unsigned); extern int corpse_revive_type(struct obj *); extern struct obj *obj_attach_mid(struct obj *, unsigned); extern struct monst *get_mtraits(struct obj *, boolean); -extern struct obj *mk_tt_object(int, int, int); -extern struct obj *mk_named_object(int, struct permonst *, int, int, +extern struct obj *mk_tt_object(int, coordxy, coordxy); +extern struct obj *mk_named_object(int, struct permonst *, + coordxy, coordxy, const char *); -extern struct obj *rnd_treefruit_at(int, int); +extern struct obj *rnd_treefruit_at(coordxy, coordxy); extern void set_corpsenm(struct obj *, int); extern long rider_revival_time(struct obj *, boolean); extern void start_corpse_timeout(struct obj *); @@ -1463,7 +1464,7 @@ extern void blessorcurse(struct obj *, int); extern void set_bknown(struct obj *, unsigned); extern boolean is_flammable(struct obj *); extern boolean is_rottable(struct obj *); -extern void place_object(struct obj *, int, int); +extern void place_object(struct obj *, coordxy, coordxy); extern void remove_object(struct obj *); extern void discard_minvent(struct monst *, boolean); extern void obj_extract_self(struct obj *); @@ -1474,12 +1475,12 @@ extern struct obj *add_to_container(struct obj *, struct obj *); extern void add_to_migration(struct obj *); extern void add_to_buried(struct obj *); extern void dealloc_obj(struct obj *); -extern void obj_ice_effects(int, int, boolean); +extern void obj_ice_effects(coordxy, coordxy, boolean); extern long peek_at_iced_corpse_age(struct obj *); extern int hornoplenty(struct obj *, boolean); extern void obj_sanity_check(void); extern struct obj *obj_nexto(struct obj *); -extern struct obj *obj_nexto_xy(struct obj *, int, int, boolean); +extern struct obj *obj_nexto_xy(struct obj *, coordxy, coordxy, boolean); extern struct obj *obj_absorb(struct obj **, struct obj **); extern struct obj *obj_meld(struct obj **, struct obj **); extern void pudding_merge_message(struct obj *, struct obj *); @@ -1527,7 +1528,7 @@ extern int max_mon_load(struct monst *); extern int can_carry(struct monst *, struct obj *); extern long mon_allowflags(struct monst *); extern int mfndpos(struct monst *, coord *, long *, long); -extern boolean monnear(struct monst *, int, int); +extern boolean monnear(struct monst *, coordxy, coordxy); extern void dmonsfree(void); extern void elemental_clog(struct monst *); extern int mcalcmove(struct monst *, boolean); @@ -1555,7 +1556,7 @@ extern void setmangry(struct monst *, boolean); extern void wake_msg(struct monst *, boolean); extern void wakeup(struct monst *, boolean); extern void wake_nearby(void); -extern void wake_nearto(int, int, int); +extern void wake_nearto(coordxy, coordxy, int); extern void seemimic(struct monst *); extern void normal_shape(struct monst *); extern void iter_mons(void (*)(struct monst *)); @@ -1642,7 +1643,7 @@ extern boolean mb_trapped(struct monst *, boolean); extern boolean monhaskey(struct monst *, boolean); extern void mon_regen(struct monst *, boolean); extern int dochugw(struct monst *, boolean); -extern boolean onscary(int, int, struct monst *); +extern boolean onscary(coordxy, coordxy, struct monst *); extern struct monst *find_pmmonst(int); extern int bee_eat_jelly(struct monst *, struct obj *); extern void monflee(struct monst *, int, boolean, boolean); @@ -1651,9 +1652,9 @@ extern int dochug(struct monst *); extern boolean m_digweapon_check(struct monst *, coordxy, coordxy); extern int m_move(struct monst *, int); 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 dissolve_bars(coordxy, coordxy); +extern boolean closed_door(coordxy, coordxy); +extern boolean accessible(coordxy, coordxy); extern void set_apparxy(struct monst *); extern boolean can_ooze(struct monst *); extern boolean can_fog(struct monst *); @@ -1732,7 +1733,7 @@ extern void thrwmu(struct monst *); extern int spitmu(struct monst *, struct attack *); extern int breamu(struct monst *, struct attack *); extern boolean linedup_callback(coordxy, coordxy, coordxy, coordxy, - boolean(*)(int,int)); + boolean(*)(coordxy, coordxy)); extern boolean linedup(coordxy, coordxy, coordxy, coordxy, int); extern boolean lined_up(struct monst *); extern struct obj *m_carrying(struct monst *, int); @@ -1741,9 +1742,9 @@ extern int spitmm(struct monst *, struct attack *, struct monst *); extern int breamm(struct monst *, struct attack *, struct monst *); extern void m_useupall(struct monst *, struct obj *); extern void m_useup(struct monst *, struct obj *); -extern void m_throw(struct monst *, int, int, int, int, int, struct obj *); -extern void hit_bars(struct obj **, int, int, int, int, unsigned); -extern boolean hits_bars(struct obj **, int, int, int, int, int, int); +extern void m_throw(struct monst *, coordxy, coordxy, coordxy, coordxy, int, struct obj *); +extern void hit_bars(struct obj **, coordxy, coordxy, coordxy, coordxy, unsigned); +extern boolean hits_bars(struct obj **, coordxy, coordxy, coordxy, coordxy, int, int); /* ### muse.c ### */ @@ -1802,7 +1803,7 @@ extern void lcheck_param_table(lua_State *); extern schar get_table_mapchr(lua_State *, const char *); extern schar get_table_mapchr_opt(lua_State *, const char *, schar); extern short nhl_get_timertype(lua_State *, int); -extern boolean nhl_get_xy_params(lua_State *, int *, int *); +extern boolean nhl_get_xy_params(lua_State *, lua_Integer *, lua_Integer *); extern void nhl_add_table_entry_int(lua_State *, const char *, lua_Integer); 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 *); @@ -1841,7 +1842,7 @@ extern int consoletty_kbhit(void); extern void consoletty_open(int); extern void consoletty_rubout(void); extern int tgetch(void); -extern int console_poskey(int *, int *, int *); +extern int console_poskey(coordxy *, coordxy *, int *); extern void set_output_mode(int); extern void synch_cursor(void); extern void nethack_enter_consoletty(void); @@ -1990,7 +1991,7 @@ extern void msgtype_free(void); 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 boolean object_from_map(int, coordxy, coordxy, struct obj **); extern const char *waterbody_name(coordxy, coordxy); extern int do_screen_description(coord, boolean, int, char *, const char **, struct permonst **); @@ -2072,7 +2073,7 @@ extern int query_objlist(const char *, struct obj **, int, menu_item **, int, boolean(*)(struct obj *)); extern struct obj *pick_obj(struct obj *); extern int encumber_msg(void); -extern int container_at(int, int, boolean); +extern int container_at(coordxy, coordxy, boolean); extern int doloot(void); extern void observe_quantum_cat(struct obj *, boolean, boolean); extern boolean container_gone(int(*)(struct obj *)); @@ -2177,13 +2178,13 @@ extern boolean can_pray(boolean); extern int dopray(void); extern const char *u_gname(void); extern int doturn(void); -extern int altarmask_at(int, int); +extern int altarmask_at(coordxy, coordxy); extern const char *a_gname(void); 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); -extern void altar_wrath(int, int); +extern void altar_wrath(coordxy, coordxy); /* ### priest.c ### */ @@ -2260,10 +2261,10 @@ extern void assign_candy_wrapper(struct obj *); extern int doread(void); extern int charge_ok(struct obj *); extern void recharge(struct obj *, int); -extern boolean valid_cloud_pos(int, int); +extern boolean valid_cloud_pos(coordxy, coordxy); extern int seffects(struct obj *); extern void drop_boulder_on_player(boolean, boolean, boolean, boolean); -extern boolean drop_boulder_on_monster(int, int, boolean, boolean); +extern boolean drop_boulder_on_monster(coordxy, coordxy, boolean, boolean); extern void wand_explode(struct obj *, int); extern void litroom(boolean, struct obj *); extern void do_genocide(int); @@ -2546,17 +2547,17 @@ extern boolean create_room(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, 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 void wallify_map(coordxy, coordxy, coordxy, coordxy); extern boolean load_special(const char *); -extern coordxy selection_getpoint(int, int, struct selectionvar *); +extern coordxy selection_getpoint(coordxy, coordxy, 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 set_selection_floodfillchk(int(*)(coordxy, coordxy)); +extern void selection_floodfill(struct selectionvar *, coordxy, coordxy, boolean); +extern boolean pm_good_location(coordxy, coordxy, struct permonst *); extern void get_location_coord(coordxy *, coordxy *, int, struct mkroom *, long); -extern void selection_setpoint(int, int, struct selectionvar *, coordxy); +extern void selection_setpoint(coordxy, coordxy, struct selectionvar *, coordxy); extern struct selectionvar * selection_not(struct selectionvar *); extern void selection_filter_percent(struct selectionvar *, int); extern int selection_rndcoord(struct selectionvar *, coordxy *, coordxy *, @@ -2671,11 +2672,11 @@ extern void sysopt_seduce_set(int); /* ### teleport.c ### */ extern boolean noteleport_level(struct monst *); -extern boolean goodpos(int, int, struct monst *, mmflags_nht); +extern boolean goodpos(coordxy, coordxy, struct monst *, mmflags_nht); 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 void teleds(coordxy, coordxy, int); extern boolean safe_teleds(int); extern boolean teleport_pet(struct monst *, boolean); extern void tele(void); @@ -2686,8 +2687,8 @@ extern void level_tele(void); extern void domagicportal(struct trap *); extern void tele_trap(struct trap *); extern void level_tele_trap(struct trap *, unsigned); -extern void rloc_to(struct monst *, int, int); -extern void rloc_to_flag(struct monst *, int, int, unsigned); +extern void rloc_to(struct monst *, coordxy, coordxy); +extern void rloc_to_flag(struct monst *, coordxy, coordxy, unsigned); extern boolean rloc(struct monst *, unsigned); extern boolean tele_restrict(struct monst *); extern void mtele_trap(struct monst *, struct trap *, int); @@ -2755,7 +2756,7 @@ extern coord *gettrack(int, int); extern boolean burnarmor(struct monst *); 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 struct trap *maketrap(coordxy, coordxy, int); extern void fall_through(boolean, unsigned); extern struct monst *animate_statue(struct obj *, coordxy, coordxy, int, int *); extern struct monst *activate_statue_trap(struct trap *, coordxy, coordxy, @@ -2771,7 +2772,7 @@ extern void minstapetrify(struct monst *, boolean); extern void selftouch(const char *); extern void mselftouch(struct monst *, const char *, boolean); extern void float_up(void); -extern void fill_pit(int, int); +extern void fill_pit(coordxy, coordxy); extern int float_down(long, long); extern void climb_pit(void); extern boolean fire_damage(struct obj *, boolean, coordxy, coordxy); @@ -2785,19 +2786,19 @@ extern void drain_en(int); extern int dountrap(void); extern int could_untrap(boolean, boolean); extern void cnv_trap_obj(int, int, struct trap *, boolean); -extern int untrap(boolean, int, int, struct obj *); +extern int untrap(boolean, coordxy, coordxy, struct obj *); extern boolean openholdingtrap(struct monst *, boolean *); extern boolean closeholdingtrap(struct monst *, boolean *); extern boolean openfallingtrap(struct monst *, boolean, boolean *); extern boolean chest_trap(struct obj *, int, boolean); extern void deltrap(struct trap *); extern boolean delfloortrap(struct trap *); -extern struct trap *t_at(int, int); +extern struct trap *t_at(coordxy, coordxy); extern int count_traps(int); extern void b_trapped(const char *, int); extern boolean unconscious(void); extern void blow_up_landmine(struct trap *); -extern int launch_obj(short, int, int, int, int, int); +extern int launch_obj(short, coordxy, coordxy, coordxy, coordxy, int); extern boolean launch_in_progress(void); extern void force_launch_placement(void); extern boolean uteetering_at_seen_pit(struct trap *); @@ -3058,8 +3059,8 @@ extern void vision_recalc(int); extern void block_point(int, int); extern void unblock_point(int, int); extern boolean clear_path(int, int, int, int); -extern void do_clear_area(int, int, int, void(*)(int, int, void *), - genericptr_t); +extern void do_clear_area(coordxy, coordxy, int, + void(*)(coordxy, coordxy, void *), genericptr_t); extern unsigned howmonseen(struct monst *); #ifdef VMS @@ -3348,8 +3349,8 @@ extern boolean obj_resists(struct obj *, int, int); extern boolean obj_shudders(struct obj *); extern void do_osshock(struct obj *); extern int bhito(struct obj *, struct obj *); -extern int bhitpile(struct obj *, int(*)(struct obj *, struct obj *), int, - int, schar); +extern int bhitpile(struct obj *, int(*)(struct obj *, struct obj *), + coordxy, coordxy, schar); extern int zappable(struct obj *); extern void do_enlightenment_effect(void); extern void zapnodir(struct obj *); @@ -3367,12 +3368,12 @@ extern int spell_damage_bonus(int); extern const char *exclam(int force); extern void hit(const char *, struct monst *, const char *); extern void miss(const char *, struct monst *); -extern struct monst *bhit(int, int, int, enum bhit_call_types, +extern struct monst *bhit(coordxy, coordxy, int, enum bhit_call_types, int(*)(struct monst *, struct obj *), int(*)(struct obj *, struct obj *), struct obj **); -extern struct monst *boomhit(struct obj *, int, int); +extern struct monst *boomhit(struct obj *, coordxy, coordxy); extern int zhitm(struct monst *, int, int, struct obj **); -extern int burn_floor_objects(int, int, boolean, boolean); +extern int burn_floor_objects(coordxy, coordxy, boolean, boolean); 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 *); diff --git a/include/winX.h b/include/winX.h index fde0e7b8d..725d4e902 100644 --- a/include/winX.h +++ b/include/winX.h @@ -460,7 +460,7 @@ extern void X11_print_glyph(winid, coordxy, coordxy, const glyph_info *, extern void X11_raw_print(const char *); extern void X11_raw_print_bold(const char *); extern int X11_nhgetch(void); -extern int X11_nh_poskey(int *, int *, int *); +extern int X11_nh_poskey(coordxy *, coordxy *, int *); extern void X11_nhbell(void); extern int X11_doprev_message(void); extern char X11_yn_function_core(const char *, const char *, char, unsigned); diff --git a/include/wincurs.h b/include/wincurs.h index 02b9ebcfc..83df0113b 100644 --- a/include/wincurs.h +++ b/include/wincurs.h @@ -97,7 +97,7 @@ extern void curses_print_glyph(winid wid, coordxy x, coordxy y, extern void curses_raw_print(const char *str); extern void curses_raw_print_bold(const char *str); extern int curses_nhgetch(void); -extern int curses_nh_poskey(int *x, int *y, int *mod); +extern int curses_nh_poskey(coordxy *x, coordxy *y, int *mod); extern void curses_nhbell(void); extern int curses_doprev_message(void); extern char curses_yn_function(const char *question, const char *choices, @@ -174,7 +174,7 @@ extern int curses_convert_attr(int attr); extern int curses_read_attrs(const char *attrs); extern char *curses_fmt_attrs(char *); extern int curses_convert_keys(int key); -extern int curses_get_mouse(int *mousex, int *mousey, int *mod); +extern int curses_get_mouse(coordxy *mousex, coordxy *mousey, int *mod); extern void curses_mouse_support(int); /* cursdial.c */ diff --git a/include/winprocs.h b/include/winprocs.h index b4426e592..9ad5667a6 100644 --- a/include/winprocs.h +++ b/include/winprocs.h @@ -59,7 +59,7 @@ struct window_procs { void (*win_raw_print)(const char *); void (*win_raw_print_bold)(const char *); int (*win_nhgetch)(void); - int (*win_nh_poskey)(int *, int *, int *); + int (*win_nh_poskey)(coordxy *, coordxy *, int *); void (*win_nhbell)(void); int (*win_doprev_message)(void); char (*win_yn_function)(const char *, const char *, char); @@ -381,7 +381,7 @@ struct chain_procs { void (*win_raw_print)(CARGS, const char *); void (*win_raw_print_bold)(CARGS, const char *); int (*win_nhgetch)(CARGS); - int (*win_nh_poskey)(CARGS, int *, int *, int *); + int (*win_nh_poskey)(CARGS, coordxy *, coordxy *, int *); void (*win_nhbell)(CARGS); int (*win_doprev_message)(CARGS); char (*win_yn_function) @@ -457,7 +457,7 @@ extern void safe_print_glyph(winid, coordxy, coordxy, extern void safe_raw_print(const char *); extern void safe_raw_print_bold(const char *); extern int safe_nhgetch(void); -extern int safe_nh_poskey(int *, int *, int *); +extern int safe_nh_poskey(coordxy *, coordxy *, int *); extern void safe_nhbell(void); extern int safe_doprev_message(void); extern char safe_yn_function(const char *, const char *, char); diff --git a/include/wintty.h b/include/wintty.h index 653cbbc81..e6cbe68ae 100644 --- a/include/wintty.h +++ b/include/wintty.h @@ -254,7 +254,7 @@ E void tty_print_glyph(winid, coordxy, coordxy, const glyph_info *, E void tty_raw_print(const char *); E void tty_raw_print_bold(const char *); E int tty_nhgetch(void); -E int tty_nh_poskey(int *, int *, int *); +E int tty_nh_poskey(coordxy *, coordxy *, int *); E void tty_nhbell(void); E int tty_doprev_message(void); E char tty_yn_function(const char *, const char *, char); diff --git a/include/wintype.h b/include/wintype.h index c5c93ada1..3ebb3db56 100644 --- a/include/wintype.h +++ b/include/wintype.h @@ -15,14 +15,20 @@ typedef union any { struct obj *a_obj; struct monst *a_monst; int a_int; + int a_xint16; + int a_xint8; char a_char; schar a_schar; uchar a_uchar; unsigned int a_uint; long a_long; unsigned long a_ulong; + coordxy a_coordxy; int *a_iptr; + xint16 *a_xint16ptr; + xint8 *a_xint8ptr; long *a_lptr; + coordxy *a_coordxyptr; unsigned long *a_ulptr; unsigned *a_uptr; const char *a_string; diff --git a/src/apply.c b/src/apply.c index 095d7ae75..5591c4a3f 100644 --- a/src/apply.c +++ b/src/apply.c @@ -7,7 +7,7 @@ static int use_camera(struct obj *); static int use_towel(struct obj *); -static boolean its_dead(int, int, int *); +static boolean its_dead(coordxy, coordxy, int *); static int use_stethoscope(struct obj *); static void use_whistle(struct obj *); static void use_magic_whistle(struct obj *); @@ -39,10 +39,10 @@ static int do_break_wand(struct obj *); static int apply_ok(struct obj *); static int flip_through_book(struct obj *); static boolean figurine_location_checks(struct obj *, coord *, boolean); -static boolean check_jump(genericptr_t, int, int); -static boolean is_valid_jump_pos(int, int, int, boolean); -static boolean get_valid_jump_position(int, int); -static boolean get_valid_polearm_position(int, int); +static boolean check_jump(genericptr_t, coordxy, coordxy); +static boolean is_valid_jump_pos(coordxy, coordxy, int, boolean); +static boolean get_valid_jump_position(coordxy, coordxy); +static boolean get_valid_polearm_position(coordxy, coordxy); static boolean find_poleable_mon(coord *, int, int); static const char no_elbow_room[] = @@ -177,7 +177,7 @@ use_towel(struct obj *obj) /* maybe give a stethoscope message based on floor objects */ static boolean -its_dead(int rx, int ry, int *resp) +its_dead(coordxy rx, coordxy ry, int *resp) { char buf[BUFSZ]; boolean more_corpses; @@ -302,7 +302,8 @@ use_stethoscope(struct obj *obj) { struct monst *mtmp; struct rm *lev; - int rx, ry, res; + int res; + coordxy rx, ry; boolean interference = (u.uswallow && is_whirly(u.ustuck->data) && !rn2(Role_if(PM_HEALER) ? 10 : 3)); @@ -1769,7 +1770,7 @@ enum jump_trajectory { /* callback routine for walk_path() */ static boolean -check_jump(genericptr arg, int x, int y) +check_jump(genericptr arg, coordxy x, coordxy y) { int traj = *(int *) arg; struct rm *lev = &levl[x][y]; @@ -1800,7 +1801,7 @@ check_jump(genericptr arg, int x, int y) } static boolean -is_valid_jump_pos(int x, int y, int magic, boolean showmsg) +is_valid_jump_pos(coordxy x, coordxy y, int magic, boolean showmsg) { if (!magic && !(HJumping & ~INTRINSIC) && !EJumping && distu(x, y) != 5) { /* The Knight jumping restriction still applies when riding a @@ -1828,9 +1829,9 @@ is_valid_jump_pos(int x, int y, int magic, boolean showmsg) passage through doorways: horizonal, vertical, or diagonal; since knight's jump and other irregular directions are possible, we flatten those out to simplify door checks */ - int diag, traj, - dx = x - u.ux, dy = y - u.uy, - ax = abs(dx), ay = abs(dy); + int diag, traj; + coordxy dx = x - u.ux, dy = y - u.uy, + ax = abs(dx), ay = abs(dy); /* diag: any non-orthogonal destination classifed as diagonal */ diag = (magic || Passes_walls || (!dx && !dy)) ? jAny @@ -1866,7 +1867,7 @@ is_valid_jump_pos(int x, int y, int magic, boolean showmsg) } static boolean -get_valid_jump_position(int x, int y) +get_valid_jump_position(coordxy x, coordxy y) { return (isok(x, y) && (ACCESSIBLE(levl[x][y].typ) || Passes_walls) @@ -1879,12 +1880,12 @@ display_jump_positions(int state) if (state == 0) { tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); } else if (state == 1) { - int x, y, dx, dy; + coordxy x, y, dx, dy; for (dx = -4; dx <= 4; dx++) for (dy = -4; dy <= 4; dy++) { - x = dx + (int) u.ux; - y = dy + (int) u.uy; + x = dx + (coordxy) u.ux; + y = dy + (coordxy) u.uy; if (get_valid_jump_position(x, y)) tmp_at(x, y); } @@ -3143,7 +3144,8 @@ find_poleable_mon(coord *pos, int min_range, int max_range) struct monst *mtmp; coord mpos; boolean impaired; - int x, y, lo_x, hi_x, lo_y, hi_y, rt, glyph; + coordxy x, y, lo_x, hi_x, lo_y, hi_y, rt; + int glyph; impaired = (Confusion || Stunned || Hallucination); mpos.x = mpos.y = 0; /* no candidate location yet */ @@ -3176,7 +3178,7 @@ find_poleable_mon(coord *pos, int min_range, int max_range) } static boolean -get_valid_polearm_position(int x, int y) +get_valid_polearm_position(coordxy x, coordxy y) { int glyph; @@ -3194,7 +3196,7 @@ display_polearm_positions(int state) if (state == 0) { tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); } else if (state == 1) { - int x, y, dx, dy; + coordxy x, y, dx, dy; for (dx = -4; dx <= 4; dx++) for (dy = -4; dy <= 4; dy++) { @@ -3622,7 +3624,8 @@ static int do_break_wand(struct obj *obj) { static const char nothing_else_happens[] = "But nothing else happens..."; - register int i, x, y; + register int i; + coordxy x, y; register struct monst *mon; int dmg, damage; boolean affects_objects; diff --git a/src/artifact.c b/src/artifact.c index 901e743e5..aab7a288c 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -27,7 +27,7 @@ static unsigned long abil_to_spfx(long *); static uchar abil_to_adtyp(long *); static int glow_strength(int); static boolean untouchable(struct obj *, boolean); -static int count_surround_traps(int, int); +static int count_surround_traps(coordxy, coordxy); /* The amount added to the victim's total hit points to insure that the victim will be killed even after damage bonus/penalty adjustments. @@ -2347,12 +2347,13 @@ retouch_equipment(int dropflag) /* 0==don't drop, 1==drop all, 2==drop weapon */ } static int -count_surround_traps(int x, int y) +count_surround_traps(coordxy x, coordxy y) { struct rm *levp; struct obj *otmp; struct trap *ttmp; - int dx, dy, glyph, ret = 0; + coordxy dx, dy; + int glyph, ret = 0; for (dx = x - 1; dx < x + 2; ++dx) for (dy = y - 1; dy < y + 2; ++dy) { diff --git a/src/bones.c b/src/bones.c index 280a6207d..2b353fd0a 100644 --- a/src/bones.c +++ b/src/bones.c @@ -8,7 +8,7 @@ static boolean no_bones_level(d_level *); static void goodfruit(int); static void resetobjs(struct obj *, boolean); -static void give_to_nearby_mon(struct obj *, int, int); +static void give_to_nearby_mon(struct obj *, coordxy, coordxy); static boolean fixuporacle(struct monst *); static void remove_mon_from_bones(struct monst *); @@ -220,7 +220,7 @@ sanitize_name(char *namebuf) but skipping hero's location. If no such monster, place object on floor at x,y. */ static void -give_to_nearby_mon(struct obj *otmp, int x, int y) +give_to_nearby_mon(struct obj *otmp, coordxy x, coordxy y) { struct monst *mtmp; struct monst *selected = (struct monst *) 0; @@ -256,7 +256,7 @@ void drop_upon_death( struct monst *mtmp, /* monster if hero rises as one (non ghost) */ struct obj *cont, /* container if hero is turned into a statue */ - int x, int y) + coordxy x, coordxy y) { struct obj *otmp; @@ -399,7 +399,7 @@ remove_mon_from_bones(struct monst *mtmp) void savebones(int how, time_t when, struct obj *corpse) { - int x, y; + coordxy x, y; struct trap *ttmp; struct monst *mtmp; struct fruit *f; diff --git a/src/cmd.c b/src/cmd.c index 7f2ad2027..025595e01 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -151,9 +151,9 @@ static boolean accept_menu_prefix(const struct ext_func_tab *); static void reset_cmd_vars(boolean); static void mcmd_addmenu(winid, int, const char *); static char here_cmd_menu(void); -static char there_cmd_menu(int, int, int); -static void act_on_act(int, int, int); -static char readchar_core(int *, int *, int *); +static char there_cmd_menu(coordxy, coordxy, int); +static void act_on_act(int, coordxy, coordxy); +static char readchar_core(coordxy *, coordxy *, int *); static char *parse(void); static void show_direction_keys(winid, char, boolean); static boolean help_dir(char, uchar, const char *); @@ -1450,7 +1450,8 @@ static int wiz_show_seenv(void) { winid win; - int x, y, v, startx, stopx, curx; + coordxy x, y, startx, stopx, curx; + int v; char row[COLNO + 1]; win = create_nhwindow(NHW_TEXT); @@ -1494,7 +1495,8 @@ static int wiz_show_vision(void) { winid win; - int x, y, v; + coordxy x, y; + int v; char row[COLNO + 1]; win = create_nhwindow(NHW_TEXT); @@ -1529,7 +1531,7 @@ static int wiz_show_wmodes(void) { winid win; - int x, y; + coordxy x, y; char row[COLNO + 1]; struct rm *lev; boolean istty = WINDOWPORT(tty); @@ -1565,7 +1567,8 @@ static void wiz_map_levltyp(void) { winid win; - int x, y, terrain; + coordxy x, y; + int terrain; char row[COLNO + 1]; boolean istty = !strcmp(windowprocs.name, "tty"); @@ -4299,8 +4302,8 @@ rhack(char *cmd) } /* convert an x,y pair into a direction code */ -int -xytod(schar x, schar y) +coordxy +xytod(coordxy x, coordxy y) { register int dd; @@ -4718,7 +4721,7 @@ help_dir( void confdir(void) { - register int x = NODIAG(u.umonnum) ? dirs_ord[rn2(4)] : rn2(N_DIRS); + register coordxy x = NODIAG(u.umonnum) ? dirs_ord[rn2(4)] : rn2(N_DIRS); u.dx = xdir[x]; u.dy = ydir[x]; @@ -4739,7 +4742,7 @@ directionname(int dir) } int -isok(register int x, register int y) +isok(register coordxy x, register coordxy y) { /* x corresponds to curx, so x==1 is the first column. Ach. %% */ return x >= 1 && x <= COLNO - 1 && y >= 0 && y <= ROWNO - 1; @@ -4828,7 +4831,7 @@ mcmd_addmenu(winid win, int act, const char *txt) /* command menu entries when targeting self */ static int -there_cmd_menu_self(winid win, int x, int y, int *act UNUSED) +there_cmd_menu_self(winid win, coordxy x, coordxy y, int *act UNUSED) { int K = 0; char buf[BUFSZ]; @@ -4916,7 +4919,7 @@ there_cmd_menu_self(winid win, int x, int y, int *act UNUSED) static int there_cmd_menu_next2u( winid win, - int x, int y, + coordxy x, coordxy y, int mod, int *act) { @@ -5041,7 +5044,7 @@ there_cmd_menu_common( static void act_on_act( int act, /* action */ - int dx, int dy) /* delta to adjacent spot (farther for couple of cases) */ + coordxy dx, coordxy dy) /* delta to adjacent spot (farther for couple of cases) */ { struct obj *otmp; int dir; @@ -5205,14 +5208,14 @@ act_on_act( /* offer choice of actions to perform at adjacent location */ static char -there_cmd_menu(int x, int y, int mod) +there_cmd_menu(coordxy x, coordxy y, int mod) { winid win; char ch = '\0'; int npick = 0, K = 0; menu_item *picks = (menu_item *) 0; /*int dx = sgn(x - u.ux), dy = sgn(y - u.uy);*/ - int dx = x - u.ux, dy = y - u.uy; + coordxy dx = x - u.ux, dy = y - u.uy; int act = MCMD_NOTHING; win = create_nhwindow(NHW_MENU); @@ -5271,7 +5274,7 @@ here_cmd_menu(void) * convert a MAP window position into a movement key usable with movecmd() */ const char * -click_to_cmd(int x, int y, int mod) +click_to_cmd(coordxy x, coordxy y, int mod) { static char cmd[4]; struct obj *o; @@ -5573,7 +5576,7 @@ end_of_input(void) #endif /* HANGUPHANDLING */ static char -readchar_core(int *x, int *y, int *mod) +readchar_core(coordxy *x, coordxy *y, int *mod) { register int sym; @@ -5632,14 +5635,15 @@ char readchar(void) { char ch; - int x = u.ux, y = u.uy, mod = 0; + coordxy x = u.ux, y = u.uy; + int mod = 0; ch = readchar_core(&x, &y, &mod); return ch; } char -readchar_poskey(int *x, int *y, int *mod) +readchar_poskey(coordxy *x, coordxy *y, int *mod) { char ch; diff --git a/src/dbridge.c b/src/dbridge.c index 571a46441..fdf5f11b6 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -19,14 +19,14 @@ #include "hack.h" -static void get_wall_for_db(int *, int *); -static struct entity *e_at(int, int); -static void m_to_e(struct monst *, int, int, struct entity *); +static void get_wall_for_db(coordxy *, coordxy *); +static struct entity *e_at(coordxy, coordxy); +static void m_to_e(struct monst *, coordxy, coordxy, struct entity *); static void u_to_e(struct entity *); -static void set_entity(int, int, struct entity *); +static void set_entity(coordxy, coordxy, struct entity *); static const char *e_nam(struct entity *); static const char *E_phrase(struct entity *, const char *); -static boolean e_survives_at(struct entity *, int, int); +static boolean e_survives_at(struct entity *, coordxy, coordxy); static void e_died(struct entity *, int, int); static boolean automiss(struct entity *); static boolean e_missed(struct entity *, boolean); @@ -42,7 +42,7 @@ is_waterwall(coordxy x, coordxy y) } boolean -is_pool(int x, int y) +is_pool(coordxy x, coordxy y) { schar ltyp; @@ -58,7 +58,7 @@ is_pool(int x, int y) } boolean -is_lava(int x, int y) +is_lava(coordxy x, coordxy y) { schar ltyp; @@ -73,7 +73,7 @@ is_lava(int x, int y) } boolean -is_pool_or_lava(int x, int y) +is_pool_or_lava(coordxy x, coordxy y) { if (is_pool(x, y) || is_lava(x, y)) return TRUE; @@ -82,7 +82,7 @@ is_pool_or_lava(int x, int y) } boolean -is_ice(int x, int y) +is_ice(coordxy x, coordxy y) { schar ltyp; @@ -96,7 +96,7 @@ is_ice(int x, int y) } boolean -is_moat(int x, int y) +is_moat(coordxy x, coordxy y) { schar ltyp; @@ -134,7 +134,7 @@ db_under_typ(int mask) */ int -is_drawbridge_wall(int x, int y) +is_drawbridge_wall(coordxy x, coordxy y) { struct rm *lev; @@ -164,7 +164,7 @@ is_drawbridge_wall(int x, int y) * (instead of UP or DOWN, as with is_drawbridge_wall). */ boolean -is_db_wall(int x, int y) +is_db_wall(coordxy x, coordxy y) { return (boolean) (levl[x][y].typ == DBWALL); } @@ -174,7 +174,7 @@ is_db_wall(int x, int y) * a drawbridge or drawbridge wall. */ boolean -find_drawbridge(int *x, int *y) +find_drawbridge(coordxy *x, coordxy *y) { int dir; @@ -205,7 +205,7 @@ find_drawbridge(int *x, int *y) * Find the drawbridge wall associated with a drawbridge. */ static void -get_wall_for_db(int *x, int *y) +get_wall_for_db(coordxy *x, coordxy *y) { switch (levl[*x][*y].drawbridgemask & DB_DIR) { case DB_NORTH: @@ -229,9 +229,9 @@ get_wall_for_db(int *x, int *y) * flag must be put to TRUE if we want the drawbridge to be opened. */ boolean -create_drawbridge(int x, int y, int dir, boolean flag) +create_drawbridge(coordxy x, coordxy y, int dir, boolean flag) { - int x2, y2; + coordxy x2, y2; boolean horiz; boolean lava = levl[x][y].typ == LAVAPOOL; /* assume initialized map */ @@ -279,7 +279,7 @@ create_drawbridge(int x, int y, int dir, boolean flag) } static struct entity * -e_at(int x, int y) +e_at(coordxy x, coordxy y) { int entitycnt; @@ -296,7 +296,7 @@ e_at(int x, int y) } static void -m_to_e(struct monst *mtmp, int x, int y, struct entity *etmp) +m_to_e(struct monst *mtmp, coordxy x, coordxy y, struct entity *etmp) { etmp->emon = mtmp; if (mtmp) { @@ -320,7 +320,7 @@ u_to_e(struct entity *etmp) } static void -set_entity(int x, int y, struct entity *etmp) +set_entity(coordxy x, coordxy y, struct entity *etmp) { if (u_at(x, y)) u_to_e(etmp); @@ -371,7 +371,7 @@ E_phrase(struct entity *etmp, const char *verb) * Simple-minded "can it be here?" routine */ static boolean -e_survives_at(struct entity *etmp, int x, int y) +e_survives_at(struct entity *etmp, coordxy x, coordxy y) { if (noncorporeal(etmp->edata)) return TRUE; @@ -525,7 +525,8 @@ e_jumps(struct entity *etmp) static void do_entity(struct entity *etmp) { - int newx, newy, at_portcullis, oldx, oldy; + coordxy newx, newy, oldx, oldy; + int at_portcullis; boolean must_jump = FALSE, relocates = FALSE, e_inview; struct rm *crm; @@ -732,11 +733,11 @@ do_entity(struct entity *etmp) * Close the drawbridge located at x,y */ void -close_drawbridge(int x, int y) +close_drawbridge(coordxy x, coordxy y) { register struct rm *lev1, *lev2; struct trap *t; - int x2, y2; + coordxy x2, y2; lev1 = &levl[x][y]; if (lev1->typ != DRAWBRIDGE_DOWN) @@ -793,11 +794,11 @@ close_drawbridge(int x, int y) * Open the drawbridge located at x,y */ void -open_drawbridge(int x, int y) +open_drawbridge(coordxy x, coordxy y) { register struct rm *lev1, *lev2; struct trap *t; - int x2, y2; + coordxy x2, y2; lev1 = &levl[x][y]; if (lev1->typ != DRAWBRIDGE_UP) @@ -839,12 +840,13 @@ open_drawbridge(int x, int y) * Let's destroy the drawbridge located at x,y */ void -destroy_drawbridge(int x, int y) +destroy_drawbridge(coordxy x, coordxy y) { register struct rm *lev1, *lev2; struct trap *t; struct obj *otmp; - int x2, y2, i; + coordxy x2, y2; + int i; boolean e_inview; struct entity *etmp1 = &(g.occupants[0]), *etmp2 = &(g.occupants[1]); diff --git a/src/detect.c b/src/detect.c index 9699d76a5..9f814f96b 100644 --- a/src/detect.c +++ b/src/detect.c @@ -17,17 +17,17 @@ static void map_redisplay(void); static void browse_map(int, const char *); 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 check_map_spot(coordxy, coordxy, char, unsigned); static boolean clear_stale_map(char, unsigned); 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); -static void show_map_spot(int, int); -static void findone(int, int, genericptr_t); -static void openone(int, int, genericptr_t); +static void show_map_spot(coordxy, coordxy); +static void findone(coordxy, coordxy, genericptr_t); +static void openone(coordxy, coordxy, genericptr_t); static int mfind0(struct monst *, boolean); -static int reveal_terrain_getglyph(int, int, int, unsigned, int, int); +static int reveal_terrain_getglyph(coordxy, coordxy, int, unsigned, int, int); /* dummytrap: used when detecting traps finds a door or chest trap; the couple of fields that matter are always re-initialized during use so @@ -111,7 +111,7 @@ map_monst(struct monst *mtmp, boolean showtail) /* this is checking whether a trap symbol represents a trapped chest, not whether a trapped chest is actually present */ boolean -trapped_chest_at(int ttyp, int x, int y) +trapped_chest_at(int ttyp, coordxy x, coordxy y) { struct monst *mtmp; struct obj *otmp; @@ -154,7 +154,7 @@ trapped_chest_at(int ttyp, int x, int y) /* this is checking whether a trap symbol represents a trapped door, not whether the door here is actually trapped */ boolean -trapped_door_at(int ttyp, int x, int y) +trapped_door_at(int ttyp, coordxy x, coordxy y) { struct rm *lev; @@ -234,7 +234,7 @@ do_dknown_of(struct obj *obj) /* Check whether the location has an outdated object displayed on it. */ static boolean -check_map_spot(int x, int y, char oclass, unsigned material) +check_map_spot(coordxy x, coordxy y, char oclass, unsigned material) { int glyph; register struct obj *otmp; @@ -290,7 +290,7 @@ check_map_spot(int x, int y, char oclass, unsigned material) static boolean clear_stale_map(char oclass, unsigned material) { - register int zx, zy; + register coordxy zx, zy; boolean change_made = FALSE; for (zx = 1; zx < COLNO; zx++) @@ -578,7 +578,7 @@ int object_detect(struct obj *detector, /* object doing the detecting */ int class) /* an object class, 0 for all */ { - register int x, y; + register coordxy x, y; char stuff[BUFSZ]; int is_cursed = (detector && detector->cursed); int do_dknown = (detector && (detector->oclass == POTION_CLASS @@ -1045,7 +1045,8 @@ static int furniture_detect(void) { struct monst *mon; - int x, y, glyph, sym, found = 0, revealed = 0; + coordxy x, y; + int glyph, sym, found = 0, revealed = 0; (void) unconstrain_map(); @@ -1312,7 +1313,7 @@ use_crystal_ball(struct obj **optr) } static void -show_map_spot(int x, int y) +show_map_spot(coordxy x, coordxy y) { struct rm *lev; struct trap *t; @@ -1541,7 +1542,7 @@ cvt_sdoor_to_door(struct rm *lev) /* find something at one location; it should find all somethings there since it is used for magical detection rather than physical searching */ static void -findone(int zx, int zy, genericptr_t num) +findone(coordxy zx, coordxy zy, genericptr_t num) { register struct trap *ttmp; register struct monst *mtmp; @@ -1595,7 +1596,7 @@ findone(int zx, int zy, genericptr_t num) } static void -openone(int zx, int zy, genericptr_t num) +openone(coordxy zx, coordxy zy, genericptr_t num) { register struct trap *ttmp; register struct obj *otmp; @@ -1691,7 +1692,7 @@ openit(void) /* callback hack for overriding vision in do_clear_area() */ boolean -detecting(void (*func)(int, int, genericptr_t)) +detecting(void (*func)(coordxy, coordxy, genericptr_t)) { return (func == findone || func == openone); } @@ -1728,7 +1729,7 @@ find_trap(struct trap *trap) static int mfind0(struct monst *mtmp, boolean via_warning) { - int x = mtmp->mx, y = mtmp->my; + coordxy x = mtmp->mx, y = mtmp->my; boolean found_something = FALSE; if (via_warning && !warning_of(mtmp)) @@ -1864,7 +1865,7 @@ dosearch(void) void warnreveal(void) { - int x, y; + coordxy x, y; struct monst *mtmp; for (x = u.ux - 1; x <= u.ux + 1; x++) @@ -1881,7 +1882,7 @@ warnreveal(void) void sokoban_detect(void) { - register int x, y; + register coordxy x, y; register struct trap *ttmp; register struct obj *obj; @@ -1908,7 +1909,7 @@ sokoban_detect(void) } static int -reveal_terrain_getglyph(int x, int y, int full, unsigned swallowed, +reveal_terrain_getglyph(coordxy x, coordxy y, int full, unsigned swallowed, int default_glyph, int which_subset) { int glyph, levl_glyph; @@ -1989,7 +1990,8 @@ reveal_terrain_getglyph(int x, int y, int full, unsigned swallowed, void dump_map(void) { - int x, y, glyph, skippedrows, lastnonblank; + coordxy x, y; + int glyph, skippedrows, lastnonblank; int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON; int default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree : S_stone); @@ -2052,7 +2054,8 @@ reveal_terrain( if ((Hallucination || Stunned || Confusion) && !full) { You("are too disoriented for this."); } else { - int x, y, glyph, default_glyph; + coordxy x, y; + int glyph, default_glyph; char buf[BUFSZ]; /* there is a TER_MAP bit too; we always show map regardless of it */ boolean keep_traps = (which_subset & TER_TRP) !=0, diff --git a/src/dig.c b/src/dig.c index b6fbf5b82..6dce498f7 100644 --- a/src/dig.c +++ b/src/dig.c @@ -13,7 +13,7 @@ static void dig_up_grave(coord *); static boolean watchman_canseeu(struct monst *); static int adj_pit_checks(coord *, char *); static void pit_flow(struct trap *, schar); -static boolean furniture_handled(int, int, boolean); +static boolean furniture_handled(coordxy, coordxy, boolean); /* Indices returned by dig_typ() */ enum dig_types { @@ -173,7 +173,7 @@ is_digging(void) #define BY_OBJECT ((struct monst *) 0) boolean -dig_check(struct monst *madeby, boolean verbose, int x, int y) +dig_check(struct monst *madeby, boolean verbose, coordxy x, coordxy y) { struct trap *ttmp = t_at(x, y); const char *verb = @@ -483,7 +483,7 @@ dig(void) } static boolean -furniture_handled(int x, int y, boolean madeby_u) +furniture_handled(coordxy x, coordxy y, boolean madeby_u) { struct rm *lev = &levl[x][y]; @@ -495,7 +495,7 @@ furniture_handled(int x, int y, boolean madeby_u) breaksink(x, y); } else if (lev->typ == DRAWBRIDGE_DOWN || (is_drawbridge_wall(x, y) >= 0)) { - int bx = x, by = y; + coordxy bx = x, by = y; /* if under the portcullis, the bridge is adjacent */ (void) find_drawbridge(&bx, &by); @@ -518,12 +518,12 @@ holetime(void) /* Return typ of liquid to fill a hole with, or ROOM, if no liquid nearby */ schar -fillholetyp(int x, int y, +fillholetyp(coordxy x, coordxy y, boolean fill_if_any) /* force filling if it exists at all */ { - register int x1, y1; - int lo_x = max(1, x - 1), hi_x = min(x + 1, COLNO - 1), - lo_y = max(0, y - 1), hi_y = min(y + 1, ROWNO - 1); + coordxy x1, y1; + coordxy lo_x = max(1, x - 1), hi_x = min(x + 1, COLNO - 1), + lo_y = max(0, y - 1), hi_y = min(y + 1, ROWNO - 1); int pool_cnt = 0, moat_cnt = 0, lava_cnt = 0; for (x1 = lo_x; x1 <= hi_x; x1++) @@ -552,7 +552,7 @@ fillholetyp(int x, int y, } void -digactualhole(int x, int y, struct monst *madeby, int ttyp) +digactualhole(coordxy x, coordxy y, struct monst *madeby, int ttyp) { struct obj *oldobjs, *newobjs; register struct trap *ttmp; @@ -810,7 +810,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) if (pit_only) { pline_The("drawbridge seems too hard to dig through."); } else { - int x = dig_x, y = dig_y; + coordxy x = dig_x, y = dig_y; /* if under the portcullis, the bridge is adjacent */ (void) find_drawbridge(&x, &y); destroy_drawbridge(x, y); @@ -1029,7 +1029,7 @@ use_pick_axe(struct obj *obj) int use_pick_axe2(struct obj *obj) { - register int rx, ry; + coordxy rx, ry; register struct rm *lev; struct trap *trap, *trap_with_u; int dig_target; @@ -1394,7 +1394,8 @@ zap_dig(void) struct monst *mtmp; struct obj *otmp; struct trap *trap_with_u = (struct trap *) 0; - int zx, zy, diridx = 8, digdepth, flow_x = -1, flow_y = -1; + coordxy zx, zy, flow_x = -1, flow_y = -1; + int diridx = 8, digdepth; boolean shopdoor, shopwall, maze_dig, pitdig = FALSE, pitflow = FALSE; /* @@ -1702,7 +1703,7 @@ pit_flow(struct trap *trap, schar filltyp) : (char *) 0); for (idx = 0; idx < N_DIRS; ++idx) { if (t.conjoined & (1 << idx)) { - int x, y; + coordxy x, y; struct trap *t2; x = t.tx + xdir[idx]; diff --git a/src/display.c b/src/display.c index f2629078e..1b83021c6 100644 --- a/src/display.c +++ b/src/display.c @@ -123,14 +123,14 @@ */ #include "hack.h" -static void show_mon_or_warn(int, int, int); +static void show_mon_or_warn(coordxy, coordxy, int); 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 check_pos(coordxy, coordxy, int); static int get_bk_glyph(coordxy x, coordxy y); -static int tether_glyph(int, int); +static int tether_glyph(coordxy, coordxy); static void mimic_light_blocking(struct monst *); #ifdef UNBUFFERED_GLYPHINFO static glyph_info *glyphinfo_at(coordxy, coordxy, int); @@ -138,14 +138,14 @@ static glyph_info *glyphinfo_at(coordxy, coordxy, int); /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ #ifdef WA_VERBOSE -static boolean more_than_one(int, int, int, int, int); +static boolean more_than_one(coordxy, coordxy, coordxy, coordxy, coordxy); #endif -static int set_twall(int, int, int, int, int, int, int, int); -static int set_wall(int, int, int); -static int set_corn(int, int, int, int, int, int, int, int); -static int set_crosswall(int, int); -static void set_seenv(struct rm *, int, int, int, int); +static int set_twall(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy); +static int set_wall(coordxy, coordxy, int); +static int set_corn(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy); +static int set_crosswall(coordxy, coordxy); +static void set_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy); static void t_warn(struct rm *); static int wall_angle(struct rm *); @@ -266,9 +266,6 @@ magic_map_background(coordxy x, coordxy y, int show) * having to create fake objects and traps. However, I am reluctant to * make this change. */ -/* FIXME: some of these use coordxys for x and y, and some use ints. Make - * this consistent. - */ /* * map_background() @@ -296,7 +293,7 @@ map_background(register coordxy x, register coordxy y, register int show) void map_trap(register struct trap *trap, register int show) { - register int x = trap->tx, y = trap->ty; + register coordxy x = trap->tx, y = trap->ty; register int glyph = trap_to_glyph(trap); if (g.level.flags.hero_memory) @@ -314,7 +311,7 @@ map_trap(register struct trap *trap, register int show) void map_object(register struct obj *obj, register int show) { - register int x = obj->ox, y = obj->oy; + register coordxy x = obj->ox, y = obj->oy; register int glyph = obj_to_glyph(obj, newsym_rn2); if (g.level.flags.hero_memory) { @@ -351,7 +348,7 @@ map_invisible(register coordxy x, register coordxy y) } boolean -unmap_invisible(int x, int y) +unmap_invisible(coordxy x, coordxy y) { if (isok(x,y) && glyph_is_invisible(levl[x][y].glyph)) { unmap_object(x, y); @@ -372,7 +369,7 @@ unmap_invisible(int x, int y) * to call newsym(). */ void -unmap_object(register int x, register int y) +unmap_object(register coordxy x, register coordxy y) { register struct trap *trap; @@ -419,14 +416,14 @@ unmap_object(register int x, register int y) } void -map_location(int x, int y, int show) +map_location(coordxy x, coordxy y, int show) { _map_location(x, y, show); } /* display something on monster layer; may need to fixup object layer */ static void -show_mon_or_warn(int x, int y, int monglyph) +show_mon_or_warn(coordxy x, coordxy y, int monglyph) { struct obj *o; @@ -577,7 +574,7 @@ display_monster(coordxy x, coordxy y, /* display position */ static void display_warning(struct monst *mon) { - int x = mon->mx, y = mon->my; + coordxy x = mon->mx, y = mon->my; int glyph; if (mon_warning(mon)) { @@ -814,7 +811,7 @@ feel_location(coordxy x, coordxy y) * Possibly put a new glyph at the given location. */ void -newsym(register int x, register int y) +newsym(coordxy x, coordxy y) { struct monst *mon; int see_it; @@ -995,7 +992,7 @@ shieldeff(coordxy x, coordxy y) } static int -tether_glyph(int x, int y) +tether_glyph(coordxy x, coordxy y) { int tdx, tdy; tdx = u.ux - x; @@ -1040,7 +1037,7 @@ static struct tmp_glyph { } tgfirst; void -tmp_at(int x, int y) +tmp_at(coordxy x, coordxy y) { static struct tmp_glyph *tglyph = (struct tmp_glyph *) 0; struct tmp_glyph *tmp; @@ -1169,7 +1166,7 @@ tmp_at(int x, int y) * meant to be at the location. */ void -flash_glyph_at(int x, int y, int tg, int rpt) +flash_glyph_at(coordxy x, coordxy y, int tg, int rpt) { int i, glyph[2]; @@ -1205,7 +1202,7 @@ swallowed(int first) cls(); bot(); } else { - register int x, y; + coordxy x, y; /* Clear old location */ for (y = lasty - 1; y <= lasty + 1; y++) @@ -1263,7 +1260,7 @@ under_water(int mode) { static coordxy lastx, lasty; static boolean dela; - register int x, y; + coordxy x, y; /* swallowing has a higher precedence than under water */ if (Is_waterlevel(&u.uz) || u.uswallow) @@ -1504,7 +1501,7 @@ doredraw(void) void docrt(void) { - register int x, y; + coordxy x, y; register struct rm *lev; if (!u.ux || g.program_state.in_docrt) @@ -1562,7 +1559,8 @@ docrt(void) void redraw_map(void) { - int x, y, glyph; + coordxy x, y; + int glyph; glyph_info bkglyphinfo = nul_glyphinfo; /* @@ -1633,7 +1631,7 @@ reglyph_darkroom(void) * between object piles and single objects, it doesn't mark the location * for update. */ void -newsym_force(int x, int y) +newsym_force(coordxy x, coordxy y) { newsym(x, y); g.gbuf[y][x].gnew = 1; @@ -1647,7 +1645,7 @@ newsym_force(int x, int y) * Store the glyph in the 3rd screen for later flushing. */ void -show_glyph(int x, int y, int glyph) +show_glyph(coordxy x, coordxy y, int glyph) { #ifndef UNBUFFERED_GLYPHINFO glyph_info glyphinfo; @@ -1826,7 +1824,7 @@ static gbuf_entry nul_gbuf = { void clear_glyph_buffer(void) { - register int x, y; + register coordxy x, y; gbuf_entry *gptr = &g.gbuf[0][0]; glyph_info *giptr = #ifndef UNBUFFERED_GLYPHINFO @@ -1861,9 +1859,10 @@ clear_glyph_buffer(void) /* used by tty after menu or text popup has temporarily overwritten the map and it has been erased so shows spaces, not necessarily S_unexplored */ void -row_refresh(int start, int stop, int y) +row_refresh(coordxy start, coordxy stop, coordxy y) { - register int x, glyph; + register coordxy x; + int glyph; register boolean force; gbuf_entry *gptr = &g.gbuf[0][0]; glyph_info bkglyphinfo = nul_glyphinfo; @@ -1924,7 +1923,7 @@ flush_screen(int cursor_on_u) */ static int flushing = 0; static int delay_flushing = 0; - register int x, y; + register coordxy x, y; glyph_info bkglyphinfo = nul_glyphinfo; /* 3.7: don't update map, status, or perm_invent during save/restore */ @@ -2784,7 +2783,7 @@ reset_glyphmap(enum glyphmap_change_triggers trigger) #ifdef WA_VERBOSE static const char *type_to_name(int); -static void error4(int, int, int, int, int, int); +static void error4(coordxy, coordxy, int, int, int, int); static int bad_count[MAX_TYPE]; /* count of positions flagged as bad */ static const char *const type_names[MAX_TYPE] = { @@ -2803,7 +2802,7 @@ type_to_name(int type) } static void -error4(int x, int y, int a, int b, int c, int dd) +error4(coordxy x, coordxy y, int a, int b, int c, int dd) { pline("set_wall_state: %s @ (%d,%d) %s%s%s%s", type_to_name(levl[x][y].typ), x, y, @@ -2819,7 +2818,7 @@ error4(int x, int y, int a, int b, int c, int dd) * Things that are ambiguous: lava */ static int -check_pos(int x, int y, int which) +check_pos(coordxy x, coordxy y, int which) { int type; @@ -2835,7 +2834,7 @@ check_pos(int x, int y, int which) /*ARGSUSED*/ #ifdef WA_VERBOSE static boolean -more_than_one(int x, int y, int a, int b, int c) +more_than_one(coordxy x, coordxy y, coordxy a, coordxy b, coordxy c) { if ((a && (b | c)) || (b && (a | c)) || (c && (a | b))) { error4(x, y, a, b, c, 0); @@ -2852,11 +2851,11 @@ more_than_one(int x, int y, int a, int b, int c) static int set_twall( #ifdef WA_VERBOSE - int x0, int y0, /* used #if WA_VERBOSE */ + coordxy x0, coordxy y0, /* used #if WA_VERBOSE */ #else - int x0 UNUSED, int y0 UNUSED, + coordxy x0 UNUSED, coordxy y0 UNUSED, #endif - int x1, int y1, int x2, int y2, int x3, int y3) + coordxy x1, coordxy y1, coordxy x2, coordxy y2, coordxy x3, coordxy y3) { int wmode, is_1, is_2, is_3; @@ -2873,7 +2872,7 @@ set_twall( /* Return wall mode for a horizontal or vertical wall. */ static int -set_wall(int x, int y, int horiz) +set_wall(coordxy x, coordxy y, int horiz) { int wmode, is_1, is_2; @@ -2894,9 +2893,9 @@ set_wall(int x, int y, int horiz) /* Return a wall mode for a corner wall. (x4,y4) is the "inner" position. */ static int -set_corn(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) +set_corn(coordxy x1, coordxy y1, coordxy x2, coordxy y2, coordxy x3, coordxy y3, coordxy x4, coordxy y4) { - int wmode, is_1, is_2, is_3, is_4; + coordxy wmode, is_1, is_2, is_3, is_4; is_1 = check_pos(x1, y1, 1); is_2 = check_pos(x2, y2, 1); @@ -2922,9 +2921,9 @@ set_corn(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) /* Return mode for a crosswall. */ static int -set_crosswall(int x, int y) +set_crosswall(coordxy x, coordxy y) { - int wmode, is_1, is_2, is_3, is_4; + coordxy wmode, is_1, is_2, is_3, is_4; is_1 = check_pos(x - 1, y - 1, 1); is_2 = check_pos(x + 1, y - 1, 1); @@ -2958,14 +2957,14 @@ set_crosswall(int x, int y) /* called for every by set_wall_state() and for specific during vault wall repair */ void -xy_set_wall_state(int x, int y) +xy_set_wall_state(coordxy x, coordxy y) { - int wmode; + coordxy wmode; struct rm *lev = &levl[x][y]; switch (lev->typ) { case SDOOR: - wmode = set_wall(x, y, (int) lev->horizontal); + wmode = set_wall(x, y, (coordxy) lev->horizontal); break; case VWALL: wmode = set_wall(x, y, 0); @@ -3014,7 +3013,7 @@ xy_set_wall_state(int x, int y) void set_wall_state(void) { - int x, y; + coordxy x, y; #ifdef WA_VERBOSE for (x = 0; x < MAX_TYPE; x++) @@ -3030,7 +3029,7 @@ set_wall_state(void) for (x = y = 0; x < MAX_TYPE; x++) if (bad_count[x]) { if (y == 0) { - y = 1; /* only print once */ + y = 1; /* only prcoordxy once */ pline("set_wall_type: wall mode problems with: "); } pline("%s %d;", type_names[x], bad_count[x]); @@ -3049,21 +3048,22 @@ unsigned char seenv_matrix[3][3] = { { SV2, SV1, SV0 }, /* Set the seen vector of lev as if seen from (x0,y0) to (x,y). */ static void set_seenv(struct rm *lev, - int x0, int y0, int x, int y) /* from, to */ + coordxy x0, coordxy y0, coordxy x, coordxy y) /* from, to */ { - int dx = x - x0, dy = y0 - y; + coordxy dx = x - x0, dy = y0 - y; lev->seenv |= seenv_matrix[sign(dy) + 1][sign(dx) + 1]; } /* Called by blackout(vault.c) when vault guard removes temporary corridor, - turning spot back into stone; is an adjacent spot. */ + turning spot back coordxyo stone; is an adjacent spot. */ void unset_seenv(struct rm *lev, /* &levl[x1][y1] */ - int x0, int y0, int x1, int y1) /* from, to; abs(x1-x0)==1 + coordxy x0, coordxy y0, + coordxy x1, coordxy y1) /* from, to; abs(x1-x0)==1 && abs(y0-y1)==1 */ { - int dx = x1 - x0, dy = y0 - y1; + coordxy dx = x1 - x0, dy = y0 - y1; lev->seenv &= ~seenv_matrix[dy + 1][dx + 1]; } diff --git a/src/do.c b/src/do.c index 046457c9c..172a4d3cd 100644 --- a/src/do.c +++ b/src/do.c @@ -43,7 +43,7 @@ dodrop(void) * it's gone for good... If the destination is not a pool, returns FALSE. */ boolean -boulder_hits_pool(struct obj *otmp, int rx, int ry, boolean pushing) +boulder_hits_pool(struct obj *otmp, coordxy rx, coordxy ry, boolean pushing) { if (!otmp || otmp->otyp != BOULDER) { impossible("Not a boulder?"); @@ -138,7 +138,7 @@ boulder_hits_pool(struct obj *otmp, int rx, int ry, boolean pushing) * away. */ boolean -flooreffects(struct obj *obj, int x, int y, const char *verb) +flooreffects(struct obj *obj, coordxy x, coordxy y, const char *verb) { struct trap *t; struct monst *mtmp; @@ -385,7 +385,7 @@ polymorph_sink(void) static boolean teleport_sink(void) { - int cx, cy; + coordxy cx, cy; int cnt = 0; struct trap *trp; struct engr *eng; diff --git a/src/do_name.c b/src/do_name.c index 7dc882553..7c5d591e6 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -10,11 +10,11 @@ static void getpos_help_keyxhelp(winid, const char *, const char *, int); static void getpos_help(boolean, const char *); static int QSORTCALLBACK cmp_coord_distu(const void *, const void *); static int gloc_filter_classify_glyph(int); -static int gloc_filter_floodfill_matcharea(int, int); -static void gloc_filter_floodfill(int, int); +static int gloc_filter_floodfill_matcharea(coordxy, coordxy); +static void gloc_filter_floodfill(coordxy, coordxy); static void gloc_filter_init(void); static void gloc_filter_done(void); -static boolean gather_locs_interesting(int, int, int); +static boolean gather_locs_interesting(coordxy, coordxy, int); static void gather_locs(coord **, int *, int); static void auto_describe(int, int); static void truncate_to_map(int *, int *, schar, schar); @@ -43,10 +43,10 @@ nextmbuf(void) * parameter value 0 = initialize, 1 = highlight, 2 = done */ static void (*getpos_hilitefunc)(int) = (void (*)(int)) 0; -static boolean (*getpos_getvalid)(int, int) = (boolean (*)(int, int)) 0; +static boolean (*getpos_getvalid)(coordxy, coordxy) = (boolean (*)(coordxy, coordxy)) 0; void -getpos_sethilite(void (*gp_hilitef)(int), boolean (*gp_getvalidf)(int, int)) +getpos_sethilite(void (*gp_hilitef)(int), boolean (*gp_getvalidf)(coordxy, coordxy)) { getpos_hilitefunc = gp_hilitef; getpos_getvalid = gp_getvalidf; @@ -295,7 +295,7 @@ gloc_filter_classify_glyph(int glyph) } static int -gloc_filter_floodfill_matcharea(int x, int y) +gloc_filter_floodfill_matcharea(coordxy x, coordxy y) { int glyph = back_to_glyph(x, y); @@ -313,7 +313,7 @@ gloc_filter_floodfill_matcharea(int x, int y) } static void -gloc_filter_floodfill(int x, int y) +gloc_filter_floodfill(coordxy x, coordxy y) { g.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y); @@ -355,7 +355,7 @@ gloc_filter_done(void) DISABLE_WARNING_UNREACHABLE_CODE static boolean -gather_locs_interesting(int x, int y, int gloc) +gather_locs_interesting(coordxy x, coordxy y, int gloc) { int glyph, sym; @@ -428,7 +428,8 @@ RESTORE_WARNINGS static void gather_locs(coord **arr_p, int *cnt_p, int gloc) { - int x, y, pass, idx; + int pass, idx; + coordxy x, y; /* * We always include the hero's location even if there is no monster @@ -469,7 +470,7 @@ gather_locs(coord **arr_p, int *cnt_p, int gloc) } char * -dxdy_to_dist_descr(int dx, int dy, boolean fulldir) +dxdy_to_dist_descr(coordxy dx, coordxy dy, boolean fulldir) { static char buf[30]; int dst; @@ -507,7 +508,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL /* coordinate formatting for 'whatis_coord' option */ char * -coord_desc(int x, int y, char *outbuf, char cmode) +coord_desc(coordxy x, coordxy y, char *outbuf, char cmode) { static char screen_fmt[16]; /* [12] suffices: "[%02d,%02d]" */ int dx, dy; @@ -693,7 +694,8 @@ getpos(coord *ccp, boolean force, const char *goal) char mMoOdDxX[13]; int result = 0; int cx, cy, i, c; - int sidx, tx = u.ux, ty = u.uy; + int sidx; + coordxy tx = u.ux, ty = u.uy; boolean msg_given = TRUE; /* clear message window by default */ boolean show_goal_msg = FALSE; boolean hilite_state = FALSE; @@ -1031,7 +1033,7 @@ getpos(coord *ccp, boolean force, const char *goal) if (garr[i]) free((genericptr_t) garr[i]); getpos_hilitefunc = (void (*)(int)) 0; - getpos_getvalid = (boolean (*)(int, int)) 0; + getpos_getvalid = (boolean (*)(coordxy, coordxy)) 0; u.dx = udx, u.dy = udy, u.dz = udz; return result; } diff --git a/src/dogmove.c b/src/dogmove.c index 55c430214..39de229f0 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -136,10 +136,10 @@ static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS, 0 }; -static void wantdoor(int, int, genericptr_t); +static void wantdoor(coordxy, coordxy, genericptr_t); boolean -cursed_object_at(int x, int y) +cursed_object_at(coordxy x, coordxy y) { struct obj *otmp; @@ -214,8 +214,8 @@ dog_nutrition(struct monst *mtmp, struct obj *obj) int dog_eat(struct monst *mtmp, struct obj *obj, /* if unpaid, then thrown or kicked by hero */ - int x, /* dog's starting location, */ - int y, /* might be different from current */ + coordxy x, /* dog's starting location, */ + coordxy y, /* might be different from current */ boolean devour) { register struct edog *edog = EDOG(mtmp); @@ -506,7 +506,7 @@ static int dog_goal(register struct monst *mtmp, struct edog *edog, int after, int udist, int whappr) { - register int omx, omy; + register coordxy omx, omy; boolean in_masters_sight, dog_has_minvent; register struct obj *obj; xint16 otyp; @@ -530,7 +530,7 @@ dog_goal(register struct monst *mtmp, struct edog *edog, #define DDIST(x, y) (dist2(x, y, omx, omy)) #define SQSRCHRADIUS 5 int min_x, max_x, min_y, max_y; - register int nx, ny; + coordxy nx, ny; g.gtyp = UNDEF; /* no goal as yet */ g.gx = g.gy = 0; /* suppress 'used before set' message */ @@ -917,7 +917,7 @@ dog_move(register struct monst *mtmp, boolean has_edog, cursemsg[9], do_eat = FALSE; boolean better_with_displacing = FALSE; coordxy nix, niy; /* position mtmp is (considering) moving to */ - register int nx, ny; /* temporary coordinates */ + coordxy nx, ny; /* temporary coordinates */ xint16 cnt, uncursedcnt, chcnt; int chi = -1, nidist, ndist; coord poss[9]; @@ -1379,7 +1379,7 @@ can_reach_location(struct monst *mon, coordxy mx, coordxy my, coordxy fx, coordx /* do_clear_area client */ static void -wantdoor(int x, int y, genericptr_t distance) +wantdoor(coordxy x, coordxy y, genericptr_t distance) { int ndist, *dist_ptr = (int *) distance; diff --git a/src/dokick.c b/src/dokick.c index 3e4c153fe..585ac8fbd 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -19,8 +19,8 @@ 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 *, coordxy, coordxy); -static void kick_dumb(int, int); -static void kick_ouch(int, int, const char *); +static void kick_dumb(coordxy, coordxy); +static void kick_ouch(coordxy, coordxy, const char *); static void otransit_msg(struct obj *, boolean, boolean, long); static void drop_to(coord *, schar, coordxy, coordxy); @@ -803,7 +803,7 @@ watchman_door_damage(struct monst *mtmp, coordxy x, coordxy y) } static void -kick_dumb(int x, int y) +kick_dumb(coordxy x, coordxy y) { exercise(A_DEX, FALSE); if (martial() || ACURR(A_DEX) >= 16 || rn2(3)) { @@ -820,7 +820,7 @@ kick_dumb(int x, int y) } static void -kick_ouch(int x, int y, const char *kickobjnam) +kick_ouch(coordxy x, coordxy y, const char *kickobjnam) { int dmg; char buf[BUFSZ]; @@ -850,7 +850,7 @@ kick_ouch(int x, int y, const char *kickobjnam) int dokick(void) { - int x, y; + coordxy x, y; int avrg_attrib; int glyph, oldglyph = -1; register struct monst *mtmp; @@ -943,7 +943,7 @@ dokick(void) return ECMD_TIME; } if (Levitation) { - int xx, yy; + coordxy xx, yy; xx = u.ux - u.dx; yy = u.uy - u.dy; diff --git a/src/dothrow.c b/src/dothrow.c index 2bfbc4adf..901a24e23 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -20,7 +20,7 @@ static boolean harmless_missile(struct obj *); static void breakmsg(struct obj *, boolean); static boolean toss_up(struct obj *, boolean); static void sho_obj_return_to_u(struct obj * obj); -static boolean mhurtle_step(genericptr_t, int, int); +static boolean mhurtle_step(genericptr_t, coordxy, coordxy); /* uwep might already be removed from inventory so test for W_WEP instead; for Valk+Mjollnir, caller needs to validate the strength requirement */ @@ -610,10 +610,11 @@ hitfloor( */ boolean walk_path(coord *src_cc, coord *dest_cc, - boolean (*check_proc)(genericptr_t, int, int), + boolean (*check_proc)(genericptr_t, coordxy, coordxy), genericptr_t arg) { - int x, y, dx, dy, x_change, y_change, err, i, prev_x, prev_y; + int err; + coordxy x, y, dx, dy, x_change, y_change, i, prev_x, prev_y; boolean keep_going = TRUE; /* Use Bresenham's Line Algorithm to walk from src to dest. @@ -692,7 +693,7 @@ walk_path(coord *src_cc, coord *dest_cc, vs drag-to-dest; original callers use first mode, jumping wants second, grappling hook backfire and thrown chained ball need third */ boolean -hurtle_jump(genericptr_t arg, int x, int y) +hurtle_jump(genericptr_t arg, coordxy x, coordxy y) { boolean res; long save_EWwalking = EWwalking; @@ -723,9 +724,10 @@ hurtle_jump(genericptr_t arg, int x, int y) * o let jumps go over boulders */ boolean -hurtle_step(genericptr_t arg, int x, int y) +hurtle_step(genericptr_t arg, coordxy x, coordxy y) { - int ox, oy, *range = (int *) arg; + coordxy ox, oy; + int *range = (int *) arg; struct obj *obj; struct monst *mon; boolean may_pass = TRUE, via_jumping, stopping_short; @@ -938,7 +940,7 @@ hurtle_step(genericptr_t arg, int x, int y) } static boolean -mhurtle_step(genericptr_t arg, int x, int y) +mhurtle_step(genericptr_t arg, coordxy x, coordxy y) { struct monst *mon = (struct monst *) arg; struct monst *mtmp; diff --git a/src/dungeon.c b/src/dungeon.c index eb61c1f5f..0f15f8b20 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1406,7 +1406,7 @@ prev_level(boolean at_stairs) } void -u_on_newpos(int x, int y) +u_on_newpos(coordxy x, coordxy y) { if (!isok(x, y)) { /* validate location */ void (*func)(const char *, ...); @@ -1463,7 +1463,7 @@ u_on_rndspot(int upflag) } void -stairway_add(int x, int y, boolean up, boolean isladder, d_level *dest) +stairway_add(coordxy x, coordxy y, boolean up, boolean isladder, d_level *dest) { stairway *tmp = (stairway *) alloc(sizeof (stairway)); @@ -1491,7 +1491,7 @@ stairway_free_all(void) } stairway * -stairway_at(int x, int y) +stairway_at(coordxy x, coordxy y) { stairway *tmp = g.stairs; @@ -1660,7 +1660,7 @@ Can_fall_thru(d_level *lev) * Checks for amulets and such must be done elsewhere. */ boolean -Can_rise_up(int x, int y, d_level *lev) +Can_rise_up(coordxy x, coordxy y, d_level *lev) { stairway *stway = stairway_find_special_dir(FALSE); @@ -1815,7 +1815,7 @@ On_W_tower_level(d_level *lev) /* is of `lev' inside the Wizard's tower? */ boolean -In_W_tower(int x, int y, d_level *lev) +In_W_tower(coordxy x, coordxy y, d_level *lev) { if (!On_W_tower_level(lev)) return FALSE; @@ -2766,7 +2766,8 @@ recalc_mapseen(void) struct cemetery *bp, **bonesaddr; struct trap *t; unsigned i, ridx, atmp; - int x, y, ltyp, count; + int ltyp, count; + coordxy x, y; char uroom; /* Should not happen in general, but possible if in the process diff --git a/src/engrave.c b/src/engrave.c index d945c846f..963acac66 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -177,7 +177,7 @@ can_reach_floor(boolean check_pit) /* give a message after caller has determined that hero can't reach */ void -cant_reach_floor(int x, int y, boolean up, boolean check_pit) +cant_reach_floor(coordxy x, coordxy y, boolean up, boolean check_pit) { You("can't reach the %s.", up ? ceiling(x, y) @@ -187,7 +187,7 @@ cant_reach_floor(int x, int y, boolean up, boolean check_pit) } const char * -surface(int x, int y) +surface(coordxy x, coordxy y) { struct rm *lev = &levl[x][y]; @@ -218,7 +218,7 @@ surface(int x, int y) } const char * -ceiling(int x, int y) +ceiling(coordxy x, coordxy y) { struct rm *lev = &levl[x][y]; const char *what; @@ -310,7 +310,7 @@ wipe_engr_at(coordxy x, coordxy y, xint16 cnt, boolean magical) } void -read_engr_at(int x, int y) +read_engr_at(coordxy x, coordxy y) { struct engr *ep = engr_at(x, y); int sensed = 0; @@ -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, xint16 e_type) +make_engr_at(coordxy x, coordxy y, const char *s, long e_time, xint16 e_type) { struct engr *ep; unsigned smem = Strlen(s) + 1; @@ -409,7 +409,7 @@ make_engr_at(int x, int y, const char *s, long e_time, xint16 e_type) /* delete any engraving at location */ void -del_engr_at(int x, int y) +del_engr_at(coordxy x, coordxy y) { struct engr *ep = engr_at(x, y); @@ -1437,7 +1437,7 @@ rloc_engr(struct engr *ep) * The caller is responsible for newsym(x, y). */ void -make_grave(int x, int y, const char *str) +make_grave(coordxy x, coordxy y, const char *str) { char buf[BUFSZ]; diff --git a/src/explode.c b/src/explode.c index 740ebb9aa..fb5f61515 100644 --- a/src/explode.c +++ b/src/explode.c @@ -29,7 +29,7 @@ static const int explosion[3][3] = { */ void explode( - int x, int y, /* explosion's location; adjacent spots are also affected */ + coordxy x, coordxy y, /* explosion's location; adjacent spots are also affected */ int type, /* same as in zap.c; -(wand typ) for some WAND_CLASS */ int dam, /* damage amount */ char olet, /* object class or BURNING_OIL or MON_EXPLODE */ @@ -639,7 +639,7 @@ struct scatter_chain { /* returns number of scattered objects */ long -scatter(int sx, int sy, /* location of objects to scatter */ +scatter(coordxy sx, coordxy sy, /* location of objects to scatter */ int blastforce, /* force behind the scattering */ unsigned int scflags, struct obj *obj) /* only scatter this obj */ @@ -806,7 +806,7 @@ scatter(int sx, int sy, /* location of objects to scatter */ } } for (stmp = schain; stmp; stmp = stmp2) { - int x, y; + coordxy x, y; boolean obj_left_shop = FALSE; stmp2 = stmp->next; @@ -867,7 +867,7 @@ scatter(int sx, int sy, /* location of objects to scatter */ * For now, just perform a "regular" explosion. */ void -splatter_burning_oil(int x, int y, boolean diluted_oil) +splatter_burning_oil(coordxy x, coordxy y, boolean diluted_oil) { int dmg = d(diluted_oil ? 3 : 4, 4); @@ -879,7 +879,7 @@ splatter_burning_oil(int x, int y, boolean diluted_oil) /* lit potion of oil is exploding; extinguish it as a light source before possibly killing the hero and attempting to save bones */ void -explode_oil(struct obj *obj, int x, int y) +explode_oil(struct obj *obj, coordxy x, coordxy y) { boolean diluted_oil = obj->odiluted; diff --git a/src/extralev.c b/src/extralev.c index ec9299ada..8904ad140 100644 --- a/src/extralev.c +++ b/src/extralev.c @@ -13,15 +13,15 @@ #define LEFT 4 #define RIGHT 8 -static void roguejoin(int, int, int, int, int); -static void roguecorr(int, int, int); -static void miniwalk(int, int); +static void roguejoin(coordxy, coordxy, coordxy, coordxy, int); +static void roguecorr(coordxy, coordxy, int); +static void miniwalk(coordxy, coordxy); static void -roguejoin(int x1, int y1, int x2, int y2, int horiz) +roguejoin(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int horiz) { - register int x, y, middle; + register coordxy x, y, middle; if (horiz) { middle = x1 + rn2(x2 - x1 + 1); for (x = min(x1, middle); x <= max(x1, middle); x++) @@ -43,9 +43,9 @@ roguejoin(int x1, int y1, int x2, int y2, int horiz) static void -roguecorr(int x, int y, int dir) +roguecorr(coordxy x, coordxy y, int dir) { - register int fromx, fromy, tox, toy; + register coordxy fromx, fromy, tox, toy; if (dir == DOWN) { g.r[x][y].doortable &= ~DOWN; @@ -138,7 +138,7 @@ roguecorr(int x, int y, int dir) /* Modified walkfrom() from mkmaze.c */ static void -miniwalk(int x, int y) +miniwalk(coordxy x, coordxy y) { register int q, dir; int dirs[4]; @@ -193,7 +193,7 @@ miniwalk(int x, int y) void makeroguerooms(void) { - register int x, y; + register coordxy x, y; /* Rogue levels are structured 3 by 3, with each section containing * a room or an intersection. The minimum width is 2 each way. * One difference between these and "real" Rogue levels: real Rogue @@ -242,7 +242,7 @@ makeroguerooms(void) for (y = 0; y < 3; y++) for (x = 0; x < 3; x++) { if (here.real) { /* Make a room */ - int lowx, lowy, hix, hiy; + coordxy lowx, lowy, hix, hiy; g.r[x][y].nroom = g.nroom; g.smeq[g.nroom] = g.nroom; @@ -275,7 +275,7 @@ makeroguerooms(void) } void -corr(int x, int y) +corr(coordxy x, coordxy y) { if (rn2(50)) { levl[x][y].typ = CORR; @@ -290,7 +290,7 @@ makerogueghost(void) register struct monst *ghost; struct obj *ghostobj; struct mkroom *croom; - int x, y; + coordxy x, y; if (!g.nroom) return; /* Should never happen */ diff --git a/src/fountain.c b/src/fountain.c index 020ca5564..0a6be58da 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -9,7 +9,7 @@ static void dowatersnakes(void); static void dowaterdemon(void); static void dowaternymph(void); -static void gush(int, int, genericptr_t); +static void gush(coordxy, coordxy, genericptr_t); static void dofindgem(void); static boolean watchman_warn_fountain(struct monst *); @@ -121,7 +121,7 @@ dogushforth(int drinking) } static void -gush(int x, int y, genericptr_t poolcnt) +gush(coordxy x, coordxy y, genericptr_t poolcnt) { register struct monst *mtmp; register struct trap *ttmp; @@ -527,7 +527,7 @@ dipfountain(register struct obj *obj) } void -breaksink(int x, int y) +breaksink(coordxy x, coordxy y) { if (cansee(x, y) || u_at(x, y)) pline_The("pipes break! Water spurts out!"); diff --git a/src/hack.c b/src/hack.c index 7a185a85d..86d6f1c7b 100644 --- a/src/hack.c +++ b/src/hack.c @@ -7,11 +7,11 @@ /* #define DEBUG */ /* uncomment for debugging */ -static boolean could_move_onto_boulder(int, int); +static boolean could_move_onto_boulder(coordxy, coordxy); static int moverock(void); static void dosinkfall(void); static boolean findtravelpath(int); -static boolean trapmove(int, int, struct trap *); +static boolean trapmove(coordxy, coordxy, struct trap *); static void check_buried_zombies(coordxy, coordxy); static schar u_simple_floortyp(coordxy, coordxy); static boolean swim_move_danger(coordxy, coordxy); @@ -30,11 +30,11 @@ static boolean move_out_of_bounds(coordxy, coordxy); static boolean carrying_too_much(void); static boolean escape_from_sticky_mon(coordxy, coordxy); static void domove_core(void); -static void maybe_smudge_engr(int, int, int, int); +static void maybe_smudge_engr(coordxy, coordxy, coordxy, coordxy); static struct monst *monstinroom(struct permonst *, int); static void move_update(boolean); static int pickup_checks(void); -static boolean doorless_door(int, int); +static boolean doorless_door(coordxy, coordxy); static void maybe_wail(void); #define IS_SHOP(x) (g.rooms[x].rtype >= SHOPBASE) @@ -77,7 +77,7 @@ obj_to_any(struct obj *obj) } boolean -revive_nasty(int x, int y, const char *msg) +revive_nasty(coordxy x, coordxy y, const char *msg) { register struct obj *otmp, *otmp2; struct monst *mtmp; @@ -116,7 +116,7 @@ revive_nasty(int x, int y, const char *msg) /* can hero move onto a spot containing one or more boulders? used for m and travel and during boulder push failure */ static boolean -could_move_onto_boulder(int sx, int sy) +could_move_onto_boulder(coordxy sx, coordxy sy) { /* can if able to phaze through rock (must be poly'd, so not riding) */ if (Passes_walls) @@ -853,10 +853,10 @@ invocation_pos(coordxy x, coordxy y) * mode is one of DO_MOVE, TEST_MOVE, TEST_TRAV, or TEST_TRAP */ boolean -test_move(int ux, int uy, int dx, int dy, int mode) +test_move(coordxy ux, coordxy uy, coordxy dx, coordxy dy, int mode) { - int x = ux + dx; - int y = uy + dy; + coordxy x = ux + dx; + coordxy y = uy + dy; register struct rm *tmpr = &levl[x][y]; struct rm *ust; @@ -1156,15 +1156,15 @@ findtravelpath(int mode) for (i = 0; i < n; i++) { int dir; - int x = travelstepx[set][i]; - int y = travelstepy[set][i]; + coordxy x = travelstepx[set][i]; + coordxy y = travelstepy[set][i]; /* no diagonal movement for grid bugs */ int dirmax = NODIAG(u.umonnum) ? 4 : N_DIRS; boolean alreadyrepeated = FALSE; for (dir = 0; dir < dirmax; ++dir) { - int nx = x + xdir[dirs_ord[dir]]; - int ny = y + ydir[dirs_ord[dir]]; + coordxy nx = x + xdir[dirs_ord[dir]]; + coordxy ny = y + ydir[dirs_ord[dir]]; /* * When guessing and trying to travel as close as possible @@ -1355,7 +1355,7 @@ findtravelpath(int mode) } boolean -is_valid_travelpt(int x, int y) +is_valid_travelpt(coordxy x, coordxy y) { int tx = u.tx; int ty = u.ty; @@ -1380,7 +1380,7 @@ is_valid_travelpt(int x, int y) (all failures and most successful escapes leave hero at original spot) */ static boolean trapmove( - int x, int y, /* targetted destination, */ + coordxy x, coordxy y, /* targetted destination, */ struct trap *desttrap) /* nonnull if another trap at */ { boolean anchored = FALSE; @@ -2103,7 +2103,7 @@ move_out_of_bounds(coordxy x, coordxy y) return domove_fight_empty(x, y); if (flags.mention_walls) { - int dx = u.dx, dy = u.dy; + coordxy dx = u.dx, dy = u.dy; if (dx && dy) { /* diagonal */ /* only as far as possible diagonally if in very @@ -2205,7 +2205,7 @@ escape_from_sticky_mon(coordxy x, coordxy y) void domove(void) { - int ux1 = u.ux, uy1 = u.uy; + coordxy ux1 = u.ux, uy1 = u.uy; g.domove_succeeded = 0L; domove_core(); @@ -2493,7 +2493,7 @@ runmode_delay_output(void) } static void -maybe_smudge_engr(int x1, int y1, int x2, int y2) +maybe_smudge_engr(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { struct engr *ep; @@ -2918,7 +2918,7 @@ in_rooms(register coordxy x, register coordxy y, register int typewanted) /* is (x,y) in a town? */ boolean -in_town(register int x, register int y) +in_town(coordxy x, coordxy y) { s_level *slev = Is_special(&u.uz); register struct mkroom *sroom; @@ -3240,8 +3240,8 @@ dopickup(void) void lookaround(void) { - register int x, y; - int i, x0 = 0, y0 = 0, m0 = 1, i0 = 9; + register coordxy x, y; + coordxy i, x0 = 0, y0 = 0, m0 = 1, i0 = 9; int corrct = 0, noturn = 0; struct monst *mtmp; @@ -3398,7 +3398,7 @@ lookaround(void) /* check for a doorway which lacks its door (NODOOR or BROKEN) */ static boolean -doorless_door(int x, int y) +doorless_door(coordxy x, coordxy y) { struct rm *lev_p = &levl[x][y]; @@ -3414,7 +3414,7 @@ doorless_door(int x, int y) /* used by drown() to check whether hero can crawl from water to ; also used by findtravelpath() when destination is one step away */ boolean -crawl_destination(int x, int y) +crawl_destination(coordxy x, coordxy y) { /* is location ok in general? */ if (!goodpos(x, y, &g.youmonst, 0)) @@ -3443,7 +3443,7 @@ crawl_destination(int x, int y) int monster_nearby(void) { - register int x, y; + register coordxy x, y; register struct monst *mtmp; /* Also see the similar check in dochugw() in monmove.c */ diff --git a/src/hacklib.c b/src/hacklib.c index 98ca4e90a..2e644b244 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -681,9 +681,9 @@ rounddiv(long x, int y) /* distance between two points, in moves */ int -distmin(int x0, int y0, int x1, int y1) +distmin(coordxy x0, coordxy y0, coordxy x1, coordxy y1) { - register int dx = x0 - x1, dy = y0 - y1; + coordxy dx = x0 - x1, dy = y0 - y1; if (dx < 0) dx = -dx; @@ -697,9 +697,9 @@ distmin(int x0, int y0, int x1, int y1) /* square of euclidean distance between pair of pts */ int -dist2(int x0, int y0, int x1, int y1) +dist2(coordxy x0, coordxy y0, coordxy x1, coordxy y1) { - register int dx = x0 - x1, dy = y0 - y1; + coordxy dx = x0 - x1, dy = y0 - y1; return dx * dx + dy * dy; } diff --git a/src/invent.c b/src/invent.c index d7963493d..b91e6c192 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1199,7 +1199,7 @@ freeinv(struct obj *obj) /* drawbridge is destroying all objects at */ void -delallobj(int x, int y) +delallobj(coordxy x, coordxy y) { struct obj *otmp, *otmp2; @@ -1252,7 +1252,7 @@ delobj_core( /* try to find a particular type of object at designated map location */ struct obj * -sobj_at(int otyp, int x, int y) +sobj_at(int otyp, coordxy x, coordxy y) { register struct obj *otmp; @@ -1384,7 +1384,7 @@ o_on(unsigned int id, struct obj *objchn) } boolean -obj_here(struct obj *obj, int x, int y) +obj_here(struct obj *obj, coordxy x, coordxy y) { register struct obj *otmp; @@ -1395,7 +1395,7 @@ obj_here(struct obj *obj, int x, int y) } struct obj * -g_at(int x, int y) +g_at(coordxy x, coordxy y) { register struct obj *obj = g.level.objects[x][y]; @@ -3997,7 +3997,7 @@ dotypeinv(void) /* return a string describing the dungeon feature at if there is one worth mentioning at that location; otherwise null */ const char * -dfeature_at(int x, int y, char *buf) +dfeature_at(coordxy x, coordxy y, char *buf) { struct rm *lev = &levl[x][y]; int ltyp = lev->typ, cmap = -1; @@ -5335,7 +5335,7 @@ only_here(struct obj *obj) * Currently, this is only used with a wand of probing zapped downwards. */ int -display_binventory(int x, int y, boolean as_if_seen) +display_binventory(coordxy x, coordxy y, boolean as_if_seen) { struct obj *obj; menu_item *selected = 0; diff --git a/src/light.c b/src/light.c index 89144aa4d..2431388a2 100644 --- a/src/light.c +++ b/src/light.c @@ -136,7 +136,8 @@ del_light_source(int type, anything *id) void do_light_sources(coordxy **cs_rows) { - int x, y, min_x, max_x, max_y, offset; + coordxy x, y, min_x, max_x, max_y; + int offset; coordxy *limits; short at_hero_range = 0; light_source *ls; @@ -221,7 +222,7 @@ do_light_sources(coordxy **cs_rows) remember terrain, objects, and monsters being revealed; if 'obj' is Null, is being hit by a camera's light flash */ void -show_transient_light(struct obj *obj, int x, int y) +show_transient_light(struct obj *obj, coordxy x, coordxy y) { light_source *ls = 0; anything cameraflash; @@ -621,7 +622,7 @@ any_light_source(void) * only for burning light sources. */ void -snuff_light_source(int x, int y) +snuff_light_source(coordxy x, coordxy y) { light_source *ls; struct obj *obj; diff --git a/src/lock.c b/src/lock.c index b61a09022..cc07ab82c 100644 --- a/src/lock.c +++ b/src/lock.c @@ -10,11 +10,11 @@ static int picklock(void); static int forcelock(void); static const char *lock_action(void); -static boolean obstructed(int, int, boolean); +static boolean obstructed(coordxy, coordxy, boolean); static void chest_shatter_msg(struct obj *); boolean -picking_lock(int *x, int *y) +picking_lock(coordxy *x, coordxy *y) { if (g.occupation == picklock) { *x = u.ux + u.dx; @@ -27,7 +27,7 @@ picking_lock(int *x, int *y) } boolean -picking_at(int x, int y) +picking_at(coordxy x, coordxy y) { return (boolean) (g.occupation == picklock && g.xlock.door == &levl[x][y]); } @@ -730,7 +730,7 @@ doforce(void) } boolean -stumble_on_door_mimic(int x, int y) +stumble_on_door_mimic(coordxy x, coordxy y) { struct monst *mtmp; @@ -751,7 +751,7 @@ doopen(void) /* try to open a door in direction u.dx/u.dy */ int -doopen_indir(int x, int y) +doopen_indir(coordxy x, coordxy y) { coord cc; register struct rm *door; @@ -877,7 +877,7 @@ doopen_indir(int x, int y) } static boolean -obstructed(int x, int y, boolean quietly) +obstructed(coordxy x, coordxy y, boolean quietly) { struct monst *mtmp = m_at(x, y); @@ -910,7 +910,7 @@ obstructed(int x, int y, boolean quietly) int doclose(void) { - register int x, y; + register coordxy x, y; register struct rm *door; boolean portcullis; int res = ECMD_OK; @@ -1051,7 +1051,7 @@ boxlock(struct obj *obj, struct obj *otmp) /* obj *is* a box */ /* Door/secret door was hit with spell or wand effect otmp; returns true if something happened */ boolean -doorlock(struct obj *otmp, int x, int y) +doorlock(struct obj *otmp, coordxy x, coordxy y) { register struct rm *door = &levl[x][y]; boolean res = TRUE; diff --git a/src/mail.c b/src/mail.c index fb04317c0..abf5a89e5 100644 --- a/src/mail.c +++ b/src/mail.c @@ -247,7 +247,7 @@ static boolean md_stop(coord *stopp, /* stopping position (we fill it in) */ coord *startp) /* starting position (read only) */ { - int x, y, distance, min_distance = -1; + coordxy x, y, distance, min_distance = -1; for (x = u.ux - 1; x <= u.ux + 1; x++) for (y = u.uy - 1; y <= u.uy + 1; y++) { diff --git a/src/makemon.c b/src/makemon.c index 19f7085f3..531a9b99e 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -18,7 +18,7 @@ static boolean uncommon(int); static int align_shift(struct permonst *); static boolean mk_gen_ok(int, unsigned, unsigned); static boolean wrong_elem_type(struct permonst *); -static void m_initgrp(struct monst *, int, int, int, mmflags_nht); +static void m_initgrp(struct monst *, coordxy, coordxy, int, mmflags_nht); static void m_initthrow(struct monst *, int, int); static void m_initweap(struct monst *); static void m_initinv(struct monst *); @@ -71,7 +71,7 @@ wrong_elem_type(struct permonst *ptr) /* make a group just like mtmp */ static void -m_initgrp(struct monst *mtmp, int x, int y, int n, mmflags_nht mmflags) +m_initgrp(struct monst *mtmp, coordxy x, coordxy y, int n, mmflags_nht mmflags) { coord mm; register int cnt = rnd(n); @@ -1054,7 +1054,7 @@ makemon_rnd_goodpos( coord *cc) /* output */ { int tryct = 0; - int nx, ny; + coordxy nx, ny; boolean good; do { @@ -1068,9 +1068,9 @@ makemon_rnd_goodpos( /* else go through all map positions, twice, first round ignoring positions in sight, and pick first good one. skip first round if we're in special level loader or blind */ - int xofs = nx; - int yofs = ny; - int dx,dy; + coordxy xofs = nx; + coordxy yofs = ny; + coordxy dx,dy; int bl = (g.in_mklev || Blind) ? 1 : 0; for ( ; bl < 2; bl++) { @@ -1120,7 +1120,7 @@ makemon_rnd_goodpos( struct monst * makemon( struct permonst *ptr, - int x, int y, + coordxy x, coordxy y, mmflags_nht mmflags) { register struct monst *mtmp; @@ -1514,7 +1514,7 @@ create_critters(int cnt, boolean neverask) { coord c; - int x, y; + coordxy x, y; struct monst *mon; boolean known = FALSE; boolean ask = (wizard && !neverask); diff --git a/src/mklev.c b/src/mklev.c index 033665063..1122610d5 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -24,14 +24,15 @@ static void makelevel(void); static boolean bydoor(coordxy, coordxy); static struct mkroom *find_branch_room(coord *); static struct mkroom *pos_to_room(coordxy, coordxy); -static boolean place_niche(struct mkroom *, int *, int *, int *); +static boolean place_niche(struct mkroom *, coordxy *, coordxy *, coordxy *); static void makeniche(int); static void make_niches(void); static int QSORTCALLBACK mkroom_cmp(const genericptr, const genericptr); 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 do_room_or_subroom(struct mkroom *, + coordxy, coordxy, coordxy, coordxy, + boolean, schar, boolean, boolean); static void makerooms(void); static boolean door_into_nonjoined(coordxy, coordxy); static boolean finddpos(coord *, coordxy, coordxy, coordxy, coordxy); @@ -124,7 +125,7 @@ finddpos(coord *cc, coordxy xl, coordxy yl, coordxy xh, coordxy yh) void sort_rooms(void) { - int x, y; + coordxy x, y; unsigned i, ri[MAXNROFROOMS + 1], n = (unsigned) g.nroom; qsort((genericptr_t) g.rooms, n, sizeof (struct mkroom), mkroom_cmp); @@ -144,10 +145,10 @@ sort_rooms(void) static void do_room_or_subroom(register struct mkroom *croom, - int lowx, int lowy, register int hix, register int hiy, + coordxy lowx, coordxy lowy, coordxy hix, coordxy hiy, boolean lit, schar rtype, boolean special, boolean is_room) { - register int x, y; + coordxy x, y; struct rm *lev; /* locations might bump level edges in wall-less rooms */ @@ -442,7 +443,7 @@ makecorridors(void) } void -add_door(register int x, register int y, register struct mkroom *aroom) +add_door(coordxy x, coordxy y, register struct mkroom *aroom) { register struct mkroom *broom; register int tmp; @@ -545,7 +546,7 @@ dosdoor(register coordxy x, register coordxy y, struct mkroom *aroom, int type) } static boolean -place_niche(register struct mkroom *aroom, int *dy, int *xx, int *yy) +place_niche(register struct mkroom *aroom, coordxy *dy, coordxy *xx, coordxy *yy) { coord dd; @@ -585,7 +586,7 @@ makeniche(int trap_type) register struct mkroom *aroom; struct rm *rm; int vct = 8; - int dy, xx, yy; + coordxy dy, xx, yy; struct trap *ttmp; if (g.doorindex < DOORMAX) { @@ -678,7 +679,7 @@ clear_level_structures(void) { static struct rm zerorm = { GLYPH_UNEXPLORED, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - register int x, y; + coordxy x, y; register struct rm *lev; /* note: normally we'd start at x=1 because map column #0 isn't used @@ -751,7 +752,7 @@ fill_ordinary_room(struct mkroom *croom) int trycnt = 0; coord pos; struct monst *tmonst; /* always put a web with a spider */ - int x, y; + coordxy x, y; if (croom->rtype != OROOM && croom->rtype != THEMEROOM) return; @@ -1000,7 +1001,8 @@ mineralize(int kelp_pool, int kelp_moat, int goldprob, int gemprob, { s_level *sp; struct obj *otmp; - int x, y, cnt; + coordxy x, y; + int cnt; if (kelp_pool < 0) kelp_pool = 10; @@ -1148,9 +1150,10 @@ topologize(struct mkroom *croom, boolean do_ordinary) topologize(struct mkroom *croom) #endif { - register int x, y, roomno = (int) ((croom - g.rooms) + ROOMOFFSET); - int lowx = croom->lx, lowy = croom->ly; - int hix = croom->hx, hiy = croom->hy; + coordxy x, y; + register int roomno = (int) ((croom - g.rooms) + ROOMOFFSET); + coordxy lowx = croom->lx, lowy = croom->ly; + coordxy hix = croom->hx, hiy = croom->hy; #ifdef SPECIALIZATION schar rtype = croom->rtype; #endif @@ -1336,7 +1339,7 @@ okdoor(coordxy x, coordxy y) } void -dodoor(int x, int y, struct mkroom *aroom) +dodoor(coordxy x, coordxy y, struct mkroom *aroom) { if (g.doorindex >= DOORMAX) { impossible("DOORMAX exceeded?"); diff --git a/src/mkmaze.c b/src/mkmaze.c index 409c13ca1..ff943666b 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -6,12 +6,12 @@ #include "hack.h" #include "sp_lev.h" -static int iswall(int, int); -static int iswall_or_stone(int, int); -static boolean is_solid(int, int); +static int iswall(coordxy, coordxy); +static int iswall_or_stone(coordxy, coordxy); +static boolean is_solid(coordxy, coordxy); 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 wall_cleanup(coordxy, coordxy, coordxy, coordxy); +static boolean okay(coordxy, coordxy, coordxy); static void maze0xy(coord *); static boolean put_lregion_here(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, boolean, d_level *); @@ -23,7 +23,7 @@ static void migr_booty_item(int, const char *); 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 boolean maze_inbounds(coordxy, coordxy); static void maze_remove_deadends(xint16); /* adjust a coordinate one step in the specified direction */ @@ -39,7 +39,7 @@ static void maze_remove_deadends(xint16); } while (0) static int -iswall(int x, int y) +iswall(coordxy x, coordxy y) { int type; @@ -51,7 +51,7 @@ iswall(int x, int y) } static int -iswall_or_stone(int x, int y) +iswall_or_stone(coordxy x, coordxy y) { /* out of bounds = stone */ if (!isok(x, y)) @@ -62,7 +62,7 @@ iswall_or_stone(int x, int y) /* return TRUE if out of bounds, wall or rock */ static boolean -is_solid(int x, int y) +is_solid(coordxy x, coordxy y) { return (boolean) (!isok(x, y) || IS_STWALL(levl[x][y].typ)); } @@ -164,10 +164,10 @@ extend_spine(int locale[3][3], int wall_there, int dx, int dy) /* Remove walls totally surrounded by stone */ static void -wall_cleanup(int x1, int y1, int x2, int y2) +wall_cleanup(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { uchar type; - int x, y; + coordxy x, y; struct rm *lev; /* sanity check on incoming variables */ @@ -195,12 +195,12 @@ wall_cleanup(int x1, int y1, int x2, int y2) /* Correct wall types so they extend and connect to each other */ void -fix_wall_spines(int x1, int y1, int x2, int y2) +fix_wall_spines(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { uchar type; - int x, y; + coordxy x, y; struct rm *lev; - int (*loc_f)(int, int); + int (*loc_f)(coordxy, coordxy); int bits; int locale[3][3]; /* rock or wall status surrounding positions */ @@ -256,14 +256,14 @@ fix_wall_spines(int x1, int y1, int x2, int y2) } void -wallification(int x1, int y1, int x2, int y2) +wallification(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { wall_cleanup(x1, y1, x2, y2); fix_wall_spines(x1, y1, x2, y2); } static boolean -okay(int x, int y, int dir) +okay(coordxy x, coordxy y, coordxy dir) { mz_move(x, y, dir); mz_move(x, y, dir); @@ -813,7 +813,7 @@ stolen_booty(void) #undef ORC_LEADER static boolean -maze_inbounds(int x, int y) +maze_inbounds(coordxy x, coordxy y) { return (x >= 2 && y >= 2 && x < g.x_maze_max && y < g.y_maze_max @@ -826,7 +826,7 @@ static void maze_remove_deadends(xint16 typ) { char dirok[4]; - int x, y, dir, idx, idx2, dx, dy, dx2, dy2; + coordxy x, y, dir, idx, idx2, dx, dy, dx2, dy2; dirok[0] = 0; /* lint suppression */ for (x = 2; x < g.x_maze_max; x++) @@ -871,7 +871,7 @@ maze_remove_deadends(xint16 typ) void create_maze(int corrwid, int wallthick, boolean rmdeadends) { - int x,y; + coordxy x,y; coord mm; int tmp_xmax = g.x_maze_max; int tmp_ymax = g.y_maze_max; @@ -967,7 +967,7 @@ create_maze(int corrwid, int wallthick, boolean rmdeadends) void makemaz(const char *s) { - int x, y; + coordxy x, y; char protofile[20]; s_level *sp = Is_special(&u.uz); coord mm; @@ -1134,7 +1134,7 @@ makemaz(const char *s) * that is totally safe. */ void -walkfrom(int x, int y, schar typ) +walkfrom(coordxy x, coordxy y, schar typ) { #define CELLS (ROWNO * COLNO) / 4 /* a maze cell is 4 squares */ char mazex[CELLS + 1], mazey[CELLS + 1]; /* char's are OK */ @@ -1181,7 +1181,7 @@ walkfrom(int x, int y, schar typ) #else /* !MICRO */ void -walkfrom(int x, int y, schar typ) +walkfrom(coordxy x, coordxy y, schar typ) { int q, a, dir; int dirs[4]; @@ -1220,7 +1220,8 @@ walkfrom(int x, int y, schar typ) void mazexy(coord *cc) { - int x, y, allowedtyp = (g.level.flags.corrmaze ? CORR : ROOM); + coordxy x, y; + int allowedtyp = (g.level.flags.corrmaze ? CORR : ROOM); int cpt = 0; do { @@ -1254,13 +1255,13 @@ mazexy(coord *cc) } void -get_level_extends(int * left, int * top, int * right, int * bottom) +get_level_extends(coordxy *left, coordxy *top, coordxy *right, coordxy *bottom) { - int x, y; + coordxy x, y; unsigned typ; struct rm *lev; boolean found, nonwall; - int xmin, xmax, ymin, ymax; + coordxy xmin, xmax, ymin, ymax; found = nonwall = FALSE; for (xmin = 0; !found && xmin <= COLNO; xmin++) { @@ -1341,8 +1342,8 @@ get_level_extends(int * left, int * top, int * right, int * bottom) void bound_digging(void) { - int x, y; - int xmin, xmax, ymin, ymax; + coordxy x, y; + coordxy xmin, xmax, ymin, ymax; if (Is_earthlevel(&u.uz)) return; /* everything diggable here */ @@ -1410,8 +1411,8 @@ fumaroles(void) #define gbymax (g.ymax - 1) static void set_wportal(void); -static void mk_bubble(int, int, int); -static void mv_bubble(struct bubble *, int, int, boolean); +static void mk_bubble(coordxy, coordxy, int); +static void mv_bubble(struct bubble *, coordxy, coordxy, boolean); void movebubbles(void) @@ -1424,7 +1425,8 @@ movebubbles(void) struct bubble *b; struct container *cons; struct trap *btrap; - int x, y, i, j, bcpin = 0; + coordxy x, y; + int i, j, bcpin = 0; /* set up the portal the first time bubbles are moved */ if (!g.wportal) @@ -1560,7 +1562,7 @@ movebubbles(void) void water_friction(void) { - int x, y, dx, dy; + coordxy x, y, dx, dy; boolean eff = FALSE; if (Swimming && rn2(4)) @@ -1678,7 +1680,8 @@ set_wportal(void) static void setup_waterlevel(void) { - int x, y, xskip, yskip, typ, glyph; + int typ, glyph; + coordxy x, y, xskip, yskip; if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) panic("setup_waterlevel(): [%d:%d] neither 'Water' nor 'Air'", @@ -1736,7 +1739,7 @@ unsetup_waterlevel(void) } static void -mk_bubble(int x, int y, int n) +mk_bubble(coordxy x, coordxy y, int n) { /* * These bit masks make visually pleasing bubbles on a normal aspect @@ -1799,9 +1802,10 @@ mk_bubble(int x, int y, int n) * This property also makes leaving a bubble slightly difficult. */ static void -mv_bubble(struct bubble* b, int dx, int dy, boolean ini) +mv_bubble(struct bubble* b, coordxy dx, coordxy dy, boolean ini) { - int x, y, i, j, colli = 0; + int i, j, colli = 0; + coordxy x, y; struct container *cons, *ctemp; /* clouds move slowly */ diff --git a/src/mkobj.c b/src/mkobj.c index a536af90b..3837fe7a1 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -168,7 +168,7 @@ free_omailcmd(struct obj *otmp) } struct obj * -mkobj_at(char let, int x, int y, boolean artif) +mkobj_at(char let, coordxy x, coordxy y, boolean artif) { struct obj *otmp; @@ -178,7 +178,7 @@ mkobj_at(char let, int x, int y, boolean artif) } struct obj * -mksobj_at(int otyp, int x, int y, boolean init, boolean artif) +mksobj_at(int otyp, coordxy x, coordxy y, boolean init, boolean artif) { struct obj *otmp; @@ -1815,14 +1815,14 @@ static const int treefruits[] = { /* called when a tree is kicked; never returns Null */ struct obj * -rnd_treefruit_at(int x, int y) +rnd_treefruit_at(coordxy x, coordxy y) { return mksobj_at(treefruits[rn2(SIZE(treefruits))], x, y, TRUE, FALSE); } /* create a stack of N gold pieces; never returns Null */ struct obj * -mkgold(long amount, int x, int y) +mkgold(long amount, coordxy x, coordxy y) { struct obj *gold = g_at(x, y); @@ -1862,7 +1862,7 @@ mkcorpstat( int objtype, /* CORPSE or STATUE */ struct monst *mtmp, /* dead monster, might be Null */ struct permonst *ptr, /* if non-Null, overrides mtmp->mndx */ - int x, int y, /* where to place corpse; <0,0> => random */ + coordxy x, coordxy y, /* where to place corpse; <0,0> => random */ unsigned corpstatflags) { struct obj *otmp; @@ -2018,7 +2018,7 @@ get_mtraits(struct obj *obj, boolean copyof) struct obj * mk_tt_object( int objtype, /* CORPSE or STATUE */ - int x, int y) + coordxy x, coordxy y) { struct obj *otmp; boolean initialize_it; @@ -2045,7 +2045,7 @@ struct obj * mk_named_object( int objtype, /* CORPSE or STATUE */ struct permonst *ptr, - int x, int y, + coordxy x, coordxy y, const char *nm) { struct obj *otmp; @@ -2093,7 +2093,7 @@ is_rottable(struct obj *otmp) /* put the object at the given location */ void -place_object(struct obj *otmp, int x, int y) +place_object(struct obj *otmp, coordxy x, coordxy y) { register struct obj *otmp2; @@ -2153,7 +2153,7 @@ place_object(struct obj *otmp, int x, int y) * Also used for starting ice effects too. [zap.c] */ void -obj_ice_effects(int x, int y, boolean do_buried) +obj_ice_effects(coordxy x, coordxy y, boolean do_buried) { struct obj *otmp; @@ -2621,7 +2621,7 @@ static const char NEARDATA /* pline formats for insane_object() */ void obj_sanity_check(void) { - int x, y; + coordxy x, y; struct obj *obj, *otop, *prevo; objlist_sanity(fobj, OBJ_FLOOR, "floor sanity"); @@ -3185,7 +3185,7 @@ obj_nexto(struct obj *otmp) * reliably predict which one we want to 'find' first */ struct obj * -obj_nexto_xy(struct obj *obj, int x, int y, boolean recurs) +obj_nexto_xy(struct obj *obj, coordxy x, coordxy y, boolean recurs) { struct obj *otmp; int fx, fy, ex, ey, otyp = obj->otyp; diff --git a/src/mkroom.c b/src/mkroom.c index a1f0b3e33..94d4e3776 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -20,7 +20,7 @@ static boolean isbig(struct mkroom *); static struct mkroom *pick_room(boolean); static void mkshop(void), mkzoo(int), mkswamp(void); -static void mk_zoo_thronemon(int, int); +static void mk_zoo_thronemon(coordxy, coordxy); static void mktemple(void); static coord *shrine_pos(int); static struct permonst *morguemon(void); @@ -164,7 +164,7 @@ mkshop(void) break; } if (!sroom->rlit) { - int x, y; + coordxy x, y; for (x = sroom->lx - 1; x <= sroom->hx + 1; x++) for (y = sroom->ly - 1; y <= sroom->hy + 1; y++) @@ -240,7 +240,7 @@ mkzoo(int type) } static void -mk_zoo_thronemon(int x,int y) +mk_zoo_thronemon(coordxy x, coordxy y) { int i = rnd(level_difficulty()); int pm = (i > 9) ? PM_OGRE_TYRANT @@ -263,7 +263,8 @@ fill_zoo(struct mkroom* sroom) { struct monst *mon; register int sx, sy, i; - int sh, tx = 0, ty = 0, goldlim = 0, type = sroom->rtype; + int sh, goldlim = 0, type = sroom->rtype; + coordxy tx = 0, ty = 0; int rmno = (int) ((sroom - g.rooms) + ROOMOFFSET); coord mm; @@ -511,7 +512,8 @@ static void mkswamp(void) /* Michiel Huisjes & Fred de Wilde */ { register struct mkroom *sroom; - register int sx, sy, i, eelct = 0; + register int i, eelct = 0; + coordxy sx, sy; int rmno; for (i = 0; i < 5; i++) { /* turn up to 5 rooms swampy */ diff --git a/src/mon.c b/src/mon.c index b4d348c2e..61fdb17c8 100644 --- a/src/mon.c +++ b/src/mon.c @@ -59,7 +59,7 @@ sanity_check_single_mon( const char *msg) { struct permonst *mptr = mtmp->data; - int mx = mtmp->mx, my = mtmp->my; + coordxy mx = mtmp->mx, my = mtmp->my; if (!mptr || mptr < &mons[LOW_PM] || mptr >= &mons[NUMMONS]) { /* most sanity checks issue warnings if they detect a problem, @@ -201,7 +201,7 @@ sanity_check_single_mon( void mon_sanity_check(void) { - int x, y; + coordxy x, y; struct monst *mtmp, *m; for (mtmp = fmon; mtmp; mtmp = mtmp->nmon) { @@ -498,7 +498,7 @@ make_corpse(struct monst *mtmp, unsigned int corpseflags) int num; struct obj *obj = (struct obj *) 0; struct obj *otmp = (struct obj *) 0; - int x = mtmp->mx, y = mtmp->my; + coordxy x = mtmp->mx, y = mtmp->my; int mndx = monsndx(mdat); unsigned corpstatflags = corpseflags; boolean burythem = ((corpstatflags & CORPSTAT_BURIED) != 0); @@ -1377,7 +1377,7 @@ meatcorpse(struct monst* mtmp) /* for purple worms and other voracious monsters struct obj *otmp; struct permonst *ptr, *original_ptr = mtmp->data, *corpsepm; boolean poly, grow, heal, eyes = FALSE, vis = canseemon(mtmp); - int x = mtmp->mx, y = mtmp->my; + coordxy x = mtmp->mx, y = mtmp->my; /* if a pet, eating is handled separately, in dog.c */ if (mtmp->mtame) @@ -2111,7 +2111,7 @@ mm_displacement( /* Is the square close enough for the monster to move or attack into? */ boolean -monnear(struct monst *mon, int x, int y) +monnear(struct monst *mon, coordxy x, coordxy y) { int distance = dist2(mon->mx, mon->my, x, y); @@ -2317,7 +2317,7 @@ dealloc_monst(struct monst *mon) static void mon_leaving_level(struct monst *mon) { - int mx = mon->mx, my = mon->my; + coordxy mx = mon->mx, my = mon->my; boolean onmap = (isok(mx, my) && g.level.monsters[mx][my] == mon); /* to prevent an infinite relobj-flooreffects-hmon-killed loop */ @@ -2518,7 +2518,7 @@ mondead(struct monst *mtmp) spec_death = (g.disintegested /* disintegrated/digested */ || noncorporeal(mtmp->data) || amorphous(mtmp->data)); - int x = mtmp->mx, y = mtmp->my; + coordxy x = mtmp->mx, y = mtmp->my; /* construct a format string before transformation; will be capitalized when used, expects one %s arg */ @@ -2977,7 +2977,8 @@ xkilled( struct monst *mtmp, int xkill_flags) /* 1: suppress message, 2: suppress corpse, 4: pacifist */ { - int tmp, mndx, x = mtmp->mx, y = mtmp->my; + int tmp, mndx; + coordxy x = mtmp->mx, y = mtmp->my; struct permonst *mdat; struct obj *otmp; struct trap *t; @@ -3219,7 +3220,7 @@ vamp_stone(struct monst *mtmp) { if (is_vampshifter(mtmp)) { int mndx = mtmp->cham; - int x = mtmp->mx, y = mtmp->my; + coordxy x = mtmp->mx, y = mtmp->my; /* this only happens if shapeshifted */ if (mndx >= LOW_PM && mndx != monsndx(mtmp->data) @@ -3756,7 +3757,7 @@ wake_nearby(void) /* Wake up monsters near some particular location. */ void -wake_nearto(int x, int y, int distance) +wake_nearto(coordxy x, coordxy y, int distance) { struct monst *mtmp; diff --git a/src/monmove.c b/src/monmove.c index fde3a8672..cb9eec9e6 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -85,7 +85,7 @@ mon_yells(struct monst* mon, const char* shout) static void watch_on_duty(register struct monst* mtmp) { - int x, y; + coordxy x, y; if (mtmp->mpeaceful && in_town(u.ux + u.dx, u.uy + u.dy) && mtmp->mcansee && m_canseeu(mtmp) && !rn2(3)) { @@ -118,7 +118,7 @@ dochugw( * so perform stop-what-you're-doing-if-close-enough- * to-be-a-threat check but don't move mtmp */ { - int x = mtmp->mx, y = mtmp->my; /* 'mtmp's location before dochug() */ + coordxy x = mtmp->mx, y = mtmp->my; /* 'mtmp's location before dochug() */ /* skip canspotmon() if occupation is Null */ boolean already_saw_mon = (chug && g.occupation) ? canspotmon(mtmp) : 0; int rd = chug ? dochug(mtmp) : 0; @@ -148,7 +148,7 @@ dochugw( } boolean -onscary(int x, int y, struct monst* mtmp) +onscary(coordxy x, coordxy y, struct monst* mtmp) { /* creatures who are directly resistant to magical scaring: * humans aren't monsters @@ -1200,8 +1200,8 @@ m_move(register struct monst* mtmp, register int after) { register int minr = SQSRCHRADIUS; /* not too far away */ register struct obj *otmp; - register int xx, yy; - int oomx, oomy, lmx, lmy; + register coordxy xx, yy; + coordxy oomx, oomy, lmx, lmy; /* cut down the search radius if it thinks character is closer. */ if (distmin(mtmp->mux, mtmp->muy, omx, omy) < SQSRCHRADIUS @@ -1750,7 +1750,7 @@ m_move_aggress(struct monst* mtmp, coordxy x, coordxy y) } void -dissolve_bars(register int x, register int y) +dissolve_bars(coordxy x, coordxy y) { levl[x][y].typ = (Is_special(&u.uz) || *in_rooms(x, y, 0)) ? ROOM : CORR; levl[x][y].flags = 0; @@ -1760,14 +1760,14 @@ dissolve_bars(register int x, register int y) } boolean -closed_door(register int x, register int y) +closed_door(coordxy x, coordxy y) { return (boolean) (IS_DOOR(levl[x][y].typ) && (levl[x][y].doormask & (D_LOCKED | D_CLOSED))); } boolean -accessible(register int x, register int y) +accessible(coordxy x, coordxy y) { int levtyp = levl[x][y].typ; @@ -1783,7 +1783,8 @@ void set_apparxy(register struct monst* mtmp) { boolean notseen, notthere, gotu; - int disp, mx = mtmp->mux, my = mtmp->muy; + int disp; + coordxy mx = mtmp->mux, my = mtmp->muy; long umoney = money_cnt(g.invent); /* diff --git a/src/mthrowu.c b/src/mthrowu.c index eb6af27e7..318e3fd3e 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -9,7 +9,7 @@ static int monmulti(struct monst *, struct obj *, struct obj *); static void monshoot(struct monst *, struct obj *, struct obj *); static boolean ucatchgem(struct obj *, struct monst *); static const char* breathwep_name(int); -static int drop_throw(struct obj *, boolean, int, int); +static int drop_throw(struct obj *, boolean, coordxy, coordxy); static int m_lined_up(struct monst *, struct monst *); #define URETREATING(x, y) \ @@ -156,8 +156,8 @@ static int drop_throw( register struct obj *obj, boolean ohit, - int x, - int y) + coordxy x, + coordxy y) { int retvalu = 1; int create; @@ -544,8 +544,8 @@ ucatchgem( void m_throw( struct monst *mon, /* launching monster */ - int x, int y, /* launch point */ - int dx, int dy, /* direction */ + coordxy x, coordxy y, /* launch point */ + coordxy dx, coordxy dy, /* direction */ int range, /* maximum distance */ struct obj *obj) /* missile (or stack providing it) */ { @@ -1076,7 +1076,7 @@ linedup_callback( coordxy ay, coordxy bx, coordxy by, - boolean (*fnc)(int, int)) + boolean (*fnc)(coordxy, coordxy)) { int dx, dy; @@ -1198,8 +1198,8 @@ m_carrying(struct monst* mtmp, int type) void hit_bars( struct obj **objp, /* *objp will be set to NULL if object breaks */ - int objx, int objy, /* hero's spot (when wielded) or missile's spot */ - int barsx, int barsy, /* adjacent spot where bars are located */ + coordxy objx, coordxy objy, /* hero's spot (when wielded) or missile's spot */ + coordxy barsx, coordxy barsy, /* adjacent spot where bars are located */ unsigned breakflags) /* breakage control */ { struct obj *otmp = *objp; @@ -1237,8 +1237,8 @@ hit_bars( boolean hits_bars( struct obj **obj_p, /* *obj_p will be set to NULL if object breaks */ - int x, int y, - int barsx, int barsy, + coordxy x, coordxy y, + coordxy barsx, coordxy barsy, int always_hit, /* caller can force a hit for items which would * fit through */ int whodidit) /* 1==hero, 0=other, -1==just check whether it diff --git a/src/muse.c b/src/muse.c index a82aa92fb..cf21ae1ca 100644 --- a/src/muse.c +++ b/src/muse.c @@ -20,7 +20,7 @@ static void mplayhorn(struct monst *, struct obj *, boolean); static void mreadmsg(struct monst *, struct obj *); static void mquaffmsg(struct monst *, struct obj *); static boolean m_use_healing(struct monst *); -static boolean linedup_chk_corpse(int, int); +static boolean linedup_chk_corpse(coordxy, coordxy); static void m_use_undead_turning(struct monst *, struct obj *); static int mbhitm(struct monst *, struct obj *); static void mbhit(struct monst *, int, int (*)(MONST_P, OBJ_P), @@ -327,7 +327,8 @@ find_defensive(struct monst* mtmp) { struct obj *obj; struct trap *t; - int fraction, x = mtmp->mx, y = mtmp->my; + int fraction; + coordxy x = mtmp->mx, y = mtmp->my; boolean stuck = (mtmp == u.ustuck), immobile = (mtmp->data->mmove == 0); stairway *stway; @@ -459,7 +460,7 @@ find_defensive(struct monst* mtmp) } } else { /* Note: trap doors take precedence over teleport traps. */ - int xx, yy, i, locs[10][2]; + coordxy xx, yy, i, locs[10][2]; boolean ignore_boulders = (verysmall(mtmp->data) || throws_rocks(mtmp->data) || passes_walls(mtmp->data)), @@ -514,7 +515,7 @@ find_defensive(struct monst* mtmp) goto botm; if (is_mercenary(mtmp->data) && (obj = m_carrying(mtmp, BUGLE)) != 0) { - int xx, yy; + coordxy xx, yy; struct monst *mon; /* Distance is arbitrary. What we really want to do is @@ -1129,7 +1130,7 @@ rnd_defensive_item(struct monst* mtmp) * redefine; nonconsecutive value is ok */ static boolean -linedup_chk_corpse(int x, int y) +linedup_chk_corpse(coordxy x, coordxy y) { return (sobj_at(CORPSE, x, y) != 0); } @@ -1137,9 +1138,9 @@ linedup_chk_corpse(int x, int y) static void m_use_undead_turning(struct monst* mtmp, struct obj* obj) { - int ax = u.ux + sgn(mtmp->mux - mtmp->mx) * 3, - ay = u.uy + sgn(mtmp->muy - mtmp->my) * 3; - int bx = mtmp->mx, by = mtmp->my; + coordxy ax = u.ux + sgn(mtmp->mux - mtmp->mx) * 3, + ay = u.uy + sgn(mtmp->muy - mtmp->my) * 3; + coordxy bx = mtmp->mx, by = mtmp->my; if (!(obj->otyp == WAN_UNDEAD_TURNING && obj->spe > 0)) return; @@ -1468,7 +1469,7 @@ mbhit( ddy = sgn(mon->muy - mon->my); while (range-- > 0) { - int x, y; + coordxy x, y; g.bhitpos.x += ddx; g.bhitpos.y += ddy; @@ -1589,7 +1590,7 @@ use_offensive(struct monst* mtmp) return 2; case MUSE_SCR_EARTH: { /* TODO: handle steeds */ - register int x, y; + coordxy x, y; /* don't use monster fields after killing it */ boolean confused = (mtmp->mconf ? TRUE : FALSE); int mmx = mtmp->mx, mmy = mtmp->my; @@ -1774,9 +1775,10 @@ find_misc(struct monst* mtmp) { register struct obj *obj; struct permonst *mdat = mtmp->data; - int x = mtmp->mx, y = mtmp->my; + coordxy x = mtmp->mx, y = mtmp->my; struct trap *t; - int xx, yy, pmidx = NON_PM; + coordxy xx, yy; + int pmidx = NON_PM; boolean immobile = (mdat->mmove == 0); boolean stuck = (mtmp == u.ustuck); @@ -2704,7 +2706,7 @@ munslime(struct monst* mon, boolean by_you) if (((t = t_at(mon->mx, mon->my)) == 0 || t->ttyp != FIRE_TRAP) && mptr->mmove && !mon->mtrapped) { - int xy[2][8], x, y, idx, ridx, nxy = 0; + coordxy xy[2][8], x, y, idx, ridx, nxy = 0; for (x = mon->mx - 1; x <= mon->mx + 1; ++x) for (y = mon->my - 1; y <= mon->my + 1; ++y) diff --git a/src/music.c b/src/music.c index 978b8a0f0..4dd444d32 100644 --- a/src/music.c +++ b/src/music.c @@ -221,7 +221,7 @@ static void do_earthquake(int force) { static const char into_a_chasm[] = " into a chasm"; - register int x, y; + register coordxy x, y; struct monst *mtmp; struct obj *otmp; struct trap *chasm, *trap_at_u = t_at(u.ux, u.uy); @@ -689,7 +689,7 @@ do_play_instrument(struct obj* instr) { char buf[BUFSZ] = DUMMY, c = 'y'; char *s; - int x, y; + coordxy x, y; boolean ok; if (Underwater) { diff --git a/src/nhlobj.c b/src/nhlobj.c index 5d1bba0e8..d9e46e6f0 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -359,10 +359,10 @@ l_obj_at(lua_State *L) int argc = lua_gettop(L); if (argc == 2) { - int x, y; + coordxy x, y; - x = (int) luaL_checkinteger(L, 1); - y = (int) luaL_checkinteger(L, 2); + x = (coordxy) luaL_checkinteger(L, 1); + y = (coordxy) luaL_checkinteger(L, 2); lua_pop(L, 2); (void) l_obj_push(L, g.level.objects[x][y]); return 1; @@ -379,13 +379,13 @@ l_obj_placeobj(lua_State *L) { int argc = lua_gettop(L); struct _lua_obj *lo = l_obj_check(L, 1); - int x, y; + coordxy x, y; if (argc != 3) nhl_error(L, "l_obj_placeobj: Wrong args"); - x = (int) luaL_checkinteger(L, 2); - y = (int) luaL_checkinteger(L, 3); + x = (coordxy) luaL_checkinteger(L, 2); + y = (coordxy) luaL_checkinteger(L, 3); lua_pop(L, 3); if (lobj_is_ok(lo)) { diff --git a/src/nhlsel.c b/src/nhlsel.c index 77270298b..5f5a3b061 100644 --- a/src/nhlsel.c +++ b/src/nhlsel.c @@ -181,7 +181,7 @@ l_selection_getpoint(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); coordxy x, y; - int ix, iy; + lua_Integer ix, iy; int val; long crd; diff --git a/src/nhlua.c b/src/nhlua.c index 6f85011ea..ab2f9062c 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -380,12 +380,15 @@ splev_typ2chr(schar typ) static int nhl_gettrap(lua_State *L) { - int x, y; + lua_Integer lx, ly; + coordxy x, y; - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "Incorrect arguments"); return 0; } + x = (coordxy) lx; + y = (coordxy) ly; if (isok(x, y)) { struct trap *ttmp = t_at(x,y); @@ -427,13 +430,16 @@ nhl_gettrap(lua_State *L) static int nhl_deltrap(lua_State *L) { - int x, y; + lua_Integer lx, ly; + coordxy x, y; - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "Incorrect arguments"); return 0; } - + x = (coordxy) lx; + y = (coordxy) ly; + if (isok(x, y)) { struct trap *ttmp = t_at(x,y); @@ -448,21 +454,21 @@ nhl_deltrap(lua_State *L) return TRUE if there are such params in the stack. */ boolean -nhl_get_xy_params(lua_State *L, int *x, int *y) +nhl_get_xy_params(lua_State *L, lua_Integer *x, lua_Integer *y) { int argc = lua_gettop(L); boolean ret = FALSE; if (argc == 2) { - *x = (int) lua_tointeger(L, 1); - *y = (int) lua_tointeger(L, 2); + *x = lua_tointeger(L, 1); + *y = lua_tointeger(L, 2); ret = TRUE; } else if (argc == 1 && lua_type(L, 1) == LUA_TTABLE) { lua_Integer ax, ay; ret = get_coord(L, 1, &ax, &ay); - *x = (int) ax; - *y = (int) ay; + *x = ax; + *y = ay; } return ret; } @@ -474,13 +480,17 @@ DISABLE_WARNING_UNREACHABLE_CODE static int nhl_getmap(lua_State *L) { - int x, y; + lua_Integer lx, ly; + coordxy x, y; - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "Incorrect arguments"); return 0; } + x = (coordxy) lx; + y = (coordxy) ly; + if (isok(x, y)) { char buf[BUFSZ]; lua_newtable(L); @@ -1038,7 +1048,7 @@ nhl_stairways(lua_State *L) static int nhl_test(lua_State *L) { - int x, y; + coordxy x, y; char *name, Player[] = "Player"; /* discard any extra arguments passed in */ @@ -1046,11 +1056,11 @@ nhl_test(lua_State *L) luaL_checktype(L, 1, LUA_TTABLE); - x = get_table_int(L, "x"); - y = get_table_int(L, "y"); + x = (coordxy) get_table_int(L, "x"); + y = (coordxy) get_table_int(L, "y"); name = get_table_str_opt(L, "name", Player); - pline("TEST:{ x=%i, y=%i, name=\"%s\" }", x,y, name); + pline("TEST:{ x=%i, y=%i, name=\"%s\" }", (int) x, (int) y, name); free(name); @@ -1141,15 +1151,19 @@ nhl_timer_has_at(lua_State *L) { boolean ret = FALSE; short timertype = nhl_get_timertype(L, -1); - int x, y; + lua_Integer lx, ly; + coordxy x, y; long when; lua_pop(L, 1); /* remove timertype */ - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "nhl_timer_has_at: Wrong args"); return 0; } + x = (coordxy) lx; + y = (coordxy) ly; + if (isok(x, y)) { when = spot_time_expires(x, y, timertype); ret = (when > 0L); @@ -1166,14 +1180,18 @@ nhl_timer_peek_at(lua_State *L) { long when = 0L; short timertype = nhl_get_timertype(L, -1); - int x, y; + lua_Integer lx, ly; + coordxy x, y; lua_pop(L, 1); /* remove timertype */ - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "nhl_timer_peek_at: Wrong args"); return 0; } + x = (coordxy) lx; + y = (coordxy) ly; + if (timer_is_pos(timertype) && isok(x, y)) when = spot_time_expires(x, y, timertype); lua_pushinteger(L, when); @@ -1187,14 +1205,18 @@ static int nhl_timer_stop_at(lua_State *L) { short timertype = nhl_get_timertype(L, -1); - int x, y; + lua_Integer lx, ly; + coordxy x, y; lua_pop(L, 1); /* remove timertype */ - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "nhl_timer_stop_at: Wrong args"); return 0; } + x = (coordxy) lx; + y = (coordxy) ly; + if (timer_is_pos(timertype) && isok(x, y)) spot_stop_timers(x, y, timertype); return 0; @@ -1207,14 +1229,18 @@ nhl_timer_start_at(lua_State *L) { short timertype = nhl_get_timertype(L, -2); long when = lua_tointeger(L, -1); - int x, y; + lua_Integer lx, ly; + coordxy x, y; lua_pop(L, 2); /* remove when and timertype */ - if (!nhl_get_xy_params(L, &x, &y)) { + if (!nhl_get_xy_params(L, &lx, &ly)) { nhl_error(L, "nhl_timer_start_at: Wrong args"); return 0; } + x = (coordxy) lx; + y = (coordxy) ly; + if (timer_is_pos(timertype) && isok(x, y)) { long where = ((long) x << 16) | (long) y; diff --git a/src/objnam.c b/src/objnam.c index 77358685e..ee223660a 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -3199,7 +3199,8 @@ wizterrainwish(struct _readobjnam_data *d) { struct rm *lev; boolean madeterrain = FALSE, badterrain = FALSE, didblock; - int trap, oldtyp, x = u.ux, y = u.uy; + int trap, oldtyp; + coordxy x = u.ux, y = u.uy; char *bp = d->bp, *p = d->p; for (trap = NO_TRAP + 1; trap < TRAPNUM; trap++) { diff --git a/src/pager.c b/src/pager.c index f897bf33f..cecf7f270 100644 --- a/src/pager.c +++ b/src/pager.c @@ -11,15 +11,15 @@ static boolean is_swallow_sym(int); static int append_str(char *, const char *); -static void trap_description(char *, int, int, int); -static void look_at_object(char *, int, int, int); -static void look_at_monster(char *, char *, struct monst *, int, int); -static struct permonst *lookat(int, int, char *, char *); +static void trap_description(char *, int, coordxy, coordxy); +static void look_at_object(char *, coordxy, coordxy, int); +static void look_at_monster(char *, char *, struct monst *, coordxy, coordxy); +static struct permonst *lookat(coordxy, coordxy, char *, char *); static void checkfile(char *, struct permonst *, boolean, boolean, char *); static int add_cmap_descr(int, int, int, int, coord, const char *, const char *, boolean *, const char **, char *); -static void look_region_nearby(int *, int *, int *, int *, boolean); +static void look_region_nearby(coordxy *, coordxy *, coordxy *, coordxy *, boolean); static void look_all(boolean, boolean); static void look_traps(boolean); static void do_supplemental_info(char *, struct permonst *, boolean); @@ -143,7 +143,7 @@ monhealthdescr(struct monst *mon, boolean addspace, char *outbuf) /* copy a trap's description into outbuf[] */ static void -trap_description(char *outbuf, int tnum, int x, int y) +trap_description(char *outbuf, int tnum, coordxy x, coordxy y) { /* * Trap detection used to display a bear trap at locations having @@ -169,8 +169,8 @@ mhidden_description( { struct obj *otmp; boolean fakeobj, isyou = (mon == &g.youmonst); - int x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my, - glyph = (g.level.flags.hero_memory && !isyou) ? levl[x][y].glyph + coordxy x = isyou ? u.ux : mon->mx, y = isyou ? u.uy : mon->my; + int glyph = (g.level.flags.hero_memory && !isyou) ? levl[x][y].glyph : glyph_at(x, y); *outbuf = '\0'; @@ -220,7 +220,7 @@ mhidden_description( /* extracted from lookat(); also used by namefloorobj() */ boolean -object_from_map(int glyph, int x, int y, struct obj **obj_p) +object_from_map(int glyph, coordxy x, coordxy y, struct obj **obj_p) { boolean fakeobj = FALSE, mimic_obj = FALSE; struct monst *mtmp; @@ -295,7 +295,7 @@ object_from_map(int glyph, int x, int y, struct obj **obj_p) static void look_at_object(char *buf, /* output buffer */ - int x, int y, int glyph) + coordxy x, coordxy y, int glyph) { struct obj *otmp = 0; boolean fakeobj = object_from_map(glyph, x, y, &otmp); @@ -331,7 +331,7 @@ static void look_at_monster(char *buf, char *monbuf, /* buf: output, monbuf: optional output */ struct monst *mtmp, - int x, int y) + coordxy x, coordxy y) { char *name, monnambuf[BUFSZ], healthbuf[BUFSZ]; boolean accurate = !Hallucination; @@ -524,7 +524,7 @@ waterbody_name(coordxy x, coordxy y) * If not hallucinating and the glyph is a monster, also monster data. */ static struct permonst * -lookat(int x, int y, char *buf, char *monbuf) +lookat(coordxy x, coordxy y, char *buf, char *monbuf) { struct monst *mtmp = (struct monst *) 0; struct permonst *pm = (struct permonst *) 0; @@ -1632,7 +1632,9 @@ do_look(int mode, coord *click_cc) } static void -look_region_nearby(int *lo_x, int *lo_y, int *hi_x, int *hi_y, boolean nearby) +look_region_nearby( + coordxy *lo_x, coordxy *lo_y, + coordxy *hi_x, coordxy *hi_y, boolean nearby) { *lo_y = nearby ? max(u.uy - BOLT_LIM, 0) : 0; *lo_x = nearby ? max(u.ux - BOLT_LIM, 1) : 1; @@ -1648,7 +1650,8 @@ look_all( boolean do_mons) /* True => monsters, False => objects */ { winid win; - int x, y, lo_x, lo_y, hi_x, hi_y, glyph, count = 0; + int glyph, count = 0; + coordxy x, y, lo_x, lo_y, hi_x, hi_y; char lookbuf[BUFSZ], outbuf[BUFSZ]; win = create_nhwindow(NHW_TEXT); @@ -1736,7 +1739,8 @@ look_traps(boolean nearby) { winid win; struct trap *t; - int x, y, lo_x, lo_y, hi_x, hi_y, glyph, tnum, count = 0; + int glyph, tnum, count = 0; + coordxy x, y, lo_x, lo_y, hi_x, hi_y; char lookbuf[BUFSZ], outbuf[BUFSZ]; win = create_nhwindow(NHW_TEXT); @@ -1900,7 +1904,8 @@ int doidtrap(void) { register struct trap *trap; - int x, y, tt, glyph; + int tt, glyph; + coordxy x, y; if (!getdir("^")) return ECMD_CANCEL; diff --git a/src/pickup.c b/src/pickup.c index 14742ac86..c8471e43d 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -45,9 +45,9 @@ static struct obj *tipcontainer_gettarget(struct obj *, boolean *); static int tipcontainer_checks(struct obj *, boolean); static char in_or_out_menu(const char *, struct obj *, boolean, boolean, boolean, boolean); -static boolean able_to_loot(int, int, boolean); +static boolean able_to_loot(coordxy, coordxy, boolean); static boolean reverse_loot(void); -static boolean mon_beside(int, int); +static boolean mon_beside(coordxy, coordxy); static int do_loot_cont(struct obj **, int, int); static int doloot_core(void); static void tipcontainer(struct obj *); @@ -1821,7 +1821,7 @@ encumber_msg(void) /* Is there a container at x,y. Optional: return count of containers at x,y */ int -container_at(int x, int y, boolean countem) +container_at(coordxy x, coordxy y, boolean countem) { struct obj *cobj, *nobj; int container_count = 0; @@ -1839,7 +1839,7 @@ container_at(int x, int y, boolean countem) static boolean able_to_loot( - int x, int y, + coordxy x, coordxy y, boolean looting) /* loot vs tip */ { const char *verb = looting ? "loot" : "tip"; @@ -1869,9 +1869,10 @@ able_to_loot( } static boolean -mon_beside(int x, int y) +mon_beside(coordxy x, coordxy y) { - int i, j, nx, ny; + int i, j; + coordxy nx, ny; for (i = -1; i <= 1; i++) for (j = -1; j <= 1; j++) { diff --git a/src/pray.c b/src/pray.c index a16b74f9b..6a228adb6 100644 --- a/src/pray.c +++ b/src/pray.c @@ -2244,7 +2244,7 @@ doturn(void) } int -altarmask_at(int x, int y) +altarmask_at(coordxy x, coordxy y) { int res = 0; @@ -2406,7 +2406,7 @@ align_gtitle(aligntyp alignment) } void -altar_wrath(int x, int y) +altar_wrath(coordxy x, coordxy y) { aligntyp altaralign = a_align(x, y); diff --git a/src/priest.c b/src/priest.c index afa4e14ed..9bb487827 100644 --- a/src/priest.c +++ b/src/priest.c @@ -744,7 +744,8 @@ in_your_sanctuary( void ghod_hitsu(struct monst *priest) { - int x, y, ax, ay, roomno = (int) temple_occupied(u.urooms); + coordxy x, y, ax, ay; + int roomno = (int) temple_occupied(u.urooms); struct mkroom *troom; if (!roomno || !has_shrine(priest)) diff --git a/src/read.c b/src/read.c index bf1ade8a8..71a0fd4de 100644 --- a/src/read.c +++ b/src/read.c @@ -18,7 +18,7 @@ static void p_glow1(struct obj *); static void p_glow2(struct obj *, const char *); static void forget(int); static int maybe_tame(struct monst *, struct obj *); -static boolean can_center_cloud(int, int); +static boolean can_center_cloud(coordxy, coordxy); static void display_stinking_cloud_positions(int); static void seffect_enchant_armor(struct obj **); static void seffect_destroy_armor(struct obj **); @@ -45,7 +45,7 @@ static void seffect_magic_mapping(struct obj **); #ifdef MAIL_STRUCTURES static void seffect_mail(struct obj **); #endif /* MAIL_STRUCTURES */ -static void set_lit(int, int, genericptr); +static void set_lit(coordxy, coordxy, genericptr); static void do_class_genocide(void); static void do_stinking_cloud(struct obj *, boolean); static boolean create_particular_parse(char *, @@ -1032,7 +1032,7 @@ maybe_tame(struct monst* mtmp, struct obj* sobj) * NOT the same thing as can_center_cloud. */ boolean -valid_cloud_pos(int x, int y) +valid_cloud_pos(coordxy x, coordxy y) { if (!isok(x,y)) return FALSE; @@ -1043,7 +1043,7 @@ valid_cloud_pos(int x, int y) * should have its regular effects, or not because it was out of range. */ static boolean -can_center_cloud(int x, int y) +can_center_cloud(coordxy x, coordxy y) { if (!valid_cloud_pos(x, y)) return FALSE; @@ -1056,7 +1056,7 @@ display_stinking_cloud_positions(int state) if (state == 0) { tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos)); } else if (state == 1) { - int x, y, dx, dy; + coordxy x, y, dx, dy; int dist = 6; for (dx = -dist; dx <= dist; dx++) @@ -1780,7 +1780,7 @@ seffect_earth(struct obj **sobjp) /* TODO: handle steeds */ if (!Is_rogue_level(&u.uz) && has_ceiling(&u.uz) && (!In_endgame(&u.uz) || Is_earthlevel(&u.uz))) { - register int x, y; + coordxy x, y; int nboulders = 0; /* Identify the scroll */ @@ -1961,7 +1961,7 @@ seffect_magic_mapping(struct obj **sobjp) return; } if (sblessed) { - register int x, y; + coordxy x, y; for (x = 1; x < COLNO; x++) for (y = 0; y < ROWNO; y++) @@ -2170,7 +2170,7 @@ drop_boulder_on_player(boolean confused, boolean helmet_protects, boolean byu, b } boolean -drop_boulder_on_monster(int x, int y, boolean confused, boolean byu) +drop_boulder_on_monster(coordxy x, coordxy y, boolean confused, boolean byu) { register struct obj *otmp2; register struct monst *mtmp; @@ -2300,7 +2300,7 @@ static struct litmon *gremlins = 0; * Low-level lit-field update routine. */ static void -set_lit(int x, int y, genericptr_t val) +set_lit(coordxy x, coordxy y, genericptr_t val) { struct monst *mtmp; struct litmon *gremlin; diff --git a/src/sp_lev.c b/src/sp_lev.c index 71bc99fe4..1d8f0de55 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -14,7 +14,7 @@ #include "hack.h" #include "sp_lev.h" -typedef void (*select_iter_func)(int, int, genericptr); +typedef void (*select_iter_func)(coordxy, coordxy, genericptr); extern void mkmap(lev_init *); @@ -27,7 +27,7 @@ static void flip_drawbridge_horizontal(struct rm *); 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 sel_set_wall_property(coordxy, coordxy, genericptr_t); static void set_wall_property(coordxy, coordxy, coordxy, coordxy, int); static void count_features(void); static void remove_boundary_syms(void); @@ -49,7 +49,7 @@ static boolean create_subroom(struct mkroom *, coordxy, coordxy, coordxy, static void create_door(room_door *, struct mkroom *); static void create_trap(spltrap *, struct mkroom *); static int noncoalignment(aligntyp); -static boolean m_bad_boulder_spot(int, int); +static boolean m_bad_boulder_spot(coordxy, coordxy); static int pm_to_humidity(struct permonst *); static unsigned int sp_amask_to_amask(unsigned int sp_amask); static void create_monster(monster *, struct mkroom *); @@ -62,6 +62,8 @@ static void light_region(region *); static void maze1xy(coord *, int); static void fill_empty_maze(void); static void splev_initlev(lev_init *); +static boolean generate_way_out_method(coordxy nx, coordxy ny, + struct selectionvar *ov); #if 0 /* macosx complains that these are unused */ static long sp_code_jmpaddr(long, long); @@ -79,7 +81,7 @@ static void spo_mazewalk(struct sp_coder *); static void spo_wall_property(struct sp_coder *); static void spo_room_door(struct sp_coder *); static void spo_wallify(struct sp_coder *); -static void sel_set_wallify(int, int, genericptr_t); +static void sel_set_wallify(coordxy, coordxy, genericptr_t); #endif static void spo_end_moninvent(void); static void spo_pop_container(void); @@ -88,22 +90,22 @@ static void spo_endroom(struct sp_coder *); static void l_table_getset_feature_flag(lua_State *, int, int, const char *, int); static void l_get_lregion(lua_State *, lev_region *); -static void sel_set_lit(int, int, genericptr_t); +static void sel_set_lit(coordxy, coordxy, genericptr_t); static void add_doors_to_room(struct mkroom *); static void selection_iterate(struct selectionvar *, select_iter_func, genericptr_t); -static void sel_set_ter(int, int, genericptr_t); -static void sel_set_door(int, int, genericptr_t); -static void sel_set_feature(int, int, genericptr_t); +static void sel_set_ter(coordxy, coordxy, genericptr_t); +static void sel_set_door(coordxy, coordxy, genericptr_t); +static void sel_set_feature(coordxy, coordxy, genericptr_t); static void levregion_add(lev_region *); 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 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, coordxy *, coordxy *, int); +static int floodfillchk_match_under(coordxy, coordxy); +static int floodfillchk_match_accessible(coordxy, coordxy); +static boolean sel_flood_havepoint(coordxy, coordxy, 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 *); @@ -485,7 +487,7 @@ void flip_level(int flp, boolean extras) { int x, y, i, itmp; - int minx, miny, maxx, maxy; + coordxy minx, miny, maxx, maxy; struct rm trm; struct trap *ttmp; struct obj *otmp; @@ -855,7 +857,7 @@ flip_level_rnd(int flp, boolean extras) static void -sel_set_wall_property(int x, int y, genericptr_t arg) +sel_set_wall_property(coordxy x, coordxy y, genericptr_t arg) { int prop = *(int *)arg; @@ -1195,7 +1197,7 @@ is_ok_location(coordxy x, coordxy y, getloc_flags_t humidity) } boolean -pm_good_location(int x, int y, struct permonst* pm) +pm_good_location(coordxy x, coordxy y, struct permonst* pm) { return is_ok_location(x, y, pm_to_humidity(pm)); } @@ -1234,6 +1236,7 @@ get_location_coord( *y = c.y; get_location(x, y, c.getloc_flags | (c.is_random ? NO_LOC_WARN : 0), croom); + if (*x == -1 && *y == -1 && c.is_random) get_location(x, y, humidity, croom); } @@ -1740,7 +1743,7 @@ noncoalignment(aligntyp alignment) /* attempt to screen out locations where a mimic-as-boulder shouldn't occur */ static boolean -m_bad_boulder_spot(int x, int y) +m_bad_boulder_spot(coordxy x, coordxy y) { struct rm *lev; @@ -2707,9 +2710,9 @@ light_region(region* tmpregion) } void -wallify_map(int x1, int y1, int x2, int y2) +wallify_map(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { - int x, y, xx, yy, lo_xx, lo_yy, hi_xx, hi_yy; + coordxy x, y, xx, yy, lo_xx, lo_yy, hi_xx, hi_yy; y1 = max(y1, 0); x1 = max(x1, 1); @@ -3901,17 +3904,17 @@ l_create_stairway(lua_State *L, boolean using_ladder) lcheck_param_table(L); get_table_xy_or_coord(L, &ax, &ay); up = stairdirs2i[get_table_option(L, "dir", "down", stairdirs)]; - x = ax; - y = ay; + x = (coordxy) ax; + y = (coordxy) ay; } else { - int ix = -1, iy = -1; + lua_Integer ix = -1, iy = -1; if (argc > 0 && ltype == LUA_TSTRING) { up = stairdirs2i[luaL_checkoption(L, 1, "down", stairdirs)]; lua_remove(L, 1); } nhl_get_xy_params(L, &ix, &iy); - x = ix; - y = iy; + x = (coordxy) ix; + y = (coordxy) iy; } if (x == -1 && y == -1) { @@ -4331,7 +4334,7 @@ selection_clone(struct selectionvar* sel) } coordxy -selection_getpoint(int x, int y, struct selectionvar* sel) +selection_getpoint(coordxy x, coordxy y, struct selectionvar* sel) { if (!sel || !sel->map) return 0; @@ -4342,7 +4345,7 @@ selection_getpoint(int x, int y, struct selectionvar* sel) } void -selection_setpoint(int x, int y, struct selectionvar* sel, coordxy c) +selection_setpoint(coordxy x, coordxy y, struct selectionvar* sel, coordxy c) { if (!sel || !sel->map) return; @@ -4453,7 +4456,7 @@ random_wdir(void) void selection_do_grow(struct selectionvar* ov, int dir) { - int x, y; + coordxy x, y; struct selectionvar *tmp; if (!ov) @@ -4494,17 +4497,17 @@ selection_do_grow(struct selectionvar* ov, int dir) selection_free(tmp, TRUE); } -static int (*selection_flood_check_func)(int, int); +static int (*selection_flood_check_func)(coordxy, coordxy); static schar floodfillchk_match_under_typ; void -set_selection_floodfillchk(int (*f)(int, int)) +set_selection_floodfillchk(int (*f)(coordxy, coordxy)) { selection_flood_check_func = f; } static int -floodfillchk_match_under(int x, int y) +floodfillchk_match_under(coordxy x, coordxy y) { return (floodfillchk_match_under_typ == levl[x][y].typ); } @@ -4517,7 +4520,7 @@ set_floodfillchk_match_under(coordxy typ) } static int -floodfillchk_match_accessible(int x, int y) +floodfillchk_match_accessible(coordxy x, coordxy y) { return (ACCESSIBLE(levl[x][y].typ) || levl[x][y].typ == SDOOR @@ -4526,9 +4529,9 @@ floodfillchk_match_accessible(int x, int y) /* check whethere is already in xs[],ys[] */ static boolean -sel_flood_havepoint(int x, int y, coordxy xs[], coordxy ys[], int n) +sel_flood_havepoint(coordxy x, coordxy y, coordxy xs[], coordxy ys[], int n) { - coordxy xx = (coordxy) x, yy = (coordxy) y; + coordxy xx = x, yy = y; while (n > 0) { --n; @@ -4539,7 +4542,7 @@ sel_flood_havepoint(int x, int y, coordxy xs[], coordxy ys[], int n) } void -selection_floodfill(struct selectionvar* ov, int x, int y, boolean diagonals) +selection_floodfill(struct selectionvar* ov, coordxy x, coordxy y, boolean diagonals) { struct selectionvar *tmp = selection_new(); #define SEL_FLOOD_STACK (COLNO * ROWNO) @@ -4565,7 +4568,7 @@ selection_floodfill(struct selectionvar* ov, int x, int y, boolean diagonals) coordxy dx[SEL_FLOOD_STACK]; coordxy dy[SEL_FLOOD_STACK]; - if (selection_flood_check_func == (int (*)(int, int)) 0) { + if (selection_flood_check_func == (int (*)(coordxy, coordxy)) 0) { selection_free(tmp, TRUE); return; } @@ -4871,7 +4874,7 @@ selection_iterate( select_iter_func func, genericptr_t arg) { - int x, y; + coordxy x, y; if (!ov) return; @@ -4884,7 +4887,7 @@ selection_iterate( } static void -sel_set_ter(int x, int y, genericptr_t arg) +sel_set_ter(coordxy x, coordxy y, genericptr_t arg) { terrain terr; @@ -4902,7 +4905,7 @@ sel_set_ter(int x, int y, genericptr_t arg) } static void -sel_set_feature(int x, int y, genericptr_t arg) +sel_set_feature(coordxy x, coordxy y, genericptr_t arg) { if (IS_FURNITURE(levl[x][y].typ)) return; @@ -4910,7 +4913,7 @@ sel_set_feature(int x, int y, genericptr_t arg) } static void -sel_set_door(int dx, int dy, genericptr_t arg) +sel_set_door(coordxy dx, coordxy dy, genericptr_t arg) { coordxy typ = *(coordxy *) arg; coordxy x = dx, y = dy; @@ -5203,7 +5206,7 @@ lspo_replace_terrain(lua_State *L) struct mapfragment *mf = NULL; struct selectionvar *sel = NULL; boolean freesel = FALSE; - int x, y; + coordxy x, y; lua_Integer x1, y1, x2, y2; int chance; int tolit; @@ -5288,7 +5291,7 @@ lspo_replace_terrain(lua_State *L) static boolean generate_way_out_method( - int nx, int ny, + coordxy nx, coordxy ny, struct selectionvar *ov) { static const int escapeitems[] = { @@ -5362,7 +5365,7 @@ ensure_way_out(void) { struct selectionvar *ov = selection_new(); struct trap *ttmp = g.ftrap; - int x, y; + coordxy x, y; boolean ret = TRUE; stairway *stway = g.stairs; @@ -5622,7 +5625,7 @@ lspo_levregion(lua_State *L) } static void -sel_set_lit(int x, int y, genericptr_t arg) +sel_set_lit(coordxy x, coordxy y, genericptr_t arg) { int lit = *(int *)arg; @@ -5633,7 +5636,7 @@ sel_set_lit(int x, int y, genericptr_t arg) static void add_doors_to_room(struct mkroom *croom) { - int x, y; + coordxy x, y; for (x = croom->lx - 1; x <= croom->hx + 1; x++) for (y = croom->ly - 1; y <= croom->hy + 1; y++) @@ -6019,7 +6022,7 @@ lspo_non_passwall(lua_State *L) #if 0 /*ARGSUSED*/ static void -sel_set_wallify(int x, int y, genericptr_t arg UNUSED) +sel_set_wallify(coordxy x, coordxy y, genericptr_t arg UNUSED) { wallify_map(x, y, x, y); } diff --git a/src/spell.c b/src/spell.c index 4b8079bc5..0f78ee86f 100644 --- a/src/spell.c +++ b/src/spell.c @@ -42,7 +42,7 @@ static int throwspell(void); static void cast_protection(void); static void spell_backfire(int); static const char *spelltypemnemonic(int); -static boolean spell_aim_step(genericptr_t, int, int); +static boolean spell_aim_step(genericptr_t, coordxy, coordxy); /* The roles[] table lists the role-specific values for tuning * percent_success(). @@ -1246,7 +1246,7 @@ spelleffects(int spell_otyp, boolean atme) /*ARGSUSED*/ static boolean -spell_aim_step(genericptr_t arg UNUSED, int x, int y) +spell_aim_step(genericptr_t arg UNUSED, coordxy x, coordxy y) { if (!isok(x,y)) return FALSE; diff --git a/src/steal.c b/src/steal.c index a25d842dc..e3af075a4 100644 --- a/src/steal.c +++ b/src/steal.c @@ -677,7 +677,7 @@ mdrop_obj( struct obj *obj, boolean verbosely) { - int omx = mon->mx, omy = mon->my; + coordxy omx = mon->mx, omy = mon->my; long unwornmask = obj->owornmask; /* call distant_name() for its possible side-effects even if the result might not be printed, and do it before extracing obj from minvent */ diff --git a/src/steed.c b/src/steed.c index 3f5f759a6..176d7a86a 100644 --- a/src/steed.c +++ b/src/steed.c @@ -439,7 +439,8 @@ landing_spot( int reason, int forceit) { - int i = 0, x, y, distance, min_distance = -1; + int i = 0, distance, min_distance = -1; + coordxy x, y; boolean found = FALSE; struct trap *t; diff --git a/src/teleport.c b/src/teleport.c index ac4c96510..35f9cd09c 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -5,12 +5,12 @@ #include "hack.h" -static boolean goodpos_onscary(int, int, struct permonst *); -static boolean tele_jump_ok(int, int, int, int); -static boolean teleok(int, int, boolean); +static boolean goodpos_onscary(coordxy, coordxy, struct permonst *); +static boolean tele_jump_ok(coordxy, coordxy, coordxy, coordxy); +static boolean teleok(coordxy, coordxy, boolean); static void vault_tele(void); -static boolean rloc_pos_ok(int, int, struct monst *); -static void rloc_to_core(struct monst *, int, int, unsigned); +static boolean rloc_pos_ok(coordxy, coordxy, struct monst *); +static void rloc_to_core(struct monst *, coordxy, coordxy, unsigned); static void mvault_tele(struct monst *); static boolean m_blocks_teleporting(struct monst *); @@ -43,7 +43,7 @@ noteleport_level(struct monst* mon) fields aside from 'monst->data' */ static boolean goodpos_onscary( - int x, int y, + coordxy x, coordxy y, struct permonst *mptr) { /* onscary() checks Angels and lawful minions; this oversimplifies */ @@ -75,7 +75,7 @@ goodpos_onscary( */ boolean goodpos( - int x, int y, + coordxy x, coordxy y, struct monst *mtmp, mmflags_nht gpflags) { @@ -196,8 +196,8 @@ enexto_core( { #define MAX_GOOD 15 coord good[MAX_GOOD], *good_ptr; - int x, y, range, i; - int xmin, xmax, ymin, ymax, rangemax; + coordxy x, y, range, i; + coordxy xmin, xmax, ymin, ymax, rangemax; struct monst fakemon; /* dummy monster */ boolean allow_xx_yy = (boolean) ((entflags & GP_ALLOW_XY) != 0); @@ -278,7 +278,7 @@ enexto_core( full: /* we've got between 1 and SIZE(good) candidates; choose one */ - i = rn2((int) (good_ptr - good)); + i = (coordxy) rn2((int) (good_ptr - good)); cc->x = good[i].x; cc->y = good[i].y; return TRUE; @@ -290,7 +290,7 @@ enexto_core( * only for explicitly chosen destinations.) */ static boolean -tele_jump_ok(int x1, int y1, int x2, int y2) +tele_jump_ok(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { if (!isok(x2, y2)) return FALSE; @@ -324,7 +324,7 @@ tele_jump_ok(int x1, int y1, int x2, int y2) } static boolean -teleok(register int x, register int y, boolean trapok) +teleok(coordxy x, coordxy y, boolean trapok) { if (!trapok) { /* allow teleportation onto vibrating square, it's not a real trap; @@ -352,7 +352,7 @@ teleok(register int x, register int y, boolean trapok) } void -teleds(int nux, int nuy, int teleds_flags) +teleds(coordxy nux, coordxy nuy, int teleds_flags) { boolean ball_active, ball_still_in_range = FALSE, allow_drag = (teleds_flags & TELEDS_ALLOW_DRAG) != 0, @@ -479,7 +479,8 @@ teleds(int nux, int nuy, int teleds_flags) boolean safe_teleds(int teleds_flags) { - register int nux, nuy, tcnt = 0; + coordxy nux, nuy; + int tcnt = 0; do { nux = rnd(COLNO - 1); @@ -1208,10 +1209,10 @@ level_tele_trap(struct trap* trap, unsigned int trflags) /* check whether monster can arrive at location via Tport (or fall) */ static boolean rloc_pos_ok( - int x, int y, /* coordinates of candidate location */ + coordxy x, coordxy y, /* coordinates of candidate location */ struct monst *mtmp) { - register int xx, yy; + coordxy xx, yy; if (!goodpos(x, y, mtmp, GP_CHECKSCARY)) return FALSE; @@ -1276,10 +1277,10 @@ rloc_pos_ok( static void rloc_to_core( struct monst* mtmp, - int x, int y, + coordxy x, coordxy y, unsigned rlocflags) { - register int oldx = mtmp->mx, oldy = mtmp->my; + coordxy oldx = mtmp->mx, oldy = mtmp->my; boolean resident_shk = mtmp->isshk && inhishop(mtmp); boolean preventmsg = (rlocflags & RLOC_NOMSG) != 0; boolean vanishmsg = (rlocflags & RLOC_MSG) != 0; @@ -1370,13 +1371,13 @@ rloc_to_core( } void -rloc_to(struct monst *mtmp, int x, int y) +rloc_to(struct monst *mtmp, coordxy x, coordxy y) { rloc_to_core(mtmp, x, y, RLOC_NOMSG); } void -rloc_to_flag(struct monst *mtmp, int x, int y, unsigned int rlocflags) +rloc_to_flag(struct monst *mtmp, coordxy x, coordxy y, unsigned int rlocflags) { rloc_to_core(mtmp, x, y, rlocflags); } @@ -1400,7 +1401,8 @@ rloc( struct monst *mtmp, /* mx==0 implies migrating monster arrival */ unsigned int rlocflags) { - register int x, y, trycount; + coordxy x, y; + int trycount; if (mtmp == u.usteed) { tele(); @@ -1600,7 +1602,7 @@ mlevel_tele_trap( boolean rloco(register struct obj* obj) { - register coordxy tx, ty, otx, oty; + coordxy tx, ty, otx, oty; boolean restricted_fall; int try_limit = 4000; diff --git a/src/trap.c b/src/trap.c index 7d73c8fe6..0b86e33c3 100644 --- a/src/trap.c +++ b/src/trap.c @@ -374,7 +374,7 @@ mk_trap_statue(coordxy x, coordxy y) } struct trap * -maketrap(int x, int y, int typ) +maketrap(coordxy x, coordxy y, int typ) { static union vlaunchinfo zero_vl; boolean oldplace; @@ -2647,7 +2647,7 @@ steedintrap(struct trap* trap, struct obj* otmp) void blow_up_landmine(struct trap* trap) { - int x = trap->tx, y = trap->ty, dbx, dby; + coordxy x = trap->tx, y = trap->ty, dbx, dby; struct rm *lev = &levl[x][y]; schar old_typ, typ; @@ -2731,8 +2731,8 @@ force_launch_placement(void) int launch_obj( short otyp, - int x1, int y1, - int x2, int y2, + coordxy x1, coordxy y1, + coordxy x2, coordxy y2, int style) { struct monst *mtmp; @@ -3406,7 +3406,7 @@ float_up(void) } void -fill_pit(int x, int y) +fill_pit(coordxy x, coordxy y) { struct obj *otmp; struct trap *t; @@ -5024,11 +5024,11 @@ untrap_box( int untrap( boolean force, - int rx, int ry, + coordxy rx, coordxy ry, struct obj *container) { register struct obj *otmp; - register int x, y; + coordxy x, y; int ch; struct trap *ttmp; struct monst *mtmp; @@ -5637,7 +5637,7 @@ chest_trap( } struct trap * -t_at(register int x, register int y) +t_at(coordxy x, coordxy y) { register struct trap *trap = g.ftrap; @@ -5692,7 +5692,7 @@ conjoined_pits( struct trap *trap1, boolean u_entering_trap2) { - int dx, dy, diridx, adjidx; + coordxy dx, dy, diridx, adjidx; if (!trap1 || !trap2) return FALSE; @@ -5716,7 +5716,8 @@ conjoined_pits( static void clear_conjoined_pits(struct trap* trap) { - int diridx, adjidx, x, y; + int diridx, adjidx; + coordxy x, y; struct trap *t; if (trap && is_pit(trap->ttyp)) { @@ -5758,7 +5759,8 @@ static void join_adjacent_pits(struct trap* trap) { struct trap *t; - int diridx, x, y; + int diridx; + coordxy x, y; if (!trap) return; diff --git a/src/vault.c b/src/vault.c index 4cedf6589..8177ef67e 100644 --- a/src/vault.c +++ b/src/vault.c @@ -6,10 +6,10 @@ #include "hack.h" static boolean clear_fcorr(struct monst *, boolean); -static void blackout(int, int); +static void blackout(coordxy, coordxy); static void restfakecorr(struct monst *); static void parkguard(struct monst *); -static boolean in_fcorridor(struct monst *, int, int); +static boolean in_fcorridor(struct monst *, coordxy, coordxy); static boolean find_guard_dest(struct monst *, coordxy *, coordxy *); static void move_gold(struct obj *, int); static void wallify_vault(struct monst *); @@ -44,7 +44,7 @@ free_egd(struct monst *mtmp) static boolean clear_fcorr(struct monst *grd, boolean forceshow) { - register int fcx, fcy, fcbeg; + coordxy fcx, fcy, fcbeg; struct monst *mtmp; boolean sawcorridor = FALSE, silently = g.program_state.stopprint ? TRUE : FALSE; @@ -117,7 +117,7 @@ clear_fcorr(struct monst *grd, boolean forceshow) the corridor, we don't want the light to reappear if/when a new tunnel goes through the same area */ static void -blackout(int x, int y) +blackout(coordxy x, coordxy y) { struct rm *lev; int i, j; @@ -185,7 +185,7 @@ grddead(struct monst *grd) } static boolean -in_fcorridor(struct monst *grd, int x, int y) +in_fcorridor(struct monst *grd, coordxy x, coordxy y) { register int fci; struct egd *egrd = EGD(grd); @@ -257,7 +257,7 @@ uleftvault(struct monst *grd) static boolean find_guard_dest(struct monst *guard, coordxy *rx, coordxy *ry) { - register int x, y, dd, lx, ly; + coordxy x, y, dd, lx, ly; for (dd = 2; (dd < ROWNO || dd < COLNO); dd++) { for (y = u.uy - dd; y <= u.uy + dd; y++) { @@ -585,7 +585,8 @@ move_gold(struct obj *gold, int vroom) static void wallify_vault(struct monst *grd) { - int x, y, typ; + int typ; + coordxy x, y; int vlt = EGD(grd)->vroom; char tmp_viz; coordxy lox = g.rooms[vlt].lx - 1, hix = g.rooms[vlt].hx + 1, @@ -804,8 +805,8 @@ gd_move_cleanup( int gd_move(struct monst *grd) { - int x, y, nx, ny, m, n; - int dx, dy, gx = 0, gy = 0, fci; + coordxy x, y, nx, ny, m, n; + coordxy dx, dy, gx = 0, gy = 0, fci; uchar typ; struct rm *crm; struct fakecorridor *fcp; diff --git a/src/vision.c b/src/vision.c index cbc6c5c52..76fed0d8d 100644 --- a/src/vision.c +++ b/src/vision.c @@ -89,8 +89,8 @@ static coordxy right_ptrs[ROWNO][COLNO]; static void fill_point(int, int); static void dig_point(int, int); static void view_init(void); -static void view_from(int, int, coordxy **, coordxy *, coordxy *, int, - void (*)(int, int, genericptr_t), +static void view_from(coordxy, coordxy, coordxy **, coordxy *, coordxy *, int, + void (*)(coordxy, coordxy, genericptr_t), genericptr_t); static void get_unused_cs(coordxy ***, coordxy **, coordxy **); static void rogue_vision(coordxy **, coordxy *, coordxy *); @@ -549,7 +549,7 @@ vision_recalc(int control) * + Monsters can see you even when you're in a pit. */ view_from(u.uy, u.ux, next_array, next_rmin, next_rmax, 0, - (void (*)(int, int, genericptr_t)) 0, + (void (*)(coordxy, coordxy, genericptr_t)) 0, (genericptr_t) 0); /* @@ -615,7 +615,7 @@ vision_recalc(int control) } } else view_from(u.uy, u.ux, next_array, next_rmin, next_rmax, 0, - (void (*)(int, int, genericptr_t)) 0, + (void (*)(coordxy, coordxy, genericptr_t)) 0, (genericptr_t) 0); /* @@ -1113,7 +1113,7 @@ static coordxy **cs_rows; static coordxy *cs_left; static coordxy *cs_right; -static void (*vis_func)(int, int, genericptr_t); +static void (*vis_func)(coordxy, coordxy, genericptr_t); static genericptr_t varg; /* @@ -1954,9 +1954,9 @@ left_side(int row, int left_mark, int right, const coordxy *limits) * arg argument for func */ static void -view_from(int srow, int scol, coordxy **loc_cs_rows, +view_from(coordxy srow, coordxy scol, coordxy **loc_cs_rows, coordxy *left_most, coordxy *right_most, int range, - void (*func)(int, int, genericptr_t), genericptr_t arg) + void (*func)(coordxy, coordxy, genericptr_t), genericptr_t arg) { register int i; /* loop counter */ coordxy *rowp; /* optimization for setting could_see */ @@ -2055,8 +2055,8 @@ view_from(int srow, int scol, coordxy **loc_cs_rows, * vision matrix and reduce extra work. */ void -do_clear_area(int scol, int srow, int range, - void (*func)(int, int, genericptr_t), genericptr_t arg) +do_clear_area(coordxy scol, coordxy srow, int range, + void (*func)(coordxy, coordxy, genericptr_t), genericptr_t arg) { /* If not centered on hero, do the hard work of figuring the area */ if (scol != u.ux || srow != u.uy) { diff --git a/src/windows.c b/src/windows.c index 79ac18cd8..7fccf5b12 100644 --- a/src/windows.c +++ b/src/windows.c @@ -501,7 +501,7 @@ genl_putmsghistory(const char *msg, boolean is_restoring) static int hup_nhgetch(void); static char hup_yn_function(const char *, const char *, char); -static int hup_nh_poskey(int *, int *, int *); +static int hup_nh_poskey(coordxy *, coordxy *, int *); static void hup_getlin(const char *, char *); static void hup_init_nhwindows(int *, char **); static void hup_exit_nhwindows(const char *); @@ -652,7 +652,7 @@ hup_yn_function(const char *prompt UNUSED, /*ARGSUSED*/ static int -hup_nh_poskey(int *x UNUSED, int *y UNUSED, int *mod UNUSED) +hup_nh_poskey(coordxy *x UNUSED, coordxy *y UNUSED, int *mod UNUSED) { return '\033'; } diff --git a/src/zap.c b/src/zap.c index aa92c9803..70d275484 100644 --- a/src/zap.c +++ b/src/zap.c @@ -2264,7 +2264,7 @@ int bhitpile( struct obj *obj, /* wand or fake spellbook for type of zap */ int (*fhito)(OBJ_P, OBJ_P), /* callback for each object being hit */ - int tx, int ty, /* target location */ + coordxy tx, coordxy ty, /* target location */ schar zz) /* direction for up/down zaps */ { int hitanything = 0; @@ -2977,7 +2977,8 @@ static boolean zap_updown(struct obj *obj) /* wand or spell */ { boolean striking = FALSE, disclose = FALSE; - int x, y, xx, yy, ptmp; + coordxy x, y, xx, yy; + int ptmp; struct obj *otmp; struct engr *e; struct trap *ttmp; @@ -3415,7 +3416,7 @@ maybe_explode_trap(struct trap *ttmp, struct obj *otmp) * one is revealed for a weapon, but if not a weapon is left up to fhitm(). */ struct monst * -bhit(int ddx, int ddy, int range, /* direction and range */ +bhit(coordxy ddx, coordxy ddy, int range, /* direction and range */ enum bhit_call_types weapon, /* defined in hack.h */ int (*fhitm)(MONST_P, OBJ_P), /* fns called when mon/obj hit */ int (*fhito)(OBJ_P, OBJ_P), @@ -3456,7 +3457,7 @@ bhit(int ddx, int ddy, int range, /* direction and range */ tmp_at(DISP_FLASH, obj_to_glyph(obj, rn2_on_display_rng)); while (range-- > 0) { - int x, y; + coordxy x, y; g.bhitpos.x += ddx; g.bhitpos.y += ddy; @@ -3747,7 +3748,7 @@ bhit(int ddx, int ddy, int range, /* direction and range */ * is too obviously silly. */ struct monst * -boomhit(struct obj *obj, int dx, int dy) +boomhit(struct obj *obj, coordxy dx, coordxy dy) { register int i, ct; int boom; /* showsym[] index */ @@ -3770,7 +3771,7 @@ boomhit(struct obj *obj, int dx, int dy) g.bhitpos.x = u.ux; g.bhitpos.y = u.uy; boom = counterclockwise ? S_boomleft : S_boomright; - i = xytod(dx, dy); + i = (int) xytod(dx, dy); tmp_at(DISP_FLASH, cmap_to_glyph(boom)); for (ct = 0; ct < 10; ct++) { i = DIR_CLAMP(i); @@ -4141,7 +4142,7 @@ zhitu(int type, int nd, const char *fltxt, coordxy sx, coordxy sy) * at position x,y; return the number of objects burned */ int -burn_floor_objects(int x, int y, +burn_floor_objects(coordxy x, coordxy y, boolean give_feedback, /* caller needs to decide about visibility checks */ boolean u_caused) diff --git a/sys/windows/consoletty.c b/sys/windows/consoletty.c index 5dd6cbd4c..6f30b6766 100644 --- a/sys/windows/consoletty.c +++ b/sys/windows/consoletty.c @@ -1112,7 +1112,7 @@ tgetch() } int -console_poskey(int *x, int *y, int *mod) +console_poskey(coordxy *x, coordxy *y, int *mod) { int ch; coord cc = { 0, 0 }; diff --git a/win/Qt/qt_bind.cpp b/win/Qt/qt_bind.cpp index 1e3c6669b..277383cad 100644 --- a/win/Qt/qt_bind.cpp +++ b/win/Qt/qt_bind.cpp @@ -586,7 +586,7 @@ QCoreApplication::exec: The event loop is already running return keybuffer.GetAscii(); } -int NetHackQtBind::qt_nh_poskey(int *x, int *y, int *mod) +int NetHackQtBind::qt_nh_poskey(coordxy *x, coordxy *y, int *mod) { if (main) main->fadeHighlighting(true); diff --git a/win/Qt/qt_bind.h b/win/Qt/qt_bind.h index 4b3bc492b..522532c46 100644 --- a/win/Qt/qt_bind.h +++ b/win/Qt/qt_bind.h @@ -69,7 +69,7 @@ public: static void qt_raw_print(const char *str); static void qt_raw_print_bold(const char *str); static int qt_nhgetch(); - static int qt_nh_poskey(int *x, int *y, int *mod); + static int qt_nh_poskey(coordxy *x, coordxy *y, int *mod); static void qt_nhbell(); static int qt_doprev_message(); static char qt_more(); diff --git a/win/X11/winX.c b/win/X11/winX.c index 271e10401..ea4c77147 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -989,7 +989,7 @@ X11_nhgetch(void) } int -X11_nh_poskey(int *x, int *y, int *mod) +X11_nh_poskey(coordxy *x, coordxy *y, int *mod) { int val = input_event(EXIT_ON_KEY_OR_BUTTON_PRESS); diff --git a/win/chain/wc_chainin.c b/win/chain/wc_chainin.c index a5162581e..27e1f1061 100644 --- a/win/chain/wc_chainin.c +++ b/win/chain/wc_chainin.c @@ -42,7 +42,7 @@ void chainin_print_glyph(winid, coordxy, coordxy, void chainin_raw_print(const char *); void chainin_raw_print_bold(const char *); int chainin_nhgetch(void); -int chainin_nh_poskey(int *, int *, int *); +int chainin_nh_poskey(coordxy *, coordxy *, int *); void chainin_nhbell(void); int chainin_doprev_message(void); char chainin_yn_function(const char *, const char *, char); @@ -377,8 +377,8 @@ chainin_nhgetch(void) int chainin_nh_poskey( - int *x, - int *y, + coordxy *x, + coordxy *y, int *mod) { int rv; diff --git a/win/chain/wc_chainout.c b/win/chain/wc_chainout.c index a4f75a4c7..0ebcd72be 100644 --- a/win/chain/wc_chainout.c +++ b/win/chain/wc_chainout.c @@ -42,7 +42,7 @@ void chainout_print_glyph(void *,winid, coordxy, coordxy, void chainout_raw_print(void *,const char *); void chainout_raw_print_bold(void *,const char *); int chainout_nhgetch(void *); -int chainout_nh_poskey(void *,int *, int *, int *); +int chainout_nh_poskey(void *,coordxy *, coordxy *, int *); void chainout_nhbell(void *); int chainout_doprev_message(void *); char chainout_yn_function(void *,const char *, const char *, char); @@ -446,8 +446,8 @@ chainout_nhgetch(void *vp) int chainout_nh_poskey( void *vp, - int *x, - int *y, + coordxy *x, + coordxy *y, int *mod) { struct chainout_data *tdp = vp; diff --git a/win/chain/wc_trace.c b/win/chain/wc_trace.c index 7f6680a0d..340ac840a 100644 --- a/win/chain/wc_trace.c +++ b/win/chain/wc_trace.c @@ -69,7 +69,7 @@ void trace_print_glyph(void *,winid, coordxy, coordxy, void trace_raw_print(void *,const char *); void trace_raw_print_bold(void *,const char *); int trace_nhgetch(void *); -int trace_nh_poskey(void *,int *, int *, int *); +int trace_nh_poskey(void *,coordxy *, coordxy *, int *); void trace_nhbell(void *); int trace_doprev_message(void *); char trace_yn_function(void *,const char *, const char *, char); @@ -724,8 +724,8 @@ trace_nhgetch(void *vp) int trace_nh_poskey( void *vp, - int *x, - int *y, + coordxy *x, + coordxy *y, int *mod) { struct trace_data *tdp = vp; @@ -742,7 +742,8 @@ trace_nh_poskey( } else { sprintf(buf, "(%d)", rv); } - fprintf(wc_tracelogf, "%s=> %s (%d, %d, %d)\n", INDENT, buf, *x, *y, + fprintf(wc_tracelogf, "%s=> %s (%d, %d, %d)\n", INDENT, buf, + (int) *x, (int) *y, *mod); return rv; diff --git a/win/curses/cursmain.c b/win/curses/cursmain.c index 0dc8d4c2f..fd1865c00 100644 --- a/win/curses/cursmain.c +++ b/win/curses/cursmain.c @@ -881,7 +881,7 @@ curses_nhgetch(void) } /* -int nh_poskey(int *x, int *y, int *mod) +int nh_poskey(coordxy *x, coordxy *y, int *mod) -- Returns a single character input from the user or a a positioning event (perhaps from a mouse). If the return value is non-zero, a character was typed, else, @@ -896,7 +896,7 @@ int nh_poskey(int *x, int *y, int *mod) routine always returns a non-zero character. */ int -curses_nh_poskey(int *x, int *y, int *mod) +curses_nh_poskey(coordxy *x, coordxy *y, int *mod) { int key = curses_nhgetch(); diff --git a/win/curses/cursmisc.c b/win/curses/cursmisc.c index 50ee57bfa..5e7d67255 100644 --- a/win/curses/cursmisc.c +++ b/win/curses/cursmisc.c @@ -974,7 +974,7 @@ event, or the first non-mouse key event in the case of mouse movement. */ int -curses_get_mouse(int *mousex, int *mousey, int *mod) +curses_get_mouse(coordxy *mousex, coordxy *mousey, int *mod) { int key = '\033'; diff --git a/win/curses/cursmisc.h b/win/curses/cursmisc.h index 48323565d..6f2c07149 100644 --- a/win/curses/cursmisc.h +++ b/win/curses/cursmisc.h @@ -30,7 +30,7 @@ int curses_convert_attr(int attr); int curses_read_attrs(const char *attrs); char *curses_fmt_attrs(char *); int curses_convert_keys(int key); -int curses_get_mouse(int *mousex, int *mousey, int *mod); +int curses_get_mouse(coordxy *mousex, coordxy *mousey, int *mod); void curses_mouse_support(int); #endif /* CURSMISC_H */ diff --git a/win/share/safeproc.c b/win/share/safeproc.c index 03131a1c4..e3f655ee7 100644 --- a/win/share/safeproc.c +++ b/win/share/safeproc.c @@ -331,7 +331,7 @@ safe_nhgetch(void) */ /*ARGSUSED*/ int -safe_nh_poskey(int *x, int *y, int *mod) +safe_nh_poskey(coordxy *x, coordxy *y, int *mod) { return '\033'; } diff --git a/win/shim/winshim.c b/win/shim/winshim.c index 191f7c5b9..49e74dc88 100644 --- a/win/shim/winshim.c +++ b/win/shim/winshim.c @@ -145,7 +145,7 @@ VDECLCB(shim_print_glyph,(winid w, coordxy x, coordxy y, const glyph_info *glyph 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") -DECLCB(int, shim_nh_poskey,(int *x, int *y, int *mod), "iooo", P2V x, P2V y, P2V mod) +DECLCB(int, shim_nh_poskey,(coordxy *x, coordxy *y, int *mod), "iooo", P2V x, P2V y, P2V mod) VDECLCB(shim_nhbell,(void), "v") DECLCB(int, shim_doprev_message,(void),"iv") DECLCB(char, shim_yn_function,(const char *query, const char *resp, char def), "cssi", P2V query, P2V resp, A2P def) diff --git a/win/tty/wintty.c b/win/tty/wintty.c index fc4fc08ad..83d4a6e32 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -4376,9 +4376,9 @@ tty_nhgetch(void) /*ARGSUSED*/ int #if defined(WIN32CON) -tty_nh_poskey(int *x, int *y, int *mod) +tty_nh_poskey(coordxy *x, coordxy *y, int *mod) #else -tty_nh_poskey(int *x UNUSED, int *y UNUSED, int *mod UNUSED) +tty_nh_poskey(coordxy *x UNUSED, coordxy *y UNUSED, int *mod UNUSED) #endif { int i; diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index 077ea64f4..8876dae45 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -1440,7 +1440,7 @@ mswin_nhgetch(void) } /* -int nh_poskey(int *x, int *y, int *mod) +int nh_poskey(coordxy *x, coordxy *y, int *mod) -- Returns a single character input from the user or a a positioning event (perhaps from a mouse). If the return value is non-zero, a character was typed, else, @@ -1455,7 +1455,7 @@ int nh_poskey(int *x, int *y, int *mod) routine always returns a non-zero character. */ int -mswin_nh_poskey(int *x, int *y, int *mod) +mswin_nh_poskey(coordxy *x, coordxy *y, int *mod) { PMSNHEvent event; int key; @@ -1468,8 +1468,8 @@ mswin_nh_poskey(int *x, int *y, int *mod) if (event->type == NHEVENT_MOUSE) { if (iflags.wc_mouse_support) { *mod = event->ei.ms.mod; - *x = event->ei.ms.x; - *y = event->ei.ms.y; + *x = (coordxy) event->ei.ms.x; + *y = (coordxy) event->ei.ms.y; } key = 0; } else { diff --git a/win/win32/winMS.h b/win/win32/winMS.h index 53a1fe70f..940f089d3 100644 --- a/win/win32/winMS.h +++ b/win/win32/winMS.h @@ -170,7 +170,7 @@ void mswin_raw_print(const char *str); void mswin_raw_print_bold(const char *str); void mswin_raw_print_flush(); int mswin_nhgetch(void); -int mswin_nh_poskey(int *x, int *y, int *mod); +int mswin_nh_poskey(coordxy *x, coordxy *y, int *mod); void mswin_nhbell(void); int mswin_doprev_message(void); char mswin_yn_function(const char *question, const char *choices, char def);