switch source tree from k&r to c99
This commit is contained in:
123
src/role.c
123
src/role.c
@@ -714,24 +714,22 @@ const struct Align aligns[] = {
|
||||
{ "evil", "unaligned", "Una", 0, A_NONE }
|
||||
};
|
||||
|
||||
static int NDECL(randrole_filtered);
|
||||
static char *FDECL(promptsep, (char *, int));
|
||||
static int FDECL(role_gendercount, (int));
|
||||
static int FDECL(race_alignmentcount, (int));
|
||||
static int randrole_filtered(void);
|
||||
static char *promptsep(char *, int);
|
||||
static int role_gendercount(int);
|
||||
static int race_alignmentcount(int);
|
||||
|
||||
/* used by str2XXX() */
|
||||
static char NEARDATA randomstr[] = "random";
|
||||
|
||||
boolean
|
||||
validrole(rolenum)
|
||||
int rolenum;
|
||||
validrole(int rolenum)
|
||||
{
|
||||
return (boolean) (rolenum >= 0 && rolenum < SIZE(roles) - 1);
|
||||
}
|
||||
|
||||
int
|
||||
randrole(for_display)
|
||||
boolean for_display;
|
||||
randrole(boolean for_display)
|
||||
{
|
||||
int res = SIZE(roles) - 1;
|
||||
|
||||
@@ -743,7 +741,7 @@ boolean for_display;
|
||||
}
|
||||
|
||||
static int
|
||||
randrole_filtered()
|
||||
randrole_filtered(void)
|
||||
{
|
||||
int i, n = 0, set[SIZE(roles)];
|
||||
|
||||
@@ -759,8 +757,7 @@ randrole_filtered()
|
||||
}
|
||||
|
||||
int
|
||||
str2role(str)
|
||||
const char *str;
|
||||
str2role(const char *str)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
@@ -791,8 +788,7 @@ const char *str;
|
||||
}
|
||||
|
||||
boolean
|
||||
validrace(rolenum, racenum)
|
||||
int rolenum, racenum;
|
||||
validrace(int rolenum, int racenum)
|
||||
{
|
||||
/* Assumes validrole */
|
||||
return (boolean) (racenum >= 0 && racenum < SIZE(races) - 1
|
||||
@@ -801,8 +797,7 @@ int rolenum, racenum;
|
||||
}
|
||||
|
||||
int
|
||||
randrace(rolenum)
|
||||
int rolenum;
|
||||
randrace(int rolenum)
|
||||
{
|
||||
int i, n = 0;
|
||||
|
||||
@@ -828,8 +823,7 @@ int rolenum;
|
||||
}
|
||||
|
||||
int
|
||||
str2race(str)
|
||||
const char *str;
|
||||
str2race(const char *str)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
@@ -857,8 +851,7 @@ const char *str;
|
||||
}
|
||||
|
||||
boolean
|
||||
validgend(rolenum, racenum, gendnum)
|
||||
int rolenum, racenum, gendnum;
|
||||
validgend(int rolenum, int racenum, int gendnum)
|
||||
{
|
||||
/* Assumes validrole and validrace */
|
||||
return (boolean) (gendnum >= 0 && gendnum < ROLE_GENDERS
|
||||
@@ -867,8 +860,7 @@ int rolenum, racenum, gendnum;
|
||||
}
|
||||
|
||||
int
|
||||
randgend(rolenum, racenum)
|
||||
int rolenum, racenum;
|
||||
randgend(int rolenum, int racenum)
|
||||
{
|
||||
int i, n = 0;
|
||||
|
||||
@@ -895,8 +887,7 @@ int rolenum, racenum;
|
||||
}
|
||||
|
||||
int
|
||||
str2gend(str)
|
||||
const char *str;
|
||||
str2gend(const char *str)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
@@ -923,8 +914,7 @@ const char *str;
|
||||
}
|
||||
|
||||
boolean
|
||||
validalign(rolenum, racenum, alignnum)
|
||||
int rolenum, racenum, alignnum;
|
||||
validalign(int rolenum, int racenum, int alignnum)
|
||||
{
|
||||
/* Assumes validrole and validrace */
|
||||
return (boolean) (alignnum >= 0 && alignnum < ROLE_ALIGNS
|
||||
@@ -933,8 +923,7 @@ int rolenum, racenum, alignnum;
|
||||
}
|
||||
|
||||
int
|
||||
randalign(rolenum, racenum)
|
||||
int rolenum, racenum;
|
||||
randalign(int rolenum, int racenum)
|
||||
{
|
||||
int i, n = 0;
|
||||
|
||||
@@ -961,8 +950,7 @@ int rolenum, racenum;
|
||||
}
|
||||
|
||||
int
|
||||
str2align(str)
|
||||
const char *str;
|
||||
str2align(const char *str)
|
||||
{
|
||||
int i, len;
|
||||
|
||||
@@ -990,8 +978,7 @@ const char *str;
|
||||
|
||||
/* is rolenum compatible with any racenum/gendnum/alignnum constraints? */
|
||||
boolean
|
||||
ok_role(rolenum, racenum, gendnum, alignnum)
|
||||
int rolenum, racenum, gendnum, alignnum;
|
||||
ok_role(int rolenum, int racenum, int gendnum, int alignnum)
|
||||
{
|
||||
int i;
|
||||
short allow;
|
||||
@@ -1035,8 +1022,7 @@ int rolenum, racenum, gendnum, alignnum;
|
||||
/* If pickhow == PICK_RIGID a role is returned only if there is */
|
||||
/* a single possibility */
|
||||
int
|
||||
pick_role(racenum, gendnum, alignnum, pickhow)
|
||||
int racenum, gendnum, alignnum, pickhow;
|
||||
pick_role(int racenum, int gendnum, int alignnum, int pickhow)
|
||||
{
|
||||
int i;
|
||||
int roles_ok = 0, set[SIZE(roles)];
|
||||
@@ -1058,8 +1044,7 @@ int racenum, gendnum, alignnum, pickhow;
|
||||
|
||||
/* is racenum compatible with any rolenum/gendnum/alignnum constraints? */
|
||||
boolean
|
||||
ok_race(rolenum, racenum, gendnum, alignnum)
|
||||
int rolenum, racenum, gendnum, alignnum;
|
||||
ok_race(int rolenum, int racenum, int gendnum, int alignnum)
|
||||
{
|
||||
int i;
|
||||
short allow;
|
||||
@@ -1103,8 +1088,7 @@ int rolenum, racenum, gendnum, alignnum;
|
||||
If pickhow == PICK_RIGID a race is returned only if there is
|
||||
a single possibility. */
|
||||
int
|
||||
pick_race(rolenum, gendnum, alignnum, pickhow)
|
||||
int rolenum, gendnum, alignnum, pickhow;
|
||||
pick_race(int rolenum, int gendnum, int alignnum, int pickhow)
|
||||
{
|
||||
int i;
|
||||
int races_ok = 0;
|
||||
@@ -1130,9 +1114,7 @@ int rolenum, gendnum, alignnum, pickhow;
|
||||
/* is gendnum compatible with any rolenum/racenum/alignnum constraints? */
|
||||
/* gender and alignment are not comparable (and also not constrainable) */
|
||||
boolean
|
||||
ok_gend(rolenum, racenum, gendnum, alignnum)
|
||||
int rolenum, racenum, gendnum;
|
||||
int alignnum UNUSED;
|
||||
ok_gend(int rolenum, int racenum, int gendnum, int alignnum UNUSED)
|
||||
{
|
||||
int i;
|
||||
short allow;
|
||||
@@ -1171,8 +1153,7 @@ int alignnum UNUSED;
|
||||
/* If pickhow == PICK_RIGID a gender is returned only if there is */
|
||||
/* a single possibility */
|
||||
int
|
||||
pick_gend(rolenum, racenum, alignnum, pickhow)
|
||||
int rolenum, racenum, alignnum, pickhow;
|
||||
pick_gend(int rolenum, int racenum, int alignnum, int pickhow)
|
||||
{
|
||||
int i;
|
||||
int gends_ok = 0;
|
||||
@@ -1198,10 +1179,7 @@ int rolenum, racenum, alignnum, pickhow;
|
||||
/* is alignnum compatible with any rolenum/racenum/gendnum constraints? */
|
||||
/* alignment and gender are not comparable (and also not constrainable) */
|
||||
boolean
|
||||
ok_align(rolenum, racenum, gendnum, alignnum)
|
||||
int rolenum, racenum;
|
||||
int gendnum UNUSED;
|
||||
int alignnum;
|
||||
ok_align(int rolenum, int racenum, int gendnum UNUSED, int alignnum)
|
||||
{
|
||||
int i;
|
||||
short allow;
|
||||
@@ -1240,8 +1218,7 @@ int alignnum;
|
||||
If pickhow == PICK_RIGID an alignment is returned only if there is
|
||||
a single possibility. */
|
||||
int
|
||||
pick_align(rolenum, racenum, gendnum, pickhow)
|
||||
int rolenum, racenum, gendnum, pickhow;
|
||||
pick_align(int rolenum, int racenum, int gendnum, int pickhow)
|
||||
{
|
||||
int i;
|
||||
int aligns_ok = 0;
|
||||
@@ -1265,7 +1242,7 @@ int rolenum, racenum, gendnum, pickhow;
|
||||
}
|
||||
|
||||
void
|
||||
rigid_role_checks()
|
||||
rigid_role_checks(void)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
@@ -1314,8 +1291,7 @@ rigid_role_checks()
|
||||
}
|
||||
|
||||
boolean
|
||||
setrolefilter(bufp)
|
||||
const char *bufp;
|
||||
setrolefilter(const char *bufp)
|
||||
{
|
||||
int i;
|
||||
boolean reslt = TRUE;
|
||||
@@ -1334,7 +1310,7 @@ const char *bufp;
|
||||
}
|
||||
|
||||
boolean
|
||||
gotrolefilter()
|
||||
gotrolefilter(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1347,7 +1323,7 @@ gotrolefilter()
|
||||
}
|
||||
|
||||
void
|
||||
clearrolefilter()
|
||||
clearrolefilter(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -1357,9 +1333,7 @@ clearrolefilter()
|
||||
}
|
||||
|
||||
static char *
|
||||
promptsep(buf, num_post_attribs)
|
||||
char *buf;
|
||||
int num_post_attribs;
|
||||
promptsep(char *buf, int num_post_attribs)
|
||||
{
|
||||
const char *conjuct = "and ";
|
||||
|
||||
@@ -1374,8 +1348,7 @@ int num_post_attribs;
|
||||
}
|
||||
|
||||
static int
|
||||
role_gendercount(rolenum)
|
||||
int rolenum;
|
||||
role_gendercount(int rolenum)
|
||||
{
|
||||
int gendcount = 0;
|
||||
|
||||
@@ -1391,8 +1364,7 @@ int rolenum;
|
||||
}
|
||||
|
||||
static int
|
||||
race_alignmentcount(racenum)
|
||||
int racenum;
|
||||
race_alignmentcount(int racenum)
|
||||
{
|
||||
int aligncount = 0;
|
||||
|
||||
@@ -1408,10 +1380,9 @@ int racenum;
|
||||
}
|
||||
|
||||
char *
|
||||
root_plselection_prompt(suppliedbuf, buflen, rolenum, racenum, gendnum,
|
||||
alignnum)
|
||||
char *suppliedbuf;
|
||||
int buflen, rolenum, racenum, gendnum, alignnum;
|
||||
root_plselection_prompt(
|
||||
char *suppliedbuf, int buflen,
|
||||
int rolenum, int racenum, int gendnum, int alignnum)
|
||||
{
|
||||
int k, gendercount = 0, aligncount = 0;
|
||||
char buf[BUFSZ];
|
||||
@@ -1559,9 +1530,9 @@ int buflen, rolenum, racenum, gendnum, alignnum;
|
||||
}
|
||||
|
||||
char *
|
||||
build_plselection_prompt(buf, buflen, rolenum, racenum, gendnum, alignnum)
|
||||
char *buf;
|
||||
int buflen, rolenum, racenum, gendnum, alignnum;
|
||||
build_plselection_prompt(
|
||||
char *buf, int buflen,
|
||||
int rolenum, int racenum, int gendnum, int alignnum)
|
||||
{
|
||||
const char *defprompt = "Shall I pick a character for you? [ynaq] ";
|
||||
int num_post_attribs = 0;
|
||||
@@ -1641,7 +1612,7 @@ int buflen, rolenum, racenum, gendnum, alignnum;
|
||||
#undef NUM_BP
|
||||
|
||||
void
|
||||
plnamesuffix()
|
||||
plnamesuffix(void)
|
||||
{
|
||||
char *sptr, *eptr;
|
||||
int i;
|
||||
@@ -1696,9 +1667,7 @@ plnamesuffix()
|
||||
/* show current settings for name, role, race, gender, and alignment
|
||||
in the specified window */
|
||||
void
|
||||
role_selection_prolog(which, where)
|
||||
int which;
|
||||
winid where;
|
||||
role_selection_prolog(int which, winid where)
|
||||
{
|
||||
static const char NEARDATA choosing[] = " choosing now",
|
||||
not_yet[] = " not yet specified",
|
||||
@@ -1785,10 +1754,7 @@ winid where;
|
||||
|
||||
/* add a "pick alignment first"-type entry to the specified menu */
|
||||
void
|
||||
role_menu_extra(which, where, preselect)
|
||||
int which;
|
||||
winid where;
|
||||
boolean preselect;
|
||||
role_menu_extra(int which, winid where, boolean preselect)
|
||||
{
|
||||
static NEARDATA const char RS_menu_let[] = {
|
||||
'=', /* name */
|
||||
@@ -1952,7 +1918,7 @@ boolean preselect;
|
||||
* This code also replaces quest_init().
|
||||
*/
|
||||
void
|
||||
role_init()
|
||||
role_init(void)
|
||||
{
|
||||
int alignmnt;
|
||||
struct permonst *pm;
|
||||
@@ -2091,8 +2057,7 @@ role_init()
|
||||
}
|
||||
|
||||
const char *
|
||||
Hello(mtmp)
|
||||
struct monst *mtmp;
|
||||
Hello(struct monst* mtmp)
|
||||
{
|
||||
switch (Role_switch) {
|
||||
case PM_KNIGHT:
|
||||
@@ -2115,7 +2080,7 @@ struct monst *mtmp;
|
||||
}
|
||||
|
||||
const char *
|
||||
Goodbye()
|
||||
Goodbye(void)
|
||||
{
|
||||
switch (Role_switch) {
|
||||
case PM_KNIGHT:
|
||||
|
||||
Reference in New Issue
Block a user