diff xrogue/pack.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents cadff8f047a1
children 7c1cb43f346e
line wrap: on
line diff
--- a/xrogue/pack.c	Fri Feb 19 21:02:28 2016 -0500
+++ b/xrogue/pack.c	Wed Mar 02 21:13:26 2016 -0500
@@ -21,6 +21,8 @@
 #include <string.h>
 #include "rogue.h"
 
+bool is_type(struct object *obj, int type);
+
 /*
  * add_pack:
  *      Pick up an object and add it to the pack.  If the argument is non-null
@@ -28,9 +30,7 @@
  */
 
 bool
-add_pack(item, silent)
-register struct linked_list *item;
-bool silent;
+add_pack(struct linked_list *item, bool silent)
 {
     register struct linked_list *ip, *lp = NULL, *ap;
     register struct object *obj, *op = NULL;
@@ -462,9 +462,8 @@
  *      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;
@@ -563,7 +562,7 @@
  */
 
 void
-picky_inven()
+picky_inven(void)
 {
     register struct linked_list *item;
     register char ch, mch;
@@ -616,14 +615,12 @@
 /*
  * 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;
@@ -755,7 +752,7 @@
 
             /* Write the screen */
             if ((menu_overlay && cnt < lines - 3) || 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);
@@ -814,9 +811,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;
@@ -838,8 +834,8 @@
  *      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;
@@ -864,7 +860,8 @@
  *      Identify all the items in the pack
  */
 
-idenpack()
+void
+idenpack(void)
 {
         reg struct linked_list *pc;
 
@@ -872,9 +869,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;
 
@@ -1029,8 +1025,8 @@
     return(FALSE);
 }
 
-del_pack(item)
-register struct linked_list *item;
+void
+del_pack(struct linked_list *item)
 {
     register struct object *obj;
 
@@ -1052,9 +1048,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;
@@ -1077,75 +1072,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);
@@ -1153,7 +1148,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);
@@ -1170,31 +1165,31 @@
             }
         }
         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);
         }
         if (on(*mp, CARRYCARD)) {
-            item = spec_item(RELIC, ALTERAN_CARD, NULL, NULL);
+            item = spec_item(RELIC, ALTERAN_CARD, 0, 0);
             obj = OBJPTR(item);
             obj->o_pos = mp->t_pos;
             attach(mp->t_pack, item);
@@ -1204,7 +1199,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;
@@ -1232,7 +1227,7 @@
             when 40: type = E_SLIMEMOLD;  /* monster food */
             otherwise: type = E_RATION;
         }
-        item = spec_item(FOOD, type, NULL, NULL);
+        item = spec_item(FOOD, type, 0, 0);
         obj = OBJPTR(item);
         obj->o_weight = things[TYP_FOOD].mi_wght;
         obj->o_pos = mp->t_pos;
@@ -1356,8 +1351,8 @@
  *      he wants (* means everything).
  */
 
-grab(y, x)
-register int y, x;
+int
+grab(int y, int x)
 {
     register struct linked_list *next_item, *item;
     register struct object *obj;
@@ -1425,7 +1420,7 @@
          * Leave 3 blank lines at the bottom and 3 blank columns to he right.
          */
         if (menu_overlay && num_there < lines - 3) {
-          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 */
@@ -1474,7 +1469,7 @@
                  */
                 if (menu_overlay && num_there < lines - 3) {
                     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 */
@@ -1513,8 +1508,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;