changeset 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 b24545357d2e
children 56e748983fa8
files srogue/armor.c srogue/chase.c srogue/command.c srogue/daemon.c srogue/daemons.c srogue/disply.c srogue/encumb.c srogue/fight.c srogue/init.c srogue/io.c srogue/list.c srogue/main.c srogue/misc.c srogue/monsters.c srogue/move.c srogue/new_leve.c srogue/options.c srogue/pack.c srogue/passages.c srogue/potions.c srogue/pstats.c srogue/rings.c srogue/rip.c srogue/rogue.ext srogue/rooms.c srogue/save.c srogue/scrolls.c srogue/state.c srogue/sticks.c srogue/things.c srogue/trader.c srogue/weapons.c srogue/wizard.c
diffstat 33 files changed, 783 insertions(+), 518 deletions(-) [+]
line wrap: on
line diff
--- a/srogue/armor.c	Thu Jan 28 18:55:47 2016 -0500
+++ b/srogue/armor.c	Sun Jan 31 13:45:07 2016 -0500
@@ -21,7 +21,8 @@
  * wear:
  *	The player wants to wear something, so let the hero try
  */
-wear()
+void
+wear(void)
 {
 	reg struct linked_list *item;
 	reg struct object *obj;
@@ -50,7 +51,8 @@
  * take_off:
  *	Get the armor off of the players back
  */
-take_off()
+void
+take_off(void)
 {
 	reg struct object *obj;
 
@@ -69,9 +71,8 @@
  * initarmor:
  *		Initialize some armor.
  */
-initarmor(obj, what)
-struct object *obj;
-int what;
+void
+initarmor(struct object *obj, int what)
 {
 	struct init_armor *iwa;
 	struct magic_item *mi;
@@ -90,8 +91,8 @@
  * hurt_armor:
  *	Returns TRUE if armor is damaged
  */
-hurt_armor(obj)
-struct object *obj;
+bool
+hurt_armor(struct object *obj)
 {
 	reg int type, ac;
 
--- a/srogue/chase.c	Thu Jan 28 18:55:47 2016 -0500
+++ b/srogue/chase.c	Sun Jan 31 13:45:07 2016 -0500
@@ -14,19 +14,24 @@
  * See the file LICENSE.TXT for full copyright and licensing information.
  */
 
+#include <stdlib.h>
 #include "rogue.h"
 #include "rogue.ext"
 
 #define FARAWAY	32767
 #define RDIST(a, b)	(DISTANCE((a)->y, (a)->x, (b).y, (b).x))
 
+int do_chase(struct linked_list *mon);
+int chase(struct thing *tp, struct coord *ee, bool runaway, bool dofight);
+
 struct coord ch_ret;	/* Where chasing takes you */
 
 /*
  * runners:
  *	Make all the running monsters move.
  */
-runners()
+void
+runners(void)
 {
 	reg struct thing *tp;
 	reg struct linked_list *mon,*nextmon;
@@ -54,8 +59,8 @@
  * do_chase:
  *	Make one thing chase another.
  */
-do_chase(mon)
-struct linked_list *mon;
+int
+do_chase(struct linked_list *mon)
 {
 	reg struct thing *th;
 	reg struct room *rer, *ree, *rxx;
@@ -241,10 +246,8 @@
  *	chasee.  Returns TRUE if we want to keep on chasing
  *	later FALSE if we reach the goal.
  */
-chase(tp, ee, runaway, dofight)
-struct thing *tp;
-struct coord *ee;
-bool runaway, dofight;
+int
+chase(struct thing *tp, struct coord *ee, bool runaway, bool dofight)
 {
 	reg int x, y, ch;
 	reg int dist, thisdist, closest;
@@ -385,9 +388,8 @@
  * runto:
  *	Set a monster running after something
  */
-runto(runner, spot)
-struct coord *runner;
-struct coord *spot;
+void
+runto(struct coord *runner, struct coord *spot)
 {
 	reg struct linked_list *item;
 	reg struct thing *tp;
@@ -409,8 +411,7 @@
  *	NULL means they aren't in any room.
  */
 struct room *
-roomin(cp)
-struct coord *cp;
+roomin(struct coord *cp)
 {
 	reg struct room *rp;
 
@@ -428,8 +429,7 @@
  *	Find the monster from his coordinates
  */
 struct linked_list *
-find_mons(y, x)
-int y, x;
+find_mons(int y, int x)
 {
 	reg struct linked_list *item;
 	reg struct thing *th;
@@ -447,8 +447,8 @@
  * diag_ok:
  *	Check to see if the move is legal if it is diagonal
  */
-diag_ok(sp, ep)
-struct coord *sp, *ep;
+bool
+diag_ok(struct coord *sp, struct coord *ep)
 {
 	if (ep->x == sp->x || ep->y == sp->y)
 		return TRUE;
@@ -462,8 +462,8 @@
  * cansee:
  *	returns true if the hero can see a certain coordinate.
  */
-cansee(y, x)
-int y, x;
+bool
+cansee(int y, int x)
 {
 	reg struct room *rer;
 	struct coord tp;
--- a/srogue/command.c	Thu Jan 28 18:55:47 2016 -0500
+++ b/srogue/command.c	Sun Jan 31 13:45:07 2016 -0500
@@ -29,11 +29,19 @@
 #include <unistd.h>
 #endif
 
+void search(void);
+void help(void);
+void d_level(void);
+void u_level(void);
+void shell(void);
+void call(void);
+
 /*
  * command:
  *	Process the user commands
  */
-command()
+void
+command(void)
 {
 	reg char ch;
 	reg int ntimes = 1;		/* Number of player moves */
@@ -416,7 +424,8 @@
  *	Player gropes about him to find hidden things.
  */
 
-search()
+void
+search(void)
 {
 	reg int x, y;
 	reg char ch;
@@ -461,7 +470,8 @@
  * help:
  *	Give single character help, or the whole mess if he wants it
  */
-help()
+void
+help(void)
 {
 	extern struct h_list helpstr[];
 	reg struct h_list *strp;
@@ -519,8 +529,7 @@
  *	Tell the player what a certain thing is.
  */
 char *
-identify(what)