diff arogue7/chase.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/chase.c	Sun Feb 07 14:39:21 2016 -0500
+++ b/arogue7/chase.c	Fri Feb 19 21:02:28 2016 -0500
@@ -19,11 +19,13 @@
 
 #include <ctype.h>
 #include <limits.h>
+#include <stdlib.h>
 #include "curses.h"
 #include "rogue.h"
 #define	MAXINT	INT_MAX
 #define	MININT	INT_MIN
 
+bool straight_shot(int ery, int erx, int eey, int eex, coord *shooting);
 
 /*
  * Canblink checks if the monster can teleport (blink).  If so, it will
@@ -31,8 +33,7 @@
  */
 
 bool
-can_blink(tp)
-register struct thing *tp;
+can_blink(struct thing *tp)
 {
     register int y, x, index=9;
     coord tryp;	/* To hold the coordinates for use in diag_ok */
@@ -127,8 +128,7 @@
  */
 
 coord *
-can_shoot(er, ee)
-register coord *er, *ee;
+can_shoot(coord *er, coord *ee)
 {
     static coord shoot_dir;
 
@@ -147,16 +147,14 @@
  * chase:
  *	Find the spot for the chaser(er) to move closer to the
  *	chasee(ee).  Rer is the room of the chaser, and ree is the
- *	room of the creature being chased (chasee).
+ *	room of the creature being chased (chasee).  Flee is true if 
+ *	destination (ee) is player and monster is running away
+ *	or the player is in a wall and the monster can't get to it
  */
 
-chase(tp, ee, rer, ree, flee)
-register struct thing *tp;
-register coord *ee;
-register struct room *rer, *ree;
-bool flee; /* True if destination (ee) is player and monster is running away
-	    * or the player is in a wall and the monster can't get to it
-	    */
+void
+chase(struct thing *tp, coord *ee, struct room *rer, struct room *ree, 
+      bool flee)
 {
     int dist, thisdist, monst_dist = MAXINT; 
     register coord *er = &tp->t_pos; 
@@ -494,8 +492,8 @@
  *	Make one thing chase another.
  */
 
-do_chase(th)
-register struct thing *th;
+void
+do_chase(struct thing *th)
 {
     register struct room *orig_rer,	/* Original room of chaser */
 			 *new_room;	/* new room of monster */
@@ -803,8 +801,7 @@
  */
 
 struct linked_list *
-get_hurl(tp)
-register struct thing *tp;
+get_hurl(struct thing *tp)
 {
     struct linked_list *arrow=NULL, *bolt=NULL, *rock=NULL,
 	*spear = NULL, *dagger=NULL, *dart=NULL, *aklad=NULL;
@@ -851,9 +848,8 @@
  *	Set a monster running after something
  */
 
-runto(runner, spot)
-register struct thing *runner;
-coord *spot;
+void
+runto(struct thing *runner, coord *spot)
 {
     if (on(*runner, ISSTONE))
 	return;
@@ -881,9 +877,7 @@
  */
 
 bool
-straight_shot(ery, erx, eey, eex, shooting)
-register int ery, erx, eey, eex;
-register coord *shooting;
+straight_shot(int ery, int erx, int eey, int eex, coord *shooting)
 {
     register int dy, dx;	/* Deltas */
     char ch;