rogue4: fix most GCC5 warnings.

Converting all function definitions to ANSI style accounts for most of
the change.  This has exposed other problems, such as daemons not
actually being their stated type, that will require more careful
solutions.
This commit is contained in:
John "Elwin" Edwards 2016-01-27 19:41:05 -05:00
parent 384386d71c
commit c1d6a6af6a
32 changed files with 625 additions and 394 deletions

View file

@ -10,6 +10,7 @@
* See the file LICENSE.TXT for full copyright and licensing information.
*/
#include <stdlib.h>
#include <curses.h>
#include <ctype.h>
#include <string.h>
@ -20,15 +21,20 @@ long e_levels[] = {
40920L, 81920L, 163840L, 327680L, 655360L, 1310720L, 2621440L, 0L
};
bool roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl);
void hit(char *er, char *ee);
void miss(char *er, char *ee);
int str_plus(str_t str);
int add_dam(str_t str);
void thunk(THING *weap, const char *mname);
void bounce(THING *weap, const char *mname);
/*
* fight:
* The player attacks the monster.
*/
fight(mp, mn, weap, thrown)
register coord *mp;
char mn;
register THING *weap;
bool thrown;
bool
fight(coord *mp, char mn, THING *weap, bool thrown)
{
register THING *tp;
register bool did_hit = TRUE;
@ -96,8 +102,8 @@ bool thrown;
* attack:
* The monster attacks the player
*/
attack(mp)
register THING *mp;
int
attack(THING *mp)
{
register const char *mname;
@ -295,8 +301,8 @@ register 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)
{
register int res = rnd(20);
register int need = (20 - at_lvl) - op_arm;
@ -308,7 +314,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)
{
register int i, add, olevel;
@ -332,9 +339,8 @@ check_level()
* roll_em:
* Roll several attacks
*/
roll_em(thatt, thdef, weap, hurl)
THING *thatt, *thdef, *weap;
bool hurl;
bool
roll_em(THING *thatt, THING *thdef, THING *weap, bool hurl)
{
register struct stats *att, *def;
register char *cp;
@ -440,9 +446,7 @@ bool hurl;
* The print name of a combatant
*/
char *
prname(who, upper)
register char *who;
bool upper;
prname(char *who, bool upper)
{
static char tbuf[MAXSTR];
@ -465,8 +469,8 @@ bool upper;
* hit:
* Print a message to indicate a succesful hit
*/
hit(er, ee)
register char *er, *ee;
void
hit(char *er, char *ee)
{
register char *s = "";
@ -491,8 +495,8 @@ register char *er, *ee;
* miss:
* Print a message to indicate a poor swing
*/
miss(er, ee)
register char *er, *ee;
void
miss(char *er, char *ee)
{
register char *s = "";
@ -514,9 +518,8 @@ register char *er, *ee;
* save_throw:
* See if a creature save against something
*/
save_throw(which, tp)
int which;
THING *tp;
bool
save_throw(int which, THING *tp)
{
register int need;
@ -528,8 +531,8 @@ THING *tp;
* save:
* See if he saves against various nasty things
*/
save(which)
register int which;
bool
save(int which)
{
if (which == VS_MAGIC)
{
@ -545,8 +548,8 @@ register int which;
* str_plus:
* Compute bonus/penalties for strength on the "to hit" roll
*/
str_plus(str)
register str_t str;
int
str_plus(str_t str)
{
if (str == 31)
return 3;
@ -563,9 +566,9 @@ register str_t str;
* add_dam:
* Compute additional damage done for exceptionally high or low strength
*/
add_dam(str)
register str_t str;
{
int
add_dam(str_t str)
{
if (str == 31)
return 6;
if (str > 21)
@ -587,7 +590,8 @@ register str_t str;
* raise_level:
* The guy just magically went up a level.
*/
raise_level()
void
raise_level(void)
{
pstats.s_exp = e_levels[pstats.s_lvl-1] + 1L;
check_level();
@ -597,9 +601,8 @@ raise_level()
* thunk:
* A missile hits a monster
*/
thunk(weap, mname)
register THING *weap;
register const char *mname;
void
thunk(THING *weap, const char *mname)
{
if (weap->o_type == WEAPON)
addmsg("the %s hits ", w_names[weap->o_which]);
@ -615,9 +618,8 @@ register const char *mname;
* bounce:
* A missile misses a monster
*/
bounce(weap, mname)
register THING *weap;
register const char *mname;
void
bounce(THING *weap, const char *mname)
{
if (weap->o_type == WEAPON)
addmsg("the %s misses ", w_names[weap->o_which]);
@ -633,10 +635,8 @@ register const char *mname;
* remove:
* Remove a monster from the screen
*/
remove_monster(mp, tp, waskill)
register coord *mp;
register THING *tp;
bool waskill;
void
remove_monster(coord *mp, THING *tp, bool waskill)
{
register THING *obj, *nexti;
@ -660,8 +660,8 @@ bool waskill;
* is_magic:
* Returns true if an object radiates magic
*/
is_magic(obj)
register THING *obj;
bool
is_magic(THING *obj)
{
switch (obj->o_type)
{
@ -683,9 +683,8 @@ register THING *obj;
* killed:
* Called to put a monster to death
*/
killed(tp, pr)
register THING *tp;
bool pr;
void
killed(THING *tp, bool pr)
{
pstats.s_exp += tp->t_stats.s_exp;
/*