diff arogue7/things.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 b786053d2f37
children
line wrap: on
line diff
--- a/arogue7/things.c	Sun Feb 07 14:39:21 2016 -0500
+++ b/arogue7/things.c	Fri Feb 19 21:02:28 2016 -0500
@@ -23,12 +23,16 @@
 #include <string.h>
 #include "rogue.h"
 
+int pick_one(struct magic_item *magic, int nitems);
+char *blesscurse(int flags);
+char *p_kind(struct object *obj);
+int extras(void);
+
 /*
  * print out the number of charges on a stick
  */
 char *
-charge_str(obj)
-register struct object *obj;
+charge_str(struct object *obj)
 {
     static char buf[20];
 
@@ -46,9 +50,7 @@
  *	inventory.
  */
 char *
-inv_name(obj, drop)
-register struct object *obj;
-bool drop;
+inv_name(struct object *obj, bool drop)
 {
     register char *pb;
 
@@ -324,8 +326,7 @@
  *	Return the name of a weapon.
  */
 char *
-weap_name(obj)
-register struct object *obj;
+weap_name(struct object *obj)
 {
     switch (obj->o_type) {
 	case WEAPON:
@@ -357,8 +358,8 @@
  * drop:
  *	put something down
  */
-drop(item)
-struct linked_list *item;
+bool
+drop(struct linked_list *item)
 {
     register char ch;
     register struct linked_list *obj, *nobj;
@@ -464,8 +465,8 @@
 /*
  * do special checks for dropping or unweilding|unwearing|unringing
  */
-dropcheck(op)
-register struct object *op;
+bool
+dropcheck(struct object *op)
 {
     int save_max;
 
@@ -566,9 +567,7 @@
  * return a new thing
  */
 struct linked_list *
-new_thing(thing_type, allow_curse)
-int thing_type;
-bool allow_curse;
+new_thing(int thing_type, bool allow_curse)
 {
     register struct linked_list *item;
     register struct object *cur;
@@ -779,8 +778,7 @@
  * provide a new item tailored to specification
  */
 struct linked_list *
-spec_item(type, which, hit, damage)
-int type, which, hit, damage;
+spec_item(int type, int which, int hit, int damage)
 {
     register struct linked_list *item;
     register struct object *obj;
@@ -858,9 +856,8 @@
 /*
  * pick an item out of a list of nitems possible magic items
  */
-pick_one(magic, nitems)
-register struct magic_item *magic;
-int nitems;
+int
+pick_one(struct magic_item *magic, int nitems)
 {
     register struct magic_item *end;
     register int i;
@@ -889,8 +886,7 @@
  */
 
 char *
-blesscurse(flags)
-int flags;
+blesscurse(int flags)
 {
     if (flags & ISKNOW)  {
 	if (flags & ISCURSED) return("cursed ");
@@ -903,11 +899,11 @@
 /*
  * p_kind returns the type of potion for some types of identified potions;
  * otherwise, it returns the color.
+ * We assume that obj points to a potion
  */
 
 char *
-p_kind(obj)
-struct object *obj;	/* We assume that obj points to a potion */
+p_kind(struct object *obj)
 {
     if (obj->o_which == P_ABIL) return(abilities[obj->o_kind]);
     else return(p_colors[obj->o_which]);
@@ -917,7 +913,8 @@
  * extras:
  *	Return the number of extra items to be created
  */
-extras()
+int
+extras(void)
 {
 	reg int i;