diff srogue/move.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 2128c7dc8a40
children e52a8a7ad4c5
line wrap: on
line diff
--- a/srogue/move.c	Thu Jan 28 18:55:47 2016 -0500
+++ b/srogue/move.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 <ctype.h>
 #include "rogue.h"
 #include "rogue.ext"
@@ -29,8 +30,8 @@
  *	Start the hero running
  */
 
-do_run(ch)
-char ch;
+void
+do_run(char ch)
 {
 	running = TRUE;
 	after = FALSE;
@@ -43,8 +44,8 @@
  *	consequences (fighting, picking up, etc.)
  */
 
-do_move(dy, dx)
-int dy, dx;
+void
+do_move(int dy, int dx)
 {
 	reg int ch;
 	reg struct room *rp;
@@ -209,8 +210,8 @@
  * Called to illuminate a room.
  * If it is dark, remove anything that might move.
  */
-light(cp)
-struct coord *cp;
+void
+light(struct coord *cp)
 {
 	reg struct room *rp;
 	reg int j, k, x, y;
@@ -291,8 +292,8 @@
  * show:
  *	returns what a certain thing will display as to the un-initiated
  */
-show(y, x)
-int y, x;
+char
+show(int y, int x)
 {
 	reg char ch = winat(y, x);
 	reg struct linked_list *it;
@@ -330,9 +331,8 @@
  * be_trapped:
  *	Hero or monster stepped on a trap.
  */
-be_trapped(tc, th)
-struct thing *th;
-struct coord *tc;
+int
+be_trapped(struct coord *tc, struct thing *th)
 {
 	reg struct trap *trp;
 	reg int ch, ishero;
@@ -340,7 +340,7 @@
 	char stuckee[35], seeit, sayso;
 
 	if ((trp = trap_at(tc->y, tc->x)) == NULL)
-		return;
+		return 0;
 	ishero = (th == &player);
 	if (ishero) {
 		strcpy(stuckee, "You");
@@ -491,7 +491,7 @@
 			if ((trp->tr_flags & ISGONE) && rnd(100) < 10) {
 				nlmove = TRUE;
 				if (rnd(100) < 15)
-					teleport(rndspot);	   /* teleport away */
+					teleport(rndspot, th);	   /* teleport away */
 				else if(rnd(100) < 15 && level > 2) {
 					level -= rnd(2) + 1;
 					new_level(NORMLEV);
@@ -519,7 +519,8 @@
  * dip_it:
  *	Dip an object into a magic pool
  */
-dip_it()
+void
+dip_it(void)
 {
 	reg struct linked_list *what;
 	reg struct object *ob;
@@ -654,8 +655,7 @@
  *	Find the trap at (y,x) on screen.
  */
 struct trap *
-trap_at(y, x)
-int y, x;
+trap_at(int y, int x)
 {
 	reg struct trap *tp, *ep;
 
@@ -673,8 +673,7 @@
  *	move in a random direction if the monster/person is confused
  */
 struct coord *
-rndmove(who)
-struct thing *who;
+rndmove(struct thing *who)
 {
 	reg int x, y, ex, ey, ch;
 	int nopen = 0;
@@ -720,8 +719,8 @@
  * isatrap:
  *	Returns TRUE if this character is some kind of trap
  */
-isatrap(ch)
-char ch;
+bool
+isatrap(char ch)
 {
 	switch(ch) {
 		case POST: