diff rogue4/chase.c @ 215:1b73a8641b37

rogue4: fix most GCC5 warnings. Converting all function definitions to ANSI style accounts for most of the change. This has exposed other problems, such as daemons not actually being their stated type, that will require more careful solutions.
author John "Elwin" Edwards
date Wed, 27 Jan 2016 19:41:05 -0500
parents 9535a08ddc39
children e52a8a7ad4c5
line wrap: on
line diff
--- a/rogue4/chase.c	Sat Jan 23 09:35:14 2016 -0500
+++ b/rogue4/chase.c	Wed Jan 27 19:41:05 2016 -0500
@@ -10,6 +10,7 @@
  * See the file LICENSE.TXT for full copyright and licensing information.
  */
 
+#include <stdlib.h>
 #include <curses.h>
 #include "rogue.h"
 
@@ -17,11 +18,16 @@
 
 coord ch_ret;				/* Where chasing takes you */
 
+bool chase(THING *tp, coord *ee);
+int do_chase(THING *th);
+coord *find_dest(THING *tp);
+
 /*
  * runners:
  *	Make all the running monsters move.
  */
-runners()
+void
+runners(void)
 {
     register THING *tp;
 	register THING *ntp;
@@ -46,8 +52,8 @@
  * do_chase:
  *	Make one thing chase another.
  */
-do_chase(th)
-register THING *th;
+int
+do_chase(THING *th)
 {
     register struct room *rer, *ree;	/* room of chaser, room of chasee */
     register int mindist = 32767, i, dist;
@@ -184,8 +190,8 @@
  * see_monst:
  *	Return TRUE if the hero can see the monster
  */
-see_monst(mp)
-register THING *mp;
+bool
+see_monst(THING *mp)
 {
     if (on(player, ISBLIND))
 	return FALSE;
@@ -203,9 +209,8 @@
  *	Set a mosnter running after something or stop it from running
  *	(for when it dies)
  */
-runto(runner, spot)
-register coord *runner;
-coord *spot;
+void
+runto(coord *runner, coord *spot)
 {
     register THING *tp;
 
@@ -234,9 +239,8 @@
  *	chasee(ee).  Returns TRUE if we want to keep on chasing later
  *	FALSE if we reach the goal.
  */
-chase(tp, ee)
-THING *tp;
-coord *ee;
+bool
+chase(THING *tp, coord *ee)
 {
     register int x, y;
     register int dist, thisdist;
@@ -339,8 +343,7 @@
  *	in any room.
  */
 struct room *
-roomin(cp)
-register coord *cp;
+roomin(coord *cp)
 {
     register struct room *rp;
     register char *fp;
@@ -360,8 +363,8 @@
  * diag_ok:
  *	Check to see if the move is legal if it is diagonal
  */
-diag_ok(sp, ep)
-register coord *sp, *ep;
+bool
+diag_ok(coord *sp, coord *ep)
 {
     if (ep->x == sp->x || ep->y == sp->y)
 	return TRUE;
@@ -372,8 +375,8 @@
  * cansee:
  *	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;
     coord tp;
@@ -396,8 +399,7 @@
  *	find the proper destination for the monster
  */
 coord *
-find_dest(tp)
-register THING *tp;
+find_dest(THING *tp)
 {
     register THING *obj;
     register int prob;