diff arogue7/misc.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/misc.c	Sun Feb 07 14:39:21 2016 -0500
+++ b/arogue7/misc.c	Fri Feb 19 21:02:28 2016 -0500
@@ -15,6 +15,7 @@
 #include "curses.h"
 #include <stdlib.h>
 #include <ctype.h>
+#include <string.h>
 #include "rogue.h"
 #ifdef PC7300
 #include "menu.h"
@@ -29,8 +30,8 @@
  *	Change the player's class to the specified one.
  */
 
-changeclass(newclass)
-int newclass;
+void
+changeclass(int newclass)
 {
     if (newclass == player.t_ctype) {
 	msg("You feel more skillful.");
@@ -132,8 +133,8 @@
 /*
  * Use the relic that our monster is wielding.
  */
-m_use_relic(monster)
-register struct thing *monster;
+void
+m_use_relic(struct thing *monster)
 {
     register struct object *obj;
 
@@ -161,7 +162,7 @@
 	}
 	when EMORI_CLOAK:
 	    debug("stunning with Emori's cloak");
-	    do_zap(monster, obj, &monster->t_newpos, WS_PARALYZE, NULL);
+	    do_zap(monster, obj, &monster->t_newpos, WS_PARALYZE, 0);
 	    obj->o_charges = 0;
 
 	when ASMO_ROD: {
@@ -228,10 +229,11 @@
  
 /*
  * add something to the contents of something else
+ * bag: the holder of the items
+ * item: the item to put inside
  */
-put_contents(bag, item)
-register struct object *bag;		/* the holder of the items */
-register struct linked_list *item;	/* the item to put inside  */
+void
+put_contents(struct object *bag, struct linked_list *item)
 {
     register struct linked_list *titem;
     register struct object *tobj;
@@ -256,10 +258,10 @@
 
 /*
  * remove something from something else
+ * bag: the holder of the items
  */
-take_contents(bag, item)
-register struct object *bag;		/* the holder of the items */
-register struct linked_list *item;
+void
+take_contents(struct object *bag, struct linked_list *item)
 {
 
     if (bag->o_ac <= 0) {
@@ -273,8 +275,8 @@
 }
 
 
-do_bag(item)
-register struct linked_list *item;
+void
+do_bag(struct linked_list *item)
 {
 
     register struct linked_list *titem = NULL;
@@ -395,8 +397,9 @@
     }
 }
 
-do_panic(who)
-int who;	/* Kind of monster to panic (all if who is NULL) */
+/* who: Kind of monster to panic (all if who is NULL) */
+void
+do_panic(int who)
 {
     register int x,y;
     register struct linked_list *mon, *item;
@@ -460,8 +463,7 @@
  * print miscellaneous magic bonuses
  */
 char *
-misc_name(obj)
-register struct object *obj;
+misc_name(struct object *obj)
 {
     static char buf[LINELEN];
     char buf1[LINELEN];
@@ -523,7 +525,8 @@
     return buf;
 }
 
-use_emori()
+void
+use_emori(void)
 {
     char selection;	/* Cloak function */
     int state = 0;	/* Menu state */
@@ -633,8 +636,8 @@
 /*
  * try to write a scroll with the quill of Nagrom
  */
-use_quill(obj)
-struct object *obj;
+void
+use_quill(struct object *obj)
 {
     struct linked_list	*item;
     register int	i,
@@ -766,7 +769,7 @@
 #endif
 	/* Should we overlay? */
 	if (menu_overlay && MAXQUILL + 3 < lines / 2) {
-	    over_win(cw, hw, MAXQUILL + 5, maxlen + 3, 0, curlen, NULL);
+	    over_win(cw, hw, MAXQUILL + 5, maxlen + 3, 0, curlen, '\0');
 	}
 	else draw(hw);
     }
@@ -795,7 +798,7 @@
 	    /* Should we overlay? */
 	    if (menu_overlay && MAXQUILL + 3 < lines / 2) {
 		over_win(cw, hw, MAXQUILL + 5, maxlen + 3,
-			    0, curlen, NULL);
+			    0, curlen, '\0');
 	    }
 	    else draw(hw);
 
@@ -835,8 +838,8 @@
     }
 }
 
-use_mm(which)
-int which;
+void
+use_mm(int which)
 {
     register struct object *obj = NULL;
     register struct linked_list *item = NULL;
@@ -915,7 +918,7 @@
 	    when GERYON_HORN:
 		/* Chase close monsters away */
 		msg("The horn blasts a shrill tone.");
-		do_panic(NULL);
+		do_panic(0);
 	    when HEIL_ANKH:
 	    case YENDOR_AMULET:
 	    case STONEBONES_AMULET:
@@ -938,7 +941,7 @@
 		msg("The jug is empty");
 		break;
 	    }
-	    quaff (obj->o_ac, NULL, NULL, FALSE);
+	    quaff (obj->o_ac, 0, 0, FALSE);
 	    obj->o_ac = JUG_EMPTY;
 	    fuse (alchemy, obj, ALCHEMYTIME, AFTER);
 	    if (!(obj->o_flags & ISKNOW))
@@ -1008,7 +1011,7 @@
 		break;
 	    }
 	    obj->o_charges--;
-	    do_panic(NULL);
+	    do_panic(0);
 	/*
 	 * dust of disappearance makes the player invisible for a while
 	 */
@@ -1124,8 +1127,7 @@
  */
 
 int
-usage_time(item)
-struct linked_list *item;
+usage_time(struct linked_list *item)
 {
     register struct object *obj;
     register int units = -1;