switch source tree from k&r to c99
This commit is contained in:
348
src/objnam.c
348
src/objnam.c
@@ -30,27 +30,27 @@ struct _readobjnam_data {
|
||||
struct obj *otmp;
|
||||
};
|
||||
|
||||
static char *FDECL(strprepend, (char *, const char *));
|
||||
static char *NDECL(nextobuf);
|
||||
static void FDECL(releaseobuf, (char *));
|
||||
static char *FDECL(xname_flags, (struct obj *, unsigned));
|
||||
static char *FDECL(minimal_xname, (struct obj *));
|
||||
static void FDECL(add_erosion_words, (struct obj *, char *));
|
||||
static char *FDECL(doname_base, (struct obj *obj, unsigned));
|
||||
static boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P,
|
||||
const char *const *));
|
||||
static char *FDECL(singplur_compound, (char *));
|
||||
static boolean FDECL(badman, (const char *, BOOLEAN_P));
|
||||
static boolean FDECL(wishymatch, (const char *, const char *, BOOLEAN_P));
|
||||
static short FDECL(rnd_otyp_by_wpnskill, (SCHAR_P));
|
||||
static short FDECL(rnd_otyp_by_namedesc, (const char *, CHAR_P, int));
|
||||
static struct obj *FDECL(wizterrainwish, (char *, char *, int, int));
|
||||
static void FDECL(readobjnam_init, (char *, struct _readobjnam_data *));
|
||||
static int FDECL(readobjnam_preparse, (struct _readobjnam_data *));
|
||||
static void FDECL(readobjnam_parse_charges, (struct _readobjnam_data *));
|
||||
static int FDECL(readobjnam_postparse1, (struct _readobjnam_data *));
|
||||
static int FDECL(readobjnam_postparse2, (struct _readobjnam_data *));
|
||||
static int FDECL(readobjnam_postparse3, (struct _readobjnam_data *));
|
||||
static char *strprepend(char *, const char *);
|
||||
static char *nextobuf(void);
|
||||
static void releaseobuf(char *);
|
||||
static char *xname_flags(struct obj *, unsigned);
|
||||
static char *minimal_xname(struct obj *);
|
||||
static void add_erosion_words(struct obj *, char *);
|
||||
static char *doname_base(struct obj *obj, unsigned);
|
||||
static boolean singplur_lookup(char *, char *, boolean,
|
||||
const char *const *);
|
||||
static char *singplur_compound(char *);
|
||||
static boolean badman(const char *, boolean);
|
||||
static boolean wishymatch(const char *, const char *, boolean);
|
||||
static short rnd_otyp_by_wpnskill(schar);
|
||||
static short rnd_otyp_by_namedesc(const char *, char, int);
|
||||
static struct obj *wizterrainwish(char *, char *, int, int);
|
||||
static void readobjnam_init(char *, struct _readobjnam_data *);
|
||||
static int readobjnam_preparse(struct _readobjnam_data *);
|
||||
static void readobjnam_parse_charges(struct _readobjnam_data *);
|
||||
static int readobjnam_postparse1(struct _readobjnam_data *);
|
||||
static int readobjnam_postparse2(struct _readobjnam_data *);
|
||||
static int readobjnam_postparse3(struct _readobjnam_data *);
|
||||
|
||||
struct Jitem {
|
||||
int item;
|
||||
@@ -84,12 +84,10 @@ static struct Jitem Japanese_items[] = { { SHORT_SWORD, "wakizashi" },
|
||||
{ POT_BOOZE, "sake" },
|
||||
{ 0, "" } };
|
||||
|
||||
static const char *FDECL(Japanese_item_name, (int i));
|
||||
static const char *Japanese_item_name(int i);
|
||||
|
||||
static char *
|
||||
strprepend(s, pref)
|
||||
register char *s;
|
||||
register const char *pref;
|
||||
strprepend(char *s,const char * pref)
|
||||
{
|
||||
register int i = (int) strlen(pref);
|
||||
|
||||
@@ -107,7 +105,7 @@ static char NEARDATA obufs[NUMOBUF][BUFSZ];
|
||||
static int obufidx = 0;
|
||||
|
||||
static char *
|
||||
nextobuf()
|
||||
nextobuf(void)
|
||||
{
|
||||
obufidx = (obufidx + 1) % NUMOBUF;
|
||||
return obufs[obufidx];
|
||||
@@ -115,8 +113,7 @@ nextobuf()
|
||||
|
||||
/* put the most recently allocated buffer back if possible */
|
||||
static void
|
||||
releaseobuf(bufp)
|
||||
char *bufp;
|
||||
releaseobuf(char *bufp)
|
||||
{
|
||||
/* caller may not know whether bufp is the most recently allocated
|
||||
buffer; if it isn't, do nothing; note that because of the somewhat
|
||||
@@ -129,8 +126,7 @@ char *bufp;
|
||||
}
|
||||
|
||||
char *
|
||||
obj_typename(otyp)
|
||||
register int otyp;
|
||||
obj_typename(int otyp)
|
||||
{
|
||||
char *buf = nextobuf();
|
||||
struct objclass *ocl = &objects[otyp];
|
||||
@@ -211,8 +207,7 @@ register int otyp;
|
||||
/* less verbose result than obj_typename(); either the actual name
|
||||
or the description (but not both); user-assigned name is ignored */
|
||||
char *
|
||||
simple_typename(otyp)
|
||||
int otyp;
|
||||
simple_typename(int otyp)
|
||||
{
|
||||
char *bufp, *pp, *save_uname = objects[otyp].oc_uname;
|
||||
|
||||
@@ -226,8 +221,7 @@ int otyp;
|
||||
|
||||
/* typename for debugging feedback where data involved might be suspect */
|
||||
char *
|
||||
safe_typename(otyp)
|
||||
int otyp;
|
||||
safe_typename(int otyp)
|
||||
{
|
||||
unsigned save_nameknown;
|
||||
char *res = 0;
|
||||
@@ -247,8 +241,7 @@ int otyp;
|
||||
}
|
||||
|
||||
boolean
|
||||
obj_is_pname(obj)
|
||||
struct obj *obj;
|
||||
obj_is_pname(struct obj* obj)
|
||||
{
|
||||
if (!obj->oartifact || !has_oname(obj))
|
||||
return FALSE;
|
||||
@@ -263,9 +256,7 @@ struct obj *obj;
|
||||
* we don't want to set dknown if it's not set already.
|
||||
*/
|
||||
char *
|
||||
distant_name(obj, func)
|
||||
struct obj *obj;
|
||||
char *FDECL((*func), (OBJ_P));
|
||||
distant_name(struct obj* obj, char* (*func)(OBJ_P))
|
||||
{
|
||||
char *str;
|
||||
|
||||
@@ -286,8 +277,8 @@ char *FDECL((*func), (OBJ_P));
|
||||
/* convert player specified fruit name into corresponding fruit juice name
|
||||
("slice of pizza" -> "pizza juice" rather than "slice of pizza juice") */
|
||||
char *
|
||||
fruitname(juice)
|
||||
boolean juice; /* whether or not to append " juice" to the name */
|
||||
fruitname(
|
||||
boolean juice) /* whether or not to append " juice" to the name */
|
||||
{
|
||||
char *buf = nextobuf();
|
||||
const char *fruit_nam = strstri(g.pl_fruit, " of ");
|
||||
@@ -303,8 +294,7 @@ boolean juice; /* whether or not to append " juice" to the name */
|
||||
|
||||
/* look up a named fruit by index (1..127) */
|
||||
struct fruit *
|
||||
fruit_from_indx(indx)
|
||||
int indx;
|
||||
fruit_from_indx(int indx)
|
||||
{
|
||||
struct fruit *f;
|
||||
|
||||
@@ -316,10 +306,10 @@ int indx;
|
||||
|
||||
/* look up a named fruit by name */
|
||||
struct fruit *
|
||||
fruit_from_name(fname, exact, highest_fid)
|
||||
const char *fname;
|
||||
boolean exact; /* False => prefix or exact match, True = exact match only */
|
||||
int *highest_fid; /* optional output; only valid if 'fname' isn't found */
|
||||
fruit_from_name(
|
||||
const char *fname,
|
||||
boolean exact, /* False => prefix or exact match, True = exact match only */
|
||||
int *highest_fid) /* optional output; only valid if 'fname' isn't found */
|
||||
{
|
||||
struct fruit *f, *tentativef;
|
||||
char *altfname;
|
||||
@@ -396,8 +386,7 @@ int *highest_fid; /* optional output; only valid if 'fname' isn't found */
|
||||
|
||||
/* sort the named-fruit linked list by fruit index number */
|
||||
void
|
||||
reorder_fruit(forward)
|
||||
boolean forward;
|
||||
reorder_fruit(boolean forward)
|
||||
{
|
||||
struct fruit *f, *allfr[1 + 127];
|
||||
int i, j, k = SIZE(allfr);
|
||||
@@ -431,16 +420,15 @@ boolean forward;
|
||||
}
|
||||
|
||||
char *
|
||||
xname(obj)
|
||||
struct obj *obj;
|
||||
xname(struct obj* obj)
|
||||
{
|
||||
return xname_flags(obj, CXN_NORMAL);
|
||||
}
|
||||
|
||||
static char *
|
||||
xname_flags(obj, cxn_flags)
|
||||
register struct obj *obj;
|
||||
unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
xname_flags(
|
||||
register struct obj *obj,
|
||||
unsigned cxn_flags) /* bitmask of CXN_xxx values */
|
||||
{
|
||||
register char *buf;
|
||||
register int typ = obj->otyp;
|
||||
@@ -787,8 +775,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
potion of object detection -- if discovered
|
||||
*/
|
||||
static char *
|
||||
minimal_xname(obj)
|
||||
struct obj *obj;
|
||||
minimal_xname(struct obj* obj)
|
||||
{
|
||||
char *bufp;
|
||||
struct obj bareobj;
|
||||
@@ -832,8 +819,7 @@ struct obj *obj;
|
||||
|
||||
/* xname() output augmented for multishot missile feedback */
|
||||
char *
|
||||
mshot_xname(obj)
|
||||
struct obj *obj;
|
||||
mshot_xname(struct obj* obj)
|
||||
{
|
||||
char tmpbuf[BUFSZ];
|
||||
char *onm = xname(obj);
|
||||
@@ -849,8 +835,7 @@ struct obj *obj;
|
||||
|
||||
/* used for naming "the unique_item" instead of "a unique_item" */
|
||||
boolean
|
||||
the_unique_obj(obj)
|
||||
struct obj *obj;
|
||||
the_unique_obj(struct obj* obj)
|
||||
{
|
||||
boolean known = (obj->known || iflags.override_ID);
|
||||
|
||||
@@ -865,8 +850,7 @@ struct obj *obj;
|
||||
|
||||
/* should monster type be prefixed with "the"? (mostly used for corpses) */
|
||||
boolean
|
||||
the_unique_pm(ptr)
|
||||
struct permonst *ptr;
|
||||
the_unique_pm(struct permonst* ptr)
|
||||
{
|
||||
boolean uniq;
|
||||
|
||||
@@ -888,9 +872,7 @@ struct permonst *ptr;
|
||||
}
|
||||
|
||||
static void
|
||||
add_erosion_words(obj, prefix)
|
||||
struct obj *obj;
|
||||
char *prefix;
|
||||
add_erosion_words(struct obj* obj, char* prefix)
|
||||
{
|
||||
boolean iscrys = (obj->otyp == CRYSKNIFE);
|
||||
boolean rknown;
|
||||
@@ -939,8 +921,7 @@ char *prefix;
|
||||
|
||||
/* used to prevent rust on items where rust makes no difference */
|
||||
boolean
|
||||
erosion_matters(obj)
|
||||
struct obj *obj;
|
||||
erosion_matters(struct obj* obj)
|
||||
{
|
||||
switch (obj->oclass) {
|
||||
case TOOL_CLASS:
|
||||
@@ -966,9 +947,7 @@ struct obj *obj;
|
||||
#define DONAME_VAGUE_QUAN 2
|
||||
|
||||
static char *
|
||||
doname_base(obj, doname_flags)
|
||||
struct obj *obj;
|
||||
unsigned doname_flags;
|
||||
doname_base(struct obj* obj, unsigned int doname_flags)
|
||||
{
|
||||
boolean ispoisoned = FALSE,
|
||||
with_price = (doname_flags & DONAME_WITH_PRICE) != 0,
|
||||
@@ -1340,24 +1319,21 @@ unsigned doname_flags;
|
||||
}
|
||||
|
||||
char *
|
||||
doname(obj)
|
||||
struct obj *obj;
|
||||
doname(struct obj* obj)
|
||||
{
|
||||
return doname_base(obj, (unsigned) 0);
|
||||
}
|
||||
|
||||
/* Name of object including price. */
|
||||
char *
|
||||
doname_with_price(obj)
|
||||
struct obj *obj;
|
||||
doname_with_price(struct obj* obj)
|
||||
{
|
||||
return doname_base(obj, DONAME_WITH_PRICE);
|
||||
}
|
||||
|
||||
/* "some" instead of precise quantity if obj->dknown not set */
|
||||
char *
|
||||
doname_vague_quan(obj)
|
||||
struct obj *obj;
|
||||
doname_vague_quan(struct obj* obj)
|
||||
{
|
||||
/* Used by farlook.
|
||||
* If it hasn't been seen up close and quantity is more than one,
|
||||
@@ -1376,8 +1352,7 @@ struct obj *obj;
|
||||
|
||||
/* used from invent.c */
|
||||
boolean
|
||||
not_fully_identified(otmp)
|
||||
struct obj *otmp;
|
||||
not_fully_identified(struct obj* otmp)
|
||||
{
|
||||
/* gold doesn't have any interesting attributes [yet?] */
|
||||
if (otmp->oclass == COIN_CLASS)
|
||||
@@ -1415,10 +1390,10 @@ struct obj *otmp;
|
||||
/* format a corpse name (xname() omits monster type; doname() calls us);
|
||||
eatcorpse() also uses us for death reason when eating tainted glob */
|
||||
char *
|
||||
corpse_xname(otmp, adjective, cxn_flags)
|
||||
struct obj *otmp;
|
||||
const char *adjective;
|
||||
unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
corpse_xname(
|
||||
struct obj *otmp,
|
||||
const char *adjective,
|
||||
unsigned cxn_flags) /* bitmask of CXN_xxx values */
|
||||
{
|
||||
/* some callers [aobjnam()] rely on prefix area that xname() sets aside */
|
||||
char *nambuf = nextobuf() + PREFIX;
|
||||
@@ -1510,8 +1485,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */
|
||||
|
||||
/* xname doesn't include monster type for "corpse"; cxname does */
|
||||
char *
|
||||
cxname(obj)
|
||||
struct obj *obj;
|
||||
cxname(struct obj* obj)
|
||||
{
|
||||
if (obj->otyp == CORPSE)
|
||||
return corpse_xname(obj, (const char *) 0, CXN_NORMAL);
|
||||
@@ -1520,8 +1494,7 @@ struct obj *obj;
|
||||
|
||||
/* like cxname, but ignores quantity */
|
||||
char *
|
||||
cxname_singular(obj)
|
||||
struct obj *obj;
|
||||
cxname_singular(struct obj* obj)
|
||||
{
|
||||
if (obj->otyp == CORPSE)
|
||||
return corpse_xname(obj, (const char *) 0, CXN_SINGULAR);
|
||||
@@ -1530,8 +1503,7 @@ struct obj *obj;
|
||||
|
||||
/* treat an object as fully ID'd when it might be used as reason for death */
|
||||
char *
|
||||
killer_xname(obj)
|
||||
struct obj *obj;
|
||||
killer_xname(struct obj* obj)
|
||||
{
|
||||
struct obj save_obj;
|
||||
unsigned save_ocknown;
|
||||
@@ -1597,11 +1569,11 @@ struct obj *obj;
|
||||
|
||||
/* xname,doname,&c with long results reformatted to omit some stuff */
|
||||
char *
|
||||
short_oname(obj, func, altfunc, lenlimit)
|
||||
struct obj *obj;
|
||||
char *FDECL((*func), (OBJ_P)), /* main formatting routine */
|
||||
*FDECL((*altfunc), (OBJ_P)); /* alternate for shortest result */
|
||||
unsigned lenlimit;
|
||||
short_oname(
|
||||
struct obj *obj,
|
||||
char *(*func)(OBJ_P), /* main formatting routine */
|
||||
char *(*altfunc)(OBJ_P), /* alternate for shortest result */
|
||||
unsigned lenlimit)
|
||||
{
|
||||
struct obj save_obj;
|
||||
char unamebuf[12], onamebuf[12], *save_oname, *save_uname, *outbuf;
|
||||
@@ -1679,9 +1651,7 @@ unsigned lenlimit;
|
||||
* Used if only one of a collection of objects is named (e.g. in eat.c).
|
||||
*/
|
||||
const char *
|
||||
singular(otmp, func)
|
||||
register struct obj *otmp;
|
||||
char *FDECL((*func), (OBJ_P));
|
||||
singular(struct obj* otmp, char* (*func)(OBJ_P))
|
||||
{
|
||||
long savequan;
|
||||
char *nam;
|
||||
@@ -1699,9 +1669,7 @@ char *FDECL((*func), (OBJ_P));
|
||||
|
||||
/* pick "", "a ", or "an " as article for 'str'; used by an() and doname() */
|
||||
char *
|
||||
just_an(outbuf, str)
|
||||
char *outbuf;
|
||||
const char *str;
|
||||
just_an(char *outbuf, const char *str)
|
||||
{
|
||||
char c0;
|
||||
|
||||
@@ -1726,8 +1694,7 @@ const char *str;
|
||||
}
|
||||
|
||||
char *
|
||||
an(str)
|
||||
const char *str;
|
||||
an(const char* str)
|
||||
{
|
||||
char *buf = nextobuf();
|
||||
|
||||
@@ -1740,8 +1707,7 @@ const char *str;
|
||||
}
|
||||
|
||||
char *
|
||||
An(str)
|
||||
const char *str;
|
||||
An(const char* str)
|
||||
{
|
||||
char *tmp = an(str);
|
||||
|
||||
@@ -1754,8 +1720,7 @@ const char *str;
|
||||
* Use type_is_pname() for monster names, not the(). the() is idempotent.
|
||||
*/
|
||||
char *
|
||||
the(str)
|
||||
const char *str;
|
||||
the(const char* str)
|
||||
{
|
||||
char *buf = nextobuf();
|
||||
boolean insert_the = FALSE;
|
||||
@@ -1810,8 +1775,7 @@ const char *str;
|
||||
}
|
||||
|
||||
char *
|
||||
The(str)
|
||||
const char *str;
|
||||
The(const char* str)
|
||||
{
|
||||
char *tmp = the(str);
|
||||
|
||||
@@ -1821,9 +1785,7 @@ const char *str;
|
||||
|
||||
/* returns "count cxname(otmp)" or just cxname(otmp) if count == 1 */
|
||||
char *
|
||||
aobjnam(otmp, verb)
|
||||
struct obj *otmp;
|
||||
const char *verb;
|
||||
aobjnam(struct obj* otmp, const char* verb)
|
||||
{
|
||||
char prefix[PREFIX];
|
||||
char *bp = cxname(otmp);
|
||||
@@ -1841,9 +1803,7 @@ const char *verb;
|
||||
|
||||
/* combine yname and aobjnam eg "your count cxname(otmp)" */
|
||||
char *
|
||||
yobjnam(obj, verb)
|
||||
struct obj *obj;
|
||||
const char *verb;
|
||||
yobjnam(struct obj* obj, const char *verb)
|
||||
{
|
||||
char *s = aobjnam(obj, verb);
|
||||
|
||||
@@ -1861,9 +1821,7 @@ const char *verb;
|
||||
|
||||
/* combine Yname2 and aobjnam eg "Your count cxname(otmp)" */
|
||||
char *
|
||||
Yobjnam2(obj, verb)
|
||||
struct obj *obj;
|
||||
const char *verb;
|
||||
Yobjnam2(struct obj* obj, const char *verb)
|
||||
{
|
||||
register char *s = yobjnam(obj, verb);
|
||||
|
||||
@@ -1873,9 +1831,7 @@ const char *verb;
|
||||
|
||||
/* like aobjnam, but prepend "The", not count, and use xname */
|
||||
char *
|
||||
Tobjnam(otmp, verb)
|
||||
struct obj *otmp;
|
||||
const char *verb;
|
||||
Tobjnam(struct obj* otmp, const char *verb)
|
||||
{
|
||||
char *bp = The(xname(otmp));
|
||||
|
||||
@@ -1888,8 +1844,7 @@ const char *verb;
|
||||
|
||||
/* capitalized variant of doname() */
|
||||
char *
|
||||
Doname2(obj)
|
||||
struct obj *obj;
|
||||
Doname2(struct obj* obj)
|
||||
{
|
||||
char *s = doname(obj);
|
||||
|
||||
@@ -1900,8 +1855,7 @@ struct obj *obj;
|
||||
#if 0 /* stalled-out work in progress */
|
||||
/* Doname2() for itemized buying of 'obj' from a shop */
|
||||
char *
|
||||
payDoname(obj)
|
||||
struct obj *obj;
|
||||
payDoname(struct obj* obj)
|
||||
{
|
||||
static const char and_contents[] = " and its contents";
|
||||
char *p = doname(obj);
|
||||
@@ -1923,8 +1877,7 @@ struct obj *obj;
|
||||
|
||||
/* returns "[your ]xname(obj)" or "Foobar's xname(obj)" or "the xname(obj)" */
|
||||
char *
|
||||
yname(obj)
|
||||
struct obj *obj;
|
||||
yname(struct obj* obj)
|
||||
{
|
||||
char *s = cxname(obj);
|
||||
|
||||
@@ -1943,8 +1896,7 @@ struct obj *obj;
|
||||
|
||||
/* capitalized variant of yname() */
|
||||
char *
|
||||
Yname2(obj)
|
||||
struct obj *obj;
|
||||
Yname2(struct obj* obj)
|
||||
{
|
||||
char *s = yname(obj);
|
||||
|
||||
@@ -1957,8 +1909,7 @@ struct obj *obj;
|
||||
* or "the minimal_xname(obj)"
|
||||
*/
|
||||
char *
|
||||
ysimple_name(obj)
|
||||
struct obj *obj;
|
||||
ysimple_name(struct obj* obj)
|
||||
{
|
||||
char *outbuf = nextobuf();
|
||||
char *s = shk_your(outbuf, obj); /* assert( s == outbuf ); */
|
||||
@@ -1969,8 +1920,7 @@ struct obj *obj;
|
||||
|
||||
/* capitalized variant of ysimple_name() */
|
||||
char *
|
||||
Ysimple_name2(obj)
|
||||
struct obj *obj;
|
||||
Ysimple_name2(struct obj* obj)
|
||||
{
|
||||
char *s = ysimple_name(obj);
|
||||
|
||||
@@ -1980,8 +1930,7 @@ struct obj *obj;
|
||||
|
||||
/* "scroll" or "scrolls" */
|
||||
char *
|
||||
simpleonames(obj)
|
||||
struct obj *obj;
|
||||
simpleonames(struct obj* obj)
|
||||
{
|
||||
char *simpleoname = minimal_xname(obj);
|
||||
|
||||
@@ -1992,8 +1941,7 @@ struct obj *obj;
|
||||
|
||||
/* "a scroll" or "scrolls"; "a silver bell" or "the Bell of Opening" */
|
||||
char *
|
||||
ansimpleoname(obj)
|
||||
struct obj *obj;
|
||||
ansimpleoname(struct obj* obj)
|
||||
{
|
||||
char *simpleoname = simpleonames(obj);
|
||||
int otyp = obj->otyp;
|
||||
@@ -2015,8 +1963,7 @@ struct obj *obj;
|
||||
|
||||
/* "the scroll" or "the scrolls" */
|
||||
char *
|
||||
thesimpleoname(obj)
|
||||
struct obj *obj;
|
||||
thesimpleoname(struct obj* obj)
|
||||
{
|
||||
char *simpleoname = simpleonames(obj);
|
||||
|
||||
@@ -2025,8 +1972,7 @@ struct obj *obj;
|
||||
|
||||
/* artifact's name without any object type or known/dknown/&c feedback */
|
||||
char *
|
||||
bare_artifactname(obj)
|
||||
struct obj *obj;
|
||||
bare_artifactname(struct obj* obj)
|
||||
{
|
||||
char *outbuf;
|
||||
|
||||
@@ -2055,9 +2001,7 @@ static const char wrpsym[] = { WAND_CLASS, RING_CLASS, POTION_CLASS,
|
||||
|
||||
/* return form of the verb (input plural) if xname(otmp) were the subject */
|
||||
char *
|
||||
otense(otmp, verb)
|
||||
struct obj *otmp;
|
||||
const char *verb;
|
||||
otense(struct obj* otmp,const char * verb)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
@@ -2089,9 +2033,7 @@ static const char *const special_subjs[] = {
|
||||
|
||||
/* return form of the verb (input plural) for present tense 3rd person subj */
|
||||
char *
|
||||
vtense(subj, verb)
|
||||
register const char *subj;
|
||||
register const char *verb;
|
||||
vtense(const char* subj, const char* verb)
|
||||
{
|
||||
char *buf = nextobuf(), *bspot;
|
||||
int len, ltmp;
|
||||
@@ -2234,10 +2176,10 @@ static const char *const as_is[] = {
|
||||
|
||||
/* singularize/pluralize decisions common to both makesingular & makeplural */
|
||||
static boolean
|
||||
singplur_lookup(basestr, endstring, to_plural, alt_as_is)
|
||||
char *basestr, *endstring; /* base string, pointer to eos(string) */
|
||||
boolean to_plural; /* true => makeplural, false => makesingular */
|
||||
const char *const *alt_as_is; /* another set like as_is[] */
|
||||
singplur_lookup(
|
||||
char *basestr, char *endstring, /* base string, pointer to eos(string) */
|
||||
boolean to_plural, /* true => makeplural, false => makesingular */
|
||||
const char *const *alt_as_is) /* another set like as_is[] */
|
||||
{
|
||||
const struct sing_plur *sp;
|
||||
const char *same, *other, *const *as;
|
||||
@@ -2309,8 +2251,7 @@ const char *const *alt_as_is; /* another set like as_is[] */
|
||||
|
||||
/* searches for common compounds, ex. lump of royal jelly */
|
||||
static char *
|
||||
singplur_compound(str)
|
||||
char *str;
|
||||
singplur_compound(char *str)
|
||||
{
|
||||
/* if new entries are added, be sure to keep compound_start[] in sync */
|
||||
static const char *const compounds[] =
|
||||
@@ -2362,8 +2303,7 @@ char *str;
|
||||
* 3.6.0: made case-insensitive.
|
||||
*/
|
||||
char *
|
||||
makeplural(oldstr)
|
||||
const char *oldstr;
|
||||
makeplural(const char* oldstr)
|
||||
{
|
||||
register char *spot;
|
||||
char lo_c, *str = nextobuf();
|
||||
@@ -2561,8 +2501,7 @@ const char *oldstr;
|
||||
* 3.6.0: made case-insensitive.
|
||||
*/
|
||||
char *
|
||||
makesingular(oldstr)
|
||||
const char *oldstr;
|
||||
makesingular(const char* oldstr)
|
||||
{
|
||||
register char *p, *bp;
|
||||
const char *excess = 0;
|
||||
@@ -2691,9 +2630,9 @@ const char *oldstr;
|
||||
}
|
||||
|
||||
static boolean
|
||||
badman(basestr, to_plural)
|
||||
const char *basestr;
|
||||
boolean to_plural; /* true => makeplural, false => makesingular */
|
||||
badman(
|
||||
const char *basestr,
|
||||
boolean to_plural) /* true => makeplural, false => makesingular */
|
||||
{
|
||||
/* these are all the prefixes for *man that don't have a *men plural */
|
||||
static const char *no_men[] = {
|
||||
@@ -2740,10 +2679,10 @@ boolean to_plural; /* true => makeplural, false => makesingular */
|
||||
|
||||
/* compare user string against object name string using fuzzy matching */
|
||||
static boolean
|
||||
wishymatch(u_str, o_str, retry_inverted)
|
||||
const char *u_str; /* from user, so might be variant spelling */
|
||||
const char *o_str; /* from objects[], so is in canonical form */
|
||||
boolean retry_inverted; /* optional extra "of" handling */
|
||||
wishymatch(
|
||||
const char *u_str, /* from user, so might be variant spelling */
|
||||
const char *o_str, /* from objects[], so is in canonical form */
|
||||
boolean retry_inverted) /* optional extra "of" handling */
|
||||
{
|
||||
static NEARDATA const char detect_SP[] = "detect ",
|
||||
SP_detection[] = " detection";
|
||||
@@ -2922,8 +2861,7 @@ static const struct alt_spellings {
|
||||
};
|
||||
|
||||
static short
|
||||
rnd_otyp_by_wpnskill(skill)
|
||||
schar skill;
|
||||
rnd_otyp_by_wpnskill(schar skill)
|
||||
{
|
||||
int i, n = 0;
|
||||
short otyp = STRANGE_OBJECT;
|
||||
@@ -2946,10 +2884,10 @@ schar skill;
|
||||
}
|
||||
|
||||
static short
|
||||
rnd_otyp_by_namedesc(name, oclass, xtra_prob)
|
||||
const char *name;
|
||||
char oclass;
|
||||
int xtra_prob; /* to force 0% random generation items to also be considered */
|
||||
rnd_otyp_by_namedesc(
|
||||
const char *name,
|
||||
char oclass,
|
||||
int xtra_prob) /* to force 0% random generation items to also be considered */
|
||||
{
|
||||
int i, n = 0;
|
||||
short validobjs[NUM_OBJECTS];
|
||||
@@ -3022,17 +2960,14 @@ int xtra_prob; /* to force 0% random generation items to also be considered */
|
||||
}
|
||||
|
||||
int
|
||||
shiny_obj(oclass)
|
||||
char oclass;
|
||||
shiny_obj(char oclass)
|
||||
{
|
||||
return (int) rnd_otyp_by_namedesc("shiny", oclass, 0);
|
||||
}
|
||||
|
||||
/* in wizard mode, readobjnam() can accept wishes for traps and terrain */
|
||||
static struct obj *
|
||||
wizterrainwish(bp, p, locked, trapped)
|
||||
char *bp, *p;
|
||||
int locked, trapped;
|
||||
wizterrainwish(char* bp, char* p, int locked, int trapped)
|
||||
{
|
||||
struct rm *lev;
|
||||
boolean madeterrain = FALSE, badterrain = FALSE, didblock;
|
||||
@@ -3260,9 +3195,7 @@ int locked, trapped;
|
||||
#define SPINACH 2
|
||||
|
||||
static void
|
||||
readobjnam_init(bp, d)
|
||||
char *bp;
|
||||
struct _readobjnam_data *d;
|
||||
readobjnam_init(char* bp, struct _readobjnam_data* d)
|
||||
{
|
||||
d->cnt = d->spe = d->spesgn = d->typ = 0;
|
||||
d->very = d->rechrg = d->blessed = d->uncursed = d->iscursed
|
||||
@@ -3286,8 +3219,7 @@ struct _readobjnam_data *d;
|
||||
}
|
||||
|
||||
static int
|
||||
readobjnam_preparse(d)
|
||||
struct _readobjnam_data *d;
|
||||
readobjnam_preparse(struct _readobjnam_data* d)
|
||||
{
|
||||
for (;;) {
|
||||
register int l;
|
||||
@@ -3428,8 +3360,7 @@ struct _readobjnam_data *d;
|
||||
}
|
||||
|
||||
static void
|
||||
readobjnam_parse_charges(d)
|
||||
struct _readobjnam_data *d;
|
||||
readobjnam_parse_charges(struct _readobjnam_data* d)
|
||||
{
|
||||
if (strlen(d->bp) > 1 && (d->p = rindex(d->bp, '(')) != 0) {
|
||||
boolean keeptrailingchars = TRUE;
|
||||
@@ -3491,8 +3422,7 @@ struct _readobjnam_data *d;
|
||||
}
|
||||
|
||||
static int
|
||||
readobjnam_postparse1(d)
|
||||
struct _readobjnam_data *d;
|
||||
readobjnam_postparse1(struct _readobjnam_data* d)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -3861,8 +3791,7 @@ struct _readobjnam_data *d;
|
||||
}
|
||||
|
||||
static int
|
||||
readobjnam_postparse2(d)
|
||||
struct _readobjnam_data *d;
|
||||
readobjnam_postparse2(struct _readobjnam_data* d)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -3921,8 +3850,7 @@ struct _readobjnam_data *d;
|
||||
}
|
||||
|
||||
static int
|
||||
readobjnam_postparse3(d)
|
||||
struct _readobjnam_data *d;
|
||||
readobjnam_postparse3(struct _readobjnam_data* d)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -4087,9 +4015,7 @@ struct _readobjnam_data *d;
|
||||
* return null.
|
||||
*/
|
||||
struct obj *
|
||||
readobjnam(bp, no_wish)
|
||||
register char *bp;
|
||||
struct obj *no_wish;
|
||||
readobjnam(char* bp, struct obj* no_wish)
|
||||
{
|
||||
struct _readobjnam_data d;
|
||||
|
||||
@@ -4518,8 +4444,7 @@ struct obj *no_wish;
|
||||
}
|
||||
|
||||
int
|
||||
rnd_class(first, last)
|
||||
int first, last;
|
||||
rnd_class(int first, int last)
|
||||
{
|
||||
int i, x, sum = 0;
|
||||
|
||||
@@ -4538,8 +4463,7 @@ int first, last;
|
||||
}
|
||||
|
||||
static const char *
|
||||
Japanese_item_name(i)
|
||||
int i;
|
||||
Japanese_item_name(int i)
|
||||
{
|
||||
struct Jitem *j = Japanese_items;
|
||||
|
||||
@@ -4552,8 +4476,7 @@ int i;
|
||||
}
|
||||
|
||||
const char *
|
||||
suit_simple_name(suit)
|
||||
struct obj *suit;
|
||||
suit_simple_name(struct obj* suit)
|
||||
{
|
||||
const char *suitnm, *esuitp;
|
||||
|
||||
@@ -4574,8 +4497,7 @@ struct obj *suit;
|
||||
}
|
||||
|
||||
const char *
|
||||
cloak_simple_name(cloak)
|
||||
struct obj *cloak;
|
||||
cloak_simple_name(struct obj* cloak)
|
||||
{
|
||||
if (cloak) {
|
||||
switch (cloak->otyp) {
|
||||
@@ -4596,8 +4518,7 @@ struct obj *cloak;
|
||||
|
||||
/* helm vs hat for messages */
|
||||
const char *
|
||||
helm_simple_name(helmet)
|
||||
struct obj *helmet;
|
||||
helm_simple_name(struct obj* helmet)
|
||||
{
|
||||
/*
|
||||
* There is some wiggle room here; the result has been chosen
|
||||
@@ -4616,8 +4537,7 @@ struct obj *helmet;
|
||||
|
||||
/* gloves vs gauntlets; depends upon discovery state */
|
||||
const char *
|
||||
gloves_simple_name(gloves)
|
||||
struct obj *gloves;
|
||||
gloves_simple_name(struct obj* gloves)
|
||||
{
|
||||
static const char gauntlets[] = "gauntlets";
|
||||
|
||||
@@ -4636,8 +4556,7 @@ struct obj *gloves;
|
||||
|
||||
/* boots vs shoes; depends upon discovery state */
|
||||
const char *
|
||||
boots_simple_name(boots)
|
||||
struct obj *boots;
|
||||
boots_simple_name(struct obj* boots)
|
||||
{
|
||||
static const char shoes[] = "shoes";
|
||||
|
||||
@@ -4656,8 +4575,7 @@ struct obj *boots;
|
||||
|
||||
/* simplified shield for messages */
|
||||
const char *
|
||||
shield_simple_name(shield)
|
||||
struct obj *shield;
|
||||
shield_simple_name(struct obj* shield)
|
||||
{
|
||||
if (shield) {
|
||||
/* xname() describes unknown (unseen) reflection as smooth */
|
||||
@@ -4687,15 +4605,13 @@ struct obj *shield;
|
||||
|
||||
/* for completness */
|
||||
const char *
|
||||
shirt_simple_name(shirt)
|
||||
struct obj *shirt UNUSED;
|
||||
shirt_simple_name(struct obj* shirt UNUSED)
|
||||
{
|
||||
return "shirt";
|
||||
}
|
||||
|
||||
const char *
|
||||
mimic_obj_name(mtmp)
|
||||
struct monst *mtmp;
|
||||
mimic_obj_name(struct monst* mtmp)
|
||||
{
|
||||
if (M_AP_TYPE(mtmp) == M_AP_OBJECT) {
|
||||
if (mtmp->mappearance == GOLD_PIECE)
|
||||
@@ -4713,12 +4629,14 @@ struct monst *mtmp;
|
||||
* last resort literal which should be very short), and an optional suffix.
|
||||
*/
|
||||
char *
|
||||
safe_qbuf(qbuf, qprefix, qsuffix, obj, func, altfunc, lastR)
|
||||
char *qbuf; /* output buffer */
|
||||
const char *qprefix, *qsuffix;
|
||||
struct obj *obj;
|
||||
char *FDECL((*func), (OBJ_P)), *FDECL((*altfunc), (OBJ_P));
|
||||
const char *lastR;
|
||||
safe_qbuf(
|
||||
char *qbuf, /* output buffer */
|
||||
const char *qprefix,
|
||||
const char *qsuffix,
|
||||
struct obj *obj,
|
||||
char *(*func)(OBJ_P),
|
||||
char *(*altfunc)(OBJ_P),
|
||||
const char *lastR)
|
||||
{
|
||||
char *bufp, *endp;
|
||||
/* convert size_t (or int for ancient systems) to ordinary unsigned */
|
||||
|
||||
Reference in New Issue
Block a user