diff xrogue/player.c @ 220:f54901b9c39b

XRogue: convert to ANSI-style function declarations.
author John "Elwin" Edwards
date Wed, 02 Mar 2016 21:13:26 -0500
parents ce0cf824c192
children 2236ef808bcb
line wrap: on
line diff
--- a/xrogue/player.c	Fri Feb 19 21:02:28 2016 -0500
+++ b/xrogue/player.c	Wed Mar 02 21:13:26 2016 -0500
@@ -17,12 +17,15 @@
 #include <curses.h>
 #include "rogue.h"
 
+bool pick_spell(struct spells spells[], int ability, int num_spells, int power,
+                const char *prompt, const char *type);
 /*
  * affect:
  *      cleric affecting undead
  */
 
-affect()
+void
+affect(void)
 {
     register struct linked_list *item;
     register struct thing *tp;
@@ -140,7 +143,8 @@
  * the cleric asks his deity for a spell
  */
 
-pray()
+void
+pray(void)
 {
     register int num_prayers, prayer_ability, which_prayer;
 
@@ -210,7 +214,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)
@@ -231,7 +235,8 @@
  * the magician is going to try and cast a spell
  */
 
-cast()
+void
+cast(void)
 {
     register int spell_ability, which_spell, num_spells;
 
@@ -291,7 +296,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)
@@ -312,7 +317,8 @@
  * the druid asks his deity for a spell
  */
 
-chant()
+void
+chant(void)
 {
     register int num_chants, chant_ability, which_chant;
 
@@ -377,7 +383,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)
@@ -396,7 +402,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 > 9 && pstats.s_const < 18) 
@@ -436,8 +443,8 @@
  * way to get this artifact and remain alive.
  */
 
-give(th)
-register struct thing *th;
+void
+give(struct thing *th)
 {
     /*
      * Find any monster within one space of you
@@ -571,8 +578,8 @@
  * Frighten a monster.  Useful for the 'good' characters.
  */
 
-fright(th)
-register struct thing *th;
+void
+fright(struct thing *th)
 {
     /*
      * Find any monster within one space of you
@@ -682,13 +689,14 @@
  * gsense: Sense gold
  */
 
-gsense()
+void
+gsense(void)
 {
     /* Thief & assassin can do this, but fighter & ranger can later */
     if (player.t_ctype == C_THIEF     || player.t_ctype == C_ASSASSIN ||
         ((player.t_ctype == C_FIGHTER || player.t_ctype == C_RANGER)  &&
     pstats.s_lvl >= 12)) {
-          read_scroll(S_GFIND, NULL, FALSE);
+          read_scroll(S_GFIND, 0, FALSE);
     }
     else msg("You seem to have no gold sense.");
     return;
@@ -698,13 +706,14 @@
  * xsense: Sense traps
  */
 
-xsense()
+void
+xsense(void)
 {
     /* Only thief can do this, but assassin, fighter, & monk can later */
     if (player.t_ctype == C_THIEF   || ((player.t_ctype == C_ASSASSIN ||
     player.t_ctype == C_FIGHTER || player.t_ctype == C_MONK)      &&
     pstats.s_lvl >= 14)) {
-        read_scroll(S_FINDTRAPS, NULL, FALSE);
+        read_scroll(S_FINDTRAPS, 0, FALSE);
     }
     else msg("You seem not to be able to sense traps.");
     return;
@@ -715,7 +724,8 @@
  *      Steal in direction given in delta
  */
 
-steal()
+void
+steal(void)
 {
     register struct linked_list *item;
     register struct thing *tp;
@@ -857,7 +867,8 @@
  * Take charmed monsters with you via up or down commands.
  */
 
-take_with()
+void
+take_with(void)
 {
     register struct thing *tp;
     register struct linked_list *item;
@@ -884,15 +895,17 @@
 /*
  * 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                           */
-const char      *prompt;        /* prompt for spell list                 */
-const char      *type;          /* type of thing--> spell, prayer, chant */
+bool
+pick_spell(struct spells spells[], int ability, int num_spells, int power,
+           const char *prompt, const char *type)
 {
     bool                nohw = FALSE;
     register int        i;
@@ -1001,7 +1014,7 @@
 
         /* Should we overlay? */
         if (menu_overlay && num_spells + 3 < lines - 3) {
-            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);
     }
@@ -1029,7 +1042,7 @@
             /* Should we overlay? */
             if (menu_overlay && num_spells + 3 < lines - 3) {
                 over_win(cw, hw, num_spells + 5, maxlen + 3,
-                            0, curlen, NULL);
+                            0, curlen, '\0');
             }
             else draw(hw);
 
@@ -1068,7 +1081,8 @@
  * Let the player know what's happening with himself
  */
 
-opt_player()
+void
+opt_player(void)
 {
     int i = 1;  /* initialize counters */
     int j = 2;
@@ -1446,7 +1460,7 @@
             if (menu_overlay) {     /* Print the list. */
                 wmove(hw, i+2, 0);
                 wprintw(hw, spacemsg);
-                over_win(cw, hw, i+3, j, i+2, 27, NULL);
+                over_win(cw, hw, i+3, j, i+2, 27, '\0');
         }
             else {
                 wmove(hw, i+2, 0);
@@ -1461,7 +1475,7 @@
                 wprintw(hw, spacemsg);
         if (j > 2) j = 78;
         else j = 39;
-                over_win(cw, hw, i+3, j, i+2, 27, NULL);
+                over_win(cw, hw, i+3, j, i+2, 27, '\0');
         }
             else {
                 wmove(hw, i+2, 0);