Merge branch 'keni-staticfn' into NetHack-3.7
This commit is contained in:
164
src/eat.c
164
src/eat.c
@@ -5,46 +5,46 @@
|
||||
|
||||
#include "hack.h"
|
||||
|
||||
static int eatmdone(void);
|
||||
static int eatfood(void);
|
||||
static struct obj *costly_tin(int);
|
||||
static int opentin(void);
|
||||
static int unfaint(void);
|
||||
staticfn int eatmdone(void);
|
||||
staticfn int eatfood(void);
|
||||
staticfn struct obj *costly_tin(int);
|
||||
staticfn int opentin(void);
|
||||
staticfn int unfaint(void);
|
||||
|
||||
static const char *food_xname(struct obj *, boolean);
|
||||
static void choke(struct obj *);
|
||||
static void recalc_wt(void);
|
||||
static int adj_victual_nutrition(void);
|
||||
static struct obj *touchfood(struct obj *) NONNULL;
|
||||
static void do_reset_eat(void);
|
||||
static void done_eating(boolean);
|
||||
static void cprefx(int);
|
||||
static boolean temp_givit(int, struct permonst *);
|
||||
static void givit(int, struct permonst *);
|
||||
static void eye_of_newt_buzz(void);
|
||||
static void cpostfx(int);
|
||||
static void consume_tin(const char *);
|
||||
static void start_tin(struct obj *);
|
||||
static int eatcorpse(struct obj *);
|
||||
static void start_eating(struct obj *, boolean);
|
||||
static void garlic_breath(struct monst *);
|
||||
static void fprefx(struct obj *);
|
||||
static void fpostfx(struct obj *);
|
||||
static int bite(void);
|
||||
static int edibility_prompts(struct obj *);
|
||||
static int doeat_nonfood(struct obj *);
|
||||
static int tinopen_ok(struct obj *);
|
||||
static int rottenfood(struct obj *);
|
||||
static void eatspecial(void);
|
||||
static int bounded_increase(int, int, int);
|
||||
static void accessory_has_effect(struct obj *);
|
||||
static void eataccessory(struct obj *);
|
||||
static const char *foodword(struct obj *);
|
||||
static int tin_variety(struct obj *, boolean);
|
||||
static boolean maybe_cannibal(int, boolean);
|
||||
static int eat_ok(struct obj *);
|
||||
static int offer_ok(struct obj *);
|
||||
static int tin_ok(struct obj *);
|
||||
staticfn const char *food_xname(struct obj *, boolean);
|
||||
staticfn void choke(struct obj *);
|
||||
staticfn void recalc_wt(void);
|
||||
staticfn int adj_victual_nutrition(void);
|
||||
staticfn struct obj *touchfood(struct obj *) NONNULL;
|
||||
staticfn void do_reset_eat(void);
|
||||
staticfn void done_eating(boolean);
|
||||
staticfn void cprefx(int);
|
||||
staticfn boolean temp_givit(int, struct permonst *);
|
||||
staticfn void givit(int, struct permonst *);
|
||||
staticfn void eye_of_newt_buzz(void);
|
||||
staticfn void cpostfx(int);
|
||||
staticfn void consume_tin(const char *);
|
||||
staticfn void start_tin(struct obj *);
|
||||
staticfn int eatcorpse(struct obj *);
|
||||
staticfn void start_eating(struct obj *, boolean);
|
||||
staticfn void garlic_breath(struct monst *);
|
||||
staticfn void fprefx(struct obj *);
|
||||
staticfn void fpostfx(struct obj *);
|
||||
staticfn int bite(void);
|
||||
staticfn int edibility_prompts(struct obj *);
|
||||
staticfn int doeat_nonfood(struct obj *);
|
||||
staticfn int tinopen_ok(struct obj *);
|
||||
staticfn int rottenfood(struct obj *);
|
||||
staticfn void eatspecial(void);
|
||||
staticfn int bounded_increase(int, int, int);
|
||||
staticfn void accessory_has_effect(struct obj *);
|
||||
staticfn void eataccessory(struct obj *);
|
||||
staticfn const char *foodword(struct obj *);
|
||||
staticfn int tin_variety(struct obj *, boolean);
|
||||
staticfn boolean maybe_cannibal(int, boolean);
|
||||
staticfn int eat_ok(struct obj *);
|
||||
staticfn int offer_ok(struct obj *);
|
||||
staticfn int tin_ok(struct obj *);
|
||||
|
||||
/* also used to see if you're allowed to eat cats and dogs */
|
||||
#define CANNIBAL_ALLOWED() (Role_if(PM_CAVE_DWELLER) || Race_if(PM_ORC))
|
||||
@@ -158,7 +158,7 @@ static const struct {
|
||||
#define TTSZ SIZE(tintxts)
|
||||
|
||||
/* called after mimicking is over */
|
||||
static int
|
||||
staticfn int
|
||||
eatmdone(void)
|
||||
{
|
||||
/* release `eatmbuf' */
|
||||
@@ -212,7 +212,7 @@ eatmupdate(void)
|
||||
}
|
||||
|
||||
/* ``[the(] singular(food, xname) [)]'' */
|
||||
static const char *
|
||||
staticfn const char *
|
||||
food_xname(struct obj *food, boolean the_pfx)
|
||||
{
|
||||
const char *result;
|
||||
@@ -240,7 +240,7 @@ food_xname(struct obj *food, boolean the_pfx)
|
||||
*
|
||||
* To a full belly all food is bad. (It.)
|
||||
*/
|
||||
static void
|
||||
staticfn void
|
||||
choke(struct obj *food)
|
||||
{
|
||||
/* only happens if you were satiated */
|
||||
@@ -287,7 +287,7 @@ choke(struct obj *food)
|
||||
}
|
||||
|
||||
/* modify victual.piece->owt depending on time spent consuming it */
|
||||
static void
|
||||
staticfn void
|
||||
recalc_wt(void)
|
||||
{
|
||||
struct obj *piece = gc.context.victual.piece;
|
||||
@@ -333,7 +333,7 @@ obj_nutrition(struct obj *otmp)
|
||||
/* nutrition increment for next byte; this used to be factored into
|
||||
victual.piece->oeaten but that produced weight change if hero
|
||||
polymorphed to or from one of the races which has nutrition adjusted */
|
||||
static int
|
||||
staticfn int
|
||||
adj_victual_nutrition(void)
|
||||
{
|
||||
int otyp = gc.context.victual.piece->otyp;
|
||||
@@ -354,7 +354,7 @@ adj_victual_nutrition(void)
|
||||
return nut;
|
||||
}
|
||||
|
||||
static struct obj *
|
||||
staticfn struct obj *
|
||||
touchfood(struct obj *otmp)
|
||||
{
|
||||
if (otmp->quan > 1L) {
|
||||
@@ -414,7 +414,7 @@ food_substitution(struct obj *old_obj, struct obj *new_obj)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
do_reset_eat(void)
|
||||
{
|
||||
debugpline0("do_reset_eat...");
|
||||
@@ -484,10 +484,10 @@ eating_dangerous_corpse(int res)
|
||||
}
|
||||
|
||||
#if 0 /* no longer used */
|
||||
static void maybe_extend_timed_resist(int);
|
||||
staticfn void maybe_extend_timed_resist(int);
|
||||
|
||||
/* if temp resist against 'prop' is about to timeout, extend it slightly */
|
||||
static void
|
||||
staticfn void
|
||||
maybe_extend_timed_resist(int prop)
|
||||
{
|
||||
long timeout = temp_resist(prop);
|
||||
@@ -506,7 +506,7 @@ maybe_extend_timed_resist(int prop)
|
||||
#endif
|
||||
|
||||
/* called each move during eating process */
|
||||
static int
|
||||
staticfn int
|
||||
eatfood(void)
|
||||
{
|
||||
struct obj *food = gc.context.victual.piece;
|
||||
@@ -531,7 +531,7 @@ eatfood(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
done_eating(boolean message)
|
||||
{
|
||||
struct obj *piece = gc.context.victual.piece;
|
||||
@@ -739,7 +739,7 @@ eat_brains(
|
||||
}
|
||||
|
||||
/* eating a corpse or egg of one's own species is usually naughty */
|
||||
static boolean
|
||||
staticfn boolean
|
||||
maybe_cannibal(int pm, boolean allowmsg)
|
||||
{
|
||||
static NEARDATA long ate_brains = 0L;
|
||||
@@ -772,7 +772,7 @@ maybe_cannibal(int pm, boolean allowmsg)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
cprefx(int pm)
|
||||
{
|
||||
(void) maybe_cannibal(pm, TRUE);
|
||||
@@ -968,7 +968,7 @@ should_givit(int type, struct permonst *ptr)
|
||||
return (ptr->mlevel > rn2(chance));
|
||||
}
|
||||
|
||||
static boolean
|
||||
staticfn boolean
|
||||
temp_givit(int type, struct permonst *ptr)
|
||||
{
|
||||
int chance = (type == STONE_RES) ? 6 : (type == ACID_RES) ? 3 : 0;
|
||||
@@ -979,7 +979,7 @@ temp_givit(int type, struct permonst *ptr)
|
||||
/* givit() tries to give you an intrinsic based on the monster's level
|
||||
* and what type of intrinsic it is trying to give you.
|
||||
*/
|
||||
static void
|
||||
staticfn void
|
||||
givit(int type, struct permonst *ptr)
|
||||
{
|
||||
debugpline1("Attempting to give intrinsic %d", type);
|
||||
@@ -1079,7 +1079,7 @@ givit(int type, struct permonst *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
eye_of_newt_buzz(void)
|
||||
{
|
||||
/* MRKR: "eye of newt" may give small magical energy boost */
|
||||
@@ -1105,7 +1105,7 @@ eye_of_newt_buzz(void)
|
||||
DISABLE_WARNING_FORMAT_NONLITERAL
|
||||
|
||||
/* called after completely consuming a corpse */
|
||||
static void
|
||||
staticfn void
|
||||
cpostfx(int pm)
|
||||
{
|
||||
int tmp = 0;
|
||||
@@ -1351,7 +1351,7 @@ violated_vegetarian(void)
|
||||
|
||||
/* common code to check and possibly charge for 1 gc.context.tin.tin,
|
||||
* will split() gc.context.tin.tin if necessary */
|
||||
static struct obj *
|
||||
staticfn struct obj *
|
||||
costly_tin(int alter_type) /* COST_xxx */
|
||||
{
|
||||
struct obj *tin = gc.context.tin.tin;
|
||||
@@ -1451,7 +1451,7 @@ set_tin_variety(struct obj *obj, int forcetype)
|
||||
obj->spe = -(r + 1); /* offset by 1 to allow index 0 */
|
||||
}
|
||||
|
||||
static int
|
||||
staticfn int
|
||||
tin_variety(
|
||||
struct obj *obj,
|
||||
boolean displ) /* we're just displaying so leave things alone */
|
||||
@@ -1477,7 +1477,7 @@ tin_variety(
|
||||
return r;
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
consume_tin(const char *mesg)
|
||||
{
|
||||
const char *what;
|
||||
@@ -1619,7 +1619,7 @@ consume_tin(const char *mesg)
|
||||
}
|
||||
|
||||
/* called during each move whilst opening a tin */
|
||||
static int
|
||||
staticfn int
|
||||
opentin(void)
|
||||
{
|
||||
/* perhaps it was stolen (although that should cause interruption) */
|
||||
@@ -1639,7 +1639,7 @@ opentin(void)
|
||||
}
|
||||
|
||||
/* called when starting to open a tin */
|
||||
static void
|
||||
staticfn void
|
||||
start_tin(struct obj *otmp)
|
||||
{
|
||||
const char *mesg = 0;
|
||||
@@ -1728,7 +1728,7 @@ Hear_again(void)
|
||||
}
|
||||
|
||||
/* called on the "first bite" of rotten food */
|
||||
static int
|
||||
staticfn int
|
||||
rottenfood(struct obj *obj)
|
||||
{
|
||||
pline("Blecch! %s %s!",
|
||||
@@ -1770,7 +1770,7 @@ rottenfood(struct obj *obj)
|
||||
}
|
||||
|
||||
/* called when a corpse is selected as food */
|
||||
static int
|
||||
staticfn int
|
||||
eatcorpse(struct obj *otmp)
|
||||
{
|
||||
int retcode = 0, tp = 0, mnum = otmp->corpsenm;
|
||||
@@ -1935,7 +1935,7 @@ eatcorpse(struct obj *otmp)
|
||||
}
|
||||
|
||||
/* called as you start to eat */
|
||||
static void
|
||||
staticfn void
|
||||
start_eating(struct obj *otmp, boolean already_partly_eaten)
|
||||
{
|
||||
const char *old_nomovemsg, *save_nomovemsg;
|
||||
@@ -1998,7 +1998,7 @@ eating_glob(struct obj *glob)
|
||||
}
|
||||
|
||||
/* scare nearby monster when hero eats garlic */
|
||||
static void
|
||||
staticfn void
|
||||
garlic_breath(struct monst *mtmp)
|
||||
{
|
||||
if (olfaction(mtmp->data) && distu(mtmp->mx, mtmp->my) < 7)
|
||||
@@ -2011,7 +2011,7 @@ garlic_breath(struct monst *mtmp)
|
||||
* Messages should use present tense since multi-turn food won't be
|
||||
* finishing at the time they're issued.
|
||||
*/
|
||||
static void
|
||||
staticfn void
|
||||
fprefx(struct obj *otmp)
|
||||
{
|
||||
switch (otmp->otyp) {
|
||||
@@ -2120,7 +2120,7 @@ fprefx(struct obj *otmp)
|
||||
}
|
||||
|
||||
/* increment a combat intrinsic with limits on its growth */
|
||||
static int
|
||||
staticfn int
|
||||
bounded_increase(int old, int inc, int typ)
|
||||
{
|
||||
int absold, absinc, sgnold, sgninc;
|
||||
@@ -2157,14 +2157,14 @@ bounded_increase(int old, int inc, int typ)
|
||||
return old + inc;
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
accessory_has_effect(struct obj *otmp)
|
||||
{
|
||||
pline("Magic spreads through your body as you digest the %s.",
|
||||
(otmp->oclass == RING_CLASS) ? "ring" : "amulet");
|
||||
}
|
||||
|
||||
static void
|
||||
staticfn void
|
||||
eataccessory(struct obj *otmp)
|
||||
{
|
||||
int typ = otmp->otyp;
|
||||
@@ -2312,7 +2312,7 @@ eataccessory(struct obj *otmp)
|
||||
}
|
||||
|
||||
/* called after eating non-food */
|
||||
static void
|
||||
staticfn void
|
||||
eatspecial(void)
|
||||
{
|
||||
struct obj *otmp = gc.context.victual.piece;
|
||||
@@ -2396,7 +2396,7 @@ static const char *const foodwords[] = {
|
||||
"plastic", "glass", "rich food", "stone"
|
||||
};
|
||||
|
||||
static const char *
|
||||
staticfn const char *
|
||||
foodword(struct obj *otmp)
|
||||
{
|
||||
if (otmp->oclass == FOOD_CLASS)
|
||||
@@ -2408,7 +2408,7 @@ foodword(struct obj *otmp)
|
||||
}
|
||||
|
||||
/* called after consuming (non-corpse) food */
|
||||
static void
|
||||
staticfn void
|
||||
fpostfx(struct obj *otmp)
|
||||
{
|
||||
switch (otmp->otyp) {
|
||||
@@ -2504,9 +2504,9 @@ fpostfx(struct obj *otmp)
|
||||
/* intended for eating a spellbook while polymorphed, but not used;
|
||||
"leather" applied to appearance, not composition, and has been
|
||||
changed to "leathery" to reflect that */
|
||||
static boolean leather_cover(struct obj *);
|
||||
staticfn boolean leather_cover(struct obj *);
|
||||
|
||||
static boolean
|
||||
staticfn boolean
|
||||
leather_cover(struct obj *otmp)
|
||||
{
|
||||
const char *odesc = OBJ_DESCR(objects[otmp->otyp]);
|
||||
@@ -2524,7 +2524,7 @@ leather_cover(struct obj *otmp)
|
||||
* return 1 if the food was dangerous and you chose to stop.
|
||||
* return 2 if the food was dangerous and you chose to eat it anyway.
|
||||
*/
|
||||
static int
|
||||
staticfn int
|
||||
edibility_prompts(struct obj *otmp)
|
||||
{
|
||||
/* Blessed food detection grants hero a one-use
|
||||
@@ -2631,7 +2631,7 @@ edibility_prompts(struct obj *otmp)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
staticfn int
|
||||
doeat_nonfood(struct obj *otmp)
|
||||
{
|
||||
int basenutrit; /* nutrition of full item */
|
||||
@@ -2970,7 +2970,7 @@ doeat(void)
|
||||
}
|
||||
|
||||
/* getobj callback for object to be opened with a tin opener */
|
||||
static int
|
||||
staticfn int
|
||||
tinopen_ok(struct obj *obj)
|
||||
{
|
||||
if (obj && obj->otyp == TIN)
|
||||
@@ -3015,7 +3015,7 @@ use_tin_opener(struct obj *obj)
|
||||
/* Take a single bite from a piece of food, checking for choking and
|
||||
* modifying usedtime. Returns 1 if they choked and survived, 0 otherwise.
|
||||
*/
|
||||
static int
|
||||
staticfn int
|
||||
bite(void)
|
||||
{
|
||||
/* hack to pacify static analyzer incorporated into gcc 12.2 */
|
||||
@@ -3218,7 +3218,7 @@ lesshungry(int num)
|
||||
newuhs(FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
staticfn int
|
||||
unfaint(void)
|
||||
{
|
||||
(void) Hear_again();
|
||||
@@ -3399,7 +3399,7 @@ newuhs(boolean incr)
|
||||
}
|
||||
|
||||
/* getobj callback for object to eat - effectively just wraps is_edible() */
|
||||
static int
|
||||
staticfn int
|
||||
eat_ok(struct obj *obj)
|
||||
{
|
||||
/* 'getobj_else' will be non-zero if floor food is present and
|
||||
@@ -3421,7 +3421,7 @@ eat_ok(struct obj *obj)
|
||||
|
||||
/* getobj callback for object to be offered (corpses and things that look like
|
||||
* the Amulet only */
|
||||
static int
|
||||
staticfn int
|
||||
offer_ok(struct obj *obj)
|
||||
{
|
||||
if (!obj)
|
||||
@@ -3443,7 +3443,7 @@ offer_ok(struct obj *obj)
|
||||
}
|
||||
|
||||
/* getobj callback for object to be tinned */
|
||||
static int
|
||||
staticfn int
|
||||
tin_ok(struct obj *obj)
|
||||
{
|
||||
if (!obj)
|
||||
|
||||
Reference in New Issue
Block a user