Advanced Rogue 7: convert to ANSI-style function declarations.

Almost 1500 lines of compiler warnings remain, and the GCC developers
are already working on a new version with even more warnings turned on
by default.
This commit is contained in:
John "Elwin" Edwards 2016-02-19 21:02:28 -05:00
parent f38b2223c8
commit e8e6e604c3
39 changed files with 1181 additions and 889 deletions

View file

@ -20,9 +20,18 @@
#include "curses.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "rogue.h"
int hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee, bool back_stab, bool thrown, bool short_msg);
bool roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
bool hurl, struct object *cur_weapon, bool back_stab);
void hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool back_stab, bool thrown, bool short_msg);
void miss(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool thrown, bool short_msg);
int add_dam(short str);
int hung_dam(void);
#define CONF_DAMAGE -1
#define PARAL_DAMAGE -2
#define DEST_DAMAGE -3
@ -31,9 +40,8 @@ int hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee, b
/*
* returns true if player has a any chance to hit the monster
*/
player_can_hit(tp, weap)
register struct thing *tp;
register struct object *weap;
bool
player_can_hit(struct thing *tp, struct object *weap)
{
if (off(*tp, CMAGICHIT) && off(*tp, BMAGICHIT) && off(*tp, MAGICHIT))
return(TRUE);
@ -61,10 +69,8 @@ register struct object *weap;
* The player attacks the monster.
*/
fight(mp, weap, thrown)
register coord *mp;
struct object *weap;
bool thrown;
bool
fight(coord *mp, struct object *weap, bool thrown)
{
register struct thing *tp;
register struct linked_list *item;
@ -225,10 +231,8 @@ bool thrown;
* The monster attacks the player
*/
attack(mp, weapon, thrown)
register struct thing *mp;
register struct object *weapon;
bool thrown;
bool
attack(struct thing *mp, struct object *weapon, bool thrown)
{
register char *mname;
register bool see_att, did_hit = FALSE;
@ -301,9 +305,8 @@ bool thrown;
* returns true if the swing hits
*/
swing(class, at_lvl, op_arm, wplus)
short class;
int at_lvl, op_arm, wplus;
bool
swing(short class, int at_lvl, int op_arm, int wplus)
{
register int res = rnd(20)+1;
register int need;
@ -323,12 +326,9 @@ int at_lvl, op_arm, wplus;
* Roll several attacks
*/
roll_em(att_er, def_er, weap, hurl, cur_weapon, back_stab)
struct thing *att_er, *def_er;
struct object *weap;
bool hurl;
struct object *cur_weapon;
bool back_stab;
bool
roll_em(struct thing *att_er, struct thing *def_er, struct object *weap,
bool hurl, struct object *cur_weapon, bool back_stab)
{
register struct stats *att, *def;
register char *cp = NULL;
@ -700,9 +700,7 @@ bool back_stab;
*/
char *
prname(who, upper)
register char *who;
bool upper;
prname(char *who, bool upper)
{
static char tbuf[LINELEN];
@ -727,11 +725,9 @@ bool upper;
* Print a message to indicate a succesful hit
*/
hit(weapon, see_att, see_def, er, ee, back_stab, thrown, short_msg)
register struct object *weapon;
bool see_att, see_def;
register char *er, *ee;
bool back_stab, thrown, short_msg;
void
hit(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool back_stab, bool thrown, bool short_msg)
{
register char *s = "";
char att_name[LINELEN], /* Name of attacker */
@ -791,11 +787,9 @@ bool back_stab, thrown, short_msg;
* Print a message to indicate a poor swing
*/
miss(weapon, see_att, see_def, er, ee, thrown, short_msg)
register struct object *weapon;
bool see_att, see_def;
register char *er, *ee;
bool thrown, short_msg;
void
miss(struct object *weapon, bool see_att, bool see_def, char *er, char *ee,
bool thrown, bool short_msg)
{
register char *s = "";
char
@ -836,8 +830,8 @@ bool thrown, short_msg;
* compute to-hit bonus for dexterity
*/
dext_plus(dexterity)
register int dexterity;
int
dext_plus(int dexterity)
{
return (dexterity > 10 ? (dexterity-13)/3 : (dexterity-10)/3);
}
@ -848,8 +842,8 @@ register int dexterity;
* compute armor class bonus for dexterity
*/
dext_prot(dexterity)
register int dexterity;
int
dext_prot(int dexterity)
{
return ((dexterity-10)/2);
}
@ -858,8 +852,8 @@ register int dexterity;
* compute bonus/penalties for strength on the "to hit" roll
*/
str_plus(str)
register short str;
int
str_plus(short str)
{
return((str-10)/3);
}
@ -869,8 +863,8 @@ register short str;
* compute additional damage done for exceptionally high or low strength
*/
add_dam(str)
register short str;
int
add_dam(short str)
{
return((str-9)/2);
}
@ -879,7 +873,8 @@ register short str;
* hung_dam:
* Calculate damage depending on players hungry state
*/
hung_dam()
int
hung_dam(void)
{
reg int howmuch;
@ -897,12 +892,11 @@ hung_dam()
/*
* thunk:
* A missile hits a monster
* tp: defender
*/
thunk(weap, tp, mname)
register struct object *weap;
register struct thing *tp; /* Defender */
register char *mname;
void
thunk(struct object *weap, struct thing *tp, char *mname)
{
char *def_name; /* Name of defender */
@ -924,10 +918,8 @@ register char *mname;
* A missile from a monster hits the player
*/
m_thunk(weap, tp, mname)
register struct object *weap;
register struct thing *tp;
register char *mname;
void
m_thunk(struct object *weap, struct thing *tp, char *mname)
{
char *att_name; /* Name of attacker */
@ -947,12 +939,11 @@ register char *mname;
/*
* bounce:
* A missile misses a monster
* tp: defender
*/
bounce(weap, tp, mname)
register struct object *weap;
register struct thing *tp; /* Defender */
register char *mname;
void
bounce(struct object *weap, struct thing *tp, char *mname)
{
char *def_name; /* Name of defender */
@ -974,10 +965,8 @@ register char *mname;
* A missle from a monster misses the player
*/
m_bounce(weap, tp, mname)
register struct object *weap;
register struct thing *tp;
register char *mname;
void
m_bounce(struct object *weap, struct thing *tp, char *mname)
{
char *att_name; /* Name of attacker */
@ -1001,8 +990,8 @@ register char *mname;
* Returns true if an object radiates magic
*/
is_magic(obj)
register struct object *obj;
bool
is_magic(struct object *obj)
{
switch (obj->o_type)
{
@ -1028,9 +1017,8 @@ register struct object *obj;
int chance = 0;/* cumulative chance for goodies to loose it */
killed(item, pr, points, treasure)
register struct linked_list *item;
bool pr, points, treasure;
void
killed(struct linked_list *item, bool pr, bool points, bool treasure)
{
register struct thing *tp, *mp;
register struct linked_list *pitem, *nexti, *mitem;
@ -1137,9 +1125,7 @@ bool pr, points, treasure;
*/
struct linked_list *
wield_weap(thrown, mp)
struct object *thrown;
struct thing *mp;
wield_weap(struct object *thrown, struct thing *mp)
{
int look_for, /* The projectile weapon we are looking for */
new_rate, /* The rating of a prospective weapon */
@ -1220,8 +1206,9 @@ struct thing *mp;
return(candidate);
}
explode(tp)
register struct thing *tp;
void
explode(struct thing *tp)
{
register int x,y, damage;
@ -1275,11 +1262,8 @@ register struct thing *tp;
* Called when one monster attacks another monster.
*/
skirmish(attacker, mp, weap, thrown)
register struct thing *attacker;
register coord *mp;
struct object *weap;
bool thrown;
bool
skirmish(struct thing *attacker, coord *mp, struct object *weap, bool thrown)
{
register struct thing *defender;
register struct linked_list *item;