switch source tree from k&r to c99
This commit is contained in:
81
src/o_init.c
81
src/o_init.c
@@ -5,16 +5,15 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static void FDECL(setgemprobs, (d_level *));
|
||||
static void FDECL(shuffle, (int, int, BOOLEAN_P));
|
||||
static void NDECL(shuffle_all);
|
||||
static boolean FDECL(interesting_to_discover, (int));
|
||||
static int FDECL(CFDECLSPEC discovered_cmp, (const genericptr,
|
||||
const genericptr));
|
||||
static char *FDECL(oclass_to_name, (CHAR_P, char *));
|
||||
static void setgemprobs(d_level *);
|
||||
static void shuffle(int, int, boolean);
|
||||
static void shuffle_all(void);
|
||||
static boolean interesting_to_discover(int);
|
||||
static int CFDECLSPEC discovered_cmp(const genericptr, const genericptr);
|
||||
static char *oclass_to_name(char, char *);
|
||||
|
||||
#ifdef USE_TILES
|
||||
static void NDECL(shuffle_tiles);
|
||||
static void shuffle_tiles(void);
|
||||
extern short glyph2tile[]; /* from tile.c */
|
||||
|
||||
/* Shuffle tile assignments to match descriptions, so a red potion isn't
|
||||
@@ -27,7 +26,7 @@ extern short glyph2tile[]; /* from tile.c */
|
||||
* another routine.
|
||||
*/
|
||||
static void
|
||||
shuffle_tiles()
|
||||
shuffle_tiles(void)
|
||||
{
|
||||
int i;
|
||||
short tmp_tilemap[NUM_OBJECTS];
|
||||
@@ -41,8 +40,7 @@ shuffle_tiles()
|
||||
#endif /* USE_TILES */
|
||||
|
||||
static void
|
||||
setgemprobs(dlev)
|
||||
d_level *dlev;
|
||||
setgemprobs(d_level* dlev)
|
||||
{
|
||||
int j, first, lev;
|
||||
|
||||
@@ -68,9 +66,7 @@ d_level *dlev;
|
||||
|
||||
/* shuffle descriptions on objects o_low to o_high */
|
||||
static void
|
||||
shuffle(o_low, o_high, domaterial)
|
||||
int o_low, o_high;
|
||||
boolean domaterial;
|
||||
shuffle(int o_low, int o_high, boolean domaterial)
|
||||
{
|
||||
int i, j, num_to_shuffle;
|
||||
short sw;
|
||||
@@ -108,7 +104,7 @@ boolean domaterial;
|
||||
}
|
||||
|
||||
void
|
||||
init_objects()
|
||||
init_objects(void)
|
||||
{
|
||||
int i, first, last, sum, prevoclass;
|
||||
char oclass;
|
||||
@@ -205,9 +201,9 @@ init_objects()
|
||||
|
||||
/* retrieve the range of objects that otyp shares descriptions with */
|
||||
void
|
||||
obj_shuffle_range(otyp, lo_p, hi_p)
|
||||
int otyp; /* input: representative item */
|
||||
int *lo_p, *hi_p; /* output: range that item belongs among */
|
||||
obj_shuffle_range(
|
||||
int otyp, /* input: representative item */
|
||||
int *lo_p, int *hi_p) /* output: range that item belongs among */
|
||||
{
|
||||
int i, ocls = objects[otyp].oc_class;
|
||||
|
||||
@@ -258,7 +254,7 @@ int *lo_p, *hi_p; /* output: range that item belongs among */
|
||||
|
||||
/* randomize object descriptions */
|
||||
static void
|
||||
shuffle_all()
|
||||
shuffle_all(void)
|
||||
{
|
||||
/* entire classes; obj_shuffle_range() handles their exceptions */
|
||||
static char shuffle_classes[] = {
|
||||
@@ -287,9 +283,7 @@ shuffle_all()
|
||||
/* Return TRUE if the provided string matches the unidentified description of
|
||||
* the provided object. */
|
||||
boolean
|
||||
objdescr_is(obj, descr)
|
||||
struct obj *obj;
|
||||
const char *descr;
|
||||
objdescr_is(struct obj* obj, const char * descr)
|
||||
{
|
||||
const char *objdescr;
|
||||
|
||||
@@ -306,7 +300,7 @@ const char *descr;
|
||||
|
||||
/* find the object index for snow boots; used [once] by slippery ice code */
|
||||
int
|
||||
find_skates()
|
||||
find_skates(void)
|
||||
{
|
||||
register int i;
|
||||
register const char *s;
|
||||
@@ -321,14 +315,13 @@ find_skates()
|
||||
|
||||
/* level dependent initialization */
|
||||
void
|
||||
oinit()
|
||||
oinit(void)
|
||||
{
|
||||
setgemprobs(&u.uz);
|
||||
}
|
||||
|
||||
void
|
||||
savenames(nhfp)
|
||||
NHFILE *nhfp;
|
||||
savenames(NHFILE* nhfp)
|
||||
{
|
||||
int i;
|
||||
unsigned int len;
|
||||
@@ -361,8 +354,7 @@ NHFILE *nhfp;
|
||||
}
|
||||
|
||||
void
|
||||
restnames(nhfp)
|
||||
NHFILE *nhfp;
|
||||
restnames(NHFILE* nhfp)
|
||||
{
|
||||
int i;
|
||||
unsigned int len = 0;
|
||||
@@ -390,10 +382,7 @@ NHFILE *nhfp;
|
||||
}
|
||||
|
||||
void
|
||||
discover_object(oindx, mark_as_known, credit_hero)
|
||||
register int oindx;
|
||||
boolean mark_as_known;
|
||||
boolean credit_hero;
|
||||
discover_object(int oindx, boolean mark_as_known, boolean credit_hero)
|
||||
{
|
||||
if (!objects[oindx].oc_name_known) {
|
||||
register int dindx, acls = objects[oindx].oc_class;
|
||||
@@ -423,8 +412,7 @@ boolean credit_hero;
|
||||
|
||||
/* if a class name has been cleared, we may need to purge it from disco[] */
|
||||
void
|
||||
undiscover_object(oindx)
|
||||
register int oindx;
|
||||
undiscover_object(int oindx)
|
||||
{
|
||||
if (!objects[oindx].oc_name_known) {
|
||||
register int dindx, acls = objects[oindx].oc_class;
|
||||
@@ -452,8 +440,7 @@ register int oindx;
|
||||
}
|
||||
|
||||
static boolean
|
||||
interesting_to_discover(i)
|
||||
register int i;
|
||||
interesting_to_discover(int i)
|
||||
{
|
||||
/* Pre-discovered objects are now printed with a '*' */
|
||||
return (boolean) (objects[i].oc_uname != (char *) 0
|
||||
@@ -469,9 +456,7 @@ static const short uniq_objs[] = {
|
||||
|
||||
/* discoveries qsort comparison function */
|
||||
static int CFDECLSPEC
|
||||
discovered_cmp(v1, v2)
|
||||
const genericptr v1;
|
||||
const genericptr v2;
|
||||
discovered_cmp(const genericptr v1, const genericptr v2)
|
||||
{
|
||||
const char *s1 = *(const char **) v1;
|
||||
const char *s2 = *(const char **) v2;
|
||||
@@ -485,9 +470,7 @@ const genericptr v2;
|
||||
}
|
||||
|
||||
static char *
|
||||
sortloot_descr(otyp, outbuf)
|
||||
int otyp;
|
||||
char *outbuf;
|
||||
sortloot_descr(int otyp,char * outbuf)
|
||||
{
|
||||
Loot sl_cookie;
|
||||
struct obj o;
|
||||
@@ -528,8 +511,8 @@ const char *const disco_orders_descr[] = {
|
||||
};
|
||||
|
||||
int
|
||||
choose_disco_sort(mode)
|
||||
int mode; /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */
|
||||
choose_disco_sort(
|
||||
int mode) /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */
|
||||
{
|
||||
winid tmpwin;
|
||||
menu_item *selected;
|
||||
@@ -582,7 +565,7 @@ int mode; /* 0 => 'O' cmd, 1 => full discoveries; 2 => class discoveries */
|
||||
|
||||
/* the '\' command - show discovered object types */
|
||||
int
|
||||
dodiscovered() /* free after Robert Viduya */
|
||||
dodiscovered(void) /* free after Robert Viduya */
|
||||
{
|
||||
winid tmpwin;
|
||||
char *s, *p, oclass, prev_class,
|
||||
@@ -701,9 +684,7 @@ dodiscovered() /* free after Robert Viduya */
|
||||
|
||||
/* lower case let_to_name() output, which differs from def_oc_syms[].name */
|
||||
static char *
|
||||
oclass_to_name(oclass, buf)
|
||||
char oclass;
|
||||
char *buf;
|
||||
oclass_to_name(char oclass, char *buf)
|
||||
{
|
||||
char *s;
|
||||
|
||||
@@ -715,7 +696,7 @@ char *buf;
|
||||
|
||||
/* the '`' command - show discovered object types for one class */
|
||||
int
|
||||
doclassdisco()
|
||||
doclassdisco(void)
|
||||
{
|
||||
static NEARDATA const char
|
||||
prompt[] = "View discoveries for which sort of objects?",
|
||||
@@ -916,7 +897,7 @@ doclassdisco()
|
||||
|
||||
/* put up nameable subset of discoveries list as a menu */
|
||||
void
|
||||
rename_disco()
|
||||
rename_disco(void)
|
||||
{
|
||||
register int i, dis;
|
||||
int ct = 0, mn = 0, sl;
|
||||
|
||||
Reference in New Issue
Block a user