diff arogue7/rogue.h @ 219:f9ef86cf22b2

Advanced Rogue 7: convert to ANSI-style function declarations. Almost 1500 lines of compiler warnings remain, and the GCC developers are already working on a new version with even more warnings turned on by default.
author John "Elwin" Edwards
date Fri, 19 Feb 2016 21:02:28 -0500
parents aa8e1fc62926
children b67b99f6c92b
line wrap: on
line diff
--- a/arogue7/rogue.h	Sun Feb 07 14:39:21 2016 -0500
+++ b/arogue7/rogue.h	Fri Feb 19 21:02:28 2016 -0500
@@ -1121,45 +1121,317 @@
 	int d_time;
 } ;
 
-struct linked_list	*find_mons(), *find_obj(), *get_item(), *new_item(),
-			*new_thing(), *wake_monster(), *get_hurl(), 
-			*spec_item(), *creat_item(), *wield_weap();
-struct room		*roomin();
-struct trap		*trap_at();
+void    _attach(struct linked_list **list, struct linked_list *item);
+void    _detach(struct linked_list **list, struct linked_list *item);
+void    _o_free_list(struct linked_list **ptr);
+void    _r_free_list(struct linked_list **ptr);
+void    _t_free_list(struct linked_list **ptr);
+int     ac_compute(bool ignoremetal);
+void    activity(void);
+void    add_charisma(int change);
+void    add_constitution(int change);
+void    add_dexterity(int change);
+void    add_haste(bool blessed);
+void    add_intelligence(int change);
+bool    add_pack(struct linked_list *item, bool silent, 
+                 struct linked_list **packret);
+void    add_slow(void);
+void    add_strength(int change);
+void    add_wisdom(int change);
+void    addmsg(char *fmt, ...);
+void    affect(void);
+void    aggravate(bool do_uniques, bool do_good);
+void    alchemy(struct object *obj);
+void    appear(void);
+bool    attack(struct thing *mp, struct object *weapon, bool thrown);
+void    auto_save(int sig);
+char    be_trapped(struct thing *th, coord *tc);
+bool    blue_light(bool blessed, bool cursed);
+void    bugkill(int sig);
+void    buy_it(void);
+void    byebye(int sig);
+bool    can_blink(struct thing *tp);
+coord  *can_shoot(coord *er, coord *ee);
+bool    cansee(int y, int x);
+void    carry_obj(struct thing *mp, int chance);
+void    cast(void);
+void    changeclass(int newclass);
+void    chant(void);
+void    chant_recovery(void);
+void    chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree, 
+              bool flee);
+long    check_level(void);
+void    check_residue(struct thing *tp);
+void    chg_str(int amt);
+void    cloak_charge(struct object *obj);
+void    command(void);
+void    confus_player(void);
+int     const_bonus(void);
+void    corr_move(int dy, int dx);
+struct linked_list *creat_item(void);
+bool    creat_mons(struct thing *person, short monster, bool report);
+void    create_obj(bool prompt, int which_item, int which_type);
+void    cur_null(struct object *op);
+void    cure_disease(void);
+void    dbotline(WINDOW *scr, char *message);
+void    death(short monst);
+void    del_pack(struct linked_list *item);
+void    destroy_item(struct linked_list *item);
+int     dex_compute(void);
+int     dext_plus(int dexterity);
+int     dext_prot(int dexterity);
+bool    diag_ok(coord *sp, coord *ep, struct thing *flgptr);
+void    dip_it(void);
+void    do_chase(struct thing *th);
+void    do_daemons(int flag);
+void    do_fuses(int flag);
+void    do_maze(void);
+void    do_motion(struct object *obj, int ydelta, int xdelta, struct thing *tp);
+void    do_move(int dy, int dx);
+void    do_passages(void);
+void    do_post(bool startup);
+void    do_rooms(void);
+void    do_run(char ch);
+void    do_terrain(int basey, int basex, int deltay, int deltax, bool fresh);
+void    do_zap(struct thing *zapper, struct object *obj, coord *direction,
+               int which, int flags);
+void    doctor(struct thing *tp);
+coord  *doorway(struct room *rp, coord *door);
+void    draw_room(struct room *rp);
+int     dress_units(struct linked_list *item);
+bool    drop(struct linked_list *item);
+bool    dropcheck(struct object *op);
+void    dsrpt_monster(struct thing *tp, bool always, bool see_him);
+void    dsrpt_player(void);
+void    dust_appear(void);
+void    eat(void);
+void    eat_gold(struct object *obj);
+int     effect(struct thing *att, struct thing *def, struct object *weap, 
+               bool thrown, bool see_att, bool see_def);
+int     encread(char *start, unsigned int size, int inf);
+int     encwrite(char *start, unsigned int size, int outf);
+void    endmsg(void);
+void    explode(struct thing *tp);
+void    extinguish(int (*func)());
+void    fall(struct linked_list *item, bool pr);
+coord  *fallpos(coord *pos, bool be_clear, int range);
+void    fatal(char *s);
+bool    fight(coord *mp, struct object *weap, bool thrown);
+struct linked_list *find_mons(int y, int x);
+struct linked_list *find_obj(int y, int x);
+struct delayed_action *find_slot(int (*func)());
+int     findmindex(char *name);
+void    fix_stick(struct object *cur);
+void    fumble(void);
+void    fuse(int (*func)(), int arg, int time, int type);
+void    genmonsters(int least, bool treas);
+coord   get_coordinates(void);
+bool    get_dir(coord *direction);
+struct linked_list *get_hurl(struct thing *tp);
+struct linked_list *get_item(struct linked_list *list, char *purpose, int type,
+                             bool askfirst, bool showcost);
+int     get_str(char *opt, WINDOW *win);
+int     get_worth(struct object *obj);
+int     getdeath(void);
+bool    getdelta(char match, int *dy, int *dx);
+int     grab(int y, int x);
+void    gsense(void);
+bool    hit_monster(int y, int x, struct object *obj, struct thing *tp);
+int     hitweight(void);
+short   id_monst(char monster);
+void    idenpack(void);
+void    init_colors(void);
+void    init_foods(void);
+void    init_materials(void);
+void    init_misc(void);
+void    init_names(void);
+void    init_player(void);
+void    init_stones(void);
+void    init_terrain(void);
+void    init_things(void);
+void    init_weapon(struct object *weap, char type);
+char   *inv_name(struct object *obj, bool drop);
+bool    inventory(struct linked_list *list, int type);
+bool    is_current(struct object *obj);
+bool    is_magic(struct object *obj);
+bool    isatrap(char ch);
+int     itemweight(struct object *wh);
+void    kill_daemon(int (*func)());
+void    killed(struct linked_list *item, bool pr, bool points, bool treasure);
+void    lake_check(coord *place);
+void    land(void);
+void    lengthen(int (*func)(), int xtime);
+void    light(coord *cp);
+bool    lit_room(struct room *rp);
+void    look(bool wakeup, bool runend);
+void    lower_level(short who);
+void    m_use_relic(struct thing *monster);
+void    m_use_wand(struct thing *monster);
+void    make_sell_pack(struct thing *tp);
+short   makemonster(bool showall, char *label, char *action) ;
+bool    maze_view(int y, int x);
+char   *misc_name(struct object *obj);
+void    missile(int ydelta, int xdelta, struct linked_list *item, 
+                struct thing *tp);
+char   *monster_name(struct thing *tp);
+bool    move_hero(int why);
+short   movement(struct thing *tp);
+void    msg(char *fmt, ...);
+void    nameitem(struct linked_list *item, bool mark);
+bool    need_dir(int type, int which);
+unsigned long netread(int *error, int size, FILE *stream);
+int     netwrite(unsigned long value, int size, FILE *stream);
+char   *new(int size);
+struct linked_list *new_item(int size);
+void    new_level(LEVTYPE ltype);
+void    new_monster(struct linked_list *item, short type, coord *cp, 
+                    bool max_monster);
+struct linked_list *new_thing(int thing_type, bool allow_curse);
+void    nobolt(void);
+void    nocold(void);
+void    nofire(void);
+void    nohaste(void);
+void    noslow(void);
+char   *num(int n1, int n2);
+void    o_discard(struct linked_list *item);
+void    option(void);
+void    over_win(WINDOW *oldwin, WINDOW *newin, int maxy, int maxx, int cursory,
+                 int cursorx, char redraw);
+char    pack_char(struct linked_list *list, struct object *obj);
+void    parse_opts(char *str);
+bool    passwd(void);
+void    picky_inven(void);
+bool    player_zap(int which, int flag);
+void    playit(void);
+void    pray(void);
+void    prayer_recovery(void);
+bool    price_it(void);
+char   *prname(char *who, bool upper);
+void    quaff(int which, int kind, int flags, bool is_potion);
+void    quill_charge(void);
+void    quit(int sig);
+void    raise_level(void);
+short   randmonster(bool wander, bool no_unique);
+void    read_scroll(int which, int flag, bool is_scroll);
+int     readchar(void);
+void    res_charisma(int howmuch);
+void    res_constitution(int howmuch);
+void    res_dexterity(int howmuch);
+void    res_intelligence(int howmuch);
+void    res_strength(int howmuch);
+void    res_wisdom(int howmuch);
+bool    restore(char *file, char *envp[]);
+void    restscr(WINDOW *scr);
+int     ring_eat(int hand);
+char   *ring_num(struct object *obj);
+int     ring_value(int type);
+void    ring_on(struct linked_list *item);
+void    ring_search(void);
+void    ring_teleport(void);
+int     rnd(int range);
+void    rnd_pos(struct room *rp, coord *cp);
+int     rnd_room(void);
+coord  *rndmove(struct thing *who);
+int     roll(int number, int sides);
+void    rollwand(void);
+struct room *roomin(coord *cp);
+int     rs_restore_file(int inf);
+int     rs_save_file(FILE *savef);
+int     runners(int segments);
+void    runto(struct thing *runner, coord *spot);
+bool    save(int which, struct thing *who, int adj);
+bool    save_game(void);
+void    score(unsigned long amount, int flags, short monst);
+void    search(bool is_thief, bool door_chime);
+char    secretdoor(int y, int x);
+void    sell(struct thing *tp);
+void    sell_it(void);
+void    set_trap(struct thing *tp, int y, int x);
+void    setup(void);
+void    shoot_bolt(struct thing *shooter, coord start, coord dir, 
+                   bool get_points, short reason, char *name, int damage);
+bool    shoot_ok(char ch);
+char    show(int y, int x);
+void    sight(void);
+bool    skirmish(struct thing *attacker, coord *mp, struct object *weap, 
+                 bool thrown);
+struct linked_list *spec_item(int type, int which, int hit, int damage);
+void    spell_recovery(void);
+void    start_daemon(int (*func)(), int arg, int type);
+void    status(bool display);
+void    steal(void);
+bool    step_ok(int y, int x, int can_on_monst, struct thing *flgptr);
+void    stomach(void);
+int     str_compute(void);
+int     str_plus(short str);
+void    strangle(void);
+void    strucpy(char *s1, char *s2, int len);
+void    suffocate(void);
+void    swander(void);
+bool    swing(short class, int at_lvl, int op_arm, int wplus);
+void    take_off(void);
+int     teleport(void);
+void    total_winner(void);
+int     totalenc(struct thing *tp);
+char   *tr_name(char ch);
+struct trap *trap_at(int y, int x);
+void    trap_look(void);
+void    updpack(int getmax, struct thing *tp);
+void    unclrhead(void);
+void    unchoke(void);
+void    unconfuse(void);
+void    undance(void);
+void    unphase(void);
+void    unsee(void);
+void    unskill(void);
+void    unstink(void);
+int     usage_time(struct linked_list *item);
+void    use_mm(int which);
+char   *vowelstr(char *str);
+void    wait_for(char ch);
+struct linked_list *wake_monster(int y, int x);
+void    wake_room(struct room *rp);
+void    wanderer(void);
+void    waste_time(void);
+int     weap_move(struct thing *wielder, struct object *weap);
+char   *weap_name(struct object *obj);
+void    wear(void);
+void    wghtchk(void);
+void    whatis(struct linked_list *what);
+void    wield(void);
+struct linked_list *wield_weap(struct object *thrown, struct thing *mp);
+void    writelog(unsigned long amount, int flags, short monst);
 
-/* char	*malloc(), *getenv(), *tr_name(), *new(), *sprintf(), */
-char	*getenv(), *tr_name(), *new(),
-	*vowelstr(), *inv_name(), *strcpy(), *strcat();
-char	*num(), *ring_num(), *misc_num(), *blesscurse(), *p_kind(),
-	*typ_name(), *prname(), *monster_name(), *weap_name(), *misc_name();
-coord	*rndmove(), *can_shoot(), *fallpos(), *doorway(), get_coordinates();
-short	randmonster(), id_monst(), movement();
-void    quit(int), auto_save(int), bugkill(int), endit(int), tstp(int), 
-        byebye(int);
-int	nohaste(), spell_recovery(),
-	doctor(), runners(), swander(), unconfuse(), unsee(), fumble(),
-	unclrhead(), unphase(), noslow(), rollwand(), stomach(), sight(),
-	unstink(), suffocate(), cure_disease(), shoot_bolt(), changeclass(),
-	appear(), dust_appear(), unchoke(), alchemy(), trap_look(), strangle(),
-	ring_teleport(), ring_search(), grab(), dsrpt_player(), quill_charge(),
-	make_sell_pack(), unskill(), findmindex(), nobolt(), nofire(), nocold(),
-	usage_time(), eat_gold(), chant_recovery(), prayer_recovery(), 
-	dsrpt_monster();
-bool	blue_light(), can_blink(), creat_mons(), add_pack(),
-	straight_shot(), maze_view(), lit_room(), getdelta(), save_file(),
-	save_game(), m_use_it(), m_use_pack(), get_dir(), need_dir();
-long	lseek(), check_level();
-void	genmonsters(), 
-	add_intelligence(), add_strength(), add_wisdom(), add_dexterity(),
-	add_constitution(), add_charisma(), res_intelligence(), res_strength(int),
-	res_wisdom(), res_dexterity(), res_constitution(), res_charisma();
-
-void writelog(unsigned long amount, int flags, short monst);
+char   *md_crypt(char *key, char *salt);
+int     md_erasechar(void);
+FILE   *md_fdopen(int fd, char *mode);
+int     md_fileno(FILE *fp);
+void    md_flushinp(void);
+char   *md_gethomedir(void);
+char   *md_gethostname(void);
+char   *md_getpass(char *prompt);
+char   *md_getroguedir(void);
+int     md_getuid(void);
+char   *md_getusername(void);
+void    md_init(void);
+int     md_killchar(void);
+long    md_memused(void);
+int     md_normaluser(void);
+int     md_rand(void);
+void    md_reopen_score(void);
+int     md_readchar(WINDOW *win);
+int     md_shellescape(void);
+int     md_srand(int seed);
+int     md_unlink(char *file);
+int     md_unlink_open_file(char *file, int inf);
 
 #ifdef CHECKTIME
 int checkout();
 #endif
 
+#ifdef PC7300
+void endhardwin(void);
+#endif
 
 /*
  * Now all the global variables
@@ -1297,11 +1569,7 @@
 extern void (*res_abil[NUMABILITIES])(); /* Functions to change abilities */
 extern int  cNCOLORS, cNWOOD, cNMETAL, cNSTONES;
 extern char *rainbow[], *stones[], *wood[], *metal[];
-extern int  land(), wghtchk(), undance(), cloak_charge(struct object *);
 extern struct delayed_action d_list[MAXDAEMONS];
 extern struct delayed_action f_list[MAXFUSES];
 extern int demoncnt, fusecnt, between, chance;
 #define CCHAR(x) ( (char) (x & A_CHARTEXT) )
-extern char *md_gethostname(), *md_getusername(), *md_gethomedir(), *md_getroguedir(), *md_crypt();
-extern FILE * md_fdopen(int fd, char *mode);
-extern int md_fileno(FILE *fp);