Mercurial > hg > early-roguelike
diff arogue7/pack.c @ 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 | 1cd604c827a3 |
children | e1cd27c5464f |
line wrap: on
line diff
--- a/arogue7/pack.c Sun Feb 07 14:39:21 2016 -0500 +++ b/arogue7/pack.c Fri Feb 19 21:02:28 2016 -0500 @@ -20,6 +20,8 @@ #include "menu.h" #endif +bool is_type (struct object *obj, int type); + /* * Routines to deal with the pack */ @@ -30,9 +32,7 @@ * use it as the linked_list pointer instead of gettting it off the ground. */ bool -add_pack(item, silent, packret) -register struct linked_list *item, **packret; -bool silent; +add_pack(struct linked_list *item, bool silent, struct linked_list **packret) { register struct linked_list *ip, *lp = NULL, *ap; register struct object *obj, *op = NULL; @@ -372,9 +372,8 @@ * inventory: * list what is in the pack */ -inventory(list, type) -register struct linked_list *list; -register int type; +bool +inventory(struct linked_list *list, int type) { register struct object *obj; register char ch; @@ -511,7 +510,7 @@ * Allow player to inventory a single item */ void -picky_inven() +picky_inven(void) { register struct linked_list *item; register char ch, mch; @@ -565,13 +564,11 @@ /* * get_item: * pick something out of a pack for a purpose + * purpose: NULL if we should be silent (no prompts) */ struct linked_list * -get_item(list, purpose, type, askfirst, showcost) -reg struct linked_list *list; -char *purpose; /* NULL if we should be silent (no prompts) */ -int type; -bool askfirst, showcost; +get_item(struct linked_list *list, char *purpose, int type, bool askfirst, + bool showcost) { reg struct linked_list *item; reg struct object *obj; @@ -754,7 +751,7 @@ #endif /* Write the screen */ if ((menu_overlay && cnt < lines / 2 + 2) || cnt == 1) { - over_win(cw, hw, cnt + 2, maxx + 3, cnt, curx, NULL); + over_win(cw, hw, cnt + 2, maxx + 3, cnt, curx, '\0'); cnt = -1; /* Indicate we used over_win */ } else draw(hw); @@ -812,9 +809,8 @@ } } -pack_char(list, obj) -register struct object *obj; -struct linked_list *list; +char +pack_char(struct linked_list *list, struct object *obj) { register struct linked_list *item; register char c; @@ -836,8 +832,8 @@ * cur_null: * This updates cur_weapon etc for dropping things */ -cur_null(op) -reg struct object *op; +void +cur_null(struct object *op) { if (op == cur_weapon) cur_weapon = NULL; else if (op == cur_armor) cur_armor = NULL; @@ -861,7 +857,8 @@ * idenpack: * Identify all the items in the pack */ -idenpack() +void +idenpack(void) { reg struct linked_list *pc; @@ -869,9 +866,8 @@ whatis(pc); } -is_type (obj, type) -register struct object *obj; -register int type; +bool +is_type (struct object *obj, int type) { register bool current; @@ -1024,8 +1020,8 @@ return(FALSE); } -del_pack(item) -register struct linked_list *item; +void +del_pack(struct linked_list *item) { register struct object *obj; @@ -1047,9 +1043,8 @@ * it to him. */ -carry_obj(mp, chance) -register struct thing *mp; -int chance; +void +carry_obj(struct thing *mp, int chance) { reg struct linked_list *item; reg struct object *obj; @@ -1072,75 +1067,75 @@ */ if (on(*mp, ISUNIQUE)) { if (on(*mp, CARRYMDAGGER)) { - item = spec_item(RELIC, MUSTY_DAGGER, NULL, NULL); + item = spec_item(RELIC, MUSTY_DAGGER, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYCLOAK)) { - item = spec_item(RELIC, EMORI_CLOAK, NULL, NULL); + item = spec_item(RELIC, EMORI_CLOAK, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYANKH)) { - item = spec_item(RELIC, HEIL_ANKH, NULL, NULL); + item = spec_item(RELIC, HEIL_ANKH, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYSTAFF)) { - item = spec_item(RELIC, MING_STAFF, NULL, NULL); + item = spec_item(RELIC, MING_STAFF, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYWAND)) { - item = spec_item(RELIC, ORCUS_WAND, NULL, NULL); + item = spec_item(RELIC, ORCUS_WAND, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYROD)) { - item = spec_item(RELIC, ASMO_ROD, NULL, NULL); + item = spec_item(RELIC, ASMO_ROD, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYYAMULET)) { - item = spec_item(RELIC, YENDOR_AMULET, NULL, NULL); + item = spec_item(RELIC, YENDOR_AMULET, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYBAMULET)) { - item = spec_item(RELIC, STONEBONES_AMULET, NULL, NULL); + item = spec_item(RELIC, STONEBONES_AMULET, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYMANDOLIN)) { - item = spec_item(RELIC, BRIAN_MANDOLIN, NULL, NULL); + item = spec_item(RELIC, BRIAN_MANDOLIN, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYEYE)) { - item = spec_item(RELIC, EYE_VECNA, NULL, NULL); + item = spec_item(RELIC, EYE_VECNA, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYAXE)) { - item = spec_item(RELIC, AXE_AKLAD, NULL, NULL); + item = spec_item(RELIC, AXE_AKLAD, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); @@ -1148,7 +1143,7 @@ if (on(*mp, CARRYQUILL)) { register int i, howmany; - item = spec_item(RELIC, QUILL_NAGROM, NULL, NULL); + item = spec_item(RELIC, QUILL_NAGROM, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; obj->o_charges = rnd(QUILLCHARGES); @@ -1165,25 +1160,25 @@ } } if (on(*mp, CARRYMSTAR)) { - item = spec_item(RELIC, HRUGGEK_MSTAR, NULL, NULL); + item = spec_item(RELIC, HRUGGEK_MSTAR, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYFLAIL)) { - item = spec_item(RELIC, YEENOGHU_FLAIL, NULL, NULL); + item = spec_item(RELIC, YEENOGHU_FLAIL, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYHORN)) { - item = spec_item(RELIC, GERYON_HORN, NULL, NULL); + item = spec_item(RELIC, GERYON_HORN, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); } if (on(*mp, CARRYSURTURRING)) { - item = spec_item(RELIC, SURTUR_RING, NULL, NULL); + item = spec_item(RELIC, SURTUR_RING, 0, 0); obj = OBJPTR(item); obj->o_pos = mp->t_pos; attach(mp->t_pack, item); @@ -1193,7 +1188,7 @@ * If it carries gold, give it some */ if (on(*mp, CARRYGOLD) && rnd(100) < chance) { - item = spec_item(GOLD, NULL, NULL, NULL); + item = spec_item(GOLD, 0, 0, 0); obj = OBJPTR(item); obj->o_count = GOLDCALC + GOLDCALC; obj->o_pos = mp->t_pos; @@ -1204,7 +1199,7 @@ * If it carries food, give it some */ if (on(*mp, CARRYFOOD) && rnd(100) < chance) { - item = spec_item(FOOD, NULL, NULL, NULL); + item = spec_item(FOOD, 0, 0, 0); obj = OBJPTR(item); obj->o_weight = things[TYP_FOOD].mi_wght; obj->o_pos = mp->t_pos; @@ -1328,8 +1323,8 @@ * he wants (* means everything). */ -grab(y, x) -register y, x; +int +grab(int y, int x) { register struct linked_list *next_item, *item; register struct object *obj; @@ -1398,7 +1393,7 @@ * to he right. */ if (menu_overlay && num_there < lines / 2 + 2) { - over_win(cw, hw, num_there + 2, maxlen + 3, num_there, curlen, NULL); + over_win(cw, hw, num_there + 2, maxlen + 3, num_there, curlen, '\0'); pagecnt = -1; /* Indicate we used over_win */ } else draw(hw); /* write screen */ @@ -1446,7 +1441,7 @@ */ if (menu_overlay && num_there < lines / 2 + 2) { over_win(cw, hw, num_there + 2, maxlen + 3, - num_there, 49, NULL); + num_there, 49, '\0'); cnt = -1; /* Indicate we used over_win */ } else draw(hw); /* write screen */ @@ -1485,8 +1480,8 @@ * Create a pack for sellers (a la quartermaster) */ -make_sell_pack(tp) -struct thing *tp; +void +make_sell_pack(struct thing *tp) { reg struct linked_list *item; reg struct object *obj;