Mercurial > hg > early-roguelike
diff srogue/chase.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/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;