Super-Rogue: convert to ANSI-style function declarations.

This fixes most of the build warnings.
This commit is contained in:
John "Elwin" Edwards 2016-01-31 13:45:07 -05:00
parent 0f87d5b4d8
commit 59f448e92e
33 changed files with 783 additions and 518 deletions

View file

@ -14,19 +14,26 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "rogue.h"
#include "rogue.ext"
bool roll_em(struct stats *att, struct stats *def, struct object *weap, bool hurl);
char *mindex(char *cp, char c);
char *prname(char *who, bool upper);
void hit(char *er);
void miss(char *er);
void thunk(struct object *weap, char *mname);
void bounce(struct object *weap, char *mname);
/*
* fight:
* The player attacks the monster.
*/
fight(mp, weap, thrown)
struct coord *mp;
struct object *weap;
bool thrown;
bool
fight(struct coord *mp, struct object *weap, bool thrown)
{
reg struct thing *tp;
@ -123,8 +130,8 @@ bool thrown;
* attack:
* The monster attacks the player
*/
attack(mp)
struct thing *mp;
int
attack(struct thing *mp)
{
reg char *mname;
@ -349,8 +356,8 @@ struct thing *mp;
* swing:
* Returns true if the swing hits
*/
swing(at_lvl, op_arm, wplus)
int at_lvl, op_arm, wplus;
bool
swing(int at_lvl, int op_arm, int wplus)
{
reg int res = rnd(20)+1;
reg int need = (21 - at_lvl) - op_arm;
@ -363,7 +370,8 @@ int at_lvl, op_arm, wplus;
* check_level:
* Check to see if the guy has gone up a level.
*/
check_level()
void
check_level(void)
{
reg int lev, add, dif;
@ -387,15 +395,12 @@ check_level()
* roll_em:
* Roll several attacks
*/
roll_em(att, def, weap, hurl)
struct stats *att, *def;
struct object *weap;
bool hurl;
bool
roll_em(struct stats *att, struct stats *def, struct object *weap, bool hurl)
{
reg char *cp;
reg int ndice, nsides, def_arm, prop_hplus, prop_dplus;
reg bool did_hit = FALSE;
char *mindex();
prop_hplus = prop_dplus = 0;
if (weap == NULL) {
@ -479,8 +484,7 @@ bool hurl;
* Look for char 'c' in string pointed to by 'cp'
*/
char *
mindex(cp, c)
char *cp, c;
mindex(char *cp, char c)
{
reg int i;
@ -498,9 +502,7 @@ char *cp, c;
* The print name of a combatant
*/
char *
prname(who, upper)
char *who;
bool upper;
prname(char *who, bool upper)
{
static char tbuf[LINLEN];
@ -522,8 +524,8 @@ static char tbuf[LINLEN];
* hit:
* Print a message to indicate a succesful hit
*/
hit(er)
char *er;
void
hit(char *er)
{
msg("%s hit.",prname(er, TRUE));
}
@ -533,8 +535,8 @@ char *er;
* miss:
* Print a message to indicate a poor swing
*/
miss(er)
char *er;
void
miss(char *er)
{
msg("%s miss%s.",prname(er, TRUE),(er == 0 ? "":"es"));
}
@ -544,9 +546,8 @@ char *er;
* save_throw:
* See if a creature saves against something
*/
save_throw(which, tp)
int which;
struct thing *tp;
bool
save_throw(int which, struct thing *tp)
{
reg int need;
reg struct stats *st;
@ -561,8 +562,8 @@ struct thing *tp;
* save:
* See if he saves against various nasty things
*/
save(which)
int which;
bool
save(int which)
{
return save_throw(which, &player);
}
@ -571,7 +572,8 @@ int which;
* raise_level:
* The guy just magically went up a level.
*/
raise_level()
void
raise_level(void)
{
him->s_exp = e_levels[him->s_lvl-1] + 1L;
check_level();
@ -582,9 +584,8 @@ raise_level()
* thunk:
* A missile hits a monster
*/
thunk(weap, mname)
struct object *weap;
char *mname;
void
thunk(struct object *weap, char *mname)
{
if (weap->o_type == WEAPON)
msg("The %s hits the %s.",w_magic[weap->o_which].mi_name,mname);
@ -597,9 +598,8 @@ char *mname;
* bounce:
* A missile misses a monster
*/
bounce(weap, mname)
struct object *weap;
char *mname;
void
bounce(struct object *weap, char *mname)
{
if (weap->o_type == WEAPON)
msg("The %s misses the %s.", w_magic[weap->o_which].mi_name,mname);
@ -612,9 +612,8 @@ char *mname;
* remove:
* Remove a monster from the screen
*/
remove_monster(mp, item)
struct coord *mp;
struct linked_list *item;
void
remove_monster(struct coord *mp, struct linked_list *item)
{
reg char what;
@ -633,8 +632,8 @@ struct linked_list *item;
* is_magic:
* Returns true if an object radiates magic
*/
is_magic(obj)
struct object *obj;
bool
is_magic(struct object *obj)
{
switch (obj->o_type) {
case ARMOR:
@ -656,9 +655,8 @@ struct object *obj;
* killed:
* Called to put a monster to death
*/
killed(item, pr)
struct linked_list *item;
bool pr;
void
killed(struct linked_list *item, bool pr)
{
reg struct thing *tp;
reg struct object *obj;