diff srogue/monsters.c @ 217:94a0d9dd5ce1

Super-Rogue: convert to ANSI-style function declarations. This fixes most of the build warnings.
author John "Elwin" Edwards
date Sun, 31 Jan 2016 13:45:07 -0500
parents 7bdac632ab9d
children e7aab31362af
line wrap: on
line diff
--- a/srogue/monsters.c	Thu Jan 28 18:55:47 2016 -0500
+++ b/srogue/monsters.c	Sun Jan 31 13:45:07 2016 -0500
@@ -14,6 +14,7 @@
  * See the file LICENSE.TXT for full copyright and licensing information.
  */
 
+#include <string.h>
 #include "rogue.h"
 #include <ctype.h>
 #include "rogue.ext"
@@ -23,10 +24,10 @@
  *	Pick a monster to show up.  The lower the level,
  *	the meaner the monster.
  */
-rnd_mon(wander,baddie)
-bool wander;
-bool baddie;		/* TRUE when from a polymorph stick */
+char
+rnd_mon(bool wander, bool baddie)
 {
+	/* baddie; TRUE when from a polymorph stick */
 	reg int i, ok, cnt;
 
 	cnt = 0;
@@ -60,7 +61,8 @@
  * lev_mon:
  *	This gets all monsters possible on this level
  */
-lev_mon()
+void
+lev_mon(void)
 {
 	reg int i;
 	reg struct monster *mm;
@@ -83,10 +85,7 @@
  *	Pick a new monster and add it to the list
  */
 struct linked_list *
-new_monster(type, cp, treas)
-struct coord *cp;
-bool treas;
-char type;
+new_monster(char type, struct coord *cp, bool treas)
 {
 	reg struct linked_list *item;
 	reg struct thing *tp;
@@ -191,7 +190,8 @@
  * wanderer:
  *	A wandering monster has awakened and is headed for the player
  */
-wanderer()
+void
+wanderer(void)
 {
 	reg int ch = '-';
 	reg struct room *rp, *hr = player.t_room;
@@ -217,8 +217,7 @@
  *	What to do when the hero steps next to a monster
  */
 struct linked_list *
-wake_monster(y, x)
-int y, x;
+wake_monster(int y, int x)
 {
 	reg struct thing *tp;
 	reg struct linked_list *it;
@@ -279,7 +278,8 @@
  * genocide:
  *	Eradicate a monster forevermore
  */
-genocide()
+void
+genocide(void)
 {
 	reg struct linked_list *ip, *nip;
 	reg struct thing *mp;
@@ -331,8 +331,8 @@
  * unhold:
  *	Release the player from being held
  */
-unhold(whichmon)
-char whichmon;
+void
+unhold(char whichmon)
 {
 	switch (whichmon) {
 		case 'F':
@@ -347,8 +347,8 @@
  * midx:
  *	This returns an index to 'whichmon'
  */
-midx(whichmon)
-char whichmon;
+int
+midx(char whichmon)
 {
 	if (isupper(whichmon))
 		return(whichmon - 'A');			/* 0 to 25 for uppercase */
@@ -363,8 +363,8 @@
  *	See when monster should run or fight. Return
  *	TRUE if hit points less than acceptable.
  */
-monhurt(th)
-struct thing *th;
+bool
+monhurt(struct thing *th)
 {
 	reg int ewis, crithp, f1, f2;
 	reg struct stats *st;