diff arogue5/util.c @ 218:56e748983fa8

Advanced Rogue 5: convert to ANSI function declarations. This still leaves over a thousand lines of warning messages, mostly related to the return types of daemons and fuses.
author John "Elwin" Edwards
date Sun, 07 Feb 2016 14:39:21 -0500
parents c49f7927b0fa
children d71e5e1f49cf
line wrap: on
line diff
--- a/arogue5/util.c	Sun Jan 31 13:45:07 2016 -0500
+++ b/arogue5/util.c	Sun Feb 07 14:39:21 2016 -0500
@@ -22,7 +22,8 @@
  *	aggravate all the monsters on this level
  */
 
-aggravate()
+void
+aggravate(void)
 {
     register struct linked_list *mi;
 
@@ -35,8 +36,8 @@
  *	returns true if the hero can see a certain coordinate.
  */
 
-cansee(y, x)
-register int y, x;
+bool
+cansee(int y, int x)
 {
     register struct room *rer;
     register int radius;
@@ -93,8 +94,7 @@
 };
 
 long
-check_level(get_spells)
-bool get_spells;
+check_level(bool get_spells)
 {
     register int i, j, add = 0;
     register unsigned long exp;
@@ -148,8 +148,8 @@
  * it keeps track of the highest it has been, just in case
  */
 
-chg_str(amt)
-register int amt;
+void
+chg_str(int amt)
 {
     register int ring_str;		/* ring strengths */
     register struct stats *ptr;		/* for speed */
@@ -172,7 +172,7 @@
  * this routine computes the players current AC without dex bonus's
  */
 int 
-ac_compute()
+ac_compute(void)
 {
     register int ac;
 
@@ -194,7 +194,8 @@
 /*
  * this routine computes the players current strength
  */
-str_compute()
+int
+str_compute(void)
 {
     if (cur_misc[WEAR_GAUNTLET] != NULL		&&
 	cur_misc[WEAR_GAUNTLET]->o_which == MM_G_OGRE) {
@@ -210,7 +211,8 @@
 /*
  * this routine computes the players current dexterity
  */
-dex_compute()
+int
+dex_compute(void)
 {
     if (cur_misc[WEAR_GAUNTLET] != NULL		&&
 	cur_misc[WEAR_GAUNTLET]->o_which == MM_G_DEXTERITY) {
@@ -229,9 +231,8 @@
  *	Check to see if the move is legal if it is diagonal
  */
 
-diag_ok(sp, ep, flgptr)
-register coord *sp, *ep;
-struct thing *flgptr;
+bool
+diag_ok(coord *sp, coord *ep, struct thing *flgptr)
 {
     register int numpaths = 0;
 
@@ -252,7 +253,8 @@
  *	He wants to eat something, so let him try
  */
 
-eat()
+void
+eat(void)
 {
     register struct linked_list *item;
 
@@ -282,10 +284,7 @@
  * pick a random position around the give (y, x) coordinates
  */
 coord *
-fallpos(pos, be_clear, range)
-register coord *pos;
-bool be_clear;
-int range;
+fallpos(coord *pos, bool be_clear, int range)
 {
 	register int tried, i, j;
 	register char ch;
@@ -364,9 +363,7 @@
  */
 
 struct linked_list *
-find_mons(y, x)
-register int y;
-register int x;
+find_mons(int y, int x)
 {
     register struct linked_list *item;
     register struct thing *th;
@@ -386,9 +383,7 @@
  */
 
 struct linked_list *
-find_obj(y, x)
-register int y;
-register int x;
+find_obj(int y, int x)
 {
     register struct linked_list *obj;
     register struct object *op;
@@ -406,7 +401,8 @@
 /*
  * set up the direction co_ordinate for use in varios "prefix" commands
  */
-get_dir()
+bool
+get_dir(void)
 {
     register char *prompt;
     register bool gotit;
@@ -446,8 +442,8 @@
 /* 
  * see if the object is one of the currently used items
  */
-is_current(obj)
-register struct object *obj;
+bool
+is_current(struct object *obj)
 {
     if (obj == NULL)
 	return FALSE;
@@ -483,11 +479,12 @@
 /*
  * Look:
  *	A quick glance all around the player
+ * wakeup: Should we wake up monsters
+ * runend: At end of a run -- for mazes
  */
 
-look(wakeup, runend)
-bool wakeup;	/* Should we wake up monsters */
-bool runend;	/* At end of a run -- for mazes */
+void
+look(bool wakeup, bool runend)
 {
     register int x, y, radius;
     register char ch, och;
@@ -738,8 +735,8 @@
  *	The guy just magically went up a level.
  */
 
-raise_level(get_spells)
-bool get_spells;
+void
+raise_level(bool get_spells)
 {
     unsigned long test;	/* Next level -- be sure it is not an overflow */
 
@@ -766,11 +763,12 @@
 /*
  * save:
  *	See if a creature saves against something
+ * which: which type of save 
+ * who: who is saving 
+ * adj: saving throw adjustment 
  */
-save(which, who, adj)
-int which;		/* which type of save */
-struct thing *who;	/* who is saving */
-int adj;		/* saving throw adjustment */
+bool
+save(int which, struct thing *who, int adj)
 {
     register int need, level;
 
@@ -814,8 +812,8 @@
  *	Figure out what a secret door looks like.
  */
 
-secretdoor(y, x)
-register int y, x;
+char
+secretdoor(int y, int x)
 {
     register int i;
     register struct room *rp;
@@ -838,9 +836,8 @@
 /*
  * copy string using unctrl for things
  */
-strucpy(s1, s2, len)
-register char *s1, *s2;
-register int len;
+void
+strucpy(char *s1, char *s2, int len)
 {
     register char *sp;
 
@@ -859,8 +856,7 @@
  */
 
 char *
-tr_name(ch)
-char ch;
+tr_name(char ch)
 {
     register char *s = NULL;
 
@@ -890,8 +886,7 @@
  * for printfs: if string starts with a vowel, return "n" for an "an"
  */
 char *
-vowelstr(str)
-register char *str;
+vowelstr(char *str)
 {
     switch (*str)
     {
@@ -911,7 +906,8 @@
  *	Do nothing but let other things happen
  */
 
-waste_time()
+void
+waste_time(void)
 {
     if (inwhgt)			/* if from wghtchk then done */
 	return;