changeset 218:56e748983fa8

Advanced Rogue 5: convert to ANSI function declarations. This still leaves over a thousand lines of warning messages, mostly related to the return types of daemons and fuses.
author John "Elwin" Edwards
date Sun, 07 Feb 2016 14:39:21 -0500
parents 94a0d9dd5ce1
children f9ef86cf22b2
files arogue5/chase.c arogue5/command.c arogue5/daemon.c arogue5/daemons.c arogue5/encumb.c arogue5/fight.c arogue5/init.c arogue5/io.c arogue5/list.c arogue5/main.c arogue5/maze.c arogue5/mdport.c arogue5/misc.c arogue5/monsters.c arogue5/move.c arogue5/new_level.c arogue5/options.c arogue5/outside.c arogue5/pack.c arogue5/passages.c arogue5/player.c arogue5/potions.c arogue5/rings.c arogue5/rip.c arogue5/rogue.h arogue5/rooms.c arogue5/save.c arogue5/scrolls.c arogue5/state.c arogue5/sticks.c arogue5/things.c arogue5/trader.c arogue5/util.c arogue5/weapons.c arogue5/wear.c arogue5/wizard.c arogue5/xcrypt.c
diffstat 37 files changed, 977 insertions(+), 733 deletions(-) [+]
line wrap: on
line diff
--- a/arogue5/chase.c	Sun Jan 31 13:45:07 2016 -0500
+++ b/arogue5/chase.c	Sun Feb 07 14:39:21 2016 -0500
@@ -12,6 +12,7 @@
  * See the file LICENSE.TXT for full copyright and licensing information.
  */
 
+#include <stdlib.h>
 #include <ctype.h>
 #include <limits.h>
 #include "curses.h"
@@ -21,8 +22,8 @@
 
 coord ch_ret;				/* Where chasing takes you */
 
-
-
+struct linked_list *get_hurl(struct thing *tp);
+bool straight_shot(int ery, int erx, int eey, int eex, coord *shooting);
 
 
 /*
@@ -31,8 +32,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 */
@@ -128,8 +128,7 @@
  */
 
 coord *
-can_shoot(er, ee)
-register coord *er, *ee;
+can_shoot(coord *er, coord *ee)
 {
     static coord shoot_dir;
 
@@ -154,13 +153,11 @@
  *	FALSE if we reach the goal.
  */
 
-chase(tp, ee, flee, mdead)
-register struct thing *tp;
-register coord *ee;
-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
-	    */
-bool *mdead;
+/* 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
+ */
+bool
+chase(struct thing *tp, coord *ee, bool flee, bool *mdead)
 {
     int damage, dist, thisdist, monst_dist = MAXINT; 
     struct linked_list *weapon;
@@ -530,10 +527,10 @@
  * do_chase:
  *	Make one thing chase another.
  */
+/* flee: True if running away or player is inaccessible in wall */
 
-do_chase(th, flee)
-register struct thing *th;
-register bool flee; /* True if running away or player is inaccessible in wall */
+void
+do_chase(struct thing *th, bool flee)
 {
     register struct room *rer, *ree,	/* room of chaser, room of chasee */
 			 *orig_rer,	/* Original room of chaser */
@@ -830,8 +827,7 @@
  */
 
 struct linked_list *
-get_hurl(tp)
-register struct thing *tp;
+get_hurl(struct thing *tp)
 {
     struct linked_list *arrow, *bolt, *rock;
     register struct linked_list *pitem;
@@ -861,7 +857,8 @@
  *	Make all the running monsters move.
  */
 
-runners()
+void
+runners(void)
 {
     register struct linked_list *item;
     register struct thing *tp = NULL;
@@ -935,9 +932,8 @@
  *	Set a monster running after something
  */
 
-runto(runner, spot)
-register struct thing *runner;
-coord *spot;
+void
+runto(struct thing *runner, coord *spot)
 {
     /*
      * Start the beastie running
@@ -959,9 +955,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;
--- a/arogue5/command.c	Sun Jan 31 13:45:07 2016 -0500
+++ b/arogue5/command.c	Sun Feb 07 14:39:21 2016 -0500
@@ -21,12 +21,20 @@
 #include "rogue.h"
 #include "mach_dep.h"
 
+void help(void);
+void identify(void);
+void d_level(void);
+void u_level(void);
+void shell(void);
+void call(bool mark);
+
 /*
  * command:
  *	Process the user commands
  */
 
-command()
+void
+command(void)
 {
     register char ch;
     register int ntimes = 1;			/* Number of player moves */
@@ -207,8 +215,8 @@
 		when 'I' : after = FALSE; picky_inven();
 		when 'd' : drop(NULL);
 		when 'P' : grab(hero.y, hero.x);
-		when 'q' : quaff(-1, NULL, TRUE);
-		when 'r' : read_scroll(-1, NULL, TRUE);
+		when 'q' : quaff(-1, 0, TRUE);
+		when 'r' : read_scroll(-1, 0, TRUE);
 		when 'e' : eat();
 		when 'w' : wield();
 		when 'W' : wear();
@@ -228,7 +236,7 @@
 		when 'G' : gsense();
 		when '^' : set_trap(&player, hero.y, hero.x);
 		when 's' : search(FALSE, FALSE);
-		when 'z' : if (!do_zap(TRUE, NULL, FALSE))
+		when 'z' : if (!do_zap(TRUE, 0, FALSE))
 				after=FALSE;
 		when 'p' : pray();
 		when 'C' : cast();
@@ -475,8 +483,7 @@
  */