diff arogue7/player.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 adfa37e67084
children e52a8a7ad4c5
line wrap: on
line diff
--- a/arogue7/player.c	Sun Feb 07 14:39:21 2016 -0500
+++ b/arogue7/player.c	Fri Feb 19 21:02:28 2016 -0500
@@ -18,19 +18,23 @@
  */
 
 #include <ctype.h>
+#include <string.h>
 #include "curses.h"
 #include "rogue.h"
 #ifdef PC7300
 #include "menu.h"
 #endif
 
+bool pick_spell(struct spells spells[], int ability, int num_spells, int power,
+           char *prompt, char *type);
 
 /*
  * affect:
  *	cleric affecting undead
  */
 
-affect()
+void
+affect(void)
 {
     register struct linked_list *item;
     register struct thing *tp;
@@ -147,7 +151,8 @@
 /*
  * the magic user is going to try and cast a spell
  */
-cast()
+void
+cast(void)
 {
     int		spell_ability,
 		which_spell,
@@ -202,7 +207,7 @@
 
     if (magic_spells[which_spell].s_type == TYP_POTION)
         quaff(	magic_spells[which_spell].s_which,
-		NULL,
+		0,
         	magic_spells[which_spell].s_flag,
 		FALSE);
     else if (magic_spells[which_spell].s_type == TYP_SCROLL)
@@ -222,7 +227,8 @@
 /* 
  * the druid asks his deity for a spell
  */
-chant()
+void
+chant(void)
 {
     register int	num_chants, 
 			chant_ability, 
@@ -290,7 +296,7 @@
 
     if (druid_spells[which_chant].s_type == TYP_POTION)
 	quaff(		druid_spells[which_chant].s_which,
-			NULL,
+			0,
 			druid_spells[which_chant].s_flag,
 			FALSE);
     else if (druid_spells[which_chant].s_type == TYP_SCROLL)
@@ -309,7 +315,8 @@
 
 /* Constitution bonus */
 
-const_bonus()	/* Hit point adjustment for changing levels */
+int
+const_bonus(void)	/* Hit point adjustment for changing levels */
 {
     register int bonus;
     if (pstats.s_const > 6 && pstats.s_const <= 14) 
@@ -343,7 +350,8 @@
  *	Sense gold
  */
 
-gsense()
+void
+gsense(void)
 {
     /* Only thieves can do this */
     if (player.t_ctype != C_THIEF && player.t_ctype != C_ASSASIN) {
@@ -351,13 +359,14 @@
 	return;
     }
 
-    read_scroll(S_GFIND, NULL, FALSE);
+    read_scroll(S_GFIND, 0, FALSE);
 }
 
 /* 
  * the cleric asks his deity for a spell
  */
-pray()
+void
+pray(void)
 {
     register int	num_prayers, 
 			prayer_ability, 
@@ -430,7 +439,7 @@
 
     if (cleric_spells[which_prayer].s_type == TYP_POTION)
 	quaff(		cleric_spells[which_prayer].s_which,
-			NULL,
+			0,
 			cleric_spells[which_prayer].s_flag,
 			FALSE);
     else if (cleric_spells[which_prayer].s_type == TYP_SCROLL)
@@ -454,7 +463,8 @@
  *	Steal in direction given in delta
  */
 
-steal()
+void
+steal(void)
 {
     register struct linked_list *item;
     register struct thing *tp;
@@ -586,14 +596,16 @@
 /*
  * this routine lets the player pick the spell that they
  * want to cast regardless of character class
+ * spells: spell list
+ * ability: spell ability
+ * num_spells: number of spells that can be cast
+ * power: spell power
+ * prompt: prompt for spell list
+ * type: type of thing--> spell, prayer, chant
  */
-pick_spell(spells, ability, num_spells, power, prompt, type)
-struct spells	spells[];	/* spell list				 */
-int		ability;	/* spell ability			 */
-int		num_spells;	/* number of spells that can be cast	 */
-int		power;		/* spell power				 */
-char		*prompt;	/* prompt for spell list		 */
-char		*type;		/* type of thing--> spell, prayer, chant */
+bool
+pick_spell(struct spells spells[], int ability, int num_spells, int power,
+           char *prompt, char *type)
 {
     bool		nohw = FALSE;
     register int	i;
@@ -754,7 +766,7 @@
 #endif
 	/* Should we overlay? */
 	if (menu_overlay && num_spells + 3 < lines / 2) {
-	    over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, NULL);
+	    over_win(cw, hw, num_spells + 5, maxlen + 3, 0, curlen, '\0');
 	}
 	else draw(hw);
     }
@@ -780,7 +792,7 @@
 	    /* Should we overlay? */
 	    if (menu_overlay && num_spells + 3 < lines / 2) {
 		over_win(cw, hw, num_spells + 5, maxlen + 3,
-			    0, curlen, NULL);
+			    0, curlen, '\0');
 	    }
 	    else draw(hw);