From 9c0ed8ae632caf2906bb45b4d012d0ad422e2cf7 Mon Sep 17 00:00:00 2001 From: nhkeni Date: Thu, 14 Mar 2024 17:41:51 -0400 Subject: [PATCH] NOSTATICFN for src/* --- src/allmain.c | 36 ++-- src/alloc.c | 4 +- src/apply.c | 180 ++++++++--------- src/artifact.c | 47 ++--- src/attrib.c | 28 +-- src/ball.c | 20 +- src/bones.c | 28 +-- src/botl.c | 180 ++++++++--------- src/calendar.c | 4 +- src/cmd.c | 154 +++++++-------- src/dbridge.c | 56 +++--- src/detect.c | 64 +++---- src/dig.c | 40 ++-- src/display.c | 82 ++++---- src/dlb.c | 46 ++--- src/do.c | 52 ++--- src/do_name.c | 28 +-- src/do_wear.c | 116 +++++------ src/dog.c | 20 +- src/dogmove.c | 40 ++-- src/dokick.c | 56 +++--- src/dothrow.c | 56 +++--- src/dungeon.c | 181 ++++++++--------- src/eat.c | 164 ++++++++-------- src/end.c | 58 +++--- src/engrave.c | 32 ++-- src/exper.c | 4 +- src/explode.c | 8 +- src/extralev.c | 15 +- src/files.c | 362 +++++++++++++++++----------------- src/fountain.c | 24 +-- src/getpos.c | 56 +++--- src/hack.c | 128 ++++++------- src/insight.c | 84 ++++---- src/invent.c | 148 +++++++------- src/isaac64.c | 8 +- src/light.c | 16 +- src/lock.c | 20 +- src/mail.c | 20 +- src/makemon.c | 45 +++-- src/mcastu.c | 33 ++-- src/mdlib.c | 24 +-- src/mhitm.c | 41 ++-- src/mhitu.c | 40 ++-- src/mklev.c | 128 ++++++------- src/mkmap.c | 42 ++-- src/mkmaze.c | 92 ++++----- src/mkobj.c | 80 ++++---- src/mkroom.c | 48 ++--- src/mon.c | 108 +++++------ src/mondata.c | 2 +- src/monmove.c | 74 +++---- src/mplayer.c | 12 +- src/mthrowu.c | 28 +-- src/muse.c | 100 +++++----- src/music.c | 40 ++-- src/nhlobj.c | 72 +++---- src/nhlsel.c | 122 ++++++------ src/nhlua.c | 224 +++++++++++----------- src/nhmd4.c | 4 +- src/o_init.c | 44 ++--- src/objnam.c | 92 ++++----- src/options.c | 512 ++++++++++++++++++++++++------------------------- src/pager.c | 124 ++++++------ src/pickup.c | 149 +++++++------- src/pline.c | 24 +-- src/polyself.c | 32 ++-- src/potion.c | 140 +++++++------- src/pray.c | 104 +++++----- src/priest.c | 8 +- src/quest.c | 40 ++-- src/questpgr.c | 48 ++--- src/read.c | 160 ++++++++-------- src/rect.c | 4 +- src/region.c | 8 +- src/restore.c | 91 +++++---- src/rip.c | 4 +- src/rnd.c | 13 +- src/role.c | 16 +- src/rumors.c | 28 +-- src/save.c | 70 +++---- src/selvar.c | 11 +- src/sfstruct.c | 4 +- src/shk.c | 220 ++++++++++----------- src/shknam.c | 32 ++-- src/sit.c | 8 +- src/sounds.c | 84 ++++---- src/sp_lev.c | 356 +++++++++++++++++----------------- src/spell.c | 96 +++++----- src/steal.c | 16 +- src/steed.c | 8 +- src/strutil.c | 4 +- src/symbols.c | 16 +- src/teleport.c | 36 ++-- src/timeout.c | 88 ++++----- src/topten.c | 76 ++++---- src/trap.c | 234 +++++++++++----------- src/u_init.c | 44 ++--- src/uhitm.c | 173 ++++++++--------- src/utf8map.c | 65 +++---- src/vault.c | 49 ++--- src/version.c | 4 +- src/vision.c | 52 ++--- src/weapon.c | 28 +-- src/wield.c | 16 +- src/windows.c | 170 ++++++++-------- src/wizard.c | 28 +-- src/wizcmds.c | 46 ++--- src/worm.c | 19 +- src/worn.c | 16 +- src/write.c | 16 +- 111 files changed, 3871 insertions(+), 3879 deletions(-) diff --git a/src/allmain.c b/src/allmain.c index a0dfd803f..fc633181e 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -12,18 +12,18 @@ #include #endif -static void moveloop_preamble(boolean); -static void u_calc_moveamt(int); -static void maybe_do_tutorial(void); +staticfn void moveloop_preamble(boolean); +staticfn void u_calc_moveamt(int); +staticfn void maybe_do_tutorial(void); #ifdef POSITIONBAR -static void do_positionbar(void); +staticfn void do_positionbar(void); #endif -static void regen_pw(int); -static void regen_hp(int); -static void interrupt_multi(const char *); -static void debug_fields(const char *); +staticfn void regen_pw(int); +staticfn void regen_hp(int); +staticfn void interrupt_multi(const char *); +staticfn void debug_fields(const char *); #ifndef NODUMPENUMS -static void dump_enums(void); +staticfn void dump_enums(void); #endif /*ARGSUSED*/ @@ -41,7 +41,7 @@ early_init(int argc UNUSED, char *argv[] UNUSED) runtime_info_init(); } -static void +staticfn void moveloop_preamble(boolean resuming) { /* if a save file created in normal mode is now being restored in @@ -101,7 +101,7 @@ moveloop_preamble(boolean resuming) update_inventory(); } -static void +staticfn void u_calc_moveamt(int wtcap) { int moveamt = 0; @@ -516,7 +516,7 @@ moveloop_core(void) } } -static void +staticfn void maybe_do_tutorial(void) { s_level *sp = find_level("tut-1"); @@ -549,7 +549,7 @@ moveloop(boolean resuming) } } -static void +staticfn void regen_pw(int wtcap) { if (u.uen < u.uenmax @@ -571,7 +571,7 @@ regen_pw(int wtcap) #define U_CAN_REGEN() (Regeneration || (Sleepy && u.usleep)) /* maybe recover some lost health (or lose some when an eel out of water) */ -static void +staticfn void regen_hp(int wtcap) { int heal = 0; @@ -832,7 +832,7 @@ welcome(boolean new_game) /* false => restoring an old game */ } #ifdef POSITIONBAR -static void +staticfn void do_positionbar(void) { /* FIXME: this will break if any coordinate is too big for (char); @@ -875,7 +875,7 @@ do_positionbar(void) } #endif -static void +staticfn void interrupt_multi(const char *msg) { if (gm.multi > 0 && !gc.context.travel && !gc.context.run) { @@ -1043,7 +1043,7 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg) * optimization so that display output * can be debugged without buffering. */ -static void +staticfn void debug_fields(const char *opts) { char *op; @@ -1174,7 +1174,7 @@ struct enum_dump arti_enum_dump[] = { #ifndef NODUMPENUMS -static void +staticfn void dump_enums(void) { enum enum_dumps { diff --git a/src/alloc.c b/src/alloc.c index 796ab7ade..f8f89a952 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -26,7 +26,7 @@ char *fmt_ptr(const genericptr) NONNULL; #undef re_alloc #undef free extern void free(genericptr_t); -static void heapmon_init(void); +staticfn void heapmon_init(void); static FILE *heaplog = 0; static boolean tried_heaplog = FALSE; @@ -138,7 +138,7 @@ fmt_ptr(const genericptr ptr) /* If ${NH_HEAPLOG} is defined and we can create a file by that name, then we'll log the allocation and release information to that file. */ -static void +staticfn void heapmon_init(void) { char *logname = getenv("NH_HEAPLOG"); diff --git a/src/apply.c b/src/apply.c index 106132bfc..4a7db4897 100644 --- a/src/apply.c +++ b/src/apply.c @@ -5,56 +5,56 @@ #include "hack.h" -static int use_camera(struct obj *); -static int use_towel(struct obj *); -static boolean its_dead(coordxy, coordxy, int *); -static int use_stethoscope(struct obj *); -static void use_whistle(struct obj *); -static void use_magic_whistle(struct obj *); -static void magic_whistled(struct obj *); -static int use_leash(struct obj *); -static boolean mleashed_next2u(struct monst *); -static int use_mirror(struct obj *); -static void use_bell(struct obj **); -static void use_candelabrum(struct obj *); -static void use_candle(struct obj **); -static void use_lamp(struct obj *); -static void light_cocktail(struct obj **); -static int rub_ok(struct obj *); -static void display_jump_positions(boolean); -static void use_tinning_kit(struct obj *); -static int use_figurine(struct obj **); -static int grease_ok(struct obj *); -static int use_grease(struct obj *); -static void use_trap(struct obj *); -static int touchstone_ok(struct obj *); -static int use_stone(struct obj *); -static int set_trap(void); /* occupation callback */ -static void display_polearm_positions(boolean); -static int use_cream_pie(struct obj *); -static int jelly_ok(struct obj *); -static int use_royal_jelly(struct obj **); -static int grapple_range(void); -static boolean can_grapple_location(coordxy, coordxy); -static void display_grapple_positions(boolean); -static int use_grapple(struct obj *); -static void discard_broken_wand(void); -static void broken_wand_explode(struct obj *, int, int); -static int do_break_wand(struct obj *); -static int apply_ok(struct obj *); -static int flip_through_book(struct obj *); -static int flip_coin(struct obj *); -static boolean figurine_location_checks(struct obj *, coord *, boolean); -static boolean check_jump(genericptr_t, coordxy, coordxy); -static boolean is_valid_jump_pos(coordxy, coordxy, int, boolean); -static boolean get_valid_jump_position(coordxy, coordxy); -static boolean get_valid_polearm_position(coordxy, coordxy); -static boolean find_poleable_mon(coord *, int, int); +staticfn int use_camera(struct obj *); +staticfn int use_towel(struct obj *); +staticfn boolean its_dead(coordxy, coordxy, int *); +staticfn int use_stethoscope(struct obj *); +staticfn void use_whistle(struct obj *); +staticfn void use_magic_whistle(struct obj *); +staticfn void magic_whistled(struct obj *); +staticfn int use_leash(struct obj *); +staticfn boolean mleashed_next2u(struct monst *); +staticfn int use_mirror(struct obj *); +staticfn void use_bell(struct obj **); +staticfn void use_candelabrum(struct obj *); +staticfn void use_candle(struct obj **); +staticfn void use_lamp(struct obj *); +staticfn void light_cocktail(struct obj **); +staticfn int rub_ok(struct obj *); +staticfn void display_jump_positions(boolean); +staticfn void use_tinning_kit(struct obj *); +staticfn int use_figurine(struct obj **); +staticfn int grease_ok(struct obj *); +staticfn int use_grease(struct obj *); +staticfn void use_trap(struct obj *); +staticfn int touchstone_ok(struct obj *); +staticfn int use_stone(struct obj *); +staticfn int set_trap(void); /* occupation callback */ +staticfn void display_polearm_positions(boolean); +staticfn int use_cream_pie(struct obj *); +staticfn int jelly_ok(struct obj *); +staticfn int use_royal_jelly(struct obj **); +staticfn int grapple_range(void); +staticfn boolean can_grapple_location(coordxy, coordxy); +staticfn void display_grapple_positions(boolean); +staticfn int use_grapple(struct obj *); +staticfn void discard_broken_wand(void); +staticfn void broken_wand_explode(struct obj *, int, int); +staticfn int do_break_wand(struct obj *); +staticfn int apply_ok(struct obj *); +staticfn int flip_through_book(struct obj *); +staticfn int flip_coin(struct obj *); +staticfn boolean figurine_location_checks(struct obj *, coord *, boolean); +staticfn boolean check_jump(genericptr_t, coordxy, coordxy); +staticfn boolean is_valid_jump_pos(coordxy, coordxy, int, boolean); +staticfn boolean get_valid_jump_position(coordxy, coordxy); +staticfn boolean get_valid_polearm_position(coordxy, coordxy); +staticfn boolean find_poleable_mon(coord *, int, int); static const char no_elbow_room[] = "don't have enough elbow-room to maneuver."; -static int +staticfn int use_camera(struct obj *obj) { struct monst *mtmp; @@ -96,7 +96,7 @@ use_camera(struct obj *obj) return ECMD_TIME; } -static int +staticfn int use_towel(struct obj *obj) { boolean drying_feedback = (obj == uwep); @@ -182,7 +182,7 @@ use_towel(struct obj *obj) } /* maybe give a stethoscope message based on floor objects */ -static boolean +staticfn boolean its_dead(coordxy rx, coordxy ry, int *resp) { char buf[BUFSZ]; @@ -303,7 +303,7 @@ static const char hollow_str[] = "a hollow sound. This must be a secret %s!"; not take any time; however, unless it did, the stethoscope would be almost useless. As a compromise, one use per turn is free, another uses up the turn; this makes curse status have a tangible effect. */ -static int +staticfn int use_stethoscope(struct obj *obj) { struct monst *mtmp; @@ -460,7 +460,7 @@ use_stethoscope(struct obj *obj) static const char whistle_str[] = "produce a %s whistling sound.", alt_whistle_str[] = "produce a %s, sharp vibration."; -static void +staticfn void use_whistle(struct obj *obj) { if (!can_blow(&gy.youmonst)) { @@ -479,7 +479,7 @@ use_whistle(struct obj *obj) } } -static void +staticfn void use_magic_whistle(struct obj *obj) { if (!can_blow(&gy.youmonst)) { @@ -500,7 +500,7 @@ use_magic_whistle(struct obj *obj) } /* 'obj' is assumed to be a magic whistle */ -static void +staticfn void magic_whistled(struct obj *obj) { struct monst *mtmp, *nextmon; @@ -747,7 +747,7 @@ leashable(struct monst *mtmp) } /* ARGSUSED */ -static int +staticfn int use_leash(struct obj *obj) { coord cc; @@ -867,7 +867,7 @@ get_mleash(struct monst *mtmp) return otmp; } -static boolean +staticfn boolean mleashed_next2u(struct monst *mtmp) { if (mtmp->mleashed) { @@ -993,7 +993,7 @@ beautiful(void) static const char look_str[] = "look %s."; -static int +staticfn int use_mirror(struct obj *obj) { const char *mirror, *uvisage; @@ -1177,7 +1177,7 @@ use_mirror(struct obj *obj) #undef SEENMON } -static void +staticfn void use_bell(struct obj **optr) { struct obj *obj = *optr; @@ -1294,7 +1294,7 @@ use_bell(struct obj **optr) wake_nearby(); } -static void +staticfn void use_candelabrum(struct obj *obj) { const char *s = (obj->spe != 1) ? "candles" : "candle"; @@ -1362,7 +1362,7 @@ use_candelabrum(struct obj *obj) begin_burn(obj, FALSE); } -static void +staticfn void use_candle(struct obj **optr) { struct obj *obj = *optr; @@ -1596,7 +1596,7 @@ catch_lit(struct obj *obj) } /* light a lamp or candle */ -static void +staticfn void use_lamp(struct obj *obj) { char buf[BUFSZ]; @@ -1670,7 +1670,7 @@ use_lamp(struct obj *obj) } } -static void +staticfn void light_cocktail(struct obj **optr) { struct obj *obj = *optr; /* obj is a potion of oil */ @@ -1737,7 +1737,7 @@ light_cocktail(struct obj **optr) /* getobj callback for object to be rubbed - not selecting a secondary object to rub on a gray stone or rub jelly on */ -static int +staticfn int rub_ok(struct obj *obj) { if (!obj) @@ -1829,7 +1829,7 @@ enum jump_trajectory { }; /* callback routine for walk_path() */ -static boolean +staticfn boolean check_jump(genericptr arg, coordxy x, coordxy y) { int traj = *(int *) arg; @@ -1860,7 +1860,7 @@ check_jump(genericptr arg, coordxy x, coordxy y) return TRUE; } -static boolean +staticfn boolean is_valid_jump_pos(coordxy x, coordxy y, int magic, boolean showmsg) { if (!magic && !(HJumping & ~INTRINSIC) && !EJumping && distu(x, y) != 5) { @@ -1926,7 +1926,7 @@ is_valid_jump_pos(coordxy x, coordxy y, int magic, boolean showmsg) return TRUE; } -static boolean +staticfn boolean get_valid_jump_position(coordxy x, coordxy y) { return (isok(x, y) @@ -1934,7 +1934,7 @@ get_valid_jump_position(coordxy x, coordxy y) && is_valid_jump_pos(x, y, gj.jumping_is_magic, FALSE)); } -static void +staticfn void display_jump_positions(boolean on_off) { coordxy x, y, dx, dy; @@ -2145,7 +2145,7 @@ tinnable(struct obj *corpse) return 1; } -static void +staticfn void use_tinning_kit(struct obj *obj) { struct obj *corpse, *can; @@ -2478,7 +2478,7 @@ fig_transform(anything *arg, long timeout) newsym(cc.x, cc.y); } -static boolean +staticfn boolean figurine_location_checks(struct obj *obj, coord *cc, boolean quietly) { coordxy x, y; @@ -2511,7 +2511,7 @@ figurine_location_checks(struct obj *obj, coord *cc, boolean quietly) return TRUE; } -static int +staticfn int use_figurine(struct obj **optr) { struct obj *obj = *optr; @@ -2552,7 +2552,7 @@ use_figurine(struct obj **optr) } /* getobj callback for object to apply grease to */ -static int +staticfn int grease_ok(struct obj *obj) { if (!obj) @@ -2569,7 +2569,7 @@ grease_ok(struct obj *obj) return GETOBJ_SUGGEST; } -static int +staticfn int use_grease(struct obj *obj) { struct obj *otmp; @@ -2623,7 +2623,7 @@ use_grease(struct obj *obj) } /* getobj callback for object to rub on a known touchstone */ -static int +staticfn int touchstone_ok(struct obj *obj) { if (!obj) @@ -2645,7 +2645,7 @@ touchstone_ok(struct obj *obj) /* touchstones - by Ken Arnold */ -static int +staticfn int use_stone(struct obj *tstone) { static const char scritch[] = "\"scritch, scritch\""; @@ -2786,7 +2786,7 @@ reset_trapset(void) } /* Place a landmine/bear trap. Helge Hafting */ -static void +staticfn void use_trap(struct obj *otmp) { int ttyp, tmp; @@ -2880,7 +2880,7 @@ use_trap(struct obj *otmp) } /* occupation routine called each turn while arming a beartrap or landmine */ -static int +staticfn int set_trap(void) { struct obj *otmp = gt.trapinfo.tobj; @@ -3247,7 +3247,7 @@ static const char (glyph_is_monster(G) || glyph_is_invisible(G) || glyph_is_statue(G)) /* find pos of monster in range, if only one monster */ -static boolean +staticfn boolean find_poleable_mon(coord *pos, int min_range, int max_range) { struct monst *mtmp; @@ -3285,7 +3285,7 @@ find_poleable_mon(coord *pos, int min_range, int max_range) return TRUE; } -static boolean +staticfn boolean get_valid_polearm_position(coordxy x, coordxy y) { int glyph; @@ -3298,7 +3298,7 @@ get_valid_polearm_position(coordxy x, coordxy y) && glyph_is_poleable(glyph)))); } -static void +staticfn void display_polearm_positions(boolean on_off) { coordxy x, y, dx, dy; @@ -3470,7 +3470,7 @@ use_pole(struct obj *obj, boolean autohit) #undef glyph_is_poleable -static int +staticfn int use_cream_pie(struct obj *obj) { boolean wasblind = Blind; @@ -3509,7 +3509,7 @@ use_cream_pie(struct obj *obj) } /* getobj callback for object to rub royal jelly on */ -static int +staticfn int jelly_ok(struct obj *obj) { if (obj && obj->otyp == EGG) @@ -3518,7 +3518,7 @@ jelly_ok(struct obj *obj) return GETOBJ_EXCLUDE; } -static int +staticfn int use_royal_jelly(struct obj **optr) { int oldcorpsenm; @@ -3588,7 +3588,7 @@ use_royal_jelly(struct obj **optr) return ECMD_TIME; } -static int +staticfn int grapple_range(void) { int typ = uwep_skill_type(); @@ -3603,13 +3603,13 @@ grapple_range(void) return max_range; } -static boolean +staticfn boolean can_grapple_location(coordxy x, coordxy y) { return (isok(x, y) && cansee(x, y) && distu(x, y) <= grapple_range()); } -static void +staticfn void display_grapple_positions(boolean on_off) { coordxy x, y, dx, dy; @@ -3631,7 +3631,7 @@ display_grapple_positions(boolean on_off) } } -static int +staticfn int use_grapple(struct obj *obj) { int res = ECMD_OK, typ, tohit; @@ -3777,7 +3777,7 @@ use_grapple(struct obj *obj) return ECMD_TIME; } -static void +staticfn void discard_broken_wand(void) { struct obj *obj; @@ -3789,7 +3789,7 @@ discard_broken_wand(void) nomul(0); } -static void +staticfn void broken_wand_explode(struct obj *obj, int dmg, int expltype) { explode(u.ux, u.uy, -(obj->otyp), dmg, WAND_CLASS, expltype); @@ -3798,7 +3798,7 @@ broken_wand_explode(struct obj *obj, int dmg, int expltype) } /* return 1 if the wand is broken, hence some time elapsed */ -static int +staticfn int do_break_wand(struct obj *obj) { #define BY_OBJECT ((struct monst *) 0) @@ -4031,7 +4031,7 @@ do_break_wand(struct obj *obj) /* getobj callback for object to apply - this is more complex than most other * callbacks because there are a lot of appliables */ -static int +staticfn int apply_ok(struct obj *obj) { if (!obj) @@ -4343,7 +4343,7 @@ unfixable_trouble_count(boolean is_horn) return unfixable_trbl; } -static int +staticfn int flip_through_book(struct obj *obj) { if (Underwater) { @@ -4397,7 +4397,7 @@ flip_through_book(struct obj *obj) return ECMD_TIME; } -static int +staticfn int flip_coin(struct obj *obj) { struct obj *otmp = obj; diff --git a/src/artifact.c b/src/artifact.c index 84685a4db..1e65131cd 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -21,17 +21,18 @@ static struct artifact *get_artifact(struct obj *) NONNULL; /* never returns nul ? &artilist[(int) (o)->oartifact] \ : &artilist[ART_NONARTIFACT]) */ -static boolean bane_applies(const struct artifact *, struct monst *) NONNULLARG12; -static int spec_applies(const struct artifact *, struct monst *) NONNULLARG12; -static int invoke_ok(struct obj *); -static int arti_invoke(struct obj *); -static boolean Mb_hit(struct monst * magr, struct monst *mdef, +staticfn boolean bane_applies(const struct artifact *, struct monst *) + NONNULLARG12; +staticfn int spec_applies(const struct artifact *, struct monst *) NONNULLARG12; +staticfn int invoke_ok(struct obj *); +staticfn int arti_invoke(struct obj *); +staticfn boolean Mb_hit(struct monst * magr, struct monst *mdef, struct obj *, int *, int, boolean, char *); -static unsigned long abil_to_spfx(long *) NONNULLARG1; -static uchar abil_to_adtyp(long *) NONNULLARG1; -static int glow_strength(int); -static boolean untouchable(struct obj *, boolean); -static int count_surround_traps(coordxy, coordxy); +staticfn unsigned long abil_to_spfx(long *) NONNULLARG1; +staticfn uchar abil_to_adtyp(long *) NONNULLARG1; +staticfn int glow_strength(int); +staticfn boolean untouchable(struct obj *, boolean); +staticfn int count_surround_traps(coordxy, coordxy); /* The amount added to the victim's total hit points to insure that the victim will be killed even after damage bonus/penalty adjustments. @@ -69,10 +70,10 @@ static xint16 artidisco[NROFARTIFACTS]; */ static const struct arti_info zero_artiexist = {0}; /* all bits zero */ -static void hack_artifacts(void); +staticfn void hack_artifacts(void); /* handle some special cases; must be called after u_init() */ -static void +staticfn void hack_artifacts(void) { struct artifact *art; @@ -891,7 +892,7 @@ arti_immune(struct obj *obj, int dtyp) || weap->cary.adtyp == dtyp); } -static boolean +staticfn boolean bane_applies(const struct artifact *oart, struct monst *mon) { struct artifact atmp; @@ -907,7 +908,7 @@ bane_applies(const struct artifact *oart, struct monst *mon) } /* decide whether an artifact's special attacks apply against mtmp */ -static int +staticfn int spec_applies(const struct artifact *weap, struct monst *mtmp) { struct permonst *ptr; @@ -1147,7 +1148,7 @@ static const char *const mb_verb[2][NUM_MB_INDICES] = { }; /* called when someone is being hit by Magicbane */ -static boolean +staticfn boolean Mb_hit(struct monst *magr, /* attacker */ struct monst *mdef, /* defender */ struct obj *mb, /* Magicbane */ @@ -1629,7 +1630,7 @@ artifact_hit( RESTORE_WARNING_FORMAT_NONLITERAL /* getobj callback for object to be invoked */ -static int +staticfn int invoke_ok(struct obj *obj) { if (!obj) @@ -1664,7 +1665,7 @@ doinvoke(void) return arti_invoke(obj); } -static int +staticfn int arti_invoke(struct obj *obj) { const struct artifact *oart = get_artifact(obj); @@ -2056,7 +2057,7 @@ arti_cost(struct obj *otmp) return (100L * (long) objects[otmp->otyp].oc_cost); } -static uchar +staticfn uchar abil_to_adtyp(long *abil) { struct abil2adtyp_tag { @@ -2080,7 +2081,7 @@ abil_to_adtyp(long *abil) return 0; } -static unsigned long +staticfn unsigned long abil_to_spfx(long *abil) { static const struct abil2spfx_tag { @@ -2174,7 +2175,7 @@ static const char *const glow_verbs[] = { }; /* relative strength that Sting is glowing (0..3), to select verb */ -static int +staticfn int glow_strength(int count) { /* glow strength should also be proportional to proximity and @@ -2328,7 +2329,7 @@ retouch_object( or an artifact which conveys something via being carried or which has an #invoke effect currently in operation undergoes a touch test; if it fails, it will be unworn/unwielded and maybe dropped */ -static boolean +staticfn boolean untouchable( struct obj *obj, /* object to test; in invent or is steed's saddle */ boolean drop_untouchable) /* whether to drop it if it can't be touched */ @@ -2438,7 +2439,7 @@ retouch_equipment( clear_bypasses(); /* reset upon final exit */ } -static int +staticfn int count_surround_traps(coordxy x, coordxy y) { struct rm *levp; @@ -2552,7 +2553,7 @@ is_art(struct obj *obj, int art) ? &artilist[(int) (o)->oartifact] \ : &artilist[ART_NONARTIFACT]) */ -static struct artifact * +staticfn struct artifact * get_artifact(struct obj *obj) { if (obj) { diff --git a/src/attrib.c b/src/attrib.c index f2b997209..50c0af9ba 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -103,13 +103,13 @@ static const struct innate { hum_abil[] = { { 0, 0, 0, 0 } }; -static void exerper(void); -static int rnd_attr(void); -static int init_attr_role_redist(int, boolean); -static void postadjabil(long *); -static const struct innate *role_abil(int); -static const struct innate *check_innate_abil(long *, long); -static int innately(long *); +staticfn void exerper(void); +staticfn int rnd_attr(void); +staticfn int init_attr_role_redist(int, boolean); +staticfn void postadjabil(long *); +staticfn const struct innate *role_abil(int); +staticfn const struct innate *check_innate_abil(long *, long); +staticfn int innately(long *); /* adjust an attribute; return TRUE if change is made, FALSE otherwise */ boolean @@ -503,7 +503,7 @@ exercise(int i, boolean inc_or_dec) (void) encumber_msg(); } -static void +staticfn void exerper(void) { if (!(gm.moves % 10)) { @@ -664,7 +664,7 @@ exerchk(void) /* return random hero attribute (by role's attr distribution). returns A_MAX if failed. */ -static int +staticfn int rnd_attr(void) { int i, x = rn2(100); @@ -681,7 +681,7 @@ rnd_attr(void) adjusting the base and maximum values of the attributes. if subtracting, np must be negative. returns the left over points. */ -static int +staticfn int init_attr_role_redist(int np, boolean addition) { int tryct = 0; @@ -759,7 +759,7 @@ vary_init_attr(void) } } -static +staticfn void postadjabil(long *ability) { @@ -769,7 +769,7 @@ postadjabil(long *ability) see_monsters(); } -static const struct innate * +staticfn const struct innate * role_abil(int r) { const struct { @@ -798,7 +798,7 @@ role_abil(int r) return roleabils[i].abil; } -static const struct innate * +staticfn const struct innate * check_innate_abil(long *ability, long frommask) { const struct innate *abil = 0; @@ -844,7 +844,7 @@ check_innate_abil(long *ability, long frommask) #define FROM_LYCN 6 /* check whether particular ability has been obtained via innate attribute */ -static int +staticfn int innately(long *ability) { const struct innate *iptr; diff --git a/src/ball.c b/src/ball.c index 1cbfb1d7c..fe264eaf8 100644 --- a/src/ball.c +++ b/src/ball.c @@ -8,11 +8,11 @@ #include "hack.h" -static int bc_order(void); -static void litter(void); -static void placebc_core(void); -static void unplacebc_core(void); -static boolean check_restriction(int); +staticfn int bc_order(void); +staticfn void litter(void); +staticfn void placebc_core(void); +staticfn void unplacebc_core(void); +staticfn boolean check_restriction(int); static int bcrestriction = 0; #ifdef BREADCRUMBS @@ -116,7 +116,7 @@ ballfall(void) * * Should not be called while swallowed except on waterlevel. */ -static void +staticfn void placebc_core(void) { if (!uchain || !uball) { @@ -143,7 +143,7 @@ placebc_core(void) bcrestriction = 0; } -static void +staticfn void unplacebc_core(void) { if (u.uswallow) { @@ -176,7 +176,7 @@ unplacebc_core(void) u.bc_felt = 0; /* feel nothing */ } -static boolean +staticfn boolean check_restriction(int restriction) { boolean ret = FALSE; @@ -350,7 +350,7 @@ Lift_covet_and_placebc(int pin, char *funcnm, int linenum) * Return the stacking of the hero's ball & chain. This assumes that the * hero is being punished. */ -static int +staticfn int bc_order(void) { struct obj *obj; @@ -964,7 +964,7 @@ drop_ball(coordxy x, coordxy y) RESTORE_WARNING_FORMAT_NONLITERAL /* ball&chain cause hero to randomly lose stuff from inventory */ -static void +staticfn void litter(void) { struct obj *otmp, *nextobj = 0; diff --git a/src/bones.c b/src/bones.c index 00e89b3fd..2ed70ad91 100644 --- a/src/bones.c +++ b/src/bones.c @@ -5,15 +5,15 @@ #include "hack.h" -static boolean no_bones_level(d_level *); -static void goodfruit(int); -static void resetobjs(struct obj *, boolean); -static void give_to_nearby_mon(struct obj *, coordxy, coordxy) NONNULLARG1; -static boolean fixuporacle(struct monst *) NONNULLARG1; -static void remove_mon_from_bones(struct monst *) NONNULLARG1; -static void set_ghostly_objlist(struct obj *objchain); +staticfn boolean no_bones_level(d_level *); +staticfn void goodfruit(int); +staticfn void resetobjs(struct obj *, boolean); +staticfn void give_to_nearby_mon(struct obj *, coordxy, coordxy) NONNULLARG1; +staticfn boolean fixuporacle(struct monst *) NONNULLARG1; +staticfn void remove_mon_from_bones(struct monst *) NONNULLARG1; +staticfn void set_ghostly_objlist(struct obj *objchain); -static boolean +staticfn boolean no_bones_level(d_level *lev) { s_level *sptr; @@ -37,7 +37,7 @@ no_bones_level(d_level *lev) * ID is positive instead of negative). This way, when we later save the * chain of fruit types, we know to only save the types that exist. */ -static void +staticfn void goodfruit(int id) { struct fruit *f = fruit_from_indx(-id); @@ -46,7 +46,7 @@ goodfruit(int id) f->fid = id; } -static void +staticfn void resetobjs(struct obj *ochain, boolean restore) { struct obj *otmp, *nobj; @@ -220,7 +220,7 @@ sanitize_name(char *namebuf) /* Give object to a random object-liking monster on or adjacent to x,y but skipping hero's location. If no such monster, place object on floor at x,y. */ -static void +staticfn void give_to_nearby_mon(struct obj *otmp, coordxy x, coordxy y) { struct monst *mtmp; @@ -302,7 +302,7 @@ drop_upon_death( /* possibly restore oracle's room and/or put her back inside it; returns False if she's on the wrong level and should be removed, True otherwise */ -static boolean +staticfn boolean fixuporacle(struct monst *oracle) { coord cc; @@ -384,7 +384,7 @@ can_make_bones(void) /* monster might need to be removed before saving a bones file, in case these characters are not in their home bases */ -static void +staticfn void remove_mon_from_bones(struct monst *mtmp) { struct permonst *mptr = mtmp->data; @@ -740,7 +740,7 @@ bones_include_name(const char *name) } /* set the ghostly bit in a list of objects */ -static void +staticfn void set_ghostly_objlist(struct obj *objchain) { while (objchain) { diff --git a/src/botl.c b/src/botl.c index e37ffd8a8..0a27219a4 100644 --- a/src/botl.c +++ b/src/botl.c @@ -15,12 +15,12 @@ const char *const enc_stat[] = { "Strained", "Overtaxed", "Overloaded" }; -static const char *rank(void); -static void bot_via_windowport(void); -static void stat_update_time(void); -static char *get_strength_str(void); +staticfn const char *rank(void); +staticfn void bot_via_windowport(void); +staticfn void stat_update_time(void); +staticfn char *get_strength_str(void); -static char * +staticfn char * get_strength_str(void) { static char buf[32]; @@ -360,7 +360,7 @@ rank_of(int lev, short monnum, boolean female) return "Player"; } -static const char * +staticfn const char * rank(void) { return rank_of(u.ulevel, Role_switch, flags.female); @@ -484,52 +484,52 @@ describe_level( #ifdef STATUS_HILITES #endif /* STATUS_HILITES */ -static boolean eval_notify_windowport_field(int, boolean *, int); -static void evaluate_and_notify_windowport(boolean *, int); -static void init_blstats(void); -static int compare_blstats(struct istat_s *, struct istat_s *); -static char *anything_to_s(char *, anything *, int); -static int percentage(struct istat_s *, struct istat_s *); -static int exp_percentage(void); -static int QSORTCALLBACK cond_cmp(const genericptr, const genericptr); -static int QSORTCALLBACK menualpha_cmp(const genericptr, const genericptr); +staticfn boolean eval_notify_windowport_field(int, boolean *, int); +staticfn void evaluate_and_notify_windowport(boolean *, int); +staticfn void init_blstats(void); +staticfn int compare_blstats(struct istat_s *, struct istat_s *); +staticfn char *anything_to_s(char *, anything *, int); +staticfn int percentage(struct istat_s *, struct istat_s *); +staticfn int exp_percentage(void); +staticfn int QSORTCALLBACK cond_cmp(const genericptr, const genericptr); +staticfn int QSORTCALLBACK menualpha_cmp(const genericptr, const genericptr); #ifdef STATUS_HILITES -static void s_to_anything(anything *, char *, int); -static enum statusfields fldname_to_bl_indx(const char *); -static boolean hilite_reset_needed(struct istat_s *, long); -static boolean noneoftheabove(const char *); -static struct hilite_s *get_hilite(int, int, genericptr_t, int, int, int *); -static void split_clridx(int, int *, int *); -static boolean is_ltgt_percentnumber(const char *); -static boolean has_ltgt_percentnumber(const char *); -static int splitsubfields(char *, char ***, int); -static boolean is_fld_arrayvalues(const char *, const char *const *, int, int, +staticfn void s_to_anything(anything *, char *, int); +staticfn enum statusfields fldname_to_bl_indx(const char *); +staticfn boolean hilite_reset_needed(struct istat_s *, long); +staticfn boolean noneoftheabove(const char *); +staticfn struct hilite_s *get_hilite(int, int, genericptr_t, int, int, int *); +staticfn void split_clridx(int, int *, int *); +staticfn boolean is_ltgt_percentnumber(const char *); +staticfn boolean has_ltgt_percentnumber(const char *); +staticfn int splitsubfields(char *, char ***, int); +staticfn boolean is_fld_arrayvalues(const char *, const char *const *, int, int, int *); -static int query_arrayvalue(const char *, const char *const *, int, int); -static void status_hilite_add_threshold(int, struct hilite_s *); -static boolean parse_status_hl2(char (*)[QBUFSZ], boolean); -static unsigned long query_conditions(void); -static char *conditionbitmask2str(unsigned long); -static unsigned long match_str2conditionbitmask(const char *); -static unsigned long str2conditionbitmask(char *); -static boolean parse_condition(char (*)[QBUFSZ], int); -static char *hlattr2attrname(int, char *, size_t); -static void status_hilite_linestr_add(int, struct hilite_s *, unsigned long, +staticfn int query_arrayvalue(const char *, const char *const *, int, int); +staticfn void status_hilite_add_threshold(int, struct hilite_s *); +staticfn boolean parse_status_hl2(char (*)[QBUFSZ], boolean); +staticfn unsigned long query_conditions(void); +staticfn char *conditionbitmask2str(unsigned long); +staticfn unsigned long match_str2conditionbitmask(const char *); +staticfn unsigned long str2conditionbitmask(char *); +staticfn boolean parse_condition(char (*)[QBUFSZ], int); +staticfn char *hlattr2attrname(int, char *, size_t); +staticfn void status_hilite_linestr_add(int, struct hilite_s *, unsigned long, const char *); -static void status_hilite_linestr_done(void); -static int status_hilite_linestr_countfield(int); -static void status_hilite_linestr_gather_conditions(void); -static void status_hilite_linestr_gather(void); -static char *status_hilite2str(struct hilite_s *); -static int status_hilite_menu_choose_field(void); -static int status_hilite_menu_choose_behavior(int); -static int status_hilite_menu_choose_updownboth(int, const char *, boolean, +staticfn void status_hilite_linestr_done(void); +staticfn int status_hilite_linestr_countfield(int); +staticfn void status_hilite_linestr_gather_conditions(void); +staticfn void status_hilite_linestr_gather(void); +staticfn char *status_hilite2str(struct hilite_s *); +staticfn int status_hilite_menu_choose_field(void); +staticfn int status_hilite_menu_choose_behavior(int); +staticfn int status_hilite_menu_choose_updownboth(int, const char *, boolean, boolean); -static boolean status_hilite_menu_add(int); -static boolean status_hilite_remove(int); -static boolean status_hilite_menu_fld(int); -static void status_hilites_viewall(void); +staticfn boolean status_hilite_menu_add(int); +staticfn boolean status_hilite_remove(int); +staticfn boolean status_hilite_menu_fld(int); +staticfn void status_hilites_viewall(void); #define has_hilite(i) (gb.blstats[0][(i)].thresholds) /* TH_UPDOWN encompasses specific 'up' and 'down' also general 'changed' */ @@ -737,7 +737,7 @@ do { \ * without STATUS_HILITES. */ -static void +staticfn void bot_via_windowport(void) { char buf[BUFSZ]; @@ -1031,7 +1031,7 @@ bot_via_windowport(void) #undef cond_cache_prepA /* update just the status lines' 'time' field */ -static void +staticfn void stat_update_time(void) { int idx = gn.now_or_before_idx; /* no 0/1 toggle */ @@ -1079,7 +1079,7 @@ condopt(int idx, boolean *addr, boolean negated) } /* qsort callback routine for sorting the condition index */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK cond_cmp(const genericptr vptr1, const genericptr vptr2) { int indx1 = *(int *) vptr1, indx2 = *(int *) vptr2, @@ -1092,7 +1092,7 @@ cond_cmp(const genericptr vptr1, const genericptr vptr2) } /* qsort callback routine for alphabetical sorting of index */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK menualpha_cmp(const genericptr vptr1, const genericptr vptr2) { int indx1 = *(int *) vptr1, indx2 = *(int *) vptr2; @@ -1239,7 +1239,7 @@ opt_next_cond(int indx, char *outbuf) return TRUE; } -static boolean +staticfn boolean eval_notify_windowport_field( int fld, boolean *valsetlist, @@ -1364,7 +1364,7 @@ eval_notify_windowport_field( return updated; } -static void +staticfn void evaluate_and_notify_windowport( boolean *valsetlist, int idx) @@ -1497,7 +1497,7 @@ status_finish(void) } } -static void +staticfn void init_blstats(void) { static boolean initalready = FALSE; @@ -1547,7 +1547,7 @@ init_blstats(void) * - for strings, 0 = stayed the same, 1 = changed * */ -static int +staticfn int compare_blstats(struct istat_s *bl1, struct istat_s *bl2) { anything *a1, *a2; @@ -1620,7 +1620,7 @@ compare_blstats(struct istat_s *bl1, struct istat_s *bl2) return result; } -static char * +staticfn char * anything_to_s(char *buf, anything *a, int anytype) { if (!buf) @@ -1664,7 +1664,7 @@ anything_to_s(char *buf, anything *a, int anytype) } #ifdef STATUS_HILITES -static void +staticfn void s_to_anything(anything *a, char *buf, int anytype) { if (!buf || !a) @@ -1711,7 +1711,7 @@ s_to_anything(anything *a, char *buf, int anytype) #endif /* STATUS_HILITES */ /* integer percentage is 100 * bl->a / maxbl->a */ -static int +staticfn int percentage(struct istat_s *bl, struct istat_s *maxbl) { int result = 0; @@ -1786,7 +1786,7 @@ percentage(struct istat_s *bl, struct istat_s *maxbl) /* percentage for both xp (level) and exp (points) is the percentage for (curr_exp - this_level_start) in (next_level_start - this_level_start) */ -static int +staticfn int exp_percentage(void) { int res = 0; @@ -1942,7 +1942,7 @@ static const char threshold_value[] = "hilite_status threshold ", /* field name to bottom line index */ -static enum statusfields +staticfn enum statusfields fldname_to_bl_indx(const char *name) { int i, nmatches = 0, fld = 0; @@ -1978,7 +1978,7 @@ fldname_to_bl_indx(const char *name) return (nmatches == 1) ? fld : BL_FLUSH; } -static boolean +staticfn boolean hilite_reset_needed( struct istat_s *bl_p, long augmented_time) /* no longer augmented; it once encoded fractional @@ -2057,7 +2057,7 @@ reset_status_hilites(void) /* test whether the text from a title rule matches the string for title-while-polymorphed in the 'textmatch' menu */ -static boolean +staticfn boolean noneoftheabove(const char *hl_text) { if (fuzzymatch(hl_text, "none of the above", "\" -_", TRUE) @@ -2085,7 +2085,7 @@ noneoftheabove(const char *hl_text) * Get back: * pointer to rule that applies; Null if no rule does. */ -static struct hilite_s * +staticfn struct hilite_s * get_hilite( int idx, int fldidx, genericptr_t vp, @@ -2297,7 +2297,7 @@ get_hilite( #undef has_hilite #undef Is_Temp_Hilite -static void +staticfn void split_clridx(int idx, int *coloridx, int *attrib) { if (coloridx) @@ -2373,7 +2373,7 @@ parse_status_hl1(char *op, boolean from_configfile) } /* is str in the format of "[<>]?=?[-+]?[0-9]+%?" regex */ -static boolean +staticfn boolean is_ltgt_percentnumber(const char *str) { const char *s = str; @@ -2394,7 +2394,7 @@ is_ltgt_percentnumber(const char *str) } /* does str only contain "<>=-+0-9%" chars */ -static boolean +staticfn boolean has_ltgt_percentnumber(const char *str) { const char *s = str; @@ -2410,7 +2410,7 @@ has_ltgt_percentnumber(const char *str) /* splitsubfields(): splits str in place into '+' or '&' separated strings. * returns number of strings, or -1 if more than maxsf or MAX_SUBFIELDS */ -static int +staticfn int splitsubfields(char *str, char ***sfarr, int maxsf) { #define MAX_SUBFIELDS 16 @@ -2452,7 +2452,7 @@ splitsubfields(char *str, char ***sfarr, int maxsf) #undef MAX_SUBFIELDS } -static boolean +staticfn boolean is_fld_arrayvalues( const char *str, const char *const *arr, @@ -2469,7 +2469,7 @@ is_fld_arrayvalues( return FALSE; } -static int +staticfn int query_arrayvalue( const char *querystr, const char *const *arr, @@ -2504,7 +2504,7 @@ query_arrayvalue( return ret; } -static void +staticfn void status_hilite_add_threshold(int fld, struct hilite_s *hilite) { struct hilite_s *new_hilite, *old_hilite; @@ -2534,7 +2534,7 @@ status_hilite_add_threshold(int fld, struct hilite_s *hilite) gb.blstats[1][fld].thresholds = gb.blstats[0][fld].thresholds; } -static boolean +staticfn boolean parse_status_hl2(char (*s)[QBUFSZ], boolean from_configfile) { static const char *const aligntxt[] = { "chaotic", "neutral", "lawful" }; @@ -2829,7 +2829,7 @@ parse_status_hl2(char (*s)[QBUFSZ], boolean from_configfile) return (successes > 0); } -static unsigned long +staticfn unsigned long query_conditions(void) { int i,res; @@ -2861,7 +2861,7 @@ query_conditions(void) return ret; } -static char * +staticfn char * conditionbitmask2str(unsigned long ul) { static char buf[BUFSZ]; @@ -2891,7 +2891,7 @@ conditionbitmask2str(unsigned long ul) return buf; } -static unsigned long +staticfn unsigned long match_str2conditionbitmask(const char *str) { int i, nmatches = 0; @@ -2929,7 +2929,7 @@ match_str2conditionbitmask(const char *str) return mask; } -static unsigned long +staticfn unsigned long str2conditionbitmask(char *str) { unsigned long conditions_bitmask = 0UL; @@ -2953,7 +2953,7 @@ str2conditionbitmask(char *str) return conditions_bitmask; } -static boolean +staticfn boolean parse_condition(char (*s)[QBUFSZ], int sidx) { int i; @@ -3089,7 +3089,7 @@ clear_status_hilites(void) } } -static char * +staticfn char * hlattr2attrname(int attrib, char *buf, size_t bufsz) { if (attrib && buf) { @@ -3137,7 +3137,7 @@ struct _status_hilite_line_str { static struct _status_hilite_line_str *status_hilite_str = 0; static int status_hilite_str_id = 0; -static void +staticfn void status_hilite_linestr_add( int fld, struct hilite_s *hl, @@ -3168,7 +3168,7 @@ status_hilite_linestr_add( } } -static void +staticfn void status_hilite_linestr_done(void) { struct _status_hilite_line_str *nxt, *tmp = status_hilite_str; @@ -3182,7 +3182,7 @@ status_hilite_linestr_done(void) status_hilite_str_id = 0; } -static int +staticfn int status_hilite_linestr_countfield(int fld) { struct _status_hilite_line_str *tmp; @@ -3208,7 +3208,7 @@ count_status_hilites(void) return count; } -static void +staticfn void status_hilite_linestr_gather_conditions(void) { int i; @@ -3290,7 +3290,7 @@ status_hilite_linestr_gather_conditions(void) } } -static void +staticfn void status_hilite_linestr_gather(void) { int i; @@ -3310,7 +3310,7 @@ status_hilite_linestr_gather(void) } -static char * +staticfn char * status_hilite2str(struct hilite_s *hl) { static char buf[BUFSZ]; @@ -3392,7 +3392,7 @@ status_hilite2str(struct hilite_s *hl) return buf; } -static int +staticfn int status_hilite_menu_choose_field(void) { winid tmpwin; @@ -3427,7 +3427,7 @@ status_hilite_menu_choose_field(void) return fld; } -static int +staticfn int status_hilite_menu_choose_behavior(int fld) { winid tmpwin; @@ -3530,7 +3530,7 @@ status_hilite_menu_choose_behavior(int fld) return beh; } -static int +staticfn int status_hilite_menu_choose_updownboth( int fld, const char *str, @@ -3609,7 +3609,7 @@ status_hilite_menu_choose_updownboth( return ret; } -static boolean +staticfn boolean status_hilite_menu_add(int origfld) { int fld; @@ -4019,7 +4019,7 @@ status_hilite_menu_add(int origfld) return TRUE; } -static boolean +staticfn boolean status_hilite_remove(int id) { struct _status_hilite_line_str *hlstr = status_hilite_str; @@ -4071,7 +4071,7 @@ status_hilite_remove(int id) return FALSE; } -static boolean +staticfn boolean status_hilite_menu_fld(int fld) { winid tmpwin; @@ -4170,7 +4170,7 @@ status_hilite_menu_fld(int fld) return acted; } -static void +staticfn void status_hilites_viewall(void) { winid datawin; diff --git a/src/calendar.c b/src/calendar.c index 9021881df..857232782 100644 --- a/src/calendar.c +++ b/src/calendar.c @@ -26,7 +26,7 @@ #define LOCALTIME_type time_t * #endif -static struct tm *getlt(void); +staticfn struct tm *getlt(void); time_t getnow(void) @@ -37,7 +37,7 @@ getnow(void) return datetime; } -static struct tm * +staticfn struct tm * getlt(void) { time_t date = getnow(); diff --git a/src/cmd.c b/src/cmd.c index 27c8ed2ab..abc838e8f 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -94,53 +94,53 @@ extern int dozap(void); /**/ extern int doorganize(void); /**/ #endif /* DUMB */ -static int dosuspend_core(void); -static int dosh_core(void); -static int doherecmdmenu(void); -static int dotherecmdmenu(void); -static int doprev_message(void); -static int timed_occupation(void); -static boolean can_do_extcmd(const struct ext_func_tab *); -static int dotravel(void); -static int dotravel_target(void); -static int doclicklook(void); -static int domouseaction(void); -static int doterrain(void); -static boolean u_have_seen_whole_selection(struct selectionvar *); -static boolean u_have_seen_bounds_selection(struct selectionvar *); -static boolean u_can_see_whole_selection(struct selectionvar *); -static int dolookaround_floodfill_findroom(coordxy, coordxy); -static void lookaround_known_room(coordxy, coordxy); +staticfn int dosuspend_core(void); +staticfn int dosh_core(void); +staticfn int doherecmdmenu(void); +staticfn int dotherecmdmenu(void); +staticfn int doprev_message(void); +staticfn int timed_occupation(void); +staticfn boolean can_do_extcmd(const struct ext_func_tab *); +staticfn int dotravel(void); +staticfn int dotravel_target(void); +staticfn int doclicklook(void); +staticfn int domouseaction(void); +staticfn int doterrain(void); +staticfn boolean u_have_seen_whole_selection(struct selectionvar *); +staticfn boolean u_have_seen_bounds_selection(struct selectionvar *); +staticfn boolean u_can_see_whole_selection(struct selectionvar *); +staticfn int dolookaround_floodfill_findroom(coordxy, coordxy); +staticfn void lookaround_known_room(coordxy, coordxy); #if defined(__BORLANDC__) && !defined(_WIN32) extern void show_borlandc_stats(winid); #endif -static boolean accept_menu_prefix(const struct ext_func_tab *); -static void reset_cmd_vars(boolean); +staticfn boolean accept_menu_prefix(const struct ext_func_tab *); +staticfn void reset_cmd_vars(boolean); -static void mcmd_addmenu(winid, int, const char *); -static int there_cmd_menu_self(winid, coordxy, coordxy, int *); -static int there_cmd_menu_next2u(winid, coordxy, coordxy, int, int *); -static int there_cmd_menu_far(winid, coordxy, coordxy, int); -static int there_cmd_menu_common(winid, coordxy, coordxy, int, int *); -static void act_on_act(int, coordxy, coordxy); -static char there_cmd_menu(coordxy, coordxy, int); -static char here_cmd_menu(void); +staticfn void mcmd_addmenu(winid, int, const char *); +staticfn int there_cmd_menu_self(winid, coordxy, coordxy, int *); +staticfn int there_cmd_menu_next2u(winid, coordxy, coordxy, int, int *); +staticfn int there_cmd_menu_far(winid, coordxy, coordxy, int); +staticfn int there_cmd_menu_common(winid, coordxy, coordxy, int, int *); +staticfn void act_on_act(int, coordxy, coordxy); +staticfn char there_cmd_menu(coordxy, coordxy, int); +staticfn char here_cmd_menu(void); -static char readchar_core(coordxy *, coordxy *, int *); -static int parse(void); -static void show_direction_keys(winid, char, boolean); -static boolean help_dir(char, uchar, const char *); +staticfn char readchar_core(coordxy *, coordxy *, int *); +staticfn int parse(void); +staticfn void show_direction_keys(winid, char, boolean); +staticfn boolean help_dir(char, uchar, const char *); -static void handler_rebind_keys_add(boolean); -static boolean bind_key_fn(uchar, int (*)(void)); -static void commands_init(void); -static boolean keylist_func_has_key(const struct ext_func_tab *, boolean *); -static int keylist_putcmds(winid, boolean, int, int, boolean *); -static const char *spkey_name(int); +staticfn void handler_rebind_keys_add(boolean); +staticfn boolean bind_key_fn(uchar, int (*)(void)); +staticfn void commands_init(void); +staticfn boolean keylist_func_has_key(const struct ext_func_tab *, boolean *); +staticfn int keylist_putcmds(winid, boolean, int, int, boolean *); +staticfn const char *spkey_name(int); -static int (*timed_occ_fn)(void); -static char *doc_extcmd_flagstr(winid, const struct ext_func_tab *); +staticfn int (*timed_occ_fn)(void); +staticfn char *doc_extcmd_flagstr(winid, const struct ext_func_tab *); static const char *readchar_queue = ""; @@ -150,7 +150,7 @@ const char unavailcmd[] = "Unavailable command '%s'."; static const char cmdnotavail[] = "'%s' command not available."; /* the #prevmsg command */ -static int +staticfn int doprev_message(void) { (void) nh_doprev_message(); @@ -158,7 +158,7 @@ doprev_message(void) } /* Count down by decrementing multi */ -static int +staticfn int timed_occupation(void) { (*timed_occ_fn)(); @@ -437,7 +437,7 @@ extcmd_initiator(void) return gc.Cmd.extcmd_char; } -static boolean +staticfn boolean can_do_extcmd(const struct ext_func_tab *extcmd) { int ecflags = extcmd->flags; @@ -498,7 +498,7 @@ doextcmd(void) } /* format extended command flags for display */ -static char * +staticfn char * doc_extcmd_flagstr( winid menuwin, const struct ext_func_tab *efp) /* if Null, add a footnote to the menu */ @@ -1064,7 +1064,7 @@ levltyp_to_name(int typ) } /* #terrain command -- show known map, inspired by crawl's '|' command */ -static int +staticfn int doterrain(void) { winid men; @@ -1161,7 +1161,7 @@ doterrain(void) } /* has hero seen all locations in selection? */ -static boolean +staticfn boolean u_have_seen_whole_selection(struct selectionvar *sel) { coordxy x, y; @@ -1179,7 +1179,7 @@ u_have_seen_whole_selection(struct selectionvar *sel) } /* has hero seen all location of the rectangular outline in the selection */ -static boolean +staticfn boolean u_have_seen_bounds_selection(struct selectionvar *sel) { coordxy x, y; @@ -1212,7 +1212,7 @@ u_have_seen_bounds_selection(struct selectionvar *sel) } /* can hero currently see all locations in the selection */ -static boolean +staticfn boolean u_can_see_whole_selection(struct selectionvar *sel) { coordxy x, y; @@ -1229,7 +1229,7 @@ u_can_see_whole_selection(struct selectionvar *sel) } /* selection_floofill callback to get all locations in a room */ -static int +staticfn int dolookaround_floodfill_findroom(coordxy x, coordxy y) { schar typ = levl[x][y].typ; @@ -1242,7 +1242,7 @@ dolookaround_floodfill_findroom(coordxy x, coordxy y) } /* describe the room at x,y */ -static void +staticfn void lookaround_known_room(coordxy x, coordxy y) { struct selectionvar *sel = selection_new(); @@ -2085,7 +2085,7 @@ get_changed_key_binds(strbuf_t *sbuf) } /* interactive key binding */ -static void +staticfn void handler_rebind_keys_add(boolean keyfirst) { struct ext_func_tab *ec; @@ -2400,7 +2400,7 @@ bind_key(uchar key, const char *command) } /* bind key by ext cmd function */ -static boolean +staticfn boolean bind_key_fn(uchar key, int (*fn)(void)) { struct ext_func_tab *extcmd; @@ -2418,7 +2418,7 @@ bind_key_fn(uchar key, int (*fn)(void)) } /* initialize all keyboard commands */ -static void +staticfn void commands_init(void) { struct ext_func_tab *extcmd; @@ -2453,7 +2453,7 @@ commands_init(void) #endif } -static boolean +staticfn boolean keylist_func_has_key(const struct ext_func_tab *extcmd, boolean *skip_keys_used) /* boolean keys_used[256] */ { @@ -2469,7 +2469,7 @@ keylist_func_has_key(const struct ext_func_tab *extcmd, return FALSE; } -static int +staticfn int keylist_putcmds(winid datawin, boolean docount, int incl_flags, int excl_flags, boolean *keys_used) /* boolean keys_used[256] */ @@ -2866,7 +2866,7 @@ bind_specialkey(uchar key, const char *command) return FALSE; } -static const char * +staticfn const char * spkey_name(int nhkf) { const char *name = 0; @@ -3134,7 +3134,7 @@ update_rest_on_space(void) /* commands which accept 'm' prefix to request menu operation or other alternate behavior; it's also overloaded for move-without-autopickup; there is no overlap between the two groups of commands */ -static boolean +staticfn boolean accept_menu_prefix(const struct ext_func_tab *ec) { return (ec && ((ec->flags & CMD_M_PREFIX) != 0)); @@ -3222,7 +3222,7 @@ rnd_extcmd_idx(void) return rn2(extcmdlist_length + 1) - 1; } -static void +staticfn void reset_cmd_vars(boolean reset_cmdq) { gc.context.run = 0; @@ -3700,7 +3700,7 @@ getdir(const char *s) return 1; } -static void +staticfn void show_direction_keys( winid win, /* should specify a window which is using a fixed-width font */ char centerchar, /* '.' or '@' or ' ' */ @@ -3749,7 +3749,7 @@ show_direction_keys( /* explain choices if player has asked for getdir() help or has given an invalid direction after a prefix key ('F', 'g', 'm', &c), which might be bogus but could be up, down, or self when not applicable */ -static boolean +staticfn boolean help_dir( char sym, uchar spkey, /* actual key; either prefix or ESC */ @@ -3912,7 +3912,7 @@ isok(coordxy x, coordxy y) } /* #herecmdmenu command */ -static int +staticfn int doherecmdmenu(void) { char ch = here_cmd_menu(); @@ -3921,7 +3921,7 @@ doherecmdmenu(void) } /* #therecmdmenu command, a way to test there_cmd_menu without mouse */ -static int +staticfn int dotherecmdmenu(void) { char ch; @@ -3999,7 +3999,7 @@ enum menucmd { MCMD_TRAVEL, }; -static void +staticfn void mcmd_addmenu(winid win, int act, const char *txt) { anything any; @@ -4013,7 +4013,7 @@ mcmd_addmenu(winid win, int act, const char *txt) } /* command menu entries when targeting self */ -static int +staticfn int there_cmd_menu_self(winid win, coordxy x, coordxy y, int *act UNUSED) { int K = 0; @@ -4102,7 +4102,7 @@ there_cmd_menu_self(winid win, coordxy x, coordxy y, int *act UNUSED) } /* add entries to there_cmd_menu, when x,y is next to hero */ -static int +staticfn int there_cmd_menu_next2u( winid win, coordxy x, coordxy y, @@ -4202,7 +4202,7 @@ there_cmd_menu_next2u( return K; } -static int +staticfn int there_cmd_menu_far(winid win, coordxy x, coordxy y, int mod) { int K = 0; @@ -4217,7 +4217,7 @@ there_cmd_menu_far(winid win, coordxy x, coordxy y, int mod) return K; } -static int +staticfn int there_cmd_menu_common( winid win, coordxy x, coordxy y, @@ -4236,7 +4236,7 @@ there_cmd_menu_common( } /* queue up command(s) to perform #therecmdmenu action */ -static void +staticfn void act_on_act( int act, /* action */ coordxy dx, coordxy dy) /* delta to adjacent spot (farther sometimes) */ @@ -4421,7 +4421,7 @@ act_on_act( /* offer choice of actions to perform at adjacent location ; a few choices can be farther away */ -static char +staticfn char there_cmd_menu(coordxy x, coordxy y, int mod) { winid win; @@ -4477,7 +4477,7 @@ there_cmd_menu(coordxy x, coordxy y, int mod) return ch; } -static char +staticfn char here_cmd_menu(void) { there_cmd_menu(u.ux, u.uy, CLICK_1); @@ -4494,7 +4494,7 @@ click_to_cmd(coordxy x, coordxy y, int mod) cmdq_add_ec(CQ_CANNED, gc.Cmd.mousebtn[mod-1]->ef_funct); } -static int +staticfn int domouseaction(void) { coordxy x, y; @@ -4669,7 +4669,7 @@ get_count( } -static int +staticfn int parse(void) { int foo; @@ -4773,7 +4773,7 @@ end_of_input(void) } #endif /* HANGUPHANDLING */ -static char +staticfn char readchar_core(coordxy *x, coordxy *y, int *mod) { int sym; @@ -4859,7 +4859,7 @@ readchar_poskey(coordxy *x, coordxy *y, int *mod) } /* '_' command, #travel, via keyboard rather than mouse click */ -static int +staticfn int dotravel(void) { coord cc; @@ -4908,7 +4908,7 @@ dotravel(void) } /* #retravel, travel to iflags.travelcc, which must be set */ -static int +staticfn int dotravel_target(void) { if (!isok(iflags.travelcc.x, iflags.travelcc.y)) { @@ -4941,7 +4941,7 @@ dotravel_target(void) } /* mouse click look command */ -static int +staticfn int doclicklook(void) { if (!isok(gc.clicklook_cc.x, gc.clicklook_cc.y)) @@ -5098,7 +5098,7 @@ paranoid_query(boolean be_paranoid, const char *prompt) } /* ^Z command, #suspend */ -static int +staticfn int dosuspend_core(void) { #ifdef SUSPEND @@ -5118,7 +5118,7 @@ dosuspend_core(void) } /* '!' command, #shell */ -static int +staticfn int dosh_core(void) { #ifdef SHELL diff --git a/src/dbridge.c b/src/dbridge.c index 462e1c4da..f5ee2403e 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -19,20 +19,20 @@ #include "hack.h" -static void get_wall_for_db(coordxy *, coordxy *); -static struct entity *e_at(coordxy, coordxy); -static void m_to_e(struct monst *, coordxy, coordxy, struct entity *); -static void u_to_e(struct entity *); -static void set_entity(coordxy, coordxy, struct entity *); -static const char *e_nam(struct entity *); -static const char *E_phrase(struct entity *, const char *); -static boolean e_survives_at(struct entity *, coordxy, coordxy); -static void e_died(struct entity *, int, int); -static boolean automiss(struct entity *); -static boolean e_missed(struct entity *, boolean); -static boolean e_jumps(struct entity *); -static void do_entity(struct entity *); -static void nokiller(void); +staticfn void get_wall_for_db(coordxy *, coordxy *); +staticfn struct entity *e_at(coordxy, coordxy); +staticfn void m_to_e(struct monst *, coordxy, coordxy, struct entity *); +staticfn void u_to_e(struct entity *); +staticfn void set_entity(coordxy, coordxy, struct entity *); +staticfn const char *e_nam(struct entity *); +staticfn const char *E_phrase(struct entity *, const char *); +staticfn boolean e_survives_at(struct entity *, coordxy, coordxy); +staticfn void e_died(struct entity *, int, int); +staticfn boolean automiss(struct entity *); +staticfn boolean e_missed(struct entity *, boolean); +staticfn boolean e_jumps(struct entity *); +staticfn void do_entity(struct entity *); +staticfn void nokiller(void); boolean is_waterwall(coordxy x, coordxy y) @@ -205,7 +205,7 @@ find_drawbridge(coordxy *x, coordxy *y) /* * Find the drawbridge wall associated with a drawbridge. */ -static void +staticfn void get_wall_for_db(coordxy *x, coordxy *y) { switch (levl[*x][*y].drawbridgemask & DB_DIR) { @@ -279,7 +279,7 @@ create_drawbridge(coordxy x, coordxy y, int dir, boolean flag) return TRUE; } -static struct entity * +staticfn struct entity * e_at(coordxy x, coordxy y) { int entitycnt; @@ -296,7 +296,7 @@ e_at(coordxy x, coordxy y) : &(go.occupants[entitycnt]); } -static void +staticfn void m_to_e(struct monst *mtmp, coordxy x, coordxy y, struct entity *etmp) { etmp->emon = mtmp; @@ -313,7 +313,7 @@ m_to_e(struct monst *mtmp, coordxy x, coordxy y, struct entity *etmp) } } -static void +staticfn void u_to_e(struct entity *etmp) { etmp->emon = &gy.youmonst; @@ -322,7 +322,7 @@ u_to_e(struct entity *etmp) etmp->edata = gy.youmonst.data; } -static void +staticfn void set_entity( coordxy x, coordxy y, /* location of span or portcullis */ struct entity *etmp) /* pointer to occupants[0] or occupants[1] */ @@ -343,7 +343,7 @@ set_entity( /* #define e_strg(etmp, func) (is_u(etmp) ? (char *) 0 : func(etmp->emon)) */ -static const char * +staticfn const char * e_nam(struct entity *etmp) { return is_u(etmp) ? "you" : mon_nam(etmp->emon); @@ -353,7 +353,7 @@ e_nam(struct entity *etmp) * Generates capitalized entity name, makes 2nd -> 3rd person conversion on * verb, where necessary. */ -static const char * +staticfn const char * E_phrase(struct entity *etmp, const char *verb) { static char wholebuf[80]; @@ -372,7 +372,7 @@ E_phrase(struct entity *etmp, const char *verb) /* * Simple-minded "can it be here?" routine */ -static boolean +staticfn boolean e_survives_at(struct entity *etmp, coordxy x, coordxy y) { if (noncorporeal(etmp->edata)) @@ -394,7 +394,7 @@ e_survives_at(struct entity *etmp, coordxy x, coordxy y) return TRUE; } -static void +staticfn void e_died(struct entity *etmp, int xkill_flags, int how) { if (is_u(etmp)) { @@ -456,7 +456,7 @@ e_died(struct entity *etmp, int xkill_flags, int how) /* * These are never directly affected by a bridge or portcullis. */ -static boolean +staticfn boolean automiss(struct entity *etmp) { return (boolean) ((is_u(etmp) ? Passes_walls : passes_walls(etmp->edata)) @@ -466,7 +466,7 @@ automiss(struct entity *etmp) /* * Does falling drawbridge or portcullis miss etmp? */ -static boolean +staticfn boolean e_missed(struct entity *etmp, boolean chunks) { int misses; @@ -501,7 +501,7 @@ e_missed(struct entity *etmp, boolean chunks) /* * Can etmp jump from death? */ -static boolean +staticfn boolean e_jumps(struct entity *etmp) { int tmp = 4; /* out of 10 */ @@ -524,7 +524,7 @@ e_jumps(struct entity *etmp) return (tmp >= rnd(10)) ? TRUE : FALSE; } -static void +staticfn void do_entity(struct entity *etmp) { coordxy newx, newy, oldx, oldy; @@ -733,7 +733,7 @@ do_entity(struct entity *etmp) } /* clear stale reason for death and both 'entities' before returning */ -static void +staticfn void nokiller(void) { gk.killer.name[0] = '\0'; diff --git a/src/detect.c b/src/detect.c index 101ef2fe7..47ee007ce 100644 --- a/src/detect.c +++ b/src/detect.c @@ -11,22 +11,22 @@ #include "hack.h" #include "artifact.h" -static boolean unconstrain_map(void); -static void reconstrain_map(void); -static void map_redisplay(void); -static void browse_map(unsigned, const char *); -static void map_monst(struct monst *, boolean); -static void do_dknown_of(struct obj *); -static boolean check_map_spot(coordxy, coordxy, char, unsigned); -static boolean clear_stale_map(char, unsigned); -static void sense_trap(struct trap *, coordxy, coordxy, int); -static int detect_obj_traps(struct obj *, boolean, int); -static void display_trap_map(int); -static int furniture_detect(void); -static void findone(coordxy, coordxy, genericptr_t); -static void openone(coordxy, coordxy, genericptr_t); -static int mfind0(struct monst *, boolean); -static int reveal_terrain_getglyph(coordxy, coordxy, unsigned, int, unsigned); +staticfn boolean unconstrain_map(void); +staticfn void reconstrain_map(void); +staticfn void map_redisplay(void); +staticfn void browse_map(unsigned, const char *); +staticfn void map_monst(struct monst *, boolean); +staticfn void do_dknown_of(struct obj *); +staticfn boolean check_map_spot(coordxy, coordxy, char, unsigned); +staticfn boolean clear_stale_map(char, unsigned); +staticfn void sense_trap(struct trap *, coordxy, coordxy, int); +staticfn int detect_obj_traps(struct obj *, boolean, int); +staticfn void display_trap_map(int); +staticfn int furniture_detect(void); +staticfn void findone(coordxy, coordxy, genericptr_t); +staticfn void openone(coordxy, coordxy, genericptr_t); +staticfn int mfind0(struct monst *, boolean); +staticfn int reveal_terrain_getglyph(coordxy, coordxy, unsigned, int, unsigned); /* dummytrap: used when detecting traps finds a door or chest trap; the couple of fields that matter are always re-initialized during use so @@ -51,7 +51,7 @@ struct found_things { /* bring hero out from underwater or underground or being engulfed; return True iff any change occurred */ -static boolean +staticfn boolean unconstrain_map(void) { boolean res = u.uinwater || u.uburied || u.uswallow; @@ -66,7 +66,7 @@ unconstrain_map(void) } /* put hero back underwater or underground or engulfed */ -static void +staticfn void reconstrain_map(void) { /* if was in water and taken out, put back; bypass set_uinwater() */ @@ -75,7 +75,7 @@ reconstrain_map(void) u.uswallow = iflags.save_uswallow, iflags.save_uswallow = 0; } -static void +staticfn void map_redisplay(void) { reconstrain_map(); @@ -87,7 +87,7 @@ map_redisplay(void) } /* use getpos()'s 'autodescribe' to view whatever is currently shown on map */ -static void +staticfn void browse_map(unsigned ter_typ, const char *ter_explain) { coord dummy_pos; /* don't care whether player actually picks a spot */ @@ -103,7 +103,7 @@ browse_map(unsigned ter_typ, const char *ter_explain) } /* extracted from monster_detection() so can be shared by do_vicinity_map() */ -static void +staticfn void map_monst(struct monst *mtmp, boolean showtail) { int glyph = (monsym(mtmp->data) == ' ') @@ -230,7 +230,7 @@ o_material(struct obj *obj, unsigned material) return (struct obj *) 0; } -static void +staticfn void do_dknown_of(struct obj *obj) { struct obj *otmp; @@ -243,7 +243,7 @@ do_dknown_of(struct obj *obj) } /* Check whether the location has an outdated object displayed on it. */ -static boolean +staticfn boolean check_map_spot(coordxy x, coordxy y, char oclass, unsigned material) { int glyph; @@ -297,7 +297,7 @@ check_map_spot(coordxy x, coordxy y, char oclass, unsigned material) * reappear after the detection has completed. Return true if noticeable * change occurs. */ -static boolean +staticfn boolean clear_stale_map(char oclass, unsigned material) { coordxy zx, zy; @@ -844,7 +844,7 @@ monster_detect(struct obj *otmp, /* detecting object (if any) */ return 0; } -static void +staticfn void sense_trap(struct trap *trap, coordxy x, coordxy y, int src_cursed) { if (Hallucination || src_cursed) { @@ -886,7 +886,7 @@ sense_trap(struct trap *trap, coordxy x, coordxy y, int src_cursed) /* check a list of objects for chest traps; return 1 if found at , 2 if found at some other spot, 3 if both, 0 otherwise; optionally update the map to show where such traps were found */ -static int +staticfn int detect_obj_traps( struct obj *objlist, boolean show_them, @@ -917,7 +917,7 @@ detect_obj_traps( return result; } -static void +staticfn void display_trap_map(int cursed_src) { struct monst *mon; @@ -1051,7 +1051,7 @@ trap_detect( return 0; } -static int +staticfn int furniture_detect(void) { struct monst *mon; @@ -1563,7 +1563,7 @@ cvt_sdoor_to_door(struct rm *lev) /* find something at one location; it should find all somethings there since it is used for magical detection rather than physical searching */ -static void +staticfn void findone(coordxy zx, coordxy zy, genericptr_t whatfound) { struct trap *ttmp; @@ -1624,7 +1624,7 @@ findone(coordxy zx, coordxy zy, genericptr_t whatfound) } } -static void +staticfn void openone(coordxy zx, coordxy zy, genericptr_t num) { struct trap *ttmp; @@ -1831,7 +1831,7 @@ find_trap(struct trap *trap) } } -static int +staticfn int mfind0(struct monst *mtmp, boolean via_warning) { coordxy x = mtmp->mx, y = mtmp->my; @@ -2015,7 +2015,7 @@ premap_detect(void) } } -static int +staticfn int reveal_terrain_getglyph( coordxy x, coordxy y, unsigned swallowed, diff --git a/src/dig.c b/src/dig.c index 2d65e93fa..d66027e5a 100644 --- a/src/dig.c +++ b/src/dig.c @@ -5,16 +5,16 @@ #include "hack.h" -static boolean rm_waslit(void); -static void mkcavepos(coordxy, coordxy, int, boolean, boolean); -static void mkcavearea(boolean); -static boolean pick_can_reach(struct obj *, coordxy, coordxy) NONNULLARG1; -static int dig(void); -static void dig_up_grave(coord *); -static boolean watchman_canseeu(struct monst *) NONNULLARG1; -static int adj_pit_checks(coord *, char *) NONNULLARG2; -static void pit_flow(struct trap *, schar); -static boolean furniture_handled(coordxy, coordxy, boolean); +staticfn boolean rm_waslit(void); +staticfn void mkcavepos(coordxy, coordxy, int, boolean, boolean); +staticfn void mkcavearea(boolean); +staticfn boolean pick_can_reach(struct obj *, coordxy, coordxy) NONNULLARG1; +staticfn int dig(void); +staticfn void dig_up_grave(coord *); +staticfn boolean watchman_canseeu(struct monst *) NONNULLARG1; +staticfn int adj_pit_checks(coord *, char *) NONNULLARG2; +staticfn void pit_flow(struct trap *, schar); +staticfn boolean furniture_handled(coordxy, coordxy, boolean); /* Indices returned by dig_typ() */ enum dig_types { @@ -26,7 +26,7 @@ enum dig_types { DIGTYP_TREE }; -static boolean +staticfn boolean rm_waslit(void) { coordxy x, y; @@ -44,7 +44,7 @@ rm_waslit(void) * boulders in the name of a nice effect. Vision will get fixed up again * immediately after the effect is complete. */ -static void +staticfn void mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit) { struct rm *lev; @@ -84,7 +84,7 @@ mkcavepos(coordxy x, coordxy y, int dist, boolean waslit, boolean rockit) feel_newsym(x, y); } -static void +staticfn void mkcavearea(boolean rockit) { int dist; @@ -137,7 +137,7 @@ mkcavearea(boolean rockit) } /* called when attempting to break a statue or boulder with a pick */ -static boolean +staticfn boolean pick_can_reach(struct obj *pick, coordxy x, coordxy y) { struct trap *t = t_at(x, y); @@ -260,7 +260,7 @@ dig_check(struct monst *madeby, boolean verbose, coordxy x, coordxy y) return TRUE; } -static int +staticfn int dig(void) { struct rm *lev; @@ -518,7 +518,7 @@ dig(void) return 1; } -static boolean +staticfn boolean furniture_handled(coordxy x, coordxy y, boolean madeby_u) { struct rm *lev = &levl[x][y]; @@ -963,7 +963,7 @@ dighole(boolean pit_only, boolean by_magic, coord *cc) return retval; } -static void +staticfn void dig_up_grave(coord *cc) { struct obj *otmp; @@ -1296,7 +1296,7 @@ use_pick_axe2(struct obj *obj) return ECMD_TIME; } -static boolean +staticfn boolean watchman_canseeu(struct monst *mtmp) { if (is_watch(mtmp->data) && mtmp->mcansee && m_canseeu(mtmp) @@ -1696,7 +1696,7 @@ zap_dig(void) * you're zapping a wand of digging laterally while * down in the pit. */ -static int +staticfn int adj_pit_checks(coord *cc, char *msg) { int ltyp; @@ -1777,7 +1777,7 @@ adj_pit_checks(coord *cc, char *msg) /* * Ensure that all conjoined pits fill up. */ -static void +staticfn void pit_flow(struct trap *trap, schar filltyp) { /* diff --git a/src/display.c b/src/display.c index c875394a1..ac0428642 100644 --- a/src/display.c +++ b/src/display.c @@ -123,32 +123,32 @@ */ #include "hack.h" -static void show_mon_or_warn(coordxy, coordxy, int); -static void display_monster(coordxy, coordxy, +staticfn void show_mon_or_warn(coordxy, coordxy, int); +staticfn void display_monster(coordxy, coordxy, struct monst *, int, boolean) NONNULLPTRS; -static int swallow_to_glyph(int, int); -static void display_warning(struct monst *) NONNULLARG1; -static boolean next_to_gas(struct monst *, coordxy, coordxy) NONNULLARG1; +staticfn int swallow_to_glyph(int, int); +staticfn void display_warning(struct monst *) NONNULLARG1; +staticfn boolean next_to_gas(struct monst *, coordxy, coordxy) NONNULLARG1; -static int check_pos(coordxy, coordxy, int); -static void get_bkglyph_and_framecolor(coordxy x, coordxy y, int *, uint32 *); -static int tether_glyph(coordxy, coordxy); -static void mimic_light_blocking(struct monst *) NONNULLARG1; +staticfn int check_pos(coordxy, coordxy, int); +staticfn void get_bkglyph_and_framecolor(coordxy x, coordxy y, int *, uint32 *); +staticfn int tether_glyph(coordxy, coordxy); +staticfn void mimic_light_blocking(struct monst *) NONNULLARG1; /*#define WA_VERBOSE*/ /* give (x,y) locations for all "bad" spots */ #ifdef WA_VERBOSE -static boolean more_than_one(coordxy, coordxy, coordxy, coordxy, coordxy); +staticfn boolean more_than_one(coordxy, coordxy, coordxy, coordxy, coordxy); #endif -static int set_twall(coordxy, coordxy, coordxy, coordxy, +staticfn int set_twall(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy); -static int set_wall(coordxy, coordxy, int); -static int set_corn(coordxy, coordxy, coordxy, coordxy, +staticfn int set_wall(coordxy, coordxy, int); +staticfn int set_corn(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, coordxy); -static int set_crosswall(coordxy, coordxy); -static void set_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy); -static void t_warn(struct rm *); -static int wall_angle(struct rm *); +staticfn int set_crosswall(coordxy, coordxy); +staticfn void set_seenv(struct rm *, coordxy, coordxy, coordxy, coordxy); +staticfn void t_warn(struct rm *); +staticfn int wall_angle(struct rm *); #define _glyph_at(x, y) gg.gbuf[y][x].glyphinfo.glyph @@ -468,7 +468,7 @@ map_location(coordxy x, coordxy y, int show) } /* display something on monster layer; may need to fixup object layer */ -static void +staticfn void show_mon_or_warn(coordxy x, coordxy y, int monglyph) { struct obj *o; @@ -500,7 +500,7 @@ show_mon_or_warn(coordxy x, coordxy y, int monglyph) * a worm tail. * */ -static void +staticfn void display_monster( coordxy x, coordxy y, /* display position */ struct monst *mon, /* monster to display */ @@ -619,7 +619,7 @@ display_monster( * * Do not call for worm tails. */ -static void +staticfn void display_warning(struct monst *mon) { coordxy x = mon->mx, y = mon->my; @@ -653,7 +653,7 @@ warning_of(struct monst *mon) /* returns True if mon is adjacent and would be seen if vision wasn't blocked by being in a gas cloud (implicit; caller has already checked) */ -static boolean +staticfn boolean next_to_gas( struct monst *mon, coordxy mx, coordxy my) /* won't match mon->mx,my if long worm's tail */ @@ -1072,7 +1072,7 @@ shieldeff(coordxy x, coordxy y) } } -static int +staticfn int tether_glyph(coordxy x, coordxy y) { int tdx, tdy; @@ -1473,7 +1473,7 @@ see_monsters(void) newsym(u.ux, u.uy); } -static void +staticfn void mimic_light_blocking(struct monst *mtmp) { if (mtmp->minvis && is_lightblocker_mappear(mtmp)) { @@ -1583,7 +1583,7 @@ static glyph_info no_ginfo = { : &gg.gbuf[(y)][(x)].glyphinfo) #else static glyph_info ginfo; -static glyph_info *glyphinfo_at(coordxy, coordxy, int); +staticfn glyph_info *glyphinfo_at(coordxy, coordxy, int); #define Glyphinfo_at(x, y, glyph) glyphinfo_at((x), (y), (glyph)) #endif @@ -2343,7 +2343,7 @@ back_to_glyph(coordxy x, coordxy y) * If you don't want a patchwork monster while hallucinating, decide on * a random monster in swallowed() and don't use what_mon() here. */ -static int +staticfn int swallow_to_glyph(int mnum, int loc) { int m_3 = what_mon(mnum, rn2_on_display_rng) << 3; @@ -2413,7 +2413,7 @@ glyphinfo_at(coordxy x, coordxy y, int glyph) * */ -static void +staticfn void get_bkglyph_and_framecolor( coordxy x, coordxy y, int *bkglyph, @@ -2609,9 +2609,9 @@ int wallcolors[sokoban_walls + 1] = { && gl.level.objects[(x)][(y)]->nexthere) #endif -static int cmap_to_roguecolor(int); +staticfn int cmap_to_roguecolor(int); -static int +staticfn int cmap_to_roguecolor(int cmap) { int color = NO_COLOR; @@ -3006,8 +3006,8 @@ reset_glyphmap(enum glyphmap_change_triggers trigger) #ifdef WA_VERBOSE -static const char *type_to_name(int); -static void error4(coordxy, coordxy, int, int, int, int); +staticfn const char *type_to_name(int); +staticfn void error4(coordxy, coordxy, int, int, int, int); static int bad_count[MAX_TYPE]; /* count of positions flagged as bad */ static const char *const type_names[MAX_TYPE] = { @@ -3020,13 +3020,13 @@ static const char *const type_names[MAX_TYPE] = { "CLOUD" }; -static const char * +staticfn const char * type_to_name(int type) { return (type < 0 || type >= MAX_TYPE) ? "unknown" : type_names[type]; } -static void +staticfn void error4(coordxy x, coordxy y, int a, int b, int c, int dd) { pline("set_wall_state: %s @ (%d,%d) %s%s%s%s", @@ -3042,7 +3042,7 @@ error4(coordxy x, coordxy y, int a, int b, int c, int dd) * * Things that are ambiguous: lava */ -static int +staticfn int check_pos(coordxy x, coordxy y, int which) { int type; @@ -3058,7 +3058,7 @@ check_pos(coordxy x, coordxy y, int which) /* Return TRUE if more than one is non-zero. */ /*ARGSUSED*/ #ifdef WA_VERBOSE -static boolean +staticfn boolean more_than_one(coordxy x, coordxy y, coordxy a, coordxy b, coordxy c) { if ((a && (b | c)) || (b && (a | c)) || (c && (a | b))) { @@ -3073,7 +3073,7 @@ more_than_one(coordxy x, coordxy y, coordxy a, coordxy b, coordxy c) #endif /* Return the wall mode for a T wall. */ -static int +staticfn int set_twall( #ifdef WA_VERBOSE coordxy x0, coordxy y0, /* used #if WA_VERBOSE */ @@ -3096,7 +3096,7 @@ set_twall( } /* Return wall mode for a horizontal or vertical wall. */ -static int +staticfn int set_wall(coordxy x, coordxy y, int horiz) { int wmode, is_1, is_2; @@ -3117,7 +3117,7 @@ set_wall(coordxy x, coordxy y, int horiz) } /* Return a wall mode for a corner wall. (x4,y4) is the "inner" position. */ -static int +staticfn int set_corn(coordxy x1, coordxy y1, coordxy x2, coordxy y2, coordxy x3, coordxy y3, coordxy x4, coordxy y4) { coordxy wmode, is_1, is_2, is_3, is_4; @@ -3145,7 +3145,7 @@ set_corn(coordxy x1, coordxy y1, coordxy x2, coordxy y2, coordxy x3, coordxy y3, } /* Return mode for a crosswall. */ -static int +staticfn int set_crosswall(coordxy x, coordxy y) { coordxy wmode, is_1, is_2, is_3, is_4; @@ -3274,7 +3274,7 @@ const seenV seenv_matrix[3][3] = { #define sign(z) ((z) < 0 ? -1 : ((z) != 0)) /* Set the seen vector of lev as if seen from (x0,y0) to (x,y). */ -static void +staticfn void set_seenv( struct rm *lev, coordxy x0, coordxy y0, /* from */ @@ -3358,7 +3358,7 @@ static const int cross_matrix[4][6] = { }; /* Print out a T wall warning and all interesting info. */ -static void +staticfn void t_warn(struct rm *lev) { static const char warn_str[] = "wall_angle: %s: case %d: seenv = 0x%x"; @@ -3418,7 +3418,7 @@ t_warn(struct rm *lev) * draw diagrams. See rm.h for more details on the wall modes and * seen vector (SV). */ -static int +staticfn int wall_angle(struct rm *lev) { unsigned int seenv = lev->seenv & 0xff; diff --git a/src/dlb.c b/src/dlb.c index cbcaa7bad..4ebebc027 100644 --- a/src/dlb.c +++ b/src/dlb.c @@ -59,20 +59,20 @@ extern unsigned FITSuint_(unsigned long long, const char *, int); */ #define MAX_LIBS 4 -static library dlb_libs[MAX_LIBS]; +staticfn library dlb_libs[MAX_LIBS]; -static boolean readlibdir(library * lp); -static boolean find_file(const char *name, library **lib, long *startp, +staticfn boolean readlibdir(library * lp); +staticfn boolean find_file(const char *name, library **lib, long *startp, long *sizep); -static boolean lib_dlb_init(void); -static void lib_dlb_cleanup(void); -static boolean lib_dlb_fopen(dlb *, const char *, const char *); -static int lib_dlb_fclose(dlb *); -static int lib_dlb_fread(char *, int, int, dlb *); -static int lib_dlb_fseek(dlb *, long, int); -static char *lib_dlb_fgets(char *, int, dlb *); -static int lib_dlb_fgetc(dlb *); -static long lib_dlb_ftell(dlb *); +staticfn boolean lib_dlb_init(void); +staticfn void lib_dlb_cleanup(void); +staticfn boolean lib_dlb_fopen(dlb *, const char *, const char *); +staticfn int lib_dlb_fclose(dlb *); +staticfn int lib_dlb_fread(char *, int, int, dlb *); +staticfn int lib_dlb_fseek(dlb *, long, int); +staticfn char *lib_dlb_fgets(char *, int, dlb *); +staticfn int lib_dlb_fgetc(dlb *); +staticfn long lib_dlb_ftell(dlb *); /* not static because shared with dlb_main.c */ boolean open_library(const char *lib_name, library *lp); @@ -123,7 +123,7 @@ extern char *eos(char *); * * Return TRUE on success, FALSE on failure. */ -static boolean +staticfn boolean readlibdir(library *lp) /* library pointer to fill in */ { int i; @@ -171,7 +171,7 @@ readlibdir(library *lp) /* library pointer to fill in */ * Look for the file in our directory structure. Return 1 if successful, * 0 if not found. Fill in the size and starting position. */ -static boolean +staticfn boolean find_file(const char *name, library **lib, long *startp, long *sizep) { int i, j; @@ -228,7 +228,7 @@ close_library(library *lp) * Open the library file once using stdio. Keep it open, but * keep track of the file position. */ -static boolean +staticfn boolean lib_dlb_init(void) { /* zero out array */ @@ -248,7 +248,7 @@ lib_dlb_init(void) return TRUE; } -static void +staticfn void lib_dlb_cleanup(void) { int i; @@ -269,7 +269,7 @@ build_dlb_filename(const char *lf) #endif /*ARGSUSED*/ -static boolean +staticfn boolean lib_dlb_fopen(dlb *dp, const char *name, const char *mode UNUSED) { long start, size; @@ -288,14 +288,14 @@ lib_dlb_fopen(dlb *dp, const char *name, const char *mode UNUSED) } /*ARGUSED*/ -static int +staticfn int lib_dlb_fclose(dlb *dp UNUSED) { /* nothing needs to be done */ return 0; } -static int +staticfn int lib_dlb_fread(char *buf, int size, int quan, dlb *dp) { long pos, nread, nbytes; @@ -320,7 +320,7 @@ lib_dlb_fread(char *buf, int size, int quan, dlb *dp) return (int) nread; } -static int +staticfn int lib_dlb_fseek(dlb *dp, long pos, int whence) { long curpos; @@ -345,7 +345,7 @@ lib_dlb_fseek(dlb *dp, long pos, int whence) return 0; } -static char * +staticfn char * lib_dlb_fgets(char *buf, int len, dlb *dp) { int i; @@ -377,7 +377,7 @@ lib_dlb_fgets(char *buf, int len, dlb *dp) return buf; } -static int +staticfn int lib_dlb_fgetc(dlb *dp) { char c; @@ -387,7 +387,7 @@ lib_dlb_fgetc(dlb *dp) return (int) c; } -static long +staticfn long lib_dlb_ftell(dlb *dp) { return dp->mark; diff --git a/src/do.c b/src/do.c index 9719d7f68..cc0435558 100644 --- a/src/do.c +++ b/src/do.c @@ -7,19 +7,19 @@ #include "hack.h" -static boolean teleport_sink(void); -static void dosinkring(struct obj *); -static int drop(struct obj *); -static int menudrop_split(struct obj *, long); -static boolean engulfer_digests_food(struct obj *); -static boolean danger_uprops(void); -static int wipeoff(void); -static int menu_drop(int); -static boolean u_stuck_cannot_go(const char *); -static NHFILE *currentlevel_rewrite(void); -static void familiar_level_msg(void); -static void final_level(void); -static void temperature_change_msg(schar); +staticfn boolean teleport_sink(void); +staticfn void dosinkring(struct obj *); +staticfn int drop(struct obj *); +staticfn int menudrop_split(struct obj *, long); +staticfn boolean engulfer_digests_food(struct obj *); +staticfn boolean danger_uprops(void); +staticfn int wipeoff(void); +staticfn int menu_drop(int); +staticfn boolean u_stuck_cannot_go(const char *); +staticfn NHFILE *currentlevel_rewrite(void); +staticfn void familiar_level_msg(void); +staticfn void final_level(void); +staticfn void temperature_change_msg(schar); /* static boolean badspot(coordxy,coordxy); */ @@ -447,7 +447,7 @@ polymorph_sink(void) /* Teleports the sink at the player's position; return True if sink teleported. */ -static boolean +staticfn boolean teleport_sink(void) { coordxy cx, cy; @@ -485,7 +485,7 @@ teleport_sink(void) } /* obj is a ring being dropped over a kitchen sink */ -static void +staticfn void dosinkring(struct obj *obj) { struct obj *otmp, *otmp2; @@ -701,7 +701,7 @@ canletgo(struct obj *obj, const char *word) return TRUE; } -static int +staticfn int drop(struct obj *obj) { if (!obj) @@ -834,7 +834,7 @@ dropz(struct obj *obj, boolean with_impact) /* when swallowed, move dropped object from OBJ_FREE to u.ustuck's inventory; for purple worm, immediately eat any corpse, glob, or special meat item from object polymorph; return True if object is used up, False otherwise */ -static boolean +staticfn boolean engulfer_digests_food(struct obj *obj) { /* animal swallower (purple worn) eats any @@ -932,7 +932,7 @@ doddrop(void) return result; } -static int /* check callers */ +staticfn int /* check callers */ menudrop_split(struct obj *otmp, long cnt) { if (cnt && cnt < otmp->quan) { @@ -949,7 +949,7 @@ menudrop_split(struct obj *otmp, long cnt) } /* Drop things from the hero's inventory, using a menu. */ -static int +staticfn int menu_drop(int retry) { int n, i, n_dropped = 0; @@ -1078,7 +1078,7 @@ menu_drop(int retry) return (n_dropped ? ECMD_TIME : ECMD_OK); } -static boolean +staticfn boolean u_stuck_cannot_go(const char *updn) { if (u.ustuck) { @@ -1315,7 +1315,7 @@ doup(void) } /* check that we can write out the current level */ -static NHFILE * +staticfn NHFILE * currentlevel_rewrite(void) { NHFILE *nhfp; @@ -1415,7 +1415,7 @@ u_collide_m(struct monst *mtmp) } } -static void +staticfn void familiar_level_msg(void) { static const char *const fam_msgs[4] = { @@ -1969,7 +1969,7 @@ hellish_smoke_mesg(void) } /* give a message when the level temperature is different from previous */ -static void +staticfn void temperature_change_msg(schar prev_temperature) { if (prev_temperature != gl.level.flags.temperature) { @@ -1995,7 +1995,7 @@ maybe_lvltport_feedback(void) } } -static void +staticfn void final_level(void) { /* reset monster hostility relative to player */ @@ -2266,7 +2266,7 @@ zombify_mon(anything *arg, long timeout) } /* return TRUE if hero properties are dangerous to hero */ -static boolean +staticfn boolean danger_uprops(void) { return (Stoned || Slimed || Strangled || Sick); @@ -2308,7 +2308,7 @@ donull(void) return ECMD_TIME; /* Do nothing, but let other things happen */ } -static int +staticfn int wipeoff(void) { unsigned udelta = u.ucreamed; diff --git a/src/do_name.c b/src/do_name.c index 6a3eed42d..02d410fdb 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -5,18 +5,18 @@ #include "hack.h" -static char *nextmbuf(void); -static char *name_from_player(char *, const char *, const char *); -static void do_mgivenname(void); -static boolean alreadynamed(struct monst *, char *, char *) NONNULLPTRS; -static void do_oname(struct obj *) NONNULLARG1; -static char *docall_xname(struct obj *) NONNULLARG1; -static void namefloorobj(void); +staticfn char *nextmbuf(void); +staticfn char *name_from_player(char *, const char *, const char *); +staticfn void do_mgivenname(void); +staticfn boolean alreadynamed(struct monst *, char *, char *) NONNULLPTRS; +staticfn void do_oname(struct obj *) NONNULLARG1; +staticfn char *docall_xname(struct obj *) NONNULLARG1; +staticfn void namefloorobj(void); #define NUMMBUF 5 /* manage a pool of BUFSZ buffers, so callers don't have to */ -static char * +staticfn char * nextmbuf(void) { static char NEARDATA bufs[NUMMBUF][BUFSZ]; @@ -101,7 +101,7 @@ safe_oname(struct obj *obj) /* get a name for a monster or an object from player; truncate if longer than PL_PSIZ, then return it */ -static char * +staticfn char * name_from_player( char *outbuf, /* output buffer, assumed to be at least BUFSZ long; * anything longer than PL_PSIZ will be truncated */ @@ -154,7 +154,7 @@ christen_monst(struct monst *mtmp, const char *name) /* check whether user-supplied name matches or nearly matches an unnameable monster's name, or is an attempt to delete the monster's name; if so, give alternate reject message for do_mgivenname() */ -static boolean +staticfn boolean alreadynamed(struct monst *mtmp, char *monnambuf, char *usrbuf) { char pronounbuf[10], *p; @@ -195,7 +195,7 @@ alreadynamed(struct monst *mtmp, char *monnambuf, char *usrbuf) } /* allow player to assign a name to some chosen monster */ -static void +staticfn void do_mgivenname(void) { char buf[BUFSZ], monnambuf[BUFSZ], qbuf[QBUFSZ]; @@ -286,7 +286,7 @@ do_mgivenname(void) * used with extreme care. Applying a name to an object no longer * allocates a replacement object, so that old risk is gone. */ -static void +staticfn void do_oname(struct obj *obj) { char *bufp, buf[BUFSZ], bufcpy[BUFSZ], qbuf[QBUFSZ]; @@ -600,7 +600,7 @@ docallcmd(void) } /* for use by safe_qbuf() */ -static char * +staticfn char * docall_xname(struct obj *obj) { struct obj otemp; @@ -672,7 +672,7 @@ docall(struct obj *obj) } } -static void +staticfn void namefloorobj(void) { coord cc; diff --git a/src/do_wear.c b/src/do_wear.c index e2fa3b813..724aaf043 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -20,37 +20,37 @@ static NEARDATA const long takeoff_order[] = { WORN_SHIRT, WORN_BOOTS, W_SWAPWEP, W_QUIVER, 0L }; -static void on_msg(struct obj *); -static void toggle_stealth(struct obj *, long, boolean); -static int Armor_on(void); +staticfn void on_msg(struct obj *); +staticfn void toggle_stealth(struct obj *, long, boolean); +staticfn int Armor_on(void); /* int Boots_on(void); -- moved to extern.h */ -static int Cloak_on(void); -static int Helmet_on(void); -static int Gloves_on(void); -static int Shield_on(void); -static int Shirt_on(void); -static void dragon_armor_handling(struct obj *, boolean, boolean); -static void Amulet_on(void); -static void learnring(struct obj *, boolean); -static void adjust_attrib(struct obj *, int, int); -static void Ring_off_or_gone(struct obj *, boolean); -static int select_off(struct obj *); -static struct obj *do_takeoff(void); -static int take_off(void); -static int menu_remarm(int); -static void wornarm_destroyed(struct obj *); -static void count_worn_stuff(struct obj **, boolean); -static int armor_or_accessory_off(struct obj *); -static int accessory_or_armor_on(struct obj *); -static void already_wearing(const char *); -static void already_wearing2(const char *, const char *); -static int equip_ok(struct obj *, boolean, boolean); -static int puton_ok(struct obj *); -static int remove_ok(struct obj *); -static int wear_ok(struct obj *); -static int takeoff_ok(struct obj *); +staticfn int Cloak_on(void); +staticfn int Helmet_on(void); +staticfn int Gloves_on(void); +staticfn int Shield_on(void); +staticfn int Shirt_on(void); +staticfn void dragon_armor_handling(struct obj *, boolean, boolean); +staticfn void Amulet_on(void); +staticfn void learnring(struct obj *, boolean); +staticfn void adjust_attrib(struct obj *, int, int); +staticfn void Ring_off_or_gone(struct obj *, boolean); +staticfn int select_off(struct obj *); +staticfn struct obj *do_takeoff(void); +staticfn int take_off(void); +staticfn int menu_remarm(int); +staticfn void wornarm_destroyed(struct obj *); +staticfn void count_worn_stuff(struct obj **, boolean); +staticfn int armor_or_accessory_off(struct obj *); +staticfn int accessory_or_armor_on(struct obj *); +staticfn void already_wearing(const char *); +staticfn void already_wearing2(const char *, const char *); +staticfn int equip_ok(struct obj *, boolean, boolean); +staticfn int puton_ok(struct obj *); +staticfn int remove_ok(struct obj *); +staticfn int wear_ok(struct obj *); +staticfn int takeoff_ok(struct obj *); /* maybe_destroy_armor() may return NULL */ -static struct obj *maybe_destroy_armor(struct obj *, struct obj *, +staticfn struct obj *maybe_destroy_armor(struct obj *, struct obj *, boolean *) NONNULLARG3; /* plural "fingers" or optionally "gloves" */ @@ -70,7 +70,7 @@ off_msg(struct obj *otmp) } /* for items that involve no delay */ -static void +staticfn void on_msg(struct obj *otmp) { if (flags.verbose) { @@ -91,7 +91,7 @@ on_msg(struct obj *otmp) give feedback and discover it iff stealth state is changing; stealth is blocked by riding unless hero+steed fly (handled with BStealth by mount and dismount routines) */ -static +staticfn void toggle_stealth( struct obj *obj, @@ -297,7 +297,7 @@ Boots_off(void) return 0; } -static int +staticfn int Cloak_on(void) { long oldprop = @@ -405,7 +405,7 @@ Cloak_off(void) return 0; } -static int +staticfn int Helmet_on(void) { switch (uarmh->otyp) { @@ -540,7 +540,7 @@ hard_helmet(struct obj *obj) return (is_metallic(obj) || is_crackable(obj)) ? TRUE : FALSE; } -static int +staticfn int Gloves_on(void) { long oldprop = @@ -669,7 +669,7 @@ Gloves_off(void) return 0; } -static int +staticfn int Shield_on(void) { /* no shield currently requires special handling when put on, but we @@ -719,7 +719,7 @@ Shield_off(void) return 0; } -static int +staticfn int Shirt_on(void) { /* no shirt currently requires special handling when put on, but we @@ -758,7 +758,7 @@ Shirt_off(void) } /* handle extra abilities for hero wearing dragon scale armor */ -static void +staticfn void dragon_armor_handling( struct obj *otmp, /* armor being put on or taken off */ boolean puton, /* True: on, False: off */ @@ -847,7 +847,7 @@ dragon_armor_handling( } } -static int +staticfn int Armor_on(void) { if (!uarm) /* no known instances of !uarm here but play it safe */ @@ -923,7 +923,7 @@ Armor_gone(void) return 0; } -static void +staticfn void Amulet_on(void) { /* make sure amulet isn't wielded; can't use remove_worn_item() @@ -1094,7 +1094,7 @@ Amulet_off(void) } /* handle ring discovery; comparable to learnwand() */ -static void +staticfn void learnring(struct obj *ring, boolean observed) { int ringtype = ring->otyp; @@ -1124,7 +1124,7 @@ learnring(struct obj *ring, boolean observed) } } -static void +staticfn void adjust_attrib(struct obj *obj, int which, int val) { int old_attrib; @@ -1246,7 +1246,7 @@ Ring_on(struct obj *obj) } } -static void +staticfn void Ring_off_or_gone(struct obj *obj, boolean gone) { long mask = (obj->owornmask & W_RING); @@ -1632,7 +1632,7 @@ stop_donning(struct obj *stolenobj) /* no message if stolenobj is already static NEARDATA int Narmorpieces, Naccessories; /* assign values to Narmorpieces and Naccessories */ -static void +staticfn void count_worn_stuff(struct obj **which, /* caller wants this when count is 1 */ boolean accessorizing) { @@ -1669,7 +1669,7 @@ count_worn_stuff(struct obj **which, /* caller wants this when count is 1 */ /* take off one piece or armor or one accessory; shared by dotakeoff('T') and doremring('R') */ -static int +staticfn int armor_or_accessory_off(struct obj *obj) { if (!(obj->owornmask & (W_ARMOR | W_ACCESSORY))) { @@ -1893,13 +1893,13 @@ armoroff(struct obj *otmp) return 1; } -static void +staticfn void already_wearing(const char *cc) { You("are already wearing %s%c", cc, (cc == c_that_) ? '!' : '.'); } -static void +staticfn void already_wearing2(const char *cc1, const char *cc2) { You_cant("wear %s because you're wearing %s there already.", cc1, cc2); @@ -2091,7 +2091,7 @@ canwearobj(struct obj *otmp, long *mask, boolean noisy) return !err; } -static int +staticfn int accessory_or_armor_on(struct obj *obj) { long mask = 0L; @@ -2575,7 +2575,7 @@ unchanger(void) return 0; } -static +staticfn int select_off(struct obj *otmp) { @@ -2702,7 +2702,7 @@ select_off(struct obj *otmp) return 0; } -static struct obj * +staticfn struct obj * do_takeoff(void) { struct obj *otmp = (struct obj *) 0; @@ -2778,7 +2778,7 @@ do_takeoff(void) } /* occupation callback for 'A' */ -static int +staticfn int take_off(void) { int i; @@ -2945,7 +2945,7 @@ remarm_swapwep(void) return (!uswapwep || uswapwep->bknown != oldbknown) ? ECMD_TIME : ECMD_OK; } -static int +staticfn int menu_remarm(int retry) { int n, i = 0; @@ -2999,7 +2999,7 @@ menu_remarm(int retry) /* take off the specific worn object and if it still exists after that, destroy it (taking off the item might already destroy it by dunking hero into lava) */ -static void +staticfn void wornarm_destroyed(struct obj *wornarm) { struct obj *invobj; @@ -3042,7 +3042,7 @@ wornarm_destroyed(struct obj *wornarm) * returns impacted armor with its in_use bit set, * or Null. *resisted is updated to reflect whether * it resisted or not */ -static struct obj * +staticfn struct obj * maybe_destroy_armor(struct obj *armor, struct obj *atmp, boolean *resisted) { if ((armor != 0) && (!atmp || atmp == armor) @@ -3195,7 +3195,7 @@ inaccessible_equipment(struct obj *obj, } /* not a getobj callback - unifies code among the other 4 getobj callbacks */ -static int +staticfn int equip_ok(struct obj *obj, boolean removing, boolean accessory) { boolean is_worn; @@ -3240,28 +3240,28 @@ equip_ok(struct obj *obj, boolean removing, boolean accessory) } /* getobj callback for P command */ -static int +staticfn int puton_ok(struct obj *obj) { return equip_ok(obj, FALSE, TRUE); } /* getobj callback for R command */ -static int +staticfn int remove_ok(struct obj *obj) { return equip_ok(obj, TRUE, TRUE); } /* getobj callback for W command */ -static int +staticfn int wear_ok(struct obj *obj) { return equip_ok(obj, FALSE, FALSE); } /* getobj callback for T command */ -static int +staticfn int takeoff_ok(struct obj *obj) { return equip_ok(obj, TRUE, FALSE); diff --git a/src/dog.c b/src/dog.c index 7e776e36c..fd22e3dda 100644 --- a/src/dog.c +++ b/src/dog.c @@ -5,11 +5,11 @@ #include "hack.h" -static int pet_type(void); -static struct permonst * pick_familiar_pm(struct obj *, boolean); -static void set_mon_lastmove(struct monst *); -static int mon_leave(struct monst *) NONNULLARG1; -static boolean keep_mon_accessible(struct monst *); +staticfn int pet_type(void); +staticfn struct permonst * pick_familiar_pm(struct obj *, boolean); +staticfn void set_mon_lastmove(struct monst *); +staticfn int mon_leave(struct monst *) NONNULLARG1; +staticfn boolean keep_mon_accessible(struct monst *); enum arrival { Before_you = 0, /* monsters kept on migrating_mons for accessibility; @@ -63,7 +63,7 @@ initedog(struct monst *mtmp) u.uconduct.pets++; } -static int +staticfn int pet_type(void) { if (gu.urole.petnum != NON_PM) @@ -76,7 +76,7 @@ pet_type(void) return rn2(2) ? PM_KITTEN : PM_LITTLE_DOG; } -static struct permonst * +staticfn struct permonst * pick_familiar_pm(struct obj *otmp, boolean quietly) { struct permonst *pm = (struct permonst *) 0; @@ -235,7 +235,7 @@ makedog(void) return mtmp; } -static void +staticfn void set_mon_lastmove(struct monst *mtmp) { mtmp->mlstmv = gm.moves; @@ -667,7 +667,7 @@ mon_catchup_elapsed_time( /* bookkeeping when mtmp is about to leave the current level; common to keepdogs() and migrate_to_level() */ -static int +staticfn int mon_leave(struct monst *mtmp) { struct obj *obj; @@ -706,7 +706,7 @@ mon_leave(struct monst *mtmp) /* when hero leaves a level, some monsters should be placed on the migrating_mons list instead of being stashed inside the level's file */ -static boolean +staticfn boolean keep_mon_accessible(struct monst *mon) { /* the Wizard is kept accessible so that his harassment can fetch diff --git a/src/dogmove.c b/src/dogmove.c index 22ba0976c..3a575830c 100644 --- a/src/dogmove.c +++ b/src/dogmove.c @@ -11,15 +11,15 @@ #define DOG_WEAK 500 #define DOG_STARVE 750 -static void dog_starve(struct monst *); -static boolean dog_hunger(struct monst *, struct edog *); -static int dog_invent(struct monst *, struct edog *, int); -static int dog_goal(struct monst *, struct edog *, int, int, int); -static struct monst *find_targ(struct monst *, int, int, int); -static int find_friends(struct monst *, struct monst *, int); -static struct monst *best_target(struct monst *); -static long score_targ(struct monst *, struct monst *); -static boolean can_reach_location(struct monst *, coordxy, coordxy, coordxy, +staticfn void dog_starve(struct monst *); +staticfn boolean dog_hunger(struct monst *, struct edog *); +staticfn int dog_invent(struct monst *, struct edog *, int); +staticfn int dog_goal(struct monst *, struct edog *, int, int, int); +staticfn struct monst *find_targ(struct monst *, int, int, int); +staticfn int find_friends(struct monst *, struct monst *, int); +staticfn struct monst *best_target(struct monst *); +staticfn long score_targ(struct monst *, struct monst *); +staticfn boolean can_reach_location(struct monst *, coordxy, coordxy, coordxy, coordxy) NONNULLARG1; /* pick a carried item for pet to drop */ @@ -135,7 +135,7 @@ static NEARDATA const char nofetch[] = { BALL_CLASS, CHAIN_CLASS, ROCK_CLASS, 0 }; -static void wantdoor(coordxy, coordxy, genericptr_t); +staticfn void wantdoor(coordxy, coordxy, genericptr_t); boolean cursed_object_at(coordxy x, coordxy y) @@ -325,7 +325,7 @@ dog_eat(struct monst *mtmp, return (DEADMONSTER(mtmp)) ? 2 : 1; } -static void +staticfn void dog_starve(struct monst *mtmp) { if (mtmp->mleashed && mtmp != u.usteed) @@ -339,7 +339,7 @@ dog_starve(struct monst *mtmp) } /* hunger effects -- returns TRUE on starvation */ -static boolean +staticfn boolean dog_hunger(struct monst *mtmp, struct edog *edog) { if (gm.moves > edog->hungrytime + DOG_WEAK) { @@ -377,7 +377,7 @@ dog_hunger(struct monst *mtmp, struct edog *edog) /* do something with object (drop, pick up, eat) at current position * returns 1 if object eaten (since that counts as dog's move), 2 if died */ -static int +staticfn int dog_invent(struct monst *mtmp, struct edog *edog, int udist) { coordxy omx, omy; @@ -459,7 +459,7 @@ dog_invent(struct monst *mtmp, struct edog *edog, int udist) /* set dog's goal -- gtyp, gx, gy; returns -1/0/1 (dog's desire to approach player) or -2 (abort move) */ -static int +staticfn int dog_goal( struct monst *mtmp, struct edog *edog, @@ -626,7 +626,7 @@ dog_goal( #undef FARAWAY } -static struct monst * +staticfn struct monst * find_targ( struct monst *mtmp, int dx, int dy, @@ -670,7 +670,7 @@ find_targ( return targ; } -static int +staticfn int find_friends(struct monst *mtmp, struct monst *mtarg, int maxdist) { struct monst *pal; @@ -714,7 +714,7 @@ find_friends(struct monst *mtmp, struct monst *mtarg, int maxdist) return 0; } -static long +staticfn long score_targ(struct monst *mtmp, struct monst *mtarg) { long score = 0L; @@ -814,7 +814,7 @@ score_targ(struct monst *mtmp, struct monst *mtarg) return score; } -static struct monst * +staticfn struct monst * best_target(struct monst *mtmp) /* Pet */ { int dx, dy; @@ -1331,7 +1331,7 @@ could_reach_item(struct monst *mon, coordxy nx, coordxy ny) * Since the maximum food distance is 5, this should never be more than 5 * calls deep. */ -static boolean +staticfn boolean can_reach_location(struct monst *mon, coordxy mx, coordxy my, coordxy fx, coordxy fy) { int i, j; @@ -1367,7 +1367,7 @@ can_reach_location(struct monst *mon, coordxy mx, coordxy my, coordxy fx, coordx } /* do_clear_area client */ -static void +staticfn void wantdoor(coordxy x, coordxy y, genericptr_t distance) { int ndist, *dist_ptr = (int *) distance; diff --git a/src/dokick.c b/src/dokick.c index e7f012eba..9c8ba1249 100644 --- a/src/dokick.c +++ b/src/dokick.c @@ -11,26 +11,26 @@ /* gk.kickedobj (decl.c) tracks a kicked object until placed or destroyed */ -static void kickdmg(struct monst *, boolean); -static boolean maybe_kick_monster(struct monst *, coordxy, coordxy); -static void kick_monster(struct monst *, coordxy, coordxy); -static int kick_object(coordxy, coordxy, char *) NONNULLARG3; -static int really_kick_object(coordxy, coordxy); -static char *kickstr(char *, const char *) NONNULLPTRS; -static boolean watchman_thief_arrest(struct monst *) NONNULLPTRS; -static boolean watchman_door_damage(struct monst *, +staticfn void kickdmg(struct monst *, boolean); +staticfn boolean maybe_kick_monster(struct monst *, coordxy, coordxy); +staticfn void kick_monster(struct monst *, coordxy, coordxy); +staticfn int kick_object(coordxy, coordxy, char *) NONNULLARG3; +staticfn int really_kick_object(coordxy, coordxy); +staticfn char *kickstr(char *, const char *) NONNULLPTRS; +staticfn boolean watchman_thief_arrest(struct monst *) NONNULLPTRS; +staticfn boolean watchman_door_damage(struct monst *, coordxy, coordxy) NONNULLARG1; -static void kick_dumb(coordxy, coordxy); -static void kick_ouch(coordxy, coordxy, const char *) NONNULLARG3; -static void kick_door(coordxy, coordxy, int); -static int kick_nondoor(coordxy, coordxy, int); -static void otransit_msg(struct obj *, boolean, boolean, long); -static void drop_to(coord *, schar, coordxy, coordxy) NONNULLARG1; +staticfn void kick_dumb(coordxy, coordxy); +staticfn void kick_ouch(coordxy, coordxy, const char *) NONNULLARG3; +staticfn void kick_door(coordxy, coordxy, int); +staticfn int kick_nondoor(coordxy, coordxy, int); +staticfn void otransit_msg(struct obj *, boolean, boolean, long); +staticfn void drop_to(coord *, schar, coordxy, coordxy) NONNULLARG1; static const char kick_passes_thru[] = "kick passes harmlessly through"; /* kicking damage when not poly'd into a form with a kick attack */ -static void +staticfn void kickdmg(struct monst *mon, boolean clumsy) { int mdx, mdy; @@ -122,7 +122,7 @@ kickdmg(struct monst *mon, boolean clumsy) use_skill(kick_skill, 1); } -static boolean +staticfn boolean maybe_kick_monster(struct monst *mon, coordxy x, coordxy y) { if (mon) { @@ -142,7 +142,7 @@ maybe_kick_monster(struct monst *mon, coordxy x, coordxy y) return (boolean) (mon != 0); } -static void +staticfn void kick_monster(struct monst *mon, coordxy x, coordxy y) { boolean clumsy = FALSE; @@ -480,7 +480,7 @@ container_impact_dmg( } /* jacket around really_kick_object */ -static int +staticfn int kick_object(coordxy x, coordxy y, char *kickobjnam) { int res = 0; @@ -498,7 +498,7 @@ kick_object(coordxy x, coordxy y, char *kickobjnam) } /* guts of kick_object */ -static int +staticfn int really_kick_object(coordxy x, coordxy y) { int range; @@ -783,7 +783,7 @@ really_kick_object(coordxy x, coordxy y) } /* cause of death if kicking kills kicker */ -static char * +staticfn char * kickstr(char *buf, const char *kickobjnam) { const char *what; @@ -823,7 +823,7 @@ kickstr(char *buf, const char *kickobjnam) return strcat(strcpy(buf, "kicking "), what); } -static boolean +staticfn boolean watchman_thief_arrest(struct monst *mtmp) { if (is_watch(mtmp->data) && couldsee(mtmp->mx, mtmp->my) @@ -835,7 +835,7 @@ watchman_thief_arrest(struct monst *mtmp) return FALSE; } -static boolean +staticfn boolean watchman_door_damage(struct monst *mtmp, coordxy x, coordxy y) { if (is_watch(mtmp->data) && mtmp->mpeaceful @@ -853,7 +853,7 @@ watchman_door_damage(struct monst *mtmp, coordxy x, coordxy y) return FALSE; } -static void +staticfn void kick_dumb(coordxy x, coordxy y) { exercise(A_DEX, FALSE); @@ -870,7 +870,7 @@ kick_dumb(coordxy x, coordxy y) hurtle(-u.dx, -u.dy, 1, TRUE); } -static void +staticfn void kick_ouch(coordxy x, coordxy y, const char *kickobjnam) { int dmg; @@ -899,7 +899,7 @@ kick_ouch(coordxy x, coordxy y, const char *kickobjnam) } /* kick a door */ -static void +staticfn void kick_door(coordxy x, coordxy y, int avrg_attrib) { if (gm.maploc->doormask == D_ISOPEN || gm.maploc->doormask == D_BROKEN @@ -958,7 +958,7 @@ kick_door(coordxy x, coordxy y, int avrg_attrib) } /* kick non-door terrain */ -static int +staticfn int kick_nondoor(coordxy x, coordxy y, int avrg_attrib) { if (gm.maploc->typ == SDOOR) { @@ -1455,7 +1455,7 @@ dokick(void) return ECMD_TIME; } -static void +staticfn void drop_to(coord *cc, schar loc, coordxy x, coordxy y) { stairway *stway = stairway_at(x, y); @@ -1889,7 +1889,7 @@ deliver_obj_to_mon(struct monst *mtmp, int cnt, unsigned long deliverflags) } } -static void +staticfn void otransit_msg(struct obj *otmp, boolean nodrop, boolean chainthere, long num) { char *optr = 0, obuf[BUFSZ], xbuf[BUFSZ]; diff --git a/src/dothrow.c b/src/dothrow.c index 4fe668e96..0b7b52b70 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -7,21 +7,21 @@ #include "hack.h" -static int throw_obj(struct obj *, int); -static boolean ok_to_throw(int *); -static int throw_ok(struct obj *); -static void autoquiver(void); -static struct obj *find_launcher(struct obj *); -static int gem_accept(struct monst *, struct obj *); -static boolean toss_up(struct obj *, boolean) NONNULLARG1; -static void sho_obj_return_to_u(struct obj * obj); -static struct obj *return_throw_to_inv(struct obj *, long, boolean, +staticfn int throw_obj(struct obj *, int); +staticfn boolean ok_to_throw(int *); +staticfn int throw_ok(struct obj *); +staticfn void autoquiver(void); +staticfn struct obj *find_launcher(struct obj *); +staticfn int gem_accept(struct monst *, struct obj *); +staticfn boolean toss_up(struct obj *, boolean) NONNULLARG1; +staticfn void sho_obj_return_to_u(struct obj * obj); +staticfn struct obj *return_throw_to_inv(struct obj *, long, boolean, struct obj *); -static void tmiss(struct obj *, struct monst *, boolean); -static int throw_gold(struct obj *); -static void check_shop_obj(struct obj *, coordxy, coordxy, boolean); -static void breakmsg(struct obj *, boolean); -static boolean mhurtle_step(genericptr_t, coordxy, coordxy); +staticfn void tmiss(struct obj *, struct monst *, boolean); +staticfn int throw_gold(struct obj *); +staticfn void check_shop_obj(struct obj *, coordxy, coordxy, boolean); +staticfn void breakmsg(struct obj *, boolean); +staticfn boolean mhurtle_step(genericptr_t, coordxy, coordxy); /* uwep might already be removed from inventory so test for W_WEP instead; for Valk+Mjollnir, caller needs to validate the strength requirement */ @@ -80,7 +80,7 @@ multishot_class_bonus( } /* Throw the selected object, asking for direction */ -static int +staticfn int throw_obj(struct obj *obj, int shotlimit) { struct obj *otmp, *oldslot; @@ -287,7 +287,7 @@ throw_obj(struct obj *obj, int shotlimit) } /* common to dothrow() and dofire() */ -static boolean +staticfn boolean ok_to_throw(int *shotlimit_p) /* (see dothrow()) */ { *shotlimit_p = LIMIT_TO_RANGE_INT(0, LARGEST_INT, gc.command_count); @@ -307,7 +307,7 @@ ok_to_throw(int *shotlimit_p) /* (see dothrow()) */ } /* getobj callback for object to be thrown */ -static int +staticfn int throw_ok(struct obj *obj) { if (!obj) @@ -371,7 +371,7 @@ dothrow(void) /* KMH -- Automatically fill quiver */ /* Suggested by Jeffrey Bay */ -static void +staticfn void autoquiver(void) { struct obj *otmp, *oammo = 0, *omissile = 0, *omisc = 0, *altammo = 0; @@ -437,7 +437,7 @@ autoquiver(void) /* look through hero inventory for launcher matching ammo, avoiding known cursed items. Returns NULL if no match. */ -static struct obj * +staticfn struct obj * find_launcher(struct obj *ammo) { struct obj *otmp, *oX; @@ -992,7 +992,7 @@ will_hurtle(struct monst *mon, coordxy x, coordxy y) return goodpos(x, y, mon, MM_IGNOREWATER | MM_IGNORELAVA); } -static boolean +staticfn boolean mhurtle_step(genericptr_t arg, coordxy x, coordxy y) { struct monst *mon = (struct monst *) arg; @@ -1180,7 +1180,7 @@ mhurtle(struct monst *mon, int dx, int dy, int range) return; } -static void +staticfn void check_shop_obj(struct obj *obj, coordxy x, coordxy y, boolean broken) { boolean costly_xy; @@ -1255,7 +1255,7 @@ harmless_missile(struct obj *obj) * * Returns FALSE if the object is gone. */ -static boolean +staticfn boolean toss_up(struct obj *obj, boolean hitsroof) { const char *action; @@ -1432,7 +1432,7 @@ throwing_weapon(struct obj *obj) } /* the currently thrown object is returning to you (not for boomerangs) */ -static void +staticfn void sho_obj_return_to_u(struct obj *obj) { /* might already be our location (bounced off a wall) */ @@ -1807,7 +1807,7 @@ throwit(struct obj *obj, /* handle a throw-and-return missile coming back into inventory; makes sure that if it was wielded, it will be re-wielded; if it was split off of a stack (boomerang), don't let it merge with a different compatible stack */ -static struct obj * +staticfn struct obj * return_throw_to_inv( struct obj *obj, /* object to add to invent */ long wep_mask, /* its owornmask before it was removed from invent */ @@ -1903,7 +1903,7 @@ omon_adj(struct monst *mon, struct obj *obj, boolean mon_notices) } /* thrown object misses target monster */ -static void +staticfn void tmiss(struct obj *obj, struct monst *mon, boolean maybe_wakeup) { const char *missile = mshot_xname(obj); @@ -2259,7 +2259,7 @@ thitmonst( #undef special_obj_hits_leader -static int +staticfn int gem_accept(struct monst *mon, struct obj *obj) { static NEARDATA const char @@ -2557,7 +2557,7 @@ breaktest(struct obj *obj) } } -static void +staticfn void breakmsg(struct obj *obj, boolean in_view) { const char *to_pieces; @@ -2599,7 +2599,7 @@ breakmsg(struct obj *obj, boolean in_view) } } -static int +staticfn int throw_gold(struct obj *obj) { int range, odx, ody; diff --git a/src/dungeon.c b/src/dungeon.c index abf6fa149..86b8fb4a2 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -33,55 +33,56 @@ struct lchoice { }; #if 0 -static void Fread(genericptr_t, int, int, dlb *); +staticfn void Fread(genericptr_t, int, int, dlb *); #endif -static xint16 dname_to_dnum(const char *); -static int find_branch(const char *, struct proto_dungeon *); -static xint16 parent_dnum(const char *, struct proto_dungeon *); -static int level_range(xint16, int, int, int, struct proto_dungeon *, int *); -static xint16 parent_dlevel(const char *, struct proto_dungeon *); -static int correct_branch_type(struct tmpbranch *); -static branch *add_branch(int, int, struct proto_dungeon *); -static void add_level(s_level *); -static void init_level(int, int, struct proto_dungeon *); -static int possible_places(int, boolean *, struct proto_dungeon *); -static xint16 pick_level(boolean *, int); -static boolean place_level(int, struct proto_dungeon *); -static int get_dgn_flags(lua_State *); -static int get_dgn_align(lua_State *); -static void init_dungeon_levels(lua_State *, struct proto_dungeon *, int); -static void init_dungeon_branches(lua_State *, struct proto_dungeon *, int); -static void init_dungeon_set_entry(struct proto_dungeon *, int); -static void init_dungeon_set_depth(struct proto_dungeon *, int); -static void init_castle_tune(void); -static void fixup_level_locations(void); -static void free_proto_dungeon(struct proto_dungeon *); -static boolean init_dungeon_dungeons(lua_State *, struct proto_dungeon *, int); -static boolean unplaced_floater(struct dungeon *); -static boolean unreachable_level(d_level *, boolean); -static void tport_menu(winid, char *, struct lchoice *, d_level *, boolean); -static const char *br_string(int); -static char chr_u_on_lvl(d_level *); -static void print_branch(winid, int, int, int, boolean, struct lchoice *); -static char *get_annotation(d_level *); -static void query_annotation(d_level *); -static mapseen *load_mapseen(NHFILE *); -static void save_mapseen(NHFILE *, mapseen *); -static mapseen *find_mapseen(d_level *); -static mapseen *find_mapseen_by_str(const char *); -static void print_mapseen(winid, mapseen *, int, int, boolean); -static boolean interest_mapseen(mapseen *); -static void count_feat_lastseentyp(mapseen *, coordxy, coordxy); -static void traverse_mapseenchn(int, winid, int, int, int *); -static const char *seen_string(xint16, const char *); -static const char *br_string2(branch *); -static const char *shop_string(int); -static char *tunesuffix(mapseen *, char *, size_t); +staticfn xint16 dname_to_dnum(const char *); +staticfn int find_branch(const char *, struct proto_dungeon *); +staticfn xint16 parent_dnum(const char *, struct proto_dungeon *); +staticfn int level_range(xint16, int, int, int, struct proto_dungeon *, int *); +staticfn xint16 parent_dlevel(const char *, struct proto_dungeon *); +staticfn int correct_branch_type(struct tmpbranch *); +staticfn branch *add_branch(int, int, struct proto_dungeon *); +staticfn void add_level(s_level *); +staticfn void init_level(int, int, struct proto_dungeon *); +staticfn int possible_places(int, boolean *, struct proto_dungeon *); +staticfn xint16 pick_level(boolean *, int); +staticfn boolean place_level(int, struct proto_dungeon *); +staticfn int get_dgn_flags(lua_State *); +staticfn int get_dgn_align(lua_State *); +staticfn void init_dungeon_levels(lua_State *, struct proto_dungeon *, int); +staticfn void init_dungeon_branches(lua_State *, struct proto_dungeon *, int); +staticfn void init_dungeon_set_entry(struct proto_dungeon *, int); +staticfn void init_dungeon_set_depth(struct proto_dungeon *, int); +staticfn void init_castle_tune(void); +staticfn void fixup_level_locations(void); +staticfn void free_proto_dungeon(struct proto_dungeon *); +staticfn boolean init_dungeon_dungeons(lua_State *, struct proto_dungeon *, + int); +staticfn boolean unplaced_floater(struct dungeon *); +staticfn boolean unreachable_level(d_level *, boolean); +staticfn void tport_menu(winid, char *, struct lchoice *, d_level *, boolean); +staticfn const char *br_string(int); +staticfn char chr_u_on_lvl(d_level *); +staticfn void print_branch(winid, int, int, int, boolean, struct lchoice *); +staticfn char *get_annotation(d_level *); +staticfn void query_annotation(d_level *); +staticfn mapseen *load_mapseen(NHFILE *); +staticfn void save_mapseen(NHFILE *, mapseen *); +staticfn mapseen *find_mapseen(d_level *); +staticfn mapseen *find_mapseen_by_str(const char *); +staticfn void print_mapseen(winid, mapseen *, int, int, boolean); +staticfn boolean interest_mapseen(mapseen *); +staticfn void count_feat_lastseentyp(mapseen *, coordxy, coordxy); +staticfn void traverse_mapseenchn(int, winid, int, int, int *); +staticfn const char *seen_string(xint16, const char *); +staticfn const char *br_string2(branch *); +staticfn const char *shop_string(int); +staticfn char *tunesuffix(mapseen *, char *, size_t); #ifdef DEBUG -static void dumpit(void); +staticfn void dumpit(void); -static void +staticfn void dumpit(void) { #define DD gd.dungeons[i] @@ -265,7 +266,7 @@ restore_dungeon(NHFILE *nhfp) } #if 0 -static void +staticfn void Fread(genericptr_t ptr, int size, int nitems, dlb *stream) { int cnt; @@ -281,7 +282,7 @@ Fread(genericptr_t ptr, int size, int nitems, dlb *stream) DISABLE_WARNING_UNREACHABLE_CODE -static xint16 +staticfn xint16 dname_to_dnum(const char *s) { xint16 i; @@ -308,7 +309,7 @@ find_level(const char *s) } /* Find the branch that links the named dungeon. */ -static int +staticfn int find_branch( const char *s, /* dungeon name */ struct proto_dungeon *pd) @@ -343,7 +344,7 @@ DISABLE_WARNING_UNREACHABLE_CODE * Find the "parent" by searching the prototype branch list for the branch * listing, then figuring out to which dungeon it belongs. */ -static xint16 +staticfn xint16 parent_dnum( const char *s, /* dungeon name */ struct proto_dungeon *pd) @@ -377,7 +378,7 @@ RESTORE_WARNING_UNREACHABLE_CODE * a negative random component means from the (adjusted) base to the * end of the dungeon. */ -static int +staticfn int level_range( xint16 dgn, int base, int randc, int chain, @@ -412,7 +413,7 @@ level_range( return 1; } -static xint16 +staticfn xint16 parent_dlevel(const char *s, struct proto_dungeon *pd) { int i, j, num, base, dnum = parent_dnum(s, pd); @@ -437,7 +438,7 @@ parent_dlevel(const char *s, struct proto_dungeon *pd) } /* Convert from the temporary branch type to the dungeon branch type. */ -static int +staticfn int correct_branch_type(struct tmpbranch *tbr) { switch (tbr->type) { @@ -511,7 +512,7 @@ insert_branch(branch *new_branch, boolean extract_first) #undef branch_val /* Add a dungeon branch to the branch list. */ -static branch * +staticfn branch * add_branch( int dgn, int child_entry_level, struct proto_dungeon *pd) @@ -542,7 +543,7 @@ add_branch( * level that has a dungeon number less than the dungeon number of the * last entry. */ -static void +staticfn void add_level(s_level *new_lev) { s_level *prev, *curr; @@ -563,7 +564,7 @@ add_level(s_level *new_lev) } } -static void +staticfn void init_level(int dgn, int proto_index, struct proto_dungeon *pd) { s_level *new_level; @@ -595,7 +596,7 @@ init_level(int dgn, int proto_index, struct proto_dungeon *pd) new_level->next = (s_level *) 0; } -static int +staticfn int possible_places( int idx, /* prototype index */ boolean *map, /* array MAXLEVEL+1 in length */ @@ -629,7 +630,7 @@ possible_places( DISABLE_WARNING_UNREACHABLE_CODE /* Pick the nth TRUE entry in the given boolean array. */ -static xint16 +staticfn xint16 pick_level( boolean *map, /* an array MAXLEVEL+1 in size */ int nth) @@ -646,9 +647,9 @@ pick_level( RESTORE_WARNING_UNREACHABLE_CODE #ifdef DDEBUG -static void indent(int); +staticfn void indent(int); -static void +staticfn void indent(int d) { while (d-- > 0) @@ -663,7 +664,7 @@ indent(int d) * all possible places have been tried. If all possible places have * been exhausted, return false. */ -static boolean +staticfn boolean place_level(int proto_index, struct proto_dungeon *pd) { boolean map[MAXLEVEL + 1]; /* valid levels are 1..MAXLEVEL inclusive */ @@ -741,7 +742,7 @@ static struct level_map { #undef X_LOCATE #undef X_GOAL -static int +staticfn int get_dgn_flags(lua_State *L) { int dgn_flags = 0; @@ -778,7 +779,7 @@ get_dgn_flags(lua_State *L) return dgn_flags; } -static int +staticfn int get_dgn_align(lua_State *L) { static const char *const dgnaligns[] = { @@ -794,7 +795,7 @@ get_dgn_align(lua_State *L) return a; } -static void +staticfn void init_dungeon_levels( lua_State *L, struct proto_dungeon *pd, @@ -864,7 +865,7 @@ init_dungeon_levels( panic("init_dungeon: too many special levels"); } -static void +staticfn void init_dungeon_branches( lua_State *L, struct proto_dungeon *pd, @@ -930,7 +931,7 @@ init_dungeon_branches( panic("init_dungeon: too many branches"); } -static void +staticfn void init_dungeon_set_entry(struct proto_dungeon *pd, int dngidx) { int dgn_entry = pd->tmpdungeon[dngidx].entry_lev; @@ -957,7 +958,7 @@ init_dungeon_set_entry(struct proto_dungeon *pd, int dngidx) } } -static void +staticfn void init_dungeon_set_depth(struct proto_dungeon *pd, int dngidx) { branch *br; @@ -994,7 +995,7 @@ init_dungeon_set_depth(struct proto_dungeon *pd, int dngidx) - (gd.dungeons[dngidx].entry_lev - 1); } -static boolean +staticfn boolean init_dungeon_dungeons( lua_State *L, struct proto_dungeon *pd, @@ -1104,7 +1105,7 @@ init_dungeon_dungeons( } /* initialize the Castle drawbridge tune */ -static void +staticfn void init_castle_tune(void) { int i; @@ -1115,7 +1116,7 @@ init_castle_tune(void) } /* fix up the special level names and locations for quick access */ -static void +staticfn void fixup_level_locations(void) { int i; @@ -1177,7 +1178,7 @@ fixup_level_locations(void) } } -static void +staticfn void free_proto_dungeon(struct proto_dungeon *pd) { int i; @@ -2130,7 +2131,7 @@ lev_by_name(const char *nam) #undef dlev_in_current_branch -static boolean +staticfn boolean unplaced_floater(struct dungeon *dptr) { branch *br; @@ -2145,7 +2146,7 @@ unplaced_floater(struct dungeon *dptr) return FALSE; } -static boolean +staticfn boolean unreachable_level(d_level *lvl_p, boolean unplaced) { s_level *dummy; @@ -2159,7 +2160,7 @@ unreachable_level(d_level *lvl_p, boolean unplaced) return FALSE; } -static void +staticfn void tport_menu( winid win, char *entry, @@ -2195,7 +2196,7 @@ tport_menu( } /* Convert a branch type to a string usable by print_dungeon(). */ -static const char * +staticfn const char * br_string(int type) { switch (type) { @@ -2211,14 +2212,14 @@ br_string(int type) return " (unknown)"; } -static char +staticfn char chr_u_on_lvl(d_level *dlev) { return u.uz.dnum == dlev->dnum && u.uz.dlevel == dlev->dlevel ? '*' : ' '; } /* Print all child branches between the lower and upper bounds. */ -static void +staticfn void print_branch( winid win, int dnum, int lower_bound, int upper_bound, @@ -2433,7 +2434,7 @@ recbranch_mapseen(d_level *source, d_level *dest) } } -static char * +staticfn char * get_annotation(d_level *lev) { mapseen *mptr; @@ -2455,7 +2456,7 @@ print_level_annotation(void) /* ask user to annotate level lev. if lev is NULL, uses current level. */ -static void +staticfn void query_annotation(d_level *lev) { mapseen *mptr; @@ -2592,7 +2593,7 @@ load_exclusions(NHFILE *nhfp) } /* find the particular mapseen object in the chain; may return null */ -static mapseen * +staticfn mapseen * find_mapseen(d_level *lev) { mapseen *mptr; @@ -2604,7 +2605,7 @@ find_mapseen(d_level *lev) return mptr; } -static mapseen * +staticfn mapseen * find_mapseen_by_str(const char *s) { mapseen *mptr; @@ -2650,7 +2651,7 @@ rm_mapseen(int ledger_num) } } -static void +staticfn void save_mapseen(NHFILE *nhfp, mapseen *mptr) { branch *curr; @@ -2681,7 +2682,7 @@ save_mapseen(NHFILE *nhfp, mapseen *mptr) savecemetery(nhfp, &mptr->final_resting_place); } -static mapseen * +staticfn mapseen * load_mapseen(NHFILE *nhfp) { int branchnum = 0, brindx; @@ -2842,7 +2843,7 @@ init_mapseen(d_level *lev) /* || (feat).water || (feat).ice || (feat).lava */ /* returns true if this level has something interesting to print out */ -static boolean +staticfn boolean interest_mapseen(mapseen *mptr) { if (on_level(&u.uz, &mptr->lev)) @@ -2913,7 +2914,7 @@ update_mapseen_for(coordxy x, coordxy y) } /* count mapseen feature from lastseentyp at x,y */ -static void +staticfn void count_feat_lastseentyp( mapseen *mptr, /* remembered data for a level; update feat.X counts */ coordxy x, coordxy y) @@ -3304,7 +3305,7 @@ show_overview( } /* display endgame levels or non-endgame levels, not both */ -static void +staticfn void traverse_mapseenchn( int viewendgame, /* 0: show endgame branch; 1: show other branches */ winid win, /* output window */ @@ -3328,7 +3329,7 @@ traverse_mapseenchn( } } -static const char * +staticfn const char * seen_string(xint16 x, const char *obj) { /* players are computer scientists: 0, 1, 2, n */ @@ -3348,7 +3349,7 @@ seen_string(xint16 x, const char *obj) } /* better br_string */ -static const char * +staticfn const char * br_string2(branch *br) { /* Special case: quest portal says closed if kicked from quest */ @@ -3400,7 +3401,7 @@ endgamelevelname(char *outbuf, int indx) return outbuf; } -static const char * +staticfn const char * shop_string(int rtype) { const char *str = "shop"; /* catchall */ @@ -3451,7 +3452,7 @@ shop_string(int rtype) /* if player knows about the mastermind tune, append it to Castle annotation; if drawbridge has been destroyed, flags.castletune will be zero */ -static char * +staticfn char * tunesuffix( mapseen *mptr, char *outbuf, @@ -3507,7 +3508,7 @@ tunesuffix( } \ } while (0) -static void +staticfn void print_mapseen( winid win, mapseen *mptr, int final, /* -1: as menu; 0: not final; diff --git a/src/eat.c b/src/eat.c index 73a887a11..185467baf 100644 --- a/src/eat.c +++ b/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)) @@ -157,7 +157,7 @@ static const struct { #define TTSZ SIZE(tintxts) /* called after mimicking is over */ -static int +staticfn int eatmdone(void) { /* release `eatmbuf' */ @@ -211,7 +211,7 @@ eatmupdate(void) } /* ``[the(] singular(food, xname) [)]'' */ -static const char * +staticfn const char * food_xname(struct obj *food, boolean the_pfx) { const char *result; @@ -239,7 +239,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 */ @@ -286,7 +286,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; @@ -332,7 +332,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; @@ -353,7 +353,7 @@ adj_victual_nutrition(void) return nut; } -static struct obj * +staticfn struct obj * touchfood(struct obj *otmp) { if (otmp->quan > 1L) { @@ -413,7 +413,7 @@ food_substitution(struct obj *old_obj, struct obj *new_obj) } } -static void +staticfn void do_reset_eat(void) { debugpline0("do_reset_eat..."); @@ -483,10 +483,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); @@ -505,7 +505,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; @@ -530,7 +530,7 @@ eatfood(void) } } -static void +staticfn void done_eating(boolean message) { struct obj *piece = gc.context.victual.piece; @@ -738,7 +738,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; @@ -771,7 +771,7 @@ maybe_cannibal(int pm, boolean allowmsg) return FALSE; } -static void +staticfn void cprefx(int pm) { (void) maybe_cannibal(pm, TRUE); @@ -967,7 +967,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; @@ -978,7 +978,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); @@ -1078,7 +1078,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 */ @@ -1104,7 +1104,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; @@ -1350,7 +1350,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; @@ -1450,7 +1450,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 */ @@ -1476,7 +1476,7 @@ tin_variety( return r; } -static void +staticfn void consume_tin(const char *mesg) { const char *what; @@ -1618,7 +1618,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) */ @@ -1638,7 +1638,7 @@ opentin(void) } /* called when starting to open a tin */ -static void +staticfn void start_tin(struct obj *otmp) { const char *mesg = 0; @@ -1727,7 +1727,7 @@ Hear_again(void) } /* called on the "first bite" of rotten food */ -static int +staticfn int rottenfood(struct obj *obj) { pline("Blecch! %s %s!", @@ -1769,7 +1769,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; @@ -1934,7 +1934,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; @@ -1997,7 +1997,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) @@ -2010,7 +2010,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) { @@ -2119,7 +2119,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; @@ -2156,14 +2156,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; @@ -2311,7 +2311,7 @@ eataccessory(struct obj *otmp) } /* called after eating non-food */ -static void +staticfn void eatspecial(void) { struct obj *otmp = gc.context.victual.piece; @@ -2395,7 +2395,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) @@ -2407,7 +2407,7 @@ foodword(struct obj *otmp) } /* called after consuming (non-corpse) food */ -static void +staticfn void fpostfx(struct obj *otmp) { switch (otmp->otyp) { @@ -2503,9 +2503,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]); @@ -2523,7 +2523,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 @@ -2630,7 +2630,7 @@ edibility_prompts(struct obj *otmp) return 0; } -static int +staticfn int doeat_nonfood(struct obj *otmp) { int basenutrit; /* nutrition of full item */ @@ -2969,7 +2969,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) @@ -3014,7 +3014,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 */ @@ -3217,7 +3217,7 @@ lesshungry(int num) newuhs(FALSE); } -static int +staticfn int unfaint(void) { (void) Hear_again(); @@ -3398,7 +3398,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 @@ -3420,7 +3420,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) @@ -3442,7 +3442,7 @@ offer_ok(struct obj *obj) } /* getobj callback for object to be tinned */ -static int +staticfn int tin_ok(struct obj *obj) { if (!obj) diff --git a/src/end.c b/src/end.c index 9dd33a5c4..f42e53401 100644 --- a/src/end.c +++ b/src/end.c @@ -20,26 +20,26 @@ #define nowrap_add(a, b) (a = ((a + b) < 0 ? LONG_MAX : (a + b))) #ifndef NO_SIGNAL -static void done_intr(int); +staticfn void done_intr(int); # if defined(UNIX) || defined(VMS) || defined(__EMX__) -static void done_hangup(int); +staticfn void done_hangup(int); # endif #endif -static void disclose(int, boolean); -static void get_valuables(struct obj *) NO_NNARGS; -static void sort_valuables(struct valuable_data *, int); -static void artifact_score(struct obj *, boolean, winid); -static boolean fuzzer_savelife(int); +staticfn void disclose(int, boolean); +staticfn void get_valuables(struct obj *) NO_NNARGS; +staticfn void sort_valuables(struct valuable_data *, int); +staticfn void artifact_score(struct obj *, boolean, winid); +staticfn boolean fuzzer_savelife(int); ATTRNORETURN static void really_done(int) NORETURN; -static void savelife(int); -static boolean should_query_disclose_option(int, char *); +staticfn void savelife(int); +staticfn boolean should_query_disclose_option(int, char *); #ifdef DUMPLOG -static void dump_plines(void); +staticfn void dump_plines(void); #endif -static void dump_everything(int, time_t); -static void fixup_death(int); -static int wordcount(char *); -static void bel_copy1(char **, char *); +staticfn void dump_everything(int, time_t); +staticfn void fixup_death(int); +staticfn int wordcount(char *); +staticfn void bel_copy1(char **, char *); #if defined(__BEOS__) || defined(MICRO) || defined(OS2) || defined(WIN32) ATTRNORETURN extern void nethack_exit(int) NORETURN; @@ -160,7 +160,7 @@ done2(void) #ifndef NO_SIGNAL /* called as signal() handler, so sent at least 1 arg */ /*ARGSUSED*/ -static void +staticfn void done_intr(int sig_unused UNUSED) { done_stopprint++; @@ -175,7 +175,7 @@ done_intr(int sig_unused UNUSED) #if defined(UNIX) || defined(VMS) || defined(__EMX__) /* signal() handler */ -static void +staticfn void done_hangup(int sig) { #ifdef HANGUPHANDLING @@ -360,7 +360,7 @@ static const struct { /* clear away while-helpless when the cause of death caused that helplessness (ie, "petrified by while getting stoned") */ -static void +staticfn void fixup_death(int how) { int i; @@ -470,7 +470,7 @@ panic VA_DECL(const char *, str) RESTORE_WARNING_FORMAT_NONLITERAL -static boolean +staticfn boolean should_query_disclose_option(int category, char *defquery) { int idx; @@ -512,7 +512,7 @@ should_query_disclose_option(int category, char *defquery) } #ifdef DUMPLOG -static void +staticfn void dump_plines(void) { int i, j; @@ -535,7 +535,7 @@ dump_plines(void) #endif /* DUMPLOG */ /*ARGSUSED*/ -static void +staticfn void dump_everything( int how, /* ASCENDED, ESCAPED, QUIT, etc */ time_t when) /* date+time at end of game */ @@ -610,7 +610,7 @@ dump_everything( #endif } -static void +staticfn void disclose(int how, boolean taken) { char c = '\0', defquery; @@ -694,7 +694,7 @@ disclose(int how, boolean taken) } /* try to get the player back in a viable state after being killed */ -static void +staticfn void savelife(int how) { int uhpmin; @@ -753,7 +753,7 @@ savelife(int how) * Get valuables from the given list. Revised code: the list always remains * intact. */ -static void +staticfn void get_valuables(struct obj *list) /* inventory or container contents */ { struct obj *obj; @@ -788,7 +788,7 @@ get_valuables(struct obj *list) /* inventory or container contents */ * Sort collected valuables, most frequent to least. We could just * as easily use qsort, but we don't care about efficiency here. */ -static void +staticfn void sort_valuables( struct valuable_data list[], int size) /* max value is less than 20 */ @@ -897,7 +897,7 @@ done_object_cleanup(void) } /* called twice; first to calculate total, then to list relevant items */ -static void +staticfn void artifact_score( struct obj *list, boolean counting, /* true => add up points; false => display them */ @@ -934,7 +934,7 @@ artifact_score( /* when dying while running the debug fuzzer, [almost] always keep going; True: forced survival; False: doomed unless wearing life-save amulet */ -static boolean +staticfn boolean fuzzer_savelife(int how) { /* @@ -1113,7 +1113,7 @@ done(int how) } /* separated from done() in order to specify the __noreturn__ attribute */ -static void +staticfn void really_done(int how) { boolean taken; @@ -1774,7 +1774,7 @@ restore_killers(NHFILE *nhfp) } } -static int +staticfn int wordcount(char *p) { int words = 0; @@ -1790,7 +1790,7 @@ wordcount(char *p) return words; } -static void +staticfn void bel_copy1(char **inp, char *out) { char *in = *inp; diff --git a/src/engrave.c b/src/engrave.c index 3d81b9ec0..2d7fc7cb7 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -38,14 +38,14 @@ struct _doengrave_ctx { size_t len; /* # of nonspace chars of new engraving text */ }; -static int stylus_ok(struct obj *); -static boolean u_can_engrave(void); -static void doengrave_ctx_init(struct _doengrave_ctx *); -static void doengrave_sfx_item_WAN(struct _doengrave_ctx *); -static boolean doengrave_sfx_item(struct _doengrave_ctx *); -static void doengrave_ctx_verb(struct _doengrave_ctx *); -static int engrave(void); -static const char *blengr(void); +staticfn int stylus_ok(struct obj *); +staticfn boolean u_can_engrave(void); +staticfn void doengrave_ctx_init(struct _doengrave_ctx *); +staticfn void doengrave_sfx_item_WAN(struct _doengrave_ctx *); +staticfn boolean doengrave_sfx_item(struct _doengrave_ctx *); +staticfn void doengrave_ctx_verb(struct _doengrave_ctx *); +staticfn int engrave(void); +staticfn const char *blengr(void); char * random_engraving(char *outbuf) @@ -423,7 +423,7 @@ freehand(void) } /* getobj callback for an object to engrave with */ -static int +staticfn int stylus_ok(struct obj *obj) { if (!obj) @@ -445,7 +445,7 @@ stylus_ok(struct obj *obj) } /* can hero engrave at all (at their location)? */ -static boolean +staticfn boolean u_can_engrave(void) { int levtyp = SURFACE_AT(u.ux, u.uy); @@ -487,7 +487,7 @@ u_can_engrave(void) } /* initialize the doengrave data */ -static void +staticfn void doengrave_ctx_init(struct _doengrave_ctx *de) { de->dengr = FALSE; @@ -525,7 +525,7 @@ doengrave_ctx_init(struct _doengrave_ctx *de) } /* special engraving effects for WAND objects */ -static void +staticfn void doengrave_sfx_item_WAN(struct _doengrave_ctx *de) { switch (de->otmp->otyp) { @@ -682,7 +682,7 @@ doengrave_sfx_item_WAN(struct _doengrave_ctx *de) } /* special engraving effects for all objects */ -static boolean +staticfn boolean doengrave_sfx_item(struct _doengrave_ctx *de) { switch (de->otmp->oclass) { @@ -828,7 +828,7 @@ doengrave_sfx_item(struct _doengrave_ctx *de) } /* which verb phrasing to use for engraving */ -static void +staticfn void doengrave_ctx_verb(struct _doengrave_ctx *de) { switch (de->type) { @@ -1178,7 +1178,7 @@ doengr_exit: } /* occupation callback for engraving some text */ -static int +staticfn int engrave(void) { struct engr *oep; @@ -1620,7 +1620,7 @@ static const char blind_writing[][21] = { 0x69, 0x76, 0x6b, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, }; -static const char * +staticfn const char * blengr(void) { return ROLL_FROM(blind_writing); diff --git a/src/exper.c b/src/exper.c index 193c46617..55cbef056 100644 --- a/src/exper.c +++ b/src/exper.c @@ -8,7 +8,7 @@ #include #endif -static int enermod(int); +staticfn int enermod(int); long newuexp(int lev) @@ -22,7 +22,7 @@ newuexp(int lev) return (10000000L * ((long) (lev - 19))); } -static int +staticfn int enermod(int en) { switch (Role_switch) { diff --git a/src/explode.c b/src/explode.c index 75b8a12f3..768aa72c9 100644 --- a/src/explode.c +++ b/src/explode.c @@ -4,8 +4,8 @@ #include "hack.h" -static int explosionmask(struct monst *, uchar, char) NONNULLARG1; -static void engulfer_explosion_msg(uchar, char); +staticfn int explosionmask(struct monst *, uchar, char) NONNULLARG1; +staticfn void engulfer_explosion_msg(uchar, char); /* Note: Arrays are column first, while the screen is row first */ static const int explosion[3][3] = { @@ -22,7 +22,7 @@ enum explode_action { }; /* check if shield effects are needed for location affected by explosion */ -static int +staticfn int explosionmask( struct monst *m, /* target monster (might be youmonst) */ uchar adtyp, /* damage type */ @@ -114,7 +114,7 @@ explosionmask( return res; } -static void +staticfn void engulfer_explosion_msg(uchar adtyp, char olet) { const char *adj = (char *) 0; diff --git a/src/extralev.c b/src/extralev.c index 08943c437..a6c733ff6 100644 --- a/src/extralev.c +++ b/src/extralev.c @@ -13,12 +13,11 @@ #define XL_LEFT 4 #define XL_RIGHT 8 -static void roguejoin(coordxy, coordxy, coordxy, coordxy, int); -static void roguecorr(coordxy, coordxy, int); -static void miniwalk(coordxy, coordxy); +staticfn void roguejoin(coordxy, coordxy, coordxy, coordxy, int); +staticfn void roguecorr(coordxy, coordxy, int); +staticfn void miniwalk(coordxy, coordxy); -static -void +staticfn void roguejoin(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int horiz) { coordxy x, y, middle; @@ -42,8 +41,7 @@ roguejoin(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int horiz) } } -static -void +staticfn void roguecorr(coordxy x, coordxy y, int dir) { coordxy fromx, fromy, tox, toy; @@ -137,8 +135,7 @@ roguecorr(coordxy x, coordxy y, int dir) } /* Modified walkfrom() from mkmaze.c */ -static -void +staticfn void miniwalk(coordxy x, coordxy y) { int q, dir; diff --git a/src/files.c b/src/files.c index 9a8c35f2f..3e1b7a515 100644 --- a/src/files.c +++ b/src/files.c @@ -120,119 +120,119 @@ extern char *translate_path_variables(const char *, char *); extern char *sounddir; /* defined in sounds.c */ #endif -static NHFILE *new_nhfile(void); -static void free_nhfile(NHFILE *); +staticfn NHFILE *new_nhfile(void); +staticfn void free_nhfile(NHFILE *); #ifdef SELECTSAVED -static int QSORTCALLBACK strcmp_wrap(const void *, const void *); +staticfn int QSORTCALLBACK strcmp_wrap(const void *, const void *); #endif -static char *set_bonesfile_name(char *, d_level *); -static char *set_bonestemp_name(void); +staticfn char *set_bonesfile_name(char *, d_level *); +staticfn char *set_bonestemp_name(void); #ifdef COMPRESS -static void redirect(const char *, const char *, FILE *, boolean); +staticfn void redirect(const char *, const char *, FILE *, boolean); #endif #if defined(COMPRESS) || defined(ZLIB_COMP) -static void docompress_file(const char *, boolean); +staticfn void docompress_file(const char *, boolean); #endif #if defined(ZLIB_COMP) -static boolean make_compressed_name(const char *, char *); +staticfn boolean make_compressed_name(const char *, char *); #endif #ifndef USE_FCNTL -static char *make_lockname(const char *, char *); +staticfn char *make_lockname(const char *, char *); #endif -static void set_configfile_name(const char *); -static FILE *fopen_config_file(const char *, int); -static int get_uchars(char *, uchar *, boolean, int, const char *); +staticfn void set_configfile_name(const char *); +staticfn FILE *fopen_config_file(const char *, int); +staticfn int get_uchars(char *, uchar *, boolean, int, const char *); #ifdef NOCWD_ASSUMPTIONS -static void adjust_prefix(char *, int); +staticfn void adjust_prefix(char *, int); #endif -static char *choose_random_part(char *, char); -static boolean config_error_nextline(const char *); -static void free_config_sections(void); -static char *is_config_section(char *); -static boolean handle_config_section(char *); +staticfn char *choose_random_part(char *, char); +staticfn boolean config_error_nextline(const char *); +staticfn void free_config_sections(void); +staticfn char *is_config_section(char *); +staticfn boolean handle_config_section(char *); boolean parse_config_line(char *); -static char *find_optparam(const char *); -static boolean cnf_line_OPTIONS(char *); -static boolean cnf_line_AUTOPICKUP_EXCEPTION(char *); -static boolean cnf_line_BINDINGS(char *); -static boolean cnf_line_AUTOCOMPLETE(char *); -static boolean cnf_line_MSGTYPE(char *); -static boolean cnf_line_HACKDIR(char *); -static boolean cnf_line_LEVELDIR(char *); -static boolean cnf_line_SAVEDIR(char *); -static boolean cnf_line_BONESDIR(char *); -static boolean cnf_line_DATADIR(char *); -static boolean cnf_line_SCOREDIR(char *); -static boolean cnf_line_LOCKDIR(char *); -static boolean cnf_line_CONFIGDIR(char *); -static boolean cnf_line_TROUBLEDIR(char *); -static boolean cnf_line_NAME(char *); -static boolean cnf_line_ROLE(char *); -static boolean cnf_line_dogname(char *); -static boolean cnf_line_catname(char *); -static boolean cnf_line_WIZARDS(char *); -static boolean cnf_line_SHELLERS(char *); -static boolean cnf_line_EXPLORERS(char *); -static boolean cnf_line_DEBUGFILES(char *); -static boolean cnf_line_DUMPLOGFILE(char *); -static boolean cnf_line_GENERICUSERS(char *); -static boolean cnf_line_BONES_POOLS(char *); -static boolean cnf_line_SUPPORT(char *); -static boolean cnf_line_RECOVER(char *); -static boolean cnf_line_CHECK_SAVE_UID(char *); -static boolean cnf_line_CHECK_PLNAME(char *); -static boolean cnf_line_SEDUCE(char *); -static boolean cnf_line_HIDEUSAGE(char *); -static boolean cnf_line_MAXPLAYERS(char *); -static boolean cnf_line_PERSMAX(char *); -static boolean cnf_line_PERS_IS_UID(char *); -static boolean cnf_line_ENTRYMAX(char *); -static boolean cnf_line_POINTSMIN(char *); -static boolean cnf_line_MAX_STATUENAME_RANK(char *); -static boolean cnf_line_LIVELOG(char *); -static boolean cnf_line_PANICTRACE_LIBC(char *); -static boolean cnf_line_PANICTRACE_GDB(char *); -static boolean cnf_line_GDBPATH(char *); -static boolean cnf_line_GREPPATH(char *); -static boolean cnf_line_CRASHREPORTURL(char *); -static boolean cnf_line_SAVEFORMAT(char *); -static boolean cnf_line_BONESFORMAT(char *); -static boolean cnf_line_ACCESSIBILITY(char *); -static boolean cnf_line_PORTABLE_DEVICE_PATHS(char *); -static boolean cnf_line_BOULDER(char *); -static boolean cnf_line_MENUCOLOR(char *); -static boolean cnf_line_HILITE_STATUS(char *); -static boolean cnf_line_WARNINGS(char *); -static boolean cnf_line_ROGUESYMBOLS(char *); -static boolean cnf_line_SYMBOLS(char *); -static boolean cnf_line_WIZKIT(char *); +staticfn char *find_optparam(const char *); +staticfn boolean cnf_line_OPTIONS(char *); +staticfn boolean cnf_line_AUTOPICKUP_EXCEPTION(char *); +staticfn boolean cnf_line_BINDINGS(char *); +staticfn boolean cnf_line_AUTOCOMPLETE(char *); +staticfn boolean cnf_line_MSGTYPE(char *); +staticfn boolean cnf_line_HACKDIR(char *); +staticfn boolean cnf_line_LEVELDIR(char *); +staticfn boolean cnf_line_SAVEDIR(char *); +staticfn boolean cnf_line_BONESDIR(char *); +staticfn boolean cnf_line_DATADIR(char *); +staticfn boolean cnf_line_SCOREDIR(char *); +staticfn boolean cnf_line_LOCKDIR(char *); +staticfn boolean cnf_line_CONFIGDIR(char *); +staticfn boolean cnf_line_TROUBLEDIR(char *); +staticfn boolean cnf_line_NAME(char *); +staticfn boolean cnf_line_ROLE(char *); +staticfn boolean cnf_line_dogname(char *); +staticfn boolean cnf_line_catname(char *); +staticfn boolean cnf_line_WIZARDS(char *); +staticfn boolean cnf_line_SHELLERS(char *); +staticfn boolean cnf_line_EXPLORERS(char *); +staticfn boolean cnf_line_DEBUGFILES(char *); +staticfn boolean cnf_line_DUMPLOGFILE(char *); +staticfn boolean cnf_line_GENERICUSERS(char *); +staticfn boolean cnf_line_BONES_POOLS(char *); +staticfn boolean cnf_line_SUPPORT(char *); +staticfn boolean cnf_line_RECOVER(char *); +staticfn boolean cnf_line_CHECK_SAVE_UID(char *); +staticfn boolean cnf_line_CHECK_PLNAME(char *); +staticfn boolean cnf_line_SEDUCE(char *); +staticfn boolean cnf_line_HIDEUSAGE(char *); +staticfn boolean cnf_line_MAXPLAYERS(char *); +staticfn boolean cnf_line_PERSMAX(char *); +staticfn boolean cnf_line_PERS_IS_UID(char *); +staticfn boolean cnf_line_ENTRYMAX(char *); +staticfn boolean cnf_line_POINTSMIN(char *); +staticfn boolean cnf_line_MAX_STATUENAME_RANK(char *); +staticfn boolean cnf_line_LIVELOG(char *); +staticfn boolean cnf_line_PANICTRACE_LIBC(char *); +staticfn boolean cnf_line_PANICTRACE_GDB(char *); +staticfn boolean cnf_line_GDBPATH(char *); +staticfn boolean cnf_line_GREPPATH(char *); +staticfn boolean cnf_line_CRASHREPORTURL(char *); +staticfn boolean cnf_line_SAVEFORMAT(char *); +staticfn boolean cnf_line_BONESFORMAT(char *); +staticfn boolean cnf_line_ACCESSIBILITY(char *); +staticfn boolean cnf_line_PORTABLE_DEVICE_PATHS(char *); +staticfn boolean cnf_line_BOULDER(char *); +staticfn boolean cnf_line_MENUCOLOR(char *); +staticfn boolean cnf_line_HILITE_STATUS(char *); +staticfn boolean cnf_line_WARNINGS(char *); +staticfn boolean cnf_line_ROGUESYMBOLS(char *); +staticfn boolean cnf_line_SYMBOLS(char *); +staticfn boolean cnf_line_WIZKIT(char *); #ifdef USER_SOUNDS -static boolean cnf_line_SOUNDDIR(char *); -static boolean cnf_line_SOUND(char *); +staticfn boolean cnf_line_SOUNDDIR(char *); +staticfn boolean cnf_line_SOUND(char *); #endif -static boolean cnf_line_QT_TILEWIDTH(char *); -static boolean cnf_line_QT_TILEHEIGHT(char *); -static boolean cnf_line_QT_FONTSIZE(char *); -static boolean cnf_line_QT_COMPACT(char *); +staticfn boolean cnf_line_QT_TILEWIDTH(char *); +staticfn boolean cnf_line_QT_TILEHEIGHT(char *); +staticfn boolean cnf_line_QT_FONTSIZE(char *); +staticfn boolean cnf_line_QT_COMPACT(char *); struct _cnf_parser_state; /* defined below (far below...) */ -static void cnf_parser_init(struct _cnf_parser_state *parser); -static void cnf_parser_done(struct _cnf_parser_state *parser); -static void parse_conf_buf(struct _cnf_parser_state *parser, +staticfn void cnf_parser_init(struct _cnf_parser_state *parser); +staticfn void cnf_parser_done(struct _cnf_parser_state *parser); +staticfn void parse_conf_buf(struct _cnf_parser_state *parser, boolean (*proc)(char *arg)); /* next one is in extern.h; why here too? */ boolean parse_conf_str(const char *str, boolean (*proc)(char *arg)); -static boolean parse_conf_file(FILE *fp, boolean (*proc)(char *arg)); -static void parseformat(int *, char *); -static FILE *fopen_wizkit_file(void); -static void wizkit_addinv(struct obj *); +staticfn boolean parse_conf_file(FILE *fp, boolean (*proc)(char *arg)); +staticfn void parseformat(int *, char *); +staticfn FILE *fopen_wizkit_file(void); +staticfn void wizkit_addinv(struct obj *); boolean proc_wizkit_line(char *buf); void read_wizkit(void); /* in extern.h; why here too? */ -static FILE *fopen_sym_file(void); +staticfn FILE *fopen_sym_file(void); #ifdef SELF_RECOVER -static boolean copy_bytes(int, int); +staticfn boolean copy_bytes(int, int); #endif -static NHFILE *viable_nhfile(NHFILE *); +staticfn NHFILE *viable_nhfile(NHFILE *); /* return a file's name without its path and optionally trailing 'type' */ const char * @@ -512,7 +512,7 @@ zero_nhfile(NHFILE *nhfp) nhfp->fnidx = 0; } -static NHFILE * +staticfn NHFILE * new_nhfile(void) { NHFILE *nhfp = (NHFILE *) alloc(sizeof(NHFILE)); @@ -521,7 +521,7 @@ new_nhfile(void) return nhfp; } -static void +staticfn void free_nhfile(NHFILE *nhfp) { if (nhfp) { @@ -551,8 +551,7 @@ rewind_nhfile(NHFILE *nhfp) } } -static -NHFILE * +staticfn NHFILE * viable_nhfile(NHFILE *nhfp) { /* perform some sanity checks before returning @@ -718,7 +717,7 @@ clearlocks(void) #if defined(SELECTSAVED) /* qsort comparison routine */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK strcmp_wrap(const void *p, const void *q) { #if defined(UNIX) && defined(QT_GRAPHICS) @@ -750,7 +749,7 @@ nhclose(int fd) /* set up "file" to be file name for retrieving bones, and return a * bonesid to be read/written in the bones file. */ -static char * +staticfn char * set_bonesfile_name(char *file, d_level *lev) { s_level *sptr; @@ -799,7 +798,7 @@ set_bonesfile_name(char *file, d_level *lev) * (we are not reading or writing level files while writing bones files, so * the same array may be used instead of copying.) */ -static char * +staticfn char * set_bonestemp_name(void) { char *tf; @@ -1426,7 +1425,7 @@ free_saved_games(char **saved) #ifdef COMPRESS /* external compression */ -static void +staticfn void redirect( const char *filename, const char *mode, @@ -1454,7 +1453,7 @@ redirect( * * cf. child() in unixunix.c. */ -static void +staticfn void docompress_file(const char *filename, boolean uncomp) { char *cfn = 0; @@ -1659,7 +1658,7 @@ nh_uncompress(const char *filename UNUSED_if_not_COMPRESS) } #ifdef ZLIB_COMP /* RLC 09 Mar 1999: Support internal ZLIB */ -static boolean +staticfn boolean make_compressed_name(const char *filename, char *cfn) { #ifndef SHORT_FILENAMES @@ -1690,7 +1689,7 @@ make_compressed_name(const char *filename, char *cfn) #endif /* SHORT_FILENAMES */ } -static void +staticfn void docompress_file(const char *filename, boolean uncomp) { gzFile compressedfile; @@ -1843,7 +1842,7 @@ struct flock sflock; /* for unlocking, same as above */ #ifndef USE_FCNTL -static char * +staticfn char * make_lockname(const char *filename UNUSED_conditional, char *lockname) { #if defined(UNIX) || defined(VMS) || defined(AMIGA) || defined(WIN32) \ @@ -2158,14 +2157,14 @@ do_write_config_file(void) /* remember the name of the file we're accessing; if may be used in option reject messages */ -static void +staticfn void set_configfile_name(const char *fname) { (void) strncpy(configfile, fname, sizeof configfile - 1); configfile[sizeof configfile - 1] = '\0'; } -static FILE * +staticfn FILE * fopen_config_file(const char *filename, int src) { FILE *fp; @@ -2306,7 +2305,7 @@ fopen_config_file(const char *filename, int src) * NOTE: zeros are inserted unless modlist is TRUE, in which case the list * location is unchanged. Callers must handle zeros if modlist is FALSE. */ -static int +staticfn int get_uchars(char *bufp, /* current pointer */ uchar *list, /* return list */ boolean modlist, /* TRUE: list is being modified in place */ @@ -2366,7 +2365,7 @@ get_uchars(char *bufp, /* current pointer */ } #ifdef NOCWD_ASSUMPTIONS -static void +staticfn void adjust_prefix(char *bufp, int prefixid) { char *ptr; @@ -2389,7 +2388,7 @@ adjust_prefix(char *bufp, int prefixid) #endif /* Choose at random one of the sep separated parts from str. Mangles str. */ -static char * +staticfn char * choose_random_part(char *str, char sep) { int nsep = 1; @@ -2427,7 +2426,7 @@ choose_random_part(char *str, char sep) return (char *) 0; } -static void +staticfn void free_config_sections(void) { if (gc.config_section_chosen) { @@ -2443,7 +2442,7 @@ free_config_sections(void) /* check for " [ anything-except-bracket-or-empty ] # arbitrary-comment" with spaces optional; returns pointer to "anything-except..." (with trailing " ] #..." stripped) if ok, otherwise Null */ -static char * +staticfn char * is_config_section( char *str) /* trailing spaces are stripped, ']' too iff result is good */ { @@ -2472,7 +2471,7 @@ is_config_section( return trimspaces(a); } -static boolean +staticfn boolean handle_config_section(char *buf) { char *sect = is_config_section(buf); @@ -2507,7 +2506,7 @@ handle_config_section(char *buf) #define match_varname(INP, NAM, LEN) match_optname(INP, NAM, LEN, TRUE) /* find the '=' or ':' */ -static char * +staticfn char * find_optparam(const char *buf) { char *bufp, *altp; @@ -2520,7 +2519,7 @@ find_optparam(const char *buf) return bufp; } -static boolean +staticfn boolean cnf_line_OPTIONS(char *origbuf) { char *bufp = find_optparam(origbuf); @@ -2529,33 +2528,33 @@ cnf_line_OPTIONS(char *origbuf) return parseoptions(bufp, TRUE, TRUE); } -static boolean +staticfn boolean cnf_line_AUTOPICKUP_EXCEPTION(char *bufp) { add_autopickup_exception(bufp); return TRUE; } -static boolean +staticfn boolean cnf_line_BINDINGS(char *bufp) { return parsebindings(bufp); } -static boolean +staticfn boolean cnf_line_AUTOCOMPLETE(char *bufp) { parseautocomplete(bufp, TRUE); return TRUE; } -static boolean +staticfn boolean cnf_line_MSGTYPE(char *bufp) { return msgtype_parse_add(bufp); } -static boolean +staticfn boolean cnf_line_HACKDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2570,7 +2569,7 @@ cnf_line_HACKDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_LEVELDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2590,7 +2589,7 @@ cnf_line_LEVELDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SAVEDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2612,7 +2611,7 @@ cnf_line_SAVEDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_BONESDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2623,7 +2622,7 @@ cnf_line_BONESDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_DATADIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2634,7 +2633,7 @@ cnf_line_DATADIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SCOREDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2645,7 +2644,7 @@ cnf_line_SCOREDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_LOCKDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2656,7 +2655,7 @@ cnf_line_LOCKDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_CONFIGDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2667,7 +2666,7 @@ cnf_line_CONFIGDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_TROUBLEDIR(char *bufp) { #ifdef NOCWD_ASSUMPTIONS @@ -2678,14 +2677,14 @@ cnf_line_TROUBLEDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_NAME(char *bufp) { (void) strncpy(gp.plname, bufp, PL_NSIZ - 1); return TRUE; } -static boolean +staticfn boolean cnf_line_ROLE(char *bufp) { int len; @@ -2695,21 +2694,21 @@ cnf_line_ROLE(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_dogname(char *bufp) { (void) strncpy(gd.dogname, bufp, PL_PSIZ - 1); return TRUE; } -static boolean +staticfn boolean cnf_line_catname(char *bufp) { (void) strncpy(gc.catname, bufp, PL_PSIZ - 1); return TRUE; } -static boolean +staticfn boolean cnf_line_WIZARDS(char *bufp) { if (sysopt.wizards) @@ -2726,7 +2725,7 @@ cnf_line_WIZARDS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SHELLERS(char *bufp) { if (sysopt.shellers) @@ -2735,7 +2734,7 @@ cnf_line_SHELLERS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_EXPLORERS(char *bufp) { if (sysopt.explorers) @@ -2744,7 +2743,7 @@ cnf_line_EXPLORERS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_DEBUGFILES(char *bufp) { /* if showdebug() has already been called (perhaps we've added @@ -2758,7 +2757,7 @@ cnf_line_DEBUGFILES(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_DUMPLOGFILE(char *bufp) { #ifdef DUMPLOG @@ -2771,7 +2770,7 @@ cnf_line_DUMPLOGFILE(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_GENERICUSERS(char *bufp) { if (sysopt.genericusers) @@ -2780,7 +2779,7 @@ cnf_line_GENERICUSERS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_BONES_POOLS(char *bufp) { /* max value of 10 guarantees (N % bones.pools) will be one digit @@ -2794,7 +2793,7 @@ cnf_line_BONES_POOLS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SUPPORT(char *bufp) { if (sysopt.support) @@ -2803,7 +2802,7 @@ cnf_line_SUPPORT(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_RECOVER(char *bufp) { if (sysopt.recover) @@ -2812,7 +2811,7 @@ cnf_line_RECOVER(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_CHECK_SAVE_UID(char *bufp) { int n = atoi(bufp); @@ -2821,7 +2820,7 @@ cnf_line_CHECK_SAVE_UID(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_CHECK_PLNAME(char *bufp) { int n = atoi(bufp); @@ -2830,7 +2829,7 @@ cnf_line_CHECK_PLNAME(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SEDUCE(char *bufp) { int n = !!atoi(bufp); /* XXX this could be tighter */ @@ -2852,7 +2851,7 @@ cnf_line_SEDUCE(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_HIDEUSAGE(char *bufp) { int n = !!atoi(bufp); @@ -2861,7 +2860,7 @@ cnf_line_HIDEUSAGE(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_MAXPLAYERS(char *bufp) { int n = atoi(bufp); @@ -2875,7 +2874,7 @@ cnf_line_MAXPLAYERS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_PERSMAX(char *bufp) { int n = atoi(bufp); @@ -2888,7 +2887,7 @@ cnf_line_PERSMAX(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_PERS_IS_UID(char *bufp) { int n = atoi(bufp); @@ -2901,7 +2900,7 @@ cnf_line_PERS_IS_UID(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_ENTRYMAX(char *bufp) { int n = atoi(bufp); @@ -2914,7 +2913,7 @@ cnf_line_ENTRYMAX(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_POINTSMIN(char *bufp) { int n = atoi(bufp); @@ -2927,7 +2926,7 @@ cnf_line_POINTSMIN(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_MAX_STATUENAME_RANK(char *bufp) { int n = atoi(bufp); @@ -2941,7 +2940,7 @@ cnf_line_MAX_STATUENAME_RANK(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_LIVELOG(char *bufp) { /* using 0 for base accepts "dddd" as decimal provided that first 'd' @@ -2958,7 +2957,7 @@ cnf_line_LIVELOG(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_PANICTRACE_LIBC(char *bufp) { int n = atoi(bufp); @@ -2973,7 +2972,7 @@ cnf_line_PANICTRACE_LIBC(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_PANICTRACE_GDB(char *bufp) { int n = atoi(bufp); @@ -2988,7 +2987,7 @@ cnf_line_PANICTRACE_GDB(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_GDBPATH(char *bufp) { #if defined(PANICTRACE) && !defined(VMS) @@ -3003,7 +3002,7 @@ cnf_line_GDBPATH(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_GREPPATH(char *bufp) { #if defined(PANICTRACE) && !defined(VMS) @@ -3018,7 +3017,7 @@ cnf_line_GREPPATH(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_CRASHREPORTURL(char *bufp) { if (sysopt.crashreporturl) @@ -3027,21 +3026,21 @@ cnf_line_CRASHREPORTURL(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SAVEFORMAT(char *bufp) { parseformat(sysopt.saveformat, bufp); return TRUE; } -static boolean +staticfn boolean cnf_line_BONESFORMAT(char *bufp) { parseformat(sysopt.bonesformat, bufp); return TRUE; } -static boolean +staticfn boolean cnf_line_ACCESSIBILITY(char *bufp) { int n = atoi(bufp); @@ -3054,7 +3053,7 @@ cnf_line_ACCESSIBILITY(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_PORTABLE_DEVICE_PATHS(char *bufp) { #ifdef WIN32 @@ -3073,7 +3072,7 @@ cnf_line_PORTABLE_DEVICE_PATHS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_BOULDER(char *bufp) { (void) get_uchars(bufp, &go.ov_primary_syms[SYM_BOULDER + SYM_OFF_X], @@ -3081,13 +3080,13 @@ cnf_line_BOULDER(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_MENUCOLOR(char *bufp) { return add_menu_coloring(bufp); } -static boolean +staticfn boolean cnf_line_HILITE_STATUS(char *bufp) { #ifdef STATUS_HILITES @@ -3098,7 +3097,7 @@ cnf_line_HILITE_STATUS(char *bufp) #endif } -static boolean +staticfn boolean cnf_line_WARNINGS(char *bufp) { uchar translate[MAXPCHARS]; @@ -3108,7 +3107,7 @@ cnf_line_WARNINGS(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_ROGUESYMBOLS(char *bufp) { if (parsesymbols(bufp, ROGUESET)) { @@ -3119,7 +3118,7 @@ cnf_line_ROGUESYMBOLS(char *bufp) return FALSE; } -static boolean +staticfn boolean cnf_line_SYMBOLS(char *bufp) { if (parsesymbols(bufp, PRIMARYSET)) { @@ -3130,7 +3129,7 @@ cnf_line_SYMBOLS(char *bufp) return FALSE; } -static boolean +staticfn boolean cnf_line_WIZKIT(char *bufp) { (void) strncpy(gw.wizkit, bufp, WIZKIT_MAX - 1); @@ -3138,7 +3137,7 @@ cnf_line_WIZKIT(char *bufp) } #ifdef USER_SOUNDS -static boolean +staticfn boolean cnf_line_SOUNDDIR(char *bufp) { if (sounddir) @@ -3147,7 +3146,7 @@ cnf_line_SOUNDDIR(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_SOUND(char *bufp) { add_sound_mapping(bufp); @@ -3155,7 +3154,7 @@ cnf_line_SOUND(char *bufp) } #endif /*USER_SOUNDS*/ -static boolean +staticfn boolean cnf_line_QT_TILEWIDTH(char *bufp) { #ifdef QT_GRAPHICS @@ -3169,7 +3168,7 @@ cnf_line_QT_TILEWIDTH(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_QT_TILEHEIGHT(char *bufp) { #ifdef QT_GRAPHICS @@ -3183,7 +3182,7 @@ cnf_line_QT_TILEHEIGHT(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_QT_FONTSIZE(char *bufp) { #ifdef QT_GRAPHICS @@ -3197,7 +3196,7 @@ cnf_line_QT_FONTSIZE(char *bufp) return TRUE; } -static boolean +staticfn boolean cnf_line_QT_COMPACT(char *bufp) { #ifdef QT_GRAPHICS @@ -3400,7 +3399,7 @@ config_error_init(boolean from_file, const char *sourcename, boolean secure) gp.program_state.config_error_ready = TRUE; } -static boolean +staticfn boolean config_error_nextline(const char *line) { struct _config_error_frame *ced = config_error_data; @@ -3564,7 +3563,7 @@ struct _cnf_parser_state { }; /* Initialize config parser data */ -static void +staticfn void cnf_parser_init(struct _cnf_parser_state *parser) { parser->rv = TRUE; /* assume successful parse */ @@ -3579,7 +3578,7 @@ cnf_parser_init(struct _cnf_parser_state *parser) } /* caller has finished with 'parser' (except for 'rv' so leave that intact) */ -static void +staticfn void cnf_parser_done(struct _cnf_parser_state *parser) { parser->ep = 0; /* points into parser->inbuf, so becoming stale */ @@ -3595,7 +3594,7 @@ cnf_parser_done(struct _cnf_parser_state *parser) * * Continued lines are merged together with one space in between. */ -static void +staticfn void parse_conf_buf(struct _cnf_parser_state *p, boolean (*proc)(char *arg)) { p->cont = FALSE; @@ -3745,7 +3744,7 @@ parse_conf_str(const char *str, boolean (*proc)(char *arg)) * * Read from file fp, calling parse_conf_buf for each line. */ -static boolean +staticfn boolean parse_conf_file(FILE *fp, boolean (*proc)(char *arg)) { struct _cnf_parser_state parser; @@ -3764,7 +3763,7 @@ parse_conf_file(FILE *fp, boolean (*proc)(char *arg)) return parser.rv; } -static void +staticfn void parseformat(int *arr, char *str) { const char *legal[] = { "historical", "lendian", "ascii" }; @@ -3801,7 +3800,7 @@ parseformat(int *arr, char *str) /* ---------- BEGIN WIZKIT FILE HANDLING ----------- */ -static FILE * +staticfn FILE * fopen_wizkit_file(void) { FILE *fp; @@ -3873,7 +3872,7 @@ fopen_wizkit_file(void) } /* add to hero's inventory if there's room, otherwise put item on floor */ -static void +staticfn void wizkit_addinv(struct obj *obj) { if (!obj || obj == &hands_obj) @@ -3945,8 +3944,7 @@ read_wizkit(void) extern const char *const known_handling[]; /* symbols.c */ extern const char *const known_restrictions[]; /* symbols.c */ -static -FILE * +staticfn FILE * fopen_sym_file(void) { FILE *fp; @@ -4749,11 +4747,11 @@ reveal_paths(void) #define MAXPASSAGES SIZE(gc.context.novel.pasg) /* 20 */ -static int choose_passage(int, unsigned); +staticfn int choose_passage(int, unsigned); /* choose a random passage that hasn't been chosen yet; once all have been chosen, reset the tracking to make all passages available again */ -static int +staticfn int choose_passage(int passagecnt, /* total of available passages */ unsigned oid) /* book.o_id, used to determine whether re-reading same book */ diff --git a/src/fountain.c b/src/fountain.c index 4c53979fd..492ebf6e8 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -6,12 +6,12 @@ #include "hack.h" -static void dowatersnakes(void); -static void dowaterdemon(void); -static void dowaternymph(void); -static void gush(coordxy, coordxy, genericptr_t) NONNULLARG3; -static void dofindgem(void); -static boolean watchman_warn_fountain(struct monst *) NONNULLARG1; +staticfn void dowatersnakes(void); +staticfn void dowaterdemon(void); +staticfn void dowaternymph(void); +staticfn void gush(coordxy, coordxy, genericptr_t) NONNULLARG3; +staticfn void dofindgem(void); +staticfn boolean watchman_warn_fountain(struct monst *) NONNULLARG1; DISABLE_WARNING_FORMAT_NONLITERAL @@ -34,7 +34,7 @@ floating_above(const char *what) RESTORE_WARNING_FORMAT_NONLITERAL /* Fountain of snakes! */ -static void +staticfn void dowatersnakes(void) { int num = rn1(5, 2); @@ -60,7 +60,7 @@ dowatersnakes(void) } /* Water demon */ -static void +staticfn void dowaterdemon(void) { struct monst *mtmp; @@ -90,7 +90,7 @@ dowaterdemon(void) } /* Water Nymph */ -static void +staticfn void dowaternymph(void) { struct monst *mtmp; @@ -130,7 +130,7 @@ dogushforth(int drinking) } } -static void +staticfn void gush(coordxy x, coordxy y, genericptr_t poolcnt) { struct monst *mtmp; @@ -161,7 +161,7 @@ gush(coordxy x, coordxy y, genericptr_t poolcnt) } /* Find a gem in the sparkling waters. */ -static void +staticfn void dofindgem(void) { if (!Blind) @@ -175,7 +175,7 @@ dofindgem(void) exercise(A_WIS, TRUE); /* a discovery! */ } -static boolean +staticfn boolean watchman_warn_fountain(struct monst *mtmp) { if (is_watch(mtmp->data) && couldsee(mtmp->mx, mtmp->my) diff --git a/src/getpos.c b/src/getpos.c index 527e7afea..417073a45 100644 --- a/src/getpos.c +++ b/src/getpos.c @@ -6,25 +6,25 @@ extern const char what_is_an_unknown_object[]; /* from pager.c */ -static void getpos_toggle_hilite_state(void); -static void getpos_getvalids_selection(struct selectionvar *, +staticfn void getpos_toggle_hilite_state(void); +staticfn void getpos_getvalids_selection(struct selectionvar *, boolean (*)(coordxy, coordxy)); -static void getpos_help_keyxhelp(winid, const char *, const char *, int); -static void getpos_help(boolean, const char *); -static int QSORTCALLBACK cmp_coord_distu(const void *, const void *); -static int gloc_filter_classify_glyph(int); -static int gloc_filter_floodfill_matcharea(coordxy, coordxy); -static void gloc_filter_floodfill(coordxy, coordxy); -static void gloc_filter_init(void); -static void gloc_filter_done(void); -static void gather_locs(coord **, int *, int); -static void truncate_to_map(coordxy *, coordxy *, schar, schar); -static void getpos_refresh(void); +staticfn void getpos_help_keyxhelp(winid, const char *, const char *, int); +staticfn void getpos_help(boolean, const char *); +staticfn int QSORTCALLBACK cmp_coord_distu(const void *, const void *); +staticfn int gloc_filter_classify_glyph(int); +staticfn int gloc_filter_floodfill_matcharea(coordxy, coordxy); +staticfn void gloc_filter_floodfill(coordxy, coordxy); +staticfn void gloc_filter_init(void); +staticfn void gloc_filter_done(void); +staticfn void gather_locs(coord **, int *, int); +staticfn void truncate_to_map(coordxy *, coordxy *, schar, schar); +staticfn void getpos_refresh(void); /* Callback function for getpos() to highlight desired map locations. * Parameter TRUE: initialize and highlight, FALSE: done (remove highlights). */ -static void (*getpos_hilitefunc)(boolean) = (void (*)(boolean)) 0; -static boolean (*getpos_getvalid)(coordxy, coordxy) +staticfn void (*getpos_hilitefunc)(boolean) = (void (*)(boolean)) 0; +staticfn boolean (*getpos_getvalid)(coordxy, coordxy) = (boolean (*)(coordxy, coordxy)) 0; enum getposHiliteState { HiliteNormalMap = 0, @@ -67,7 +67,7 @@ getpos_sethilite( positions and showing them via temporary S_goodpos symbol; when 'bgcolors' is On, there are three states and showing them via setting background color becomes the default */ -static void +staticfn void getpos_toggle_hilite_state(void) { /* getpos_hilitefunc isn't Null */ @@ -97,7 +97,7 @@ mapxy_valid(coordxy x, coordxy y) return FALSE; } -static void +staticfn void getpos_getvalids_selection( struct selectionvar *sel, boolean (*validf)(coordxy, coordxy)) @@ -132,7 +132,7 @@ static const char *const gloc_filtertxt[NUM_GFILTER] = { " in this area" }; -static void +staticfn void getpos_help_keyxhelp( winid tmpwin, const char *k1, const char *k2, @@ -162,7 +162,7 @@ getpos_help_keyxhelp( DISABLE_WARNING_FORMAT_NONLITERAL /* the response for '?' help request in getpos() */ -static void +staticfn void getpos_help(boolean force, const char *goal) { static const char *const fastmovemode[2] = { "8 units at a time", @@ -307,7 +307,7 @@ getpos_help(boolean force, const char *goal) RESTORE_WARNING_FORMAT_NONLITERAL -static int QSORTCALLBACK +staticfn int QSORTCALLBACK cmp_coord_distu(const void *a, const void *b) { const coord *c1 = a; @@ -336,7 +336,7 @@ cmp_coord_distu(const void *a, const void *b) (isok((x), (y)) \ && (selection_getpoint((x),(y), gg.gloc_filter_map))) -static int +staticfn int gloc_filter_classify_glyph(int glyph) { int c; @@ -359,7 +359,7 @@ gloc_filter_classify_glyph(int glyph) return 0; } -static int +staticfn int gloc_filter_floodfill_matcharea(coordxy x, coordxy y) { int glyph = back_to_glyph(x, y); @@ -377,7 +377,7 @@ gloc_filter_floodfill_matcharea(coordxy x, coordxy y) return FALSE; } -static void +staticfn void gloc_filter_floodfill(coordxy x, coordxy y) { gg.gloc_filter_floodfill_match_glyph = back_to_glyph(x, y); @@ -386,7 +386,7 @@ gloc_filter_floodfill(coordxy x, coordxy y) selection_floodfill(gg.gloc_filter_map, x, y, FALSE); } -static void +staticfn void gloc_filter_init(void) { if (iflags.getloc_filter == GFILTER_AREA) { @@ -407,7 +407,7 @@ gloc_filter_init(void) } } -static void +staticfn void gloc_filter_done(void) { if (gg.gloc_filter_map) { @@ -490,7 +490,7 @@ gather_locs_interesting(coordxy x, coordxy y, int gloc) RESTORE_WARNINGS /* gather locations for monsters or objects shown on the map */ -static void +staticfn void gather_locs(coord **arr_p, int *cnt_p, int gloc) { int pass, idx; @@ -706,7 +706,7 @@ getpos_menu(coord *ccp, int gloc) } /* add dx,dy to cx,cy, truncating at map edges */ -static void +staticfn void truncate_to_map(coordxy *cx, coordxy *cy, schar dx, schar dy) { /* diagonal moves complicate this... */ @@ -730,7 +730,7 @@ truncate_to_map(coordxy *cx, coordxy *cy, schar dx, schar dy) /* called when ^R typed; if '$' is being shown for valid spots, remove that; if alternate background color is being shown for that, redraw it */ -static void +staticfn void getpos_refresh(void) { if (getpos_hilitefunc && getpos_hilite_state == HiliteGoodposSymbol) { diff --git a/src/hack.c b/src/hack.c index 88fab01be..76bc26790 100644 --- a/src/hack.c +++ b/src/hack.c @@ -8,40 +8,40 @@ /* #define DEBUG */ /* uncomment for debugging */ -static boolean could_move_onto_boulder(coordxy, coordxy); -static int moverock(void); -static void dosinkfall(void); -static boolean findtravelpath(int); -static boolean trapmove(coordxy, coordxy, struct trap *); -static int QSORTCALLBACK notice_mons_cmp(const genericptr, const genericptr); -static schar u_simple_floortyp(coordxy, coordxy); -static boolean swim_move_danger(coordxy, coordxy); -static boolean domove_bump_mon(struct monst *, int) NONNULLARG1; -static boolean domove_attackmon_at(struct monst *, coordxy, coordxy, +staticfn boolean could_move_onto_boulder(coordxy, coordxy); +staticfn int moverock(void); +staticfn void dosinkfall(void); +staticfn boolean findtravelpath(int); +staticfn boolean trapmove(coordxy, coordxy, struct trap *); +staticfn int QSORTCALLBACK notice_mons_cmp(const genericptr, const genericptr); +staticfn schar u_simple_floortyp(coordxy, coordxy); +staticfn boolean swim_move_danger(coordxy, coordxy); +staticfn boolean domove_bump_mon(struct monst *, int) NONNULLARG1; +staticfn boolean domove_attackmon_at(struct monst *, coordxy, coordxy, boolean *) NONNULLPTRS; -static boolean domove_fight_ironbars(coordxy, coordxy); -static boolean domove_fight_web(coordxy, coordxy); -static boolean domove_swap_with_pet(struct monst *, +staticfn boolean domove_fight_ironbars(coordxy, coordxy); +staticfn boolean domove_fight_web(coordxy, coordxy); +staticfn boolean domove_swap_with_pet(struct monst *, coordxy, coordxy) NONNULLARG1; -static boolean domove_fight_empty(coordxy, coordxy); -static boolean air_turbulence(void); -static void slippery_ice_fumbling(void); -static boolean impaired_movement(coordxy *, coordxy *) NONNULLPTRS; -static boolean avoid_moving_on_trap(coordxy, coordxy, boolean); -static boolean avoid_moving_on_liquid(coordxy, coordxy, boolean); -static boolean avoid_running_into_trap_or_liquid(coordxy, coordxy); -static boolean move_out_of_bounds(coordxy, coordxy); -static boolean carrying_too_much(void); -static boolean escape_from_sticky_mon(coordxy, coordxy); -static void domove_core(void); -static void maybe_smudge_engr(coordxy, coordxy, coordxy, coordxy); -static struct monst *monstinroom(struct permonst *, int) NONNULLARG1; -static boolean furniture_present(int, int); -static void move_update(boolean); -static int pickup_checks(void); -static boolean doorless_door(coordxy, coordxy); -static void maybe_wail(void); -static boolean water_turbulence(coordxy *, coordxy *); +staticfn boolean domove_fight_empty(coordxy, coordxy); +staticfn boolean air_turbulence(void); +staticfn void slippery_ice_fumbling(void); +staticfn boolean impaired_movement(coordxy *, coordxy *) NONNULLPTRS; +staticfn boolean avoid_moving_on_trap(coordxy, coordxy, boolean); +staticfn boolean avoid_moving_on_liquid(coordxy, coordxy, boolean); +staticfn boolean avoid_running_into_trap_or_liquid(coordxy, coordxy); +staticfn boolean move_out_of_bounds(coordxy, coordxy); +staticfn boolean carrying_too_much(void); +staticfn boolean escape_from_sticky_mon(coordxy, coordxy); +staticfn void domove_core(void); +staticfn void maybe_smudge_engr(coordxy, coordxy, coordxy, coordxy); +staticfn struct monst *monstinroom(struct permonst *, int) NONNULLARG1; +staticfn boolean furniture_present(int, int); +staticfn void move_update(boolean); +staticfn int pickup_checks(void); +staticfn boolean doorless_door(coordxy, coordxy); +staticfn void maybe_wail(void); +staticfn boolean water_turbulence(coordxy *, coordxy *); #define IS_SHOP(x) (gr.rooms[x].rtype >= SHOPBASE) @@ -131,7 +131,7 @@ revive_nasty(coordxy x, coordxy y, const char *msg) /* can hero move onto a spot containing one or more boulders? used for m and travel and during boulder push failure */ -static boolean +staticfn boolean could_move_onto_boulder(coordxy sx, coordxy sy) { /* can if able to phaze through rock (must be poly'd, so not riding) */ @@ -152,7 +152,7 @@ could_move_onto_boulder(coordxy sx, coordxy sy) return squeezeablylightinvent(); } -static int +staticfn int moverock(void) { coordxy rx, ry, sx, sy; @@ -752,7 +752,7 @@ movobj(struct obj *obj, coordxy ox, coordxy oy) newsym(ox, oy); } -static void +staticfn void dosinkfall(void) { static const char fell_on_sink[] = "fell onto a sink"; @@ -1164,7 +1164,7 @@ test_move( * gt.travelmap keeps track of map locations we've moved through * this travel session. It will be cleared once the travel stops. */ -static boolean +staticfn boolean findtravelpath(int mode) { if (!gt.travelmap) @@ -1446,7 +1446,7 @@ is_valid_travelpt(coordxy x, coordxy y) /* try to escape being stuck in a trapped state by walking out of it; return true iff moving should continue to intended destination (all failures and most successful escapes leave hero at original spot) */ -static boolean +staticfn boolean trapmove( coordxy x, coordxy y, /* targeted destination, */ struct trap *desttrap) /* nonnull if another trap at */ @@ -1631,7 +1631,7 @@ notice_mon(struct monst *mtmp) } } -static int QSORTCALLBACK +staticfn int QSORTCALLBACK notice_mons_cmp(const genericptr ptr1, const genericptr ptr2) { const struct monst *m1 = *(const struct monst **) ptr1, @@ -1720,7 +1720,7 @@ u_locomotion(const char *def) } /* Return a simplified floor solid/liquid state based on hero's state */ -static schar +staticfn schar u_simple_floortyp(coordxy x, coordxy y) { boolean u_in_air = (Levitation || Flying || !grounded(gy.youmonst.data)); @@ -1768,7 +1768,7 @@ handle_tip(int tip) } /* Is it dangerous for hero to move to x,y due to water or lava? */ -static boolean +staticfn boolean swim_move_danger(coordxy x, coordxy y) { schar newtyp = u_simple_floortyp(x, y); @@ -1809,7 +1809,7 @@ swim_move_danger(coordxy x, coordxy y) } /* moving with 'm' prefix, bump into a monster? */ -static boolean +staticfn boolean domove_bump_mon(struct monst *mtmp, int glyph) { /* If they used a 'm' command, trying to move onto a monster @@ -1839,7 +1839,7 @@ domove_bump_mon(struct monst *mtmp, int glyph) returns TRUE if hero movement is used up. sets displaceu, if hero and monster could swap places instead. */ -static boolean +staticfn boolean domove_attackmon_at( struct monst *mtmp, coordxy x, coordxy y, @@ -1878,7 +1878,7 @@ domove_attackmon_at( } /* force-fight iron bars with your weapon? */ -static boolean +staticfn boolean domove_fight_ironbars(coordxy x, coordxy y) { if (gc.context.forcefight && levl[x][y].typ == IRONBARS && uwep) { @@ -1903,7 +1903,7 @@ domove_fight_ironbars(coordxy x, coordxy y) } /* force-fight a spider web with your weapon */ -static boolean +staticfn boolean domove_fight_web(coordxy x, coordxy y) { struct trap *trap = t_at(x, y); @@ -1980,7 +1980,7 @@ domove_fight_web(coordxy x, coordxy y) } /* maybe swap places with a pet? returns TRUE if swapped places */ -static boolean +staticfn boolean domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y) { struct trap *trap; @@ -2100,7 +2100,7 @@ domove_swap_with_pet(struct monst *mtmp, coordxy x, coordxy y) } /* force-fight (x,y) which doesn't have anything to fight */ -static boolean +staticfn boolean domove_fight_empty(coordxy x, coordxy y) { static const char unknown_obstacle[] = "an unknown obstacle"; @@ -2211,7 +2211,7 @@ domove_fight_empty(coordxy x, coordxy y) } /* does the plane of air disturb movement? */ -static boolean +staticfn boolean air_turbulence(void) { if (Is_airlevel(&u.uz) && rn2(4) && !Levitation && !Flying) { @@ -2234,7 +2234,7 @@ air_turbulence(void) } /* does water disturb the movement? */ -static boolean +staticfn boolean water_turbulence(coordxy *x, coordxy *y) { if (u.uinwater) { @@ -2265,7 +2265,7 @@ water_turbulence(coordxy *x, coordxy *y) return FALSE; } -static void +staticfn void slippery_ice_fumbling(void) { boolean on_ice = !Levitation && is_ice(u.ux, u.uy); @@ -2294,7 +2294,7 @@ u_maybe_impaired(void) } /* change movement dir if impaired. return TRUE if can't move */ -static boolean +staticfn boolean impaired_movement(coordxy *x, coordxy *y) { if (u_maybe_impaired()) { @@ -2313,7 +2313,7 @@ impaired_movement(coordxy *x, coordxy *y) return FALSE; } -static boolean +staticfn boolean avoid_moving_on_trap(coordxy x, coordxy y, boolean msg) { struct trap *trap; @@ -2329,7 +2329,7 @@ avoid_moving_on_trap(coordxy x, coordxy y, boolean msg) return FALSE; } -static boolean +staticfn boolean avoid_moving_on_liquid( coordxy x, coordxy y, boolean msg) @@ -2361,7 +2361,7 @@ avoid_moving_on_liquid( /* when running/rushing, avoid stepping on a known trap or pool of liquid. returns TRUE if avoided. */ -static boolean +staticfn boolean avoid_running_into_trap_or_liquid(coordxy x, coordxy y) { boolean would_stop = (gc.context.run >= 2); @@ -2379,7 +2379,7 @@ avoid_running_into_trap_or_liquid(coordxy x, coordxy y) } /* trying to move out-of-bounds? */ -static boolean +staticfn boolean move_out_of_bounds(coordxy x, coordxy y) { if (!isok(x, y)) { @@ -2409,7 +2409,7 @@ move_out_of_bounds(coordxy x, coordxy y) } /* carrying too much to be able to move? */ -static boolean +staticfn boolean carrying_too_much(void) { int wtcap; @@ -2432,7 +2432,7 @@ carrying_too_much(void) /* try to pull free from sticking monster, or you release a monster you're sticking to. returns TRUE if you lose your movement. */ -static boolean +staticfn boolean escape_from_sticky_mon(coordxy x, coordxy y) { if (u.ustuck && (x != u.ustuck->mx || y != u.ustuck->my)) { @@ -2499,7 +2499,7 @@ domove(void) gd.domove_attempting = 0L; } -static void +staticfn void domove_core(void) { struct monst *mtmp; @@ -2831,7 +2831,7 @@ runmode_delay_output(void) } } -static void +staticfn void maybe_smudge_engr(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { struct engr *ep; @@ -3181,7 +3181,7 @@ spoteffects(boolean pick) } /* returns first matching monster */ -static struct monst * +staticfn struct monst * monstinroom(struct permonst *mdat, int roomno) { struct monst *mtmp; @@ -3197,7 +3197,7 @@ monstinroom(struct permonst *mdat, int roomno) } /* check whether room contains a particular type of furniture */ -static boolean +staticfn boolean furniture_present(int furniture, int roomno) { int x, y, lx, ly, hx, hy; @@ -3303,7 +3303,7 @@ in_town(coordxy x, coordxy y) return !has_subrooms; } -static void +staticfn void move_update(boolean newlev) { char c, *ptr1, *ptr2, *ptr3, *ptr4; @@ -3502,7 +3502,7 @@ check_special_room(boolean newlev) 0 = cannot pickup, no time taken -1 = do normal pickup -2 = loot the monster */ -static int +staticfn int pickup_checks(void) { struct trap *traphere; @@ -3776,7 +3776,7 @@ lookaround(void) } /* check for a doorway which lacks its door (NODOOR or BROKEN) */ -static boolean +staticfn boolean doorless_door(coordxy x, coordxy y) { struct rm *lev_p = &levl[x][y]; @@ -3914,7 +3914,7 @@ unmul(const char *msg_override) } } -static void +staticfn void maybe_wail(void) { static short powers[] = { TELEPORT, SEE_INVIS, POISON_RES, COLD_RES, diff --git a/src/insight.c b/src/insight.c index b81ece08e..e01f2e87c 100644 --- a/src/insight.c +++ b/src/insight.c @@ -14,28 +14,28 @@ #include "hack.h" -static void enlght_out(const char *); -static void enlght_line(const char *, const char *, const char *, +staticfn void enlght_out(const char *); +staticfn void enlght_line(const char *, const char *, const char *, const char *); -static char *enlght_combatinc(const char *, int, int, char *); -static void enlght_halfdmg(int, int); -static boolean walking_on_water(void); -static boolean cause_known(int); -static char *attrval(int, int, char *); -static char *fmt_elapsed_time(char *, int); -static void background_enlightenment(int, int); -static void basics_enlightenment(int, int); -static void characteristics_enlightenment(int, int); -static void one_characteristic(int, int, int); -static void status_enlightenment(int, int); -static void weapon_insight(int); -static void attributes_enlightenment(int, int); -static void show_achievements(int); -static int QSORTCALLBACK vanqsort_cmp(const genericptr, const genericptr); -static int num_extinct(void); -static int num_gone(int, int *); -static char *size_str(int); -static void item_resistance_message(int, const char *, int); +staticfn char *enlght_combatinc(const char *, int, int, char *); +staticfn void enlght_halfdmg(int, int); +staticfn boolean walking_on_water(void); +staticfn boolean cause_known(int); +staticfn char *attrval(int, int, char *); +staticfn char *fmt_elapsed_time(char *, int); +staticfn void background_enlightenment(int, int); +staticfn void basics_enlightenment(int, int); +staticfn void characteristics_enlightenment(int, int); +staticfn void one_characteristic(int, int, int); +staticfn void status_enlightenment(int, int); +staticfn void weapon_insight(int); +staticfn void attributes_enlightenment(int, int); +staticfn void show_achievements(int); +staticfn int QSORTCALLBACK vanqsort_cmp(const genericptr, const genericptr); +staticfn int num_extinct(void); +staticfn int num_gone(int, int *); +staticfn char *size_str(int); +staticfn void item_resistance_message(int, const char *, int); extern const char *const hu_stat[]; /* hunger status from eat.c */ extern const char *const enc_stat[]; /* encumbrance status from botl.c */ @@ -112,7 +112,7 @@ static struct ll_achieve_msg achieve_msg [] = { #define you_have_X(something) \ enl_msg(You_, have, (const char *) "", (something), "") -static void +staticfn void enlght_out(const char *buf) { if (ge.en_via_menu) { @@ -121,7 +121,7 @@ enlght_out(const char *buf) putstr(ge.en_win, 0, buf); } -static void +staticfn void enlght_line( const char *start, const char *middle, @@ -154,7 +154,7 @@ enlght_line( } /* format increased chance to hit or damage or defense (Protection) */ -static char * +staticfn char * enlght_combatinc(const char *inctyp, int incamt, int final, char *outbuf) { const char *modif, *bonus; @@ -191,7 +191,7 @@ enlght_combatinc(const char *inctyp, int incamt, int final, char *outbuf) } /* report half physical or half spell damage */ -static void +staticfn void enlght_halfdmg(int category, int final) { const char *category_name; @@ -214,7 +214,7 @@ enlght_halfdmg(int category, int final) } /* is hero actively using water walking capability on water (or lava)? */ -static boolean +staticfn boolean walking_on_water(void) { if (u.uinwater || Levitation || Flying) @@ -257,7 +257,7 @@ trap_predicament(char *outbuf, int final, boolean wizxtra) /* check whether hero is wearing something that player definitely knows confers the target property; item must have been seen and its type discovered but it doesn't necessarily have to be fully identified */ -static boolean +staticfn boolean cause_known( int propindx) /* index of a property which can be conveyed by worn item */ { @@ -277,7 +277,7 @@ cause_known( } /* format a characteristic value, accommodating Strength's strangeness */ -static char * +staticfn char * attrval( int attrindx, int attrvalue, @@ -304,7 +304,7 @@ attrval( (note: for a list of more than two entries, nethack usually includes the [style-wise] optional comma before "and" but in this instance it does not) */ -static char * +staticfn char * fmt_elapsed_time(char *outbuf, int final) { int fieldcnt; @@ -432,7 +432,7 @@ enlightenment( /*ARGSUSED*/ /* display role, race, alignment and such to en_win */ -static void +staticfn void background_enlightenment(int unused_mode UNUSED, int final) { const char *role_titl, *rank_titl; @@ -691,7 +691,7 @@ background_enlightenment(int unused_mode UNUSED, int final) /* hit points, energy points, armor class -- essential information which doesn't fit very well in other categories */ /*ARGSUSED*/ -static void +staticfn void basics_enlightenment(int mode UNUSED, int final) { static char Power[] = "energy points (spell power)"; @@ -790,7 +790,7 @@ basics_enlightenment(int mode UNUSED, int final) } /* characteristics: expanded version of bottom line strength, dexterity, &c */ -static void +staticfn void characteristics_enlightenment(int mode, int final) { char buf[BUFSZ]; @@ -809,7 +809,7 @@ characteristics_enlightenment(int mode, int final) } /* display one attribute value for characteristics_enlightenment() */ -static void +staticfn void one_characteristic(int mode, int final, int attrindx) { extern const char *const attrname[]; /* attrib.c */ @@ -903,7 +903,7 @@ one_characteristic(int mode, int final, int attrindx) } /* status: selected obvious capabilities, assorted troubles */ -static void +staticfn void status_enlightenment(int mode, int final) { boolean magic = (mode & MAGICENLIGHTENMENT) ? TRUE : FALSE; @@ -1232,7 +1232,7 @@ status_enlightenment(int mode, int final) } /* extracted from status_enlightenment() to reduce clutter there */ -static void +staticfn void weapon_insight(int final) { char buf[BUFSZ]; @@ -1430,7 +1430,7 @@ weapon_insight(int final) } /* skill applies */ } -static void +staticfn void item_resistance_message( int adtyp, const char *prot_message, @@ -1449,7 +1449,7 @@ item_resistance_message( } /* attributes: intrinsics and the like, other non-obvious capabilities */ -static void +staticfn void attributes_enlightenment( int unused_mode UNUSED, int final) @@ -2190,7 +2190,7 @@ show_conduct(int final) * Achievements (see 'enum achievements' in you.h). */ -static void +staticfn void show_achievements( int final) /* 'final' is used "behind the curtain" by enl_foo() macros */ { @@ -2567,7 +2567,7 @@ const char *const vanqorders[NUM_VANQ_ORDER_MODES][3] = { "by count, low to high, by internal index within tied count" }, }; -static int QSORTCALLBACK +staticfn int QSORTCALLBACK vanqsort_cmp( const genericptr vptr1, const genericptr vptr2) @@ -2879,7 +2879,7 @@ num_genocides(void) } /* return a count of the number of extinct species */ -static int +staticfn int num_extinct(void) { int i, n = 0; @@ -2894,7 +2894,7 @@ num_extinct(void) } /* collect both genocides and extinctions, skipping uniques */ -static int +staticfn int num_gone(int mvflags, int *mindx) { uchar mflg = (uchar) mvflags; @@ -3110,7 +3110,7 @@ align_str(aligntyp alignment) return "unknown"; } -static char * +staticfn char * size_str(int msize) { static char outbuf[40]; diff --git a/src/invent.c b/src/invent.c index dfd9c243c..baee7a1c1 100644 --- a/src/invent.c +++ b/src/invent.c @@ -10,45 +10,45 @@ #define CONTAINED_SYM '>' /* designator for inside a container */ #define HANDS_SYM '-' /* hands|fingers|self depending on context */ -static void inuse_classify(Loot *, struct obj *); -static char *loot_xname(struct obj *); -static int invletter_value(char); -static int QSORTCALLBACK sortloot_cmp(const genericptr, const genericptr); -static void reorder_invent(void); -static struct obj *addinv_core0(struct obj *, struct obj *, +staticfn void inuse_classify(Loot *, struct obj *); +staticfn char *loot_xname(struct obj *); +staticfn int invletter_value(char); +staticfn int QSORTCALLBACK sortloot_cmp(const genericptr, const genericptr); +staticfn void reorder_invent(void); +staticfn struct obj *addinv_core0(struct obj *, struct obj *, boolean) NONNULLARG1; -static void noarmor(boolean); -static void invdisp_nothing(const char *, const char *); -static boolean worn_wield_only(struct obj *); -static char *cinv_doname(struct obj *); -static char *cinv_ansimpleoname(struct obj *); -static boolean only_here(struct obj *); -static void compactify(char *); -static boolean taking_off(const char *); -static void mime_action(const char *); -static char *getobj_hands_txt(const char *, char *); -static int ckvalidcat(struct obj *); -static int ckunpaid(struct obj *); -static char *safeq_xprname(struct obj *); -static char *safeq_shortxprname(struct obj *); -static char display_pickinv(const char *, const char *, const char *, +staticfn void noarmor(boolean); +staticfn void invdisp_nothing(const char *, const char *); +staticfn boolean worn_wield_only(struct obj *); +staticfn char *cinv_doname(struct obj *); +staticfn char *cinv_ansimpleoname(struct obj *); +staticfn boolean only_here(struct obj *); +staticfn void compactify(char *); +staticfn boolean taking_off(const char *); +staticfn void mime_action(const char *); +staticfn char *getobj_hands_txt(const char *, char *); +staticfn int ckvalidcat(struct obj *); +staticfn int ckunpaid(struct obj *); +staticfn char *safeq_xprname(struct obj *); +staticfn char *safeq_shortxprname(struct obj *); +staticfn char display_pickinv(const char *, const char *, const char *, boolean, boolean, long *); -static char display_used_invlets(char); -static boolean this_type_only(struct obj *); -static void dounpaid(int, int, int); -static struct obj *find_unpaid(struct obj *, struct obj **); -static void menu_identify(int); -static boolean tool_being_used(struct obj *); -static int adjust_ok(struct obj *); -static int adjust_gold_ok(struct obj *); -static int doorganize_core(struct obj *); -static char obj_to_let(struct obj *); -static boolean item_naming_classification(struct obj *, char *, char *); -static int item_reading_classification(struct obj *, char *); -static void ia_addmenu(winid, int, char, const char *); -static void itemactions_pushkeys(struct obj *, int); -static int itemactions(struct obj *); -static int dispinv_with_action(char *, boolean, const char *); +staticfn char display_used_invlets(char); +staticfn boolean this_type_only(struct obj *); +staticfn void dounpaid(int, int, int); +staticfn struct obj *find_unpaid(struct obj *, struct obj **); +staticfn void menu_identify(int); +staticfn boolean tool_being_used(struct obj *); +staticfn int adjust_ok(struct obj *); +staticfn int adjust_gold_ok(struct obj *); +staticfn int doorganize_core(struct obj *); +staticfn char obj_to_let(struct obj *); +staticfn boolean item_naming_classification(struct obj *, char *, char *); +staticfn int item_reading_classification(struct obj *, char *); +staticfn void ia_addmenu(winid, int, char, const char *); +staticfn void itemactions_pushkeys(struct obj *, int); +staticfn int itemactions(struct obj *); +staticfn int dispinv_with_action(char *, boolean, const char *); /* enum and structs are defined in wintype.h */ static win_request_info wri_info; @@ -76,7 +76,7 @@ static const char *inuse_headers[] = { /* [4] shown first, [1] last */ /* sortloot() classification for in-use sort; called at most once [per sort] for each object */ -static void +staticfn void inuse_classify(Loot *sort_item, struct obj *obj) { long w_mask = (obj->owornmask & (W_ACCESSORY | W_WEAPONS | W_ARMOR)); @@ -315,7 +315,7 @@ loot_classify(Loot *sort_item, struct obj *obj) } /* sortloot() formatting routine; for alphabetizing, not shown to user */ -static char * +staticfn char * loot_xname(struct obj *obj) { struct obj saveo; @@ -397,7 +397,7 @@ loot_xname(struct obj *obj) } /* '$'==1, 'a'-'z'==2..27, 'A'-'Z'==28..53, '#'==54, catchall 55 */ -static int +staticfn int invletter_value(char c) { return ('a' <= c && c <= 'z') ? (c - 'a' + 2) @@ -408,7 +408,7 @@ invletter_value(char c) } /* qsort comparison routine for sortloot() */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK sortloot_cmp(const genericptr vptr1, const genericptr vptr2) { struct sortloot_item *sli1 = (struct sortloot_item *) vptr1, @@ -744,7 +744,7 @@ assigninvlet(struct obj *otmp) #define inv_rank(o) ((o)->invlet ^ 040) /* sort the inventory; used by addinv() and doorganize() */ -static void +staticfn void reorder_invent(void) { struct obj *otmp, *prev, *next; @@ -1038,7 +1038,7 @@ addinv_core2(struct obj *obj) * Add obj to the hero's inventory. Make sure the object is "free". * Adjust hero attributes as necessary. */ -static struct obj * +staticfn struct obj * addinv_core0(struct obj *obj, struct obj *other_obj, boolean update_perm_invent) { @@ -1581,7 +1581,7 @@ g_at(coordxy x, coordxy y) } /* compact a string of inventory letters by dashing runs of letters */ -static void +staticfn void compactify(char *buf) { int i1 = 1, i2 = 1; @@ -1626,13 +1626,13 @@ splittable(struct obj *obj) } /* match the prompt for either 'T' or 'R' command */ -static boolean +staticfn boolean taking_off(const char *action) { return !strcmp(action, "take off") || !strcmp(action, "remove"); } -static void +staticfn void mime_action(const char *word) { char buf[BUFSZ]; @@ -1673,7 +1673,7 @@ any_obj_ok(struct obj *obj) } /* return string describing your hands based on action. */ -static char * +staticfn char * getobj_hands_txt(const char *action, char *qbuf) { if (!strcmp(action, "grease")) { @@ -2092,14 +2092,14 @@ silly_thing(const char *word, RESTORE_WARNING_FORMAT_NONLITERAL -static int +staticfn int ckvalidcat(struct obj *otmp) { /* use allow_category() from pickup.c */ return (int) allow_category(otmp); } -static int +staticfn int ckunpaid(struct obj *otmp) { return (otmp->unpaid || (Has_contents(otmp) && count_unpaid(otmp->cobj))); @@ -2136,7 +2136,7 @@ static struct xprnctx { } safeq_xprn_ctx; /* safe_qbuf() -> short_oname() callback */ -static char * +staticfn char * safeq_xprname(struct obj *obj) { return xprname(obj, (char *) 0, safeq_xprn_ctx.let, safeq_xprn_ctx.dot, @@ -2144,7 +2144,7 @@ safeq_xprname(struct obj *obj) } /* alternate safe_qbuf() -> short_oname() callback */ -static char * +staticfn char * safeq_shortxprname(struct obj *obj) { return xprname(obj, ansimpleoname(obj), safeq_xprn_ctx.let, @@ -2530,7 +2530,7 @@ identify(struct obj *otmp) } /* menu of unidentified objects; select and identify up to id_limit of them */ -static void +staticfn void menu_identify(int id_limit) { menu_item *pick_list; @@ -2728,7 +2728,7 @@ doperminv(void) } /* should of course only be called for things in invent */ -static char +staticfn char obj_to_let(struct obj *obj) { if (!flags.invlet_constant) { @@ -2855,7 +2855,7 @@ enum item_action_actions { }; /* construct text for the menu entries for IA_NAME_OBJ and IA_NAME_OTYP */ -static boolean +staticfn boolean item_naming_classification( struct obj *obj, char *onamebuf, @@ -2895,7 +2895,7 @@ item_naming_classification( } /* construct text for the menu entries for IA_READ_OBJ */ -static int +staticfn int item_reading_classification(struct obj *obj, char *outbuf) { int otyp = obj->otyp, res = IA_READ_OBJ; @@ -2936,7 +2936,7 @@ item_reading_classification(struct obj *obj, char *outbuf) return res; } -static void +staticfn void ia_addmenu(winid win, int act, char let, const char *txt) { anything any; @@ -2948,7 +2948,7 @@ ia_addmenu(winid win, int act, char let, const char *txt) ATR_NONE, clr, txt, MENU_ITEMFLAGS_NONE); } -static void +staticfn void itemactions_pushkeys(struct obj *otmp, int act) { switch (act) { @@ -3083,7 +3083,7 @@ itemactions_pushkeys(struct obj *otmp, int act) } /* Show menu of possible actions hero could do with item otmp */ -static int +staticfn int itemactions(struct obj *otmp) { int n, act = IA_NONE; @@ -3420,7 +3420,7 @@ itemactions(struct obj *otmp) order to preform context-sensitive item action on it; always returns 'ok'; invent subsets specified by the ')', '[', '(', '=', '"', or '*' commands when they're invoked with the 'm' prefix (or without it for '*') */ -static int +staticfn int dispinv_with_action( char *lets, /* list of invlet values to include */ boolean use_inuse_ordering, /* affects sortloot() and header labels */ @@ -3475,7 +3475,7 @@ ddoinv(void) * next unpaid object is returned. This routine recursively follows * containers. */ -static struct obj * +staticfn struct obj * find_unpaid(struct obj *list, struct obj **last_found) { struct obj *obj; @@ -3511,7 +3511,7 @@ free_pickinv_cache(void) * Internal function used by display_inventory and getobj that can display * inventory and return a count as well as a letter. */ -static char +staticfn char display_pickinv( const char *lets, /* non-compacted list of invlet values */ const char *xtra_choice, /* non-object "bare hands" or "fingers" */ @@ -3906,7 +3906,7 @@ display_inventory(const char *lets, boolean want_reply) * Show what is current using inventory letters. * */ -static char +staticfn char display_used_invlets(char avoidlet) { struct obj *otmp; @@ -4092,7 +4092,7 @@ count_contents( return count; } -static void +staticfn void dounpaid( int count, /* unpaid items in inventory */ int floorcount, /* unpaid items on floor (rare) */ @@ -4231,7 +4231,7 @@ dounpaid( } -static boolean +staticfn boolean this_type_only(struct obj *obj) { boolean res = (obj->oclass == gt.this_type); @@ -4995,7 +4995,7 @@ doprwep(void) } /* caller is responsible for checking !wearing_armor() */ -static void +staticfn void noarmor(boolean report_uskin) { if (!uskin || !report_uskin) { @@ -5115,7 +5115,7 @@ dopramulet(void) } /* is 'obj' a tool that's in use? can't simply check obj->owornmask */ -static boolean +staticfn boolean tool_being_used(struct obj *obj) { /* @@ -5334,7 +5334,7 @@ check_invent_gold(const char *why) /* 'why' == caller in case of warning */ } /* normal getobj callback for item to #adjust; excludes gold */ -static int +staticfn int adjust_ok(struct obj *obj) { if (!obj || obj->oclass == COIN_CLASS) @@ -5344,7 +5344,7 @@ adjust_ok(struct obj *obj) } /* getobj callback for item to #adjust if gold is wonky; allows gold */ -static int +staticfn int adjust_gold_ok(struct obj *obj) { if (!obj) @@ -5485,7 +5485,7 @@ adjust_split(void) return doorganize_core(obj); } -static int +staticfn int doorganize_core(struct obj *obj) { struct obj *otmp, *splitting, *bumped; @@ -5696,7 +5696,7 @@ doorganize_core(struct obj *obj) } /* common to display_minventory and display_cinventory */ -static void +staticfn void invdisp_nothing(const char *hdr, const char *txt) { winid win; @@ -5715,7 +5715,7 @@ invdisp_nothing(const char *hdr, const char *txt) } /* query_objlist callback: return things that are worn or wielded */ -static boolean +staticfn boolean worn_wield_only(struct obj *obj) { #if 1 @@ -5797,7 +5797,7 @@ display_minventory( /* format a container name for cinventory_display(), inserting "trapped" if that's appropriate */ -static char * +staticfn char * cinv_doname(struct obj *obj) { char *result = doname(obj); @@ -5829,7 +5829,7 @@ cinv_doname(struct obj *obj) } /* used by safe_qbuf() if the full doname() result is too long */ -static char * +staticfn char * cinv_ansimpleoname(struct obj *obj) { char *result = ansimpleoname(obj); @@ -5883,7 +5883,7 @@ display_cinventory(struct obj *obj) } -static boolean +staticfn boolean only_here(struct obj *obj) { return (obj->ox == go.only.x && obj->oy == go.only.y); diff --git a/src/isaac64.c b/src/isaac64.c index 7b5d016dd..0fa0e7a8d 100644 --- a/src/isaac64.c +++ b/src/isaac64.c @@ -32,8 +32,8 @@ static inline uint32_t lower_bits(uint64_t); static inline uint32_t upper_bits(uint64_t); -static void isaac64_update(isaac64_ctx *); -static void isaac64_mix(uint64_t[8]); +staticfn void isaac64_update(isaac64_ctx *); +staticfn void isaac64_mix(uint64_t[8]); /* Extract ISAAC64_SZ_LOG bits (starting at bit 3). */ static inline uint32_t lower_bits(uint64_t x) @@ -47,7 +47,7 @@ static inline uint32_t upper_bits(uint64_t y) return (y >> (ISAAC64_SZ_LOG+3)) & (ISAAC64_SZ-1); } -static void isaac64_update(isaac64_ctx *_ctx){ +staticfn void isaac64_update(isaac64_ctx *_ctx){ uint64_t *m; uint64_t *r; uint64_t a; @@ -100,7 +100,7 @@ static void isaac64_update(isaac64_ctx *_ctx){ _ctx->n=ISAAC64_SZ; } -static void isaac64_mix(uint64_t _x[8]){ +staticfn void isaac64_mix(uint64_t _x[8]){ static const unsigned char SHIFT[8]={9,9,23,15,14,20,17,14}; int i; for(i=0;i<8;i++){ diff --git a/src/light.c b/src/light.c index 13708f8c7..95396c16b 100644 --- a/src/light.c +++ b/src/light.c @@ -41,11 +41,11 @@ #define LSF_SHOW 0x1 /* display the light source */ #define LSF_NEEDS_FIXUP 0x2 /* need oid fixup */ -static light_source *new_light_core(coordxy, coordxy, +staticfn light_source *new_light_core(coordxy, coordxy, int, int, anything *) NONNULLPTRS; -static void discard_flashes(void); -static void write_ls(NHFILE *, light_source *); -static int maybe_write_ls(NHFILE *, int, boolean); +staticfn void discard_flashes(void); +staticfn void write_ls(NHFILE *, light_source *); +staticfn int maybe_write_ls(NHFILE *, int, boolean); /* imported from vision.c, for small circles */ extern const coordxy circle_data[]; @@ -61,7 +61,7 @@ new_light_source(coordxy x, coordxy y, int range, int type, anything *id) } /* Create a new light source and return it. Only used within this file. */ -static light_source * +staticfn light_source * new_light_core(coordxy x, coordxy y, int range, int type, anything *id) { light_source *ls; @@ -327,7 +327,7 @@ transient_light_cleanup(void) } /* camera flashes have Null object; caller wants to get rid of them now */ -static void +staticfn void discard_flashes(void) { light_source *ls, *nxt_ls; @@ -509,7 +509,7 @@ relink_light_sources(boolean ghostly) * sources that would be written. If write_it is true, actually write * the light source out. */ -static int +staticfn int maybe_write_ls(NHFILE *nhfp, int range, boolean write_it) { int count = 0, is_global; @@ -572,7 +572,7 @@ light_sources_sanity_check(void) } /* Write a light source structure to disk. */ -static void +staticfn void write_ls(NHFILE *nhfp, light_source *ls) { anything arg_save; diff --git a/src/lock.c b/src/lock.c index 818c10c19..1f6e40c8d 100644 --- a/src/lock.c +++ b/src/lock.c @@ -6,12 +6,12 @@ #include "hack.h" /* occupation callbacks */ -static int picklock(void); -static int forcelock(void); +staticfn int picklock(void); +staticfn int forcelock(void); -static const char *lock_action(void); -static boolean obstructed(coordxy, coordxy, boolean); -static void chest_shatter_msg(struct obj *); +staticfn const char *lock_action(void); +staticfn boolean obstructed(coordxy, coordxy, boolean); +staticfn void chest_shatter_msg(struct obj *); boolean picking_lock(coordxy *x, coordxy *y) @@ -33,7 +33,7 @@ picking_at(coordxy x, coordxy y) } /* produce an occupation string appropriate for the current activity */ -static const char * +staticfn const char * lock_action(void) { /* "unlocking"+2 == "locking" */ @@ -63,7 +63,7 @@ lock_action(void) } /* try to open/close a lock */ -static int +staticfn int picklock(void) { if (gx.xlock.box) { @@ -207,7 +207,7 @@ breakchestlock(struct obj *box, boolean destroyit) } /* try to force a locked chest */ -static int +staticfn int forcelock(void) { if ((gx.xlock.box->ox != u.ux) || (gx.xlock.box->oy != u.uy)) @@ -908,7 +908,7 @@ doopen_indir(coordxy x, coordxy y) return ECMD_TIME; } -static boolean +staticfn boolean obstructed(coordxy x, coordxy y, boolean quietly) { struct monst *mtmp = m_at(x, y); @@ -1257,7 +1257,7 @@ doorlock(struct obj *otmp, coordxy x, coordxy y) return res; } -static void +staticfn void chest_shatter_msg(struct obj *otmp) { const char *disposition; diff --git a/src/mail.c b/src/mail.c index 1a026f88b..3c7d64c11 100644 --- a/src/mail.c +++ b/src/mail.c @@ -40,12 +40,12 @@ * random intervals. */ -static boolean md_start(coord *); -static boolean md_stop(coord *, coord *); -static boolean md_rush(struct monst *, int, int); -static void newmail(struct mail_info *); +staticfn boolean md_start(coord *); +staticfn boolean md_stop(coord *, coord *); +staticfn boolean md_rush(struct monst *, int, int); +staticfn void newmail(struct mail_info *); #if defined(SIMPLE_MAIL) || defined(SERVER_ADMIN_MSG) -static void read_simplemail(const char *mbox, boolean adminmsg); +staticfn void read_simplemail(const char *mbox, boolean adminmsg); #endif #if !defined(UNIX) && !defined(VMS) @@ -145,7 +145,7 @@ getmailstatus(void) * Pick coordinates for a starting position for the mail daemon. Called * from newmail() and newphone(). */ -static boolean +staticfn boolean md_start(coord *startp) { coord testcc; /* scratch coordinates */ @@ -243,7 +243,7 @@ md_start(coord *startp) * enexto(). Use enexto() as a last resort because enexto() chooses * its point randomly, which is not what we want. */ -static boolean +staticfn boolean md_stop(coord *stopp, /* stopping position (we fill it in) */ coord *startp) /* starting position (read only) */ { @@ -273,7 +273,7 @@ md_stop(coord *stopp, /* stopping position (we fill it in) */ } /* Let the mail daemon have a larger vocabulary. */ -static NEARDATA const char *mail_text[] = { "Gangway!", "Look out!", +staticfn NEARDATA const char *mail_text[] = { "Gangway!", "Look out!", "Pardon me!" }; #define md_exclamations() (mail_text[rn2(3)]) @@ -283,7 +283,7 @@ static NEARDATA const char *mail_text[] = { "Gangway!", "Look out!", * FALSE if the md gets stuck in a position where there is a monster. Return * TRUE otherwise. */ -static boolean +staticfn boolean md_rush(struct monst *md, int tx, int ty) /* destination of mail daemon */ { @@ -387,7 +387,7 @@ md_rush(struct monst *md, /* Deliver a scroll of mail. */ /*ARGSUSED*/ -static void +staticfn void newmail(struct mail_info *info) { struct monst *md; diff --git a/src/makemon.c b/src/makemon.c index bd61ef13e..48fc326a7 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -14,17 +14,17 @@ (mptr->mlet == S_HUMAN && Role_if(role_pm) \ && (mptr->msound == MS_LEADER || mptr->msound == MS_NEMESIS)) -static boolean uncommon(int); -static int align_shift(struct permonst *); -static int temperature_shift(struct permonst *); -static boolean mk_gen_ok(int, unsigned, unsigned); -static boolean wrong_elem_type(struct permonst *); -static void m_initgrp(struct monst *, coordxy, coordxy, int, mmflags_nht); -static void m_initthrow(struct monst *, int, int); -static void m_initweap(struct monst *); -static void m_initinv(struct monst *); -static boolean makemon_rnd_goodpos(struct monst *, mmflags_nht, coord *); -static void init_mextra(struct mextra *); +staticfn boolean uncommon(int); +staticfn int align_shift(struct permonst *); +staticfn int temperature_shift(struct permonst *); +staticfn boolean mk_gen_ok(int, unsigned, unsigned); +staticfn boolean wrong_elem_type(struct permonst *); +staticfn void m_initgrp(struct monst *, coordxy, coordxy, int, mmflags_nht); +staticfn void m_initthrow(struct monst *, int, int); +staticfn void m_initweap(struct monst *); +staticfn void m_initinv(struct monst *); +staticfn boolean makemon_rnd_goodpos(struct monst *, mmflags_nht, coord *); +staticfn void init_mextra(struct mextra *); #define m_initsgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 3, mmf) #define m_initlgrp(mtmp, x, y, mmf) m_initgrp(mtmp, x, y, 10, mmf) @@ -51,7 +51,7 @@ is_home_elemental(struct permonst *ptr) /* * Return true if the given monster cannot exist on this elemental level. */ -static boolean +staticfn boolean wrong_elem_type(struct permonst *ptr) { if (ptr->mlet == S_ELEMENTAL) { @@ -74,7 +74,7 @@ wrong_elem_type(struct permonst *ptr) } /* make a group just like mtmp */ -static void +staticfn void m_initgrp(struct monst *mtmp, coordxy x, coordxy y, int n, mmflags_nht mmflags) { coord mm; @@ -140,8 +140,7 @@ m_initgrp(struct monst *mtmp, coordxy x, coordxy y, int n, mmflags_nht mmflags) } } -static -void +staticfn void m_initthrow(struct monst *mtmp, int otyp, int oquan) { struct obj *otmp; @@ -154,7 +153,7 @@ m_initthrow(struct monst *mtmp, int otyp, int oquan) (void) mpickobj(mtmp, otmp); } -static void +staticfn void m_initweap(struct monst *mtmp) { struct permonst *ptr = mtmp->data; @@ -576,7 +575,7 @@ mkmonmoney(struct monst *mtmp, long amount) } } -static void +staticfn void m_initinv(struct monst *mtmp) { int cnt; @@ -1041,7 +1040,7 @@ newmonhp(struct monst *mon, int mndx) static const struct mextra zeromextra = DUMMY; -static void +staticfn void init_mextra(struct mextra *mex) { *mex = zeromextra; @@ -1058,7 +1057,7 @@ newmextra(void) return mextra; } -static boolean +staticfn boolean makemon_rnd_goodpos( struct monst *mon, mmflags_nht gpflags, @@ -1567,7 +1566,7 @@ create_critters( return known; } -static boolean +staticfn boolean uncommon(int mndx) { if (mons[mndx].geno & (G_NOGEN | G_UNIQ)) @@ -1585,7 +1584,7 @@ uncommon(int mndx) * comparing the dungeon alignment and monster alignment. * return an integer in the range of 0-5. */ -static int +staticfn int align_shift(struct permonst *ptr) { static NEARDATA long oldmoves = 0L; /* != 1, starting value of moves */ @@ -1615,7 +1614,7 @@ align_shift(struct permonst *ptr) } /* return larger value if monster prefers the level temperature */ -static int +staticfn int temperature_shift(struct permonst *ptr) { if (gl.level.flags.temperature @@ -1710,7 +1709,7 @@ rndmonst_adj(int minadj, int maxadj) } /* decide whether it's ok to generate a candidate monster by mkclass() */ -static boolean +staticfn boolean mk_gen_ok(int mndx, unsigned mvflagsmask, unsigned genomask) { struct permonst *ptr = &mons[mndx]; diff --git a/src/mcastu.c b/src/mcastu.c index 88271b034..cd54ff7e2 100644 --- a/src/mcastu.c +++ b/src/mcastu.c @@ -35,17 +35,17 @@ enum mcast_cleric_spells { CLC_GEYSER }; -static void cursetxt(struct monst *, boolean); -static int choose_magic_spell(int); -static int choose_clerical_spell(int); -static int m_cure_self(struct monst *, int); -static void cast_wizard_spell(struct monst *, int, int); -static void cast_cleric_spell(struct monst *, int, int); -static boolean is_undirected_spell(unsigned int, int); -static boolean spell_would_be_useless(struct monst *, unsigned int, int); +staticfn void cursetxt(struct monst *, boolean); +staticfn int choose_magic_spell(int); +staticfn int choose_clerical_spell(int); +staticfn int m_cure_self(struct monst *, int); +staticfn void cast_wizard_spell(struct monst *, int, int); +staticfn void cast_cleric_spell(struct monst *, int, int); +staticfn boolean is_undirected_spell(unsigned int, int); +staticfn boolean spell_would_be_useless(struct monst *, unsigned int, int); /* feedback when frustrated monster couldn't cast a spell */ -static void +staticfn void cursetxt(struct monst *mtmp, boolean undirected) { if (canseemon(mtmp) && couldsee(mtmp->mx, mtmp->my)) { @@ -73,7 +73,7 @@ cursetxt(struct monst *mtmp, boolean undirected) /* convert a level-based random selection into a specific mage spell; inappropriate choices will be screened out by spell_would_be_useless() */ -static int +staticfn int choose_magic_spell(int spellval) { /* for 3.4.3 and earlier, val greater than 22 selected default spell */ @@ -126,7 +126,7 @@ choose_magic_spell(int spellval) } /* convert a level-based random selection into a specific cleric spell */ -static int +staticfn int choose_clerical_spell(int spellnum) { /* for 3.4.3 and earlier, num greater than 13 selected the default spell @@ -357,7 +357,7 @@ castmu( return ret; } -static int +staticfn int m_cure_self(struct monst *mtmp, int dmg) { if (mtmp->mhp < mtmp->mhpmax) { @@ -439,8 +439,7 @@ death_inflicted_by( If you modify either of these, be sure to change is_undirected_spell() and spell_would_be_useless(). */ -static -void +staticfn void cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum) { if (dmg == 0 && !is_undirected_spell(AD_SPEL, spellnum)) { @@ -618,7 +617,7 @@ cast_wizard_spell(struct monst *mtmp, int dmg, int spellnum) DISABLE_WARNING_FORMAT_NONLITERAL -static void +staticfn void cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum) { int orig_dmg = 0; @@ -865,7 +864,7 @@ cast_cleric_spell(struct monst *mtmp, int dmg, int spellnum) RESTORE_WARNING_FORMAT_NONLITERAL -static boolean +staticfn boolean is_undirected_spell(unsigned int adtyp, int spellnum) { if (adtyp == AD_SPEL) { @@ -893,7 +892,7 @@ is_undirected_spell(unsigned int adtyp, int spellnum) } /* Some spells are useless under some circumstances. */ -static boolean +staticfn boolean spell_would_be_useless(struct monst *mtmp, unsigned int adtyp, int spellnum) { /* Some spells don't require the player to really be there and can be cast diff --git a/src/mdlib.c b/src/mdlib.c index f2aae69a7..e9293150d 100644 --- a/src/mdlib.c +++ b/src/mdlib.c @@ -60,7 +60,7 @@ char *version_id_string(char *, size_t, const char *) NONNULL NONNULLPTRS; char *bannerc_string(char *, size_t, const char *) NONNULL NONNULLPTRS; int case_insensitive_comp(const char *, const char *) NONNULLPTRS; -static void make_version(void); +staticfn void make_version(void); #ifndef HAS_NO_MKSTEMP #ifdef _MSC_VER @@ -83,10 +83,10 @@ const char *do_runtime_info(int *) NO_NNARGS; void release_runtime_info(void); char *mdlib_version_string(char *, const char *) NONNULL NONNULLPTRS; -static void build_options(void); -static int count_and_validate_winopts(void); -static void opt_out_words(char *, int *) NONNULLPTRS; -static void build_savebones_compat_string(void); +staticfn void build_options(void); +staticfn int count_and_validate_winopts(void); +staticfn void opt_out_words(char *, int *) NONNULLPTRS; +staticfn void build_savebones_compat_string(void); static int idxopttext, done_runtime_opt_init_once = 0; #define MAXOPT 60 /* 3.7: currently 40 lines get inserted into opttext[] */ @@ -160,7 +160,7 @@ static struct win_information window_opts[] = { }; #if !defined(MAKEDEFS_C) -static int count_and_validate_soundlibopts(void); +staticfn int count_and_validate_soundlibopts(void); struct soundlib_information { enum soundlib_ids id; @@ -252,7 +252,7 @@ md_ignored_features(void) ); } -static void +staticfn void make_version(void) { int i; @@ -415,7 +415,7 @@ mkstemp(char *template) static char save_bones_compat_buf[BUFSZ]; -static void +staticfn void build_savebones_compat_string(void) { #ifdef VERSION_COMPATIBILITY @@ -633,7 +633,7 @@ static const char *const build_opts[] = { "and basic NetHack features" }; -static int +staticfn int count_and_validate_winopts(void) { int i, cnt = 0; @@ -658,7 +658,7 @@ count_and_validate_winopts(void) } #if !defined(MAKEDEFS_C) -static int +staticfn int count_and_validate_soundlibopts(void) { int i, cnt = 0; @@ -672,7 +672,7 @@ count_and_validate_soundlibopts(void) } #endif -static void +staticfn void opt_out_words( char *str, /* input, but modified during processing */ int *length_p) /* in/out */ @@ -700,7 +700,7 @@ opt_out_words( } } -static void +staticfn void build_options(void) { char buf[COLBUFSZ]; diff --git a/src/mhitm.c b/src/mhitm.c index 3e401f395..d74866296 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -9,21 +9,21 @@ static const char brief_feeling[] = "have a %s feeling for a moment, then it passes."; -static void noises(struct monst *, struct attack *); -static void pre_mm_attack(struct monst *, struct monst *); -static void missmm(struct monst *, struct monst *, struct attack *); -static int hitmm(struct monst *, struct monst *, struct attack *, +staticfn void noises(struct monst *, struct attack *); +staticfn void pre_mm_attack(struct monst *, struct monst *); +staticfn void missmm(struct monst *, struct monst *, struct attack *); +staticfn int hitmm(struct monst *, struct monst *, struct attack *, struct obj *, int); -static int gazemm(struct monst *, struct monst *, struct attack *); -static int gulpmm(struct monst *, struct monst *, struct attack *); -static int explmm(struct monst *, struct monst *, struct attack *); -static int mdamagem(struct monst *, struct monst *, struct attack *, +staticfn int gazemm(struct monst *, struct monst *, struct attack *); +staticfn int gulpmm(struct monst *, struct monst *, struct attack *); +staticfn int explmm(struct monst *, struct monst *, struct attack *); +staticfn int mdamagem(struct monst *, struct monst *, struct attack *, struct obj *, int); -static void mswingsm(struct monst *, struct monst *, struct obj *); -static int passivemm(struct monst *, struct monst *, boolean, int, +staticfn void mswingsm(struct monst *, struct monst *, struct obj *); +staticfn int passivemm(struct monst *, struct monst *, boolean, int, struct obj *); -static void +staticfn void noises(struct monst *magr, struct attack *mattk) { boolean farq = (mdistu(magr) > 15); @@ -37,7 +37,7 @@ noises(struct monst *magr, struct attack *mattk) } } -static void +staticfn void pre_mm_attack(struct monst *magr, struct monst *mdef) { boolean showit = FALSE; @@ -72,8 +72,7 @@ pre_mm_attack(struct monst *magr, struct monst *mdef) } /* feedback for when a monster-vs-monster attack misses */ -static -void +staticfn void missmm( struct monst *magr, /* attacker */ struct monst *mdef, /* defender */ @@ -631,7 +630,7 @@ failed_grab( } /* Returns the result of mdamagem(). */ -static int +staticfn int hitmm( struct monst *magr, struct monst *mdef, @@ -722,7 +721,7 @@ hitmm( } /* Returns the same values as mdamagem(). */ -static int +staticfn int gazemm(struct monst *magr, struct monst *mdef, struct attack *mattk) { char buf[BUFSZ]; @@ -835,7 +834,7 @@ engulf_target(struct monst *magr, struct monst *mdef) } /* Returns the same values as mattackm(). */ -static int +staticfn int gulpmm( struct monst *magr, struct monst *mdef, @@ -954,7 +953,7 @@ gulpmm( return status; } -static int +staticfn int explmm(struct monst *magr, struct monst *mdef, struct attack *mattk) { int result; @@ -1000,7 +999,7 @@ explmm(struct monst *magr, struct monst *mdef, struct attack *mattk) /* * See comment at top of mattackm(), for return values. */ -static int +staticfn int mdamagem( struct monst *magr, struct monst *mdef, @@ -1259,7 +1258,7 @@ rustm(struct monst *mdef, struct obj *obj) (void) erode_obj(obj, (char *) 0, dmgtyp, EF_GREASE | EF_VERBOSE); } -static void +staticfn void mswingsm( struct monst *magr, /* attacker */ struct monst *mdef, /* defender */ @@ -1279,7 +1278,7 @@ mswingsm( * Passive responses by defenders. Does not replicate responses already * handled above. Returns same values as mattackm. */ -static int +staticfn int passivemm( struct monst *magr, struct monst *mdef, diff --git a/src/mhitu.c b/src/mhitu.c index 055700e57..412ccc717 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -8,18 +8,18 @@ static NEARDATA struct obj *mon_currwep = (struct obj *) 0; -static void missmu(struct monst *, boolean, struct attack *); -static void mswings(struct monst *, struct obj *, boolean); -static void wildmiss(struct monst *, struct attack *); -static void calc_mattacku_vars(struct monst *, boolean *, boolean *, +staticfn void missmu(struct monst *, boolean, struct attack *); +staticfn void mswings(struct monst *, struct obj *, boolean); +staticfn void wildmiss(struct monst *, struct attack *); +staticfn void calc_mattacku_vars(struct monst *, boolean *, boolean *, boolean *, boolean *); -static void summonmu(struct monst *, boolean); -static int hitmu(struct monst *, struct attack *); -static int gulpmu(struct monst *, struct attack *); -static int explmu(struct monst *, struct attack *, boolean); -static void mayberem(struct monst *, const char *, struct obj *, +staticfn void summonmu(struct monst *, boolean); +staticfn int hitmu(struct monst *, struct attack *); +staticfn int gulpmu(struct monst *, struct attack *); +staticfn int explmu(struct monst *, struct attack *, boolean); +staticfn void mayberem(struct monst *, const char *, struct obj *, const char *); -static int passiveum(struct permonst *, struct monst *, struct attack *); +staticfn int passiveum(struct permonst *, struct monst *, struct attack *); #define ld() ((yyyymmdd((time_t) 0) - (getyear() * 10000L)) == 0xe5) @@ -80,7 +80,7 @@ hitmsg(struct monst *mtmp, struct attack *mattk) } /* monster missed you */ -static void +staticfn void missmu(struct monst *mtmp, boolean nearmiss, struct attack *mattk) { gh.hitmsg_mid = 0; @@ -125,7 +125,7 @@ mswings_verb( } /* monster swings obj */ -static void +staticfn void mswings( struct monst *mtmp, /* attacker */ struct obj *otemp, /* attacker's weapon */ @@ -167,7 +167,7 @@ u_slow_down(void) /* monster attacked wrong location due to monster blindness, hero invisibility, hero displacement, or hero being underwater */ -static void +staticfn void wildmiss(struct monst *mtmp, struct attack *mattk) { int compat; @@ -405,7 +405,7 @@ getmattk(struct monst *magr, struct monst *mdef, } /* calc some variables needed for mattacku() */ -static void +staticfn void calc_mattacku_vars( struct monst *mtmp, boolean *ranged, boolean *range2, @@ -877,7 +877,7 @@ mattacku(struct monst *mtmp) } /* monster summons help for its fight against hero */ -static void +staticfn void summonmu(struct monst *mtmp, boolean youseeit) { struct permonst *mdat = mtmp->data; @@ -1062,7 +1062,7 @@ magic_negation(struct monst *mon) * hitmu: monster hits you * returns MM_ flags */ -static int +staticfn int hitmu(struct monst *mtmp, struct attack *mattk) { struct permonst *mdat = mtmp->data; @@ -1206,7 +1206,7 @@ gulp_blnd_check(void) } /* monster swallows you, or damage if u.uswallow */ -static int +staticfn int gulpmu(struct monst *mtmp, struct attack *mattk) { struct trap *t = t_at(u.ux, u.uy); @@ -1498,7 +1498,7 @@ gulpmu(struct monst *mtmp, struct attack *mattk) } /* monster explodes in your face */ -static int +staticfn int explmu(struct monst *mtmp, struct attack *mattk, boolean ufound) { boolean kill_agr = TRUE; @@ -2195,7 +2195,7 @@ doseduce(struct monst *mon) } /* 'mon' tries to remove a piece of hero's armor */ -static void +staticfn void mayberem(struct monst *mon, const char *seducer, /* only used for alternate message */ struct obj *obj, const char *str) @@ -2248,7 +2248,7 @@ mayberem(struct monst *mon, * to know whether hero reverted in order to decide whether passive * damage applies. */ -static int +staticfn int passiveum( struct permonst *olduasmon, struct monst *mtmp, diff --git a/src/mklev.c b/src/mklev.c index 85ebd1fc4..888bdb6ac 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -9,40 +9,40 @@ /* croom->lx etc are schar (width <= int), so % arith ensures that */ /* conversion of result to int is reasonable */ -static boolean generate_stairs_room_good(struct mkroom *, int); -static struct mkroom *generate_stairs_find_room(void); -static void generate_stairs(void); -static void mkfount(struct mkroom *); -static boolean find_okay_roompos(struct mkroom *, coord *) NONNULLARG12; -static void mksink(struct mkroom *); -static void mkaltar(struct mkroom *); -static void mkgrave(struct mkroom *); -static void mkinvpos(coordxy, coordxy, int); -static int mkinvk_check_wall(coordxy x, coordxy y); -static void mk_knox_portal(coordxy, coordxy); -static void makevtele(void); -static void fill_ordinary_room(struct mkroom *, boolean) NONNULLARG1; -static void makelevel(void); -static boolean bydoor(coordxy, coordxy); -static void mktrap_victim(struct trap *); -static int traptype_rnd(unsigned); -static int traptype_roguelvl(void); -static struct mkroom *find_branch_room(coord *) NONNULLARG1; -static struct mkroom *pos_to_room(coordxy, coordxy); -static boolean cardinal_nextto_room(struct mkroom *, coordxy, coordxy); -static boolean place_niche(struct mkroom *, int *, coordxy *, coordxy *); -static void makeniche(int); -static void make_niches(void); -static int QSORTCALLBACK mkroom_cmp(const genericptr, const genericptr); -static void dosdoor(coordxy, coordxy, struct mkroom *, int); -static void join(int, int, boolean); -static void alloc_doors(void); -static void do_room_or_subroom(struct mkroom *, +staticfn boolean generate_stairs_room_good(struct mkroom *, int); +staticfn struct mkroom *generate_stairs_find_room(void); +staticfn void generate_stairs(void); +staticfn void mkfount(struct mkroom *); +staticfn boolean find_okay_roompos(struct mkroom *, coord *) NONNULLARG12; +staticfn void mksink(struct mkroom *); +staticfn void mkaltar(struct mkroom *); +staticfn void mkgrave(struct mkroom *); +staticfn void mkinvpos(coordxy, coordxy, int); +staticfn int mkinvk_check_wall(coordxy x, coordxy y); +staticfn void mk_knox_portal(coordxy, coordxy); +staticfn void makevtele(void); +staticfn void fill_ordinary_room(struct mkroom *, boolean) NONNULLARG1; +staticfn void makelevel(void); +staticfn boolean bydoor(coordxy, coordxy); +staticfn void mktrap_victim(struct trap *); +staticfn int traptype_rnd(unsigned); +staticfn int traptype_roguelvl(void); +staticfn struct mkroom *find_branch_room(coord *) NONNULLARG1; +staticfn struct mkroom *pos_to_room(coordxy, coordxy); +staticfn boolean cardinal_nextto_room(struct mkroom *, coordxy, coordxy); +staticfn boolean place_niche(struct mkroom *, int *, coordxy *, coordxy *); +staticfn void makeniche(int); +staticfn void make_niches(void); +staticfn int QSORTCALLBACK mkroom_cmp(const genericptr, const genericptr); +staticfn void dosdoor(coordxy, coordxy, struct mkroom *, int); +staticfn void join(int, int, boolean); +staticfn void alloc_doors(void); +staticfn void do_room_or_subroom(struct mkroom *, coordxy, coordxy, coordxy, coordxy, boolean, schar, boolean, boolean); -static void makerooms(void); -static boolean door_into_nonjoined(coordxy, coordxy); -static boolean finddpos(coord *, coordxy, coordxy, coordxy, coordxy); +staticfn void makerooms(void); +staticfn boolean door_into_nonjoined(coordxy, coordxy); +staticfn boolean finddpos(coord *, coordxy, coordxy, coordxy, coordxy); #define create_vault() create_room(-1, -1, 2, 2, -1, -1, VAULT, TRUE) #define init_vault() gv.vault_x = -1 @@ -50,7 +50,7 @@ static boolean finddpos(coord *, coordxy, coordxy, coordxy, coordxy); /* Args must be (const genericptr) so that qsort will always be happy. */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK mkroom_cmp(const genericptr vx, const genericptr vy) { const struct mkroom *x, *y; @@ -68,7 +68,7 @@ mkroom_cmp(const genericptr vx, const genericptr vy) * (such as shops) that will never randomly generate unwanted doors in order * to connect them up to other areas. */ -static boolean +staticfn boolean door_into_nonjoined(coordxy x, coordxy y) { coordxy tx, ty, i; @@ -88,7 +88,7 @@ door_into_nonjoined(coordxy x, coordxy y) return FALSE; } -static boolean +staticfn boolean finddpos(coord *cc, coordxy xl, coordxy yl, coordxy xh, coordxy yh) { coordxy x, y; @@ -140,7 +140,7 @@ sort_rooms(void) } } -static void +staticfn void do_room_or_subroom(struct mkroom *croom, coordxy lowx, coordxy lowy, coordxy hix, coordxy hiy, boolean lit, schar rtype, boolean special, boolean is_room) @@ -264,7 +264,7 @@ free_luathemes(enum lua_theme_group theme_group) } } -static void +staticfn void makerooms(void) { boolean tried_vault = FALSE; @@ -341,7 +341,7 @@ makerooms(void) } } -static void +staticfn void join(int a, int b, boolean nxcor) { coord cc, tt, org, dest; @@ -460,7 +460,7 @@ makecorridors(void) } /* (re)allocate space for gd.doors array */ -static void +staticfn void alloc_doors(void) { if (!gd.doors || gd.doorindex >= gd.doors_alloc) { @@ -518,7 +518,7 @@ add_door(coordxy x, coordxy y, struct mkroom *aroom) gd.doors[aroom->fdoor].y = y; } -static void +staticfn void dosdoor(coordxy x, coordxy y, struct mkroom *aroom, int type) { boolean shdoor = *in_rooms(x, y, SHOPBASE) ? TRUE : FALSE; @@ -584,7 +584,7 @@ dosdoor(coordxy x, coordxy y, struct mkroom *aroom, int type) /* is x,y location such that NEWS direction from it is inside aroom, excluding subrooms */ -static boolean +staticfn boolean cardinal_nextto_room(struct mkroom *aroom, coordxy x, coordxy y) { int rmno = (int) ((aroom - gr.rooms) + ROOMOFFSET); @@ -604,7 +604,7 @@ cardinal_nextto_room(struct mkroom *aroom, coordxy x, coordxy y) return FALSE; } -static boolean +staticfn boolean place_niche( struct mkroom *aroom, int *dy, @@ -643,7 +643,7 @@ static NEARDATA const char *trap_engravings[TRAPNUM] = { (char *) 0, (char *) 0, }; -static void +staticfn void makeniche(int trap_type) { struct mkroom *aroom; @@ -705,7 +705,7 @@ makeniche(int trap_type) } } -static void +staticfn void make_niches(void) { int ct = rnd((gn.nroom >> 1) + 1), dep = depth(&u.uz); @@ -724,7 +724,7 @@ make_niches(void) } } -static void +staticfn void makevtele(void) { makeniche(TELEP_TRAP); @@ -841,7 +841,7 @@ clear_level_structures(void) If bonus_items is TRUE, there may be an additional special item generated, depending on depth. */ -static void +staticfn void fill_ordinary_room( struct mkroom *croom, boolean bonus_items) @@ -1076,7 +1076,7 @@ fill_ordinary_room( } } -static void +staticfn void makelevel(void) { struct mkroom *croom; @@ -1467,7 +1467,7 @@ topologize(struct mkroom *croom) } /* Find an unused room for a branch location. */ -static struct mkroom * +staticfn struct mkroom * find_branch_room(coord *mp) { struct mkroom *croom = 0; @@ -1484,7 +1484,7 @@ find_branch_room(coord *mp) } /* Find the room for (x,y). Return null if not in a room. */ -static struct mkroom * +staticfn struct mkroom * pos_to_room(coordxy x, coordxy y) { int i; @@ -1559,7 +1559,7 @@ place_branch( gm.made_branch = TRUE; } -static boolean +staticfn boolean bydoor(coordxy x, coordxy y) { int typ; @@ -1624,7 +1624,7 @@ occupied(coordxy x, coordxy y) } /* generate a corpse and some items on top of a trap */ -static void +staticfn void mktrap_victim(struct trap *ttmp) { /* Object generated by the trap; initially NULL, stays NULL if @@ -1744,7 +1744,7 @@ mktrap_victim(struct trap *ttmp) } /* pick a random trap type, return NO_TRAP if "too hard" */ -static int +staticfn int traptype_rnd(unsigned mktrapflags) { unsigned lvl = level_difficulty(); @@ -1808,7 +1808,7 @@ traptype_rnd(unsigned mktrapflags) } /* random trap type for the Rogue level */ -static int +staticfn int traptype_roguelvl(void) { int kind; @@ -1999,7 +1999,7 @@ mkstairs( } /* is room a good one to generate up or down stairs in? */ -static boolean +staticfn boolean generate_stairs_room_good(struct mkroom *croom, int phase) { /* @@ -2017,7 +2017,7 @@ generate_stairs_room_good(struct mkroom *croom, int phase) } /* find a good room to generate an up or down stairs in */ -static struct mkroom * +staticfn struct mkroom * generate_stairs_find_room(void) { struct mkroom *croom; @@ -2048,7 +2048,7 @@ generate_stairs_find_room(void) /* construct stairs up and down within the same branch, up and down in different rooms if possible */ -static void +staticfn void generate_stairs(void) { /* generate_stairs_find_room() returns Null if nroom == 0, but that @@ -2083,7 +2083,7 @@ generate_stairs(void) } } -static void +staticfn void mkfount(struct mkroom *croom) { coord m; @@ -2101,7 +2101,7 @@ mkfount(struct mkroom *croom) gl.level.flags.nfountains++; } -static boolean +staticfn boolean find_okay_roompos(struct mkroom *croom, coord *crd) { int tryct = 0; @@ -2115,7 +2115,7 @@ find_okay_roompos(struct mkroom *croom, coord *crd) return TRUE; } -static void +staticfn void mksink(struct mkroom *croom) { coord m; @@ -2130,7 +2130,7 @@ mksink(struct mkroom *croom) gl.level.flags.nsinks++; } -static void +staticfn void mkaltar(struct mkroom *croom) { coord m; @@ -2151,7 +2151,7 @@ mkaltar(struct mkroom *croom) levl[m.x][m.y].altarmask = Align2amask(al); } -static void +staticfn void mkgrave(struct mkroom *croom) { coord m; @@ -2301,7 +2301,7 @@ mkinvokearea(void) /* Change level topology. Boulders in the vicinity are eliminated. * Temporarily overrides vision in the name of a nice effect. */ -static void +staticfn void mkinvpos(coordxy x, coordxy y, int dist) { struct trap *ttmp; @@ -2401,7 +2401,7 @@ mkinvpos(coordxy x, coordxy y, int dist) /* reduces clutter in mkinvokearea() while avoiding potential static analyzer confusion about using isok(x,y) to control access to levl[x][y] */ -static int +staticfn int mkinvk_check_wall(coordxy x, coordxy y) { unsigned ltyp; @@ -2422,7 +2422,7 @@ mkinvk_check_wall(coordxy x, coordxy y) * * Ludios will remain isolated until the branch is corrected by this function. */ -static void +staticfn void mk_knox_portal(coordxy x, coordxy y) { d_level *source; diff --git a/src/mkmap.c b/src/mkmap.c index 89a87ad22..4e7c057c1 100644 --- a/src/mkmap.c +++ b/src/mkmap.c @@ -8,19 +8,19 @@ #define HEIGHT (ROWNO - 1) #define WIDTH (COLNO - 2) -static void init_map(schar); -static void init_fill(schar, schar); -static schar get_map(int, int, schar); -static void pass_one(schar, schar); -static void pass_two(schar, schar); -static void pass_three(schar, schar); -static void join_map_cleanup(void); -static void join_map(schar, schar); -static void finish_map(schar, schar, boolean, boolean, boolean); -static void remove_room(unsigned); +staticfn void init_map(schar); +staticfn void init_fill(schar, schar); +staticfn schar get_map(int, int, schar); +staticfn void pass_one(schar, schar); +staticfn void pass_two(schar, schar); +staticfn void pass_three(schar, schar); +staticfn void join_map_cleanup(void); +staticfn void join_map(schar, schar); +staticfn void finish_map(schar, schar, boolean, boolean, boolean); +staticfn void remove_room(unsigned); void mkmap(lev_init *); -static void +staticfn void init_map(schar bg_typ) { int i, j; @@ -33,7 +33,7 @@ init_map(schar bg_typ) } } -static void +staticfn void init_fill(schar bg_typ, schar fg_typ) { int i, j; @@ -51,7 +51,7 @@ init_fill(schar bg_typ, schar fg_typ) } } -static schar +staticfn schar get_map(int col, int row, schar bg_typ) { if (col <= 0 || row < 0 || col > WIDTH || row >= HEIGHT) @@ -59,12 +59,12 @@ get_map(int col, int row, schar bg_typ) return levl[col][row].typ; } -static const int dirs[16] = { +staticfn const int dirs[16] = { -1, -1 /**/, -1, 0 /**/, -1, 1 /**/, 0, -1 /**/, 0, 1 /**/, 1, -1 /**/, 1, 0 /**/, 1, 1 }; -static void +staticfn void pass_one(schar bg_typ, schar fg_typ) { int i, j; @@ -97,7 +97,7 @@ pass_one(schar bg_typ, schar fg_typ) #define new_loc(i, j) *(gn.new_locations + ((j) * (WIDTH + 1)) + (i)) -static void +staticfn void pass_two(schar bg_typ, schar fg_typ) { int i, j; @@ -120,7 +120,7 @@ pass_two(schar bg_typ, schar fg_typ) levl[i][j].typ = new_loc(i, j); } -static void +staticfn void pass_three(schar bg_typ, schar fg_typ) { int i, j; @@ -243,7 +243,7 @@ flood_fill_rm( } /* join_map uses temporary rooms; clean up after it */ -static void +staticfn void join_map_cleanup(void) { coordxy x, y; @@ -255,7 +255,7 @@ join_map_cleanup(void) gr.rooms[gn.nroom].hx = gs.subrooms[gn.nsubroom].hx = -1; } -static void +staticfn void join_map(schar bg_typ, schar fg_typ) { struct mkroom *croom, *croom2; @@ -329,7 +329,7 @@ join_map(schar bg_typ, schar fg_typ) join_map_cleanup(); } -static void +staticfn void finish_map( schar fg_typ, schar bg_typ, @@ -408,7 +408,7 @@ remove_rooms(int lx, int ly, int hx, int hy) * level structure contents corresponding to roomno have already been reset. * Currently handles only the removal of rooms that have no subrooms. */ -static void +staticfn void remove_room(unsigned int roomno) { struct mkroom *croom = &gr.rooms[roomno]; diff --git a/src/mkmaze.c b/src/mkmaze.c index 92cb485d2..e151b56f8 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -6,27 +6,27 @@ #include "hack.h" #include "sp_lev.h" -static int iswall(coordxy, coordxy); -static int iswall_or_stone(coordxy, coordxy); -static boolean is_solid(coordxy, coordxy); -static int extend_spine(int[3][3], int, int, int); -static void wall_cleanup(coordxy, coordxy, coordxy, coordxy); -static boolean okay(coordxy, coordxy, coordxy); -static void maze0xy(coord *); -static boolean put_lregion_here(coordxy, coordxy, coordxy, coordxy, coordxy, +staticfn int iswall(coordxy, coordxy); +staticfn int iswall_or_stone(coordxy, coordxy); +staticfn boolean is_solid(coordxy, coordxy); +staticfn int extend_spine(int[3][3], int, int, int); +staticfn void wall_cleanup(coordxy, coordxy, coordxy, coordxy); +staticfn boolean okay(coordxy, coordxy, coordxy); +staticfn void maze0xy(coord *); +staticfn boolean put_lregion_here(coordxy, coordxy, coordxy, coordxy, coordxy, coordxy, xint16, boolean, d_level *); -static void baalz_fixup(void); -static void setup_waterlevel(void); -static void unsetup_waterlevel(void); -static void check_ransacked(const char *); -static void migr_booty_item(int, const char *); -static void migrate_orc(struct monst *, unsigned long); -static void shiny_orc_stuff(struct monst *); -static void stolen_booty(void); -static boolean maze_inbounds(coordxy, coordxy); -static void maze_remove_deadends(xint16); -static void populate_maze(void); -static boolean is_exclusion_zone(xint16, coordxy, coordxy); +staticfn void baalz_fixup(void); +staticfn void setup_waterlevel(void); +staticfn void unsetup_waterlevel(void); +staticfn void check_ransacked(const char *); +staticfn void migr_booty_item(int, const char *); +staticfn void migrate_orc(struct monst *, unsigned long); +staticfn void shiny_orc_stuff(struct monst *); +staticfn void stolen_booty(void); +staticfn boolean maze_inbounds(coordxy, coordxy); +staticfn void maze_remove_deadends(xint16); +staticfn void populate_maze(void); +staticfn boolean is_exclusion_zone(xint16, coordxy, coordxy); /* adjust a coordinate one step in the specified direction */ #define mz_move(X, Y, dir) \ @@ -40,7 +40,7 @@ static boolean is_exclusion_zone(xint16, coordxy, coordxy); } \ } while (0) -static int +staticfn int iswall(coordxy x, coordxy y) { int type; @@ -52,7 +52,7 @@ iswall(coordxy x, coordxy y) || type == SDOOR || type == IRONBARS); } -static int +staticfn int iswall_or_stone(coordxy x, coordxy y) { /* out of bounds = stone */ @@ -63,7 +63,7 @@ iswall_or_stone(coordxy x, coordxy y) } /* return TRUE if out of bounds, wall or rock */ -static boolean +staticfn boolean is_solid(coordxy x, coordxy y) { return (boolean) (!isok(x, y) || IS_STWALL(levl[x][y].typ)); @@ -148,7 +148,7 @@ set_levltyp_lit(coordxy x, coordxy y, schar typ, schar lit) * W x W This would extend a spine from x down. * . W W */ -static int +staticfn int extend_spine(int locale[3][3], int wall_there, int dx, int dy) { int spine, nx, ny; @@ -180,7 +180,7 @@ extend_spine(int locale[3][3], int wall_there, int dx, int dy) } /* Remove walls totally surrounded by stone */ -static void +staticfn void wall_cleanup(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { uchar type; @@ -279,7 +279,7 @@ wallification(coordxy x1, coordxy y1, coordxy x2, coordxy y2) fix_wall_spines(x1, y1, x2, y2); } -static boolean +staticfn boolean okay(coordxy x, coordxy y, coordxy dir) { mz_move(x, y, dir); @@ -291,7 +291,7 @@ okay(coordxy x, coordxy y, coordxy dir) } /* find random starting point for maze generation */ -static void +staticfn void maze0xy(coord *cc) { cc->x = 3 + 2 * rn2((gx.x_maze_max >> 1) - 1); @@ -299,7 +299,7 @@ maze0xy(coord *cc) return; } -static boolean +staticfn boolean is_exclusion_zone(xint16 type, coordxy x, coordxy y) { struct exclusion_zone *ez = ge.exclusion_zones; @@ -383,7 +383,7 @@ place_lregion( impossible("Couldn't place lregion type %d!", rtype); } -static boolean +staticfn boolean put_lregion_here( coordxy x, coordxy y, coordxy nlx, coordxy nly, coordxy nhx, coordxy nhy, @@ -443,7 +443,7 @@ put_lregion_here( /* fix up Baalzebub's lair, which depicts a level-sized beetle; its legs are walls within solid rock--regular wallification classifies them as superfluous and gets rid of them */ -static void +staticfn void baalz_fixup(void) { struct monst *mtmp; @@ -674,7 +674,7 @@ fixup_special(void) gn.num_lregions = 0; } -static void +staticfn void check_ransacked(const char *s) { /* this kludge only works as long as orctown is minetn-1 */ @@ -684,7 +684,7 @@ check_ransacked(const char *s) #define ORC_LEADER 1 static const char *const orcfruit[] = { "paddle cactus", "dwarven root" }; -static void +staticfn void migrate_orc(struct monst *mtmp, unsigned long mflags) { int nlev, max_depth, cur_depth; @@ -715,7 +715,7 @@ migrate_orc(struct monst *mtmp, unsigned long mflags) migrate_to_level(mtmp, ledger_no(&dest), MIGR_RANDOM, (coord *) 0); } -static void +staticfn void shiny_orc_stuff(struct monst *mtmp) { int gemprob, goldprob, otyp; @@ -747,7 +747,7 @@ shiny_orc_stuff(struct monst *mtmp) } } -static void +staticfn void migr_booty_item(int otyp, const char *gang) { struct obj *otmp; @@ -766,7 +766,7 @@ migr_booty_item(int otyp, const char *gang) } } -static void +staticfn void stolen_booty(void) { char *gang, gang_name[BUFSZ]; @@ -860,7 +860,7 @@ stolen_booty(void) #undef ORC_LEADER -static boolean +staticfn boolean maze_inbounds(coordxy x, coordxy y) { return (x >= 2 && y >= 2 @@ -870,7 +870,7 @@ maze_inbounds(coordxy x, coordxy y) && isok(x, y)); } -static void +staticfn void maze_remove_deadends(xint16 typ) { char dirok[4]; @@ -1064,7 +1064,7 @@ pick_vibrasquare_location(void) } /* add objects and monsters to random maze */ -static void +staticfn void populate_maze(void) { int i; @@ -1488,9 +1488,9 @@ fumaroles(void) #define gbxmax (gx.xmax - 1) #define gbymax (gy.ymax - 1) -static void set_wportal(void); -static void mk_bubble(coordxy, coordxy, int); -static void mv_bubble(struct bubble *, coordxy, coordxy, boolean); +staticfn void set_wportal(void); +staticfn void mk_bubble(coordxy, coordxy, int); +staticfn void mv_bubble(struct bubble *, coordxy, coordxy, boolean); void movebubbles(void) @@ -1748,7 +1748,7 @@ restore_waterlevel(NHFILE *nhfp) } } -static void +staticfn void set_wportal(void) { /* there better be only one magic portal on water level... */ @@ -1758,7 +1758,7 @@ set_wportal(void) impossible("set_wportal(): no portal!"); } -static void +staticfn void setup_waterlevel(void) { int typ, glyph; @@ -1806,7 +1806,7 @@ setup_waterlevel(void) mk_bubble(x, y, rn2(7)); } -static void +staticfn void unsetup_waterlevel(void) { struct bubble *b, *bb; @@ -1819,7 +1819,7 @@ unsetup_waterlevel(void) gb.bbubbles = ge.ebubbles = (struct bubble *) 0; } -static void +staticfn void mk_bubble(coordxy x, coordxy y, int n) { /* @@ -1882,7 +1882,7 @@ mk_bubble(coordxy x, coordxy y, int n) * in the immediate neighborhood of one, he/she may get sucked inside. * This property also makes leaving a bubble slightly difficult. */ -static void +staticfn void mv_bubble(struct bubble *b, coordxy dx, coordxy dy, boolean ini) { int i, j, colli = 0; diff --git a/src/mkobj.c b/src/mkobj.c index 422ef9d06..337b08126 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -5,27 +5,27 @@ #include "hack.h" -static boolean may_generate_eroded(struct obj *); -static void mkobj_erosions(struct obj *); -static void mkbox_cnts(struct obj *); -static unsigned nextoid(struct obj *, struct obj *); -static void mksobj_init(struct obj *, boolean); -static int item_on_ice(struct obj *); -static void shrinking_glob_gone(struct obj *); -static void obj_timer_checks(struct obj *, coordxy, coordxy, int); -static struct obj *save_mtraits(struct obj *, struct monst *); -static void objlist_sanity(struct obj *, int, const char *); -static void shop_obj_sanity(struct obj *, const char *); -static void mon_obj_sanity(struct monst *, const char *); -static void insane_obj_bits(struct obj *, struct monst *); -static boolean nomerge_exception(struct obj *); -static const char *where_name(struct obj *); -static void insane_object(struct obj *, const char *, const char *, +staticfn boolean may_generate_eroded(struct obj *); +staticfn void mkobj_erosions(struct obj *); +staticfn void mkbox_cnts(struct obj *); +staticfn unsigned nextoid(struct obj *, struct obj *); +staticfn void mksobj_init(struct obj *, boolean); +staticfn int item_on_ice(struct obj *); +staticfn void shrinking_glob_gone(struct obj *); +staticfn void obj_timer_checks(struct obj *, coordxy, coordxy, int); +staticfn struct obj *save_mtraits(struct obj *, struct monst *); +staticfn void objlist_sanity(struct obj *, int, const char *); +staticfn void shop_obj_sanity(struct obj *, const char *); +staticfn void mon_obj_sanity(struct monst *, const char *); +staticfn void insane_obj_bits(struct obj *, struct monst *); +staticfn boolean nomerge_exception(struct obj *); +staticfn const char *where_name(struct obj *); +staticfn void insane_object(struct obj *, const char *, const char *, struct monst *); -static void check_contained(struct obj *, const char *); -static void check_glob(struct obj *, const char *); -static void sanity_check_worn(struct obj *); -static void init_oextra(struct oextra *); +staticfn void check_contained(struct obj *, const char *); +staticfn void check_glob(struct obj *, const char *); +staticfn void sanity_check_worn(struct obj *); +staticfn void init_oextra(struct oextra *); struct icp { int iprob; /* probability of an item type */ @@ -75,7 +75,7 @@ static const struct icp hellprobs[] = { { 20, WEAPON_CLASS }, static const struct oextra zerooextra = DUMMY; -static void +staticfn void init_oextra(struct oextra *oex) { *oex = zerooextra; @@ -172,7 +172,7 @@ free_omailcmd(struct obj *otmp) } /* can object be generated eroded? */ -static boolean +staticfn boolean may_generate_eroded(struct obj *otmp) { /* initial hero inventory */ @@ -191,7 +191,7 @@ may_generate_eroded(struct obj *otmp) } /* random chance of applying erosions/grease to object */ -static void +staticfn void mkobj_erosions(struct obj *otmp) { if (may_generate_eroded(otmp)) { @@ -299,7 +299,7 @@ mkobj(int oclass, boolean artif) return mksobj(i, TRUE, artif); } -static void +staticfn void mkbox_cnts(struct obj *box) { int n; @@ -527,7 +527,7 @@ next_ident(void) /* when splitting a stack that has o_id-based shop prices, pick an o_id value for the new stack that will maintain the same price */ -static unsigned +staticfn unsigned nextoid(struct obj *oldobj, struct obj *newobj) { int olddif, newdif, trylimit = 256; /* limit of 4 suffices at present */ @@ -857,7 +857,7 @@ unknow_object(struct obj *obj) } /* do some initialization to newly created object; otyp must already be set */ -static void +staticfn void mksobj_init(struct obj *otmp, boolean artif) { int mndx, tryct; @@ -1374,7 +1374,7 @@ enum obj_on_ice { }; /* used by shrink_glob(); is 'item' or enclosing container on or under ice? */ -static int +staticfn int item_on_ice(struct obj *item) { struct obj *otmp; @@ -1604,7 +1604,7 @@ shrink_glob( } /* a glob has shrunk away to nothing; handle owornmask, then delete glob */ -static void +staticfn void shrinking_glob_gone(struct obj *obj) { xint16 owhere = obj->where; @@ -2075,7 +2075,7 @@ obj_attach_mid(struct obj *obj, unsigned int mid) return obj; } -static struct obj * +staticfn struct obj * save_mtraits(struct obj *obj, struct monst *mtmp) { if (mtmp->ispriest) @@ -2356,7 +2356,7 @@ peek_at_iced_corpse_age(struct obj *otmp) return retval; } -static void +staticfn void obj_timer_checks( struct obj *otmp, coordxy x, coordxy y, @@ -2897,7 +2897,7 @@ obj_sanity_check(void) } /* sanity check for objects on specified list (fobj, &c) */ -static void +staticfn void objlist_sanity(struct obj *objlist, int wheretype, const char *mesg) { struct obj *obj; @@ -2960,7 +2960,7 @@ objlist_sanity(struct obj *objlist, int wheretype, const char *mesg) /* check obj->unpaid and obj->no_charge for shop sanity; caller has verified that at least one of them is set */ -static void +staticfn void shop_obj_sanity(struct obj *obj, const char *mesg) { struct obj *otop; @@ -3030,7 +3030,7 @@ shop_obj_sanity(struct obj *obj, const char *mesg) } /* sanity check for objects carried by all monsters in specified list */ -static void +staticfn void mon_obj_sanity(struct monst *monlist, const char *mesg) { struct monst *mon; @@ -3063,7 +3063,7 @@ mon_obj_sanity(struct monst *monlist, const char *mesg) } } -static void +staticfn void insane_obj_bits(struct obj *obj, struct monst *mon) { unsigned o_in_use = obj->in_use, o_bypass = obj->bypass, @@ -3086,7 +3086,7 @@ insane_obj_bits(struct obj *obj, struct monst *mon) } /* does 'obj' use the 'nomerge' flag persistently? */ -static boolean +staticfn boolean nomerge_exception(struct obj *obj) { /* special prize objects for achievement tracking are set 'nomerge' @@ -3104,7 +3104,7 @@ static const char *const obj_state_names[NOBJ_STATES] = { "luafree" }; -static const char * +staticfn const char * where_name(struct obj *obj) { static char unknown[32]; /* big enough to handle rogue 64-bit int */ @@ -3122,7 +3122,7 @@ where_name(struct obj *obj) DISABLE_WARNING_FORMAT_NONLITERAL -static void +staticfn void insane_object( struct obj *obj, const char *fmt, @@ -3180,7 +3180,7 @@ init_dummyobj(struct obj *obj, short otyp, long oquan) } /* obj sanity check: check objects inside container */ -static void +staticfn void check_contained(struct obj *container, const char *mesg) { struct obj *obj; @@ -3226,7 +3226,7 @@ check_contained(struct obj *container, const char *mesg) } /* called when 'obj->globby' is set so we don't recheck it here */ -static void +staticfn void check_glob(struct obj *obj, const char *mesg) { #define LOWEST_GLOB GLOB_OF_GRAY_OOZE @@ -3253,7 +3253,7 @@ check_glob(struct obj *obj, const char *mesg) } /* check an object in hero's or monster's inventory which has worn mask set */ -static void +staticfn void sanity_check_worn(struct obj *obj) { #if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) diff --git a/src/mkroom.c b/src/mkroom.c index 5607ca953..0d256ab79 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -17,23 +17,23 @@ #include "hack.h" -static boolean isbig(struct mkroom *); -static struct mkroom *pick_room(boolean); -static void mkshop(void), mkzoo(int), mkswamp(void); -static void mk_zoo_thronemon(coordxy, coordxy); -static void mktemple(void); -static coord *shrine_pos(int); -static struct permonst *morguemon(void); -static struct permonst *squadmon(void); -static void save_room(NHFILE *, struct mkroom *); -static void rest_room(NHFILE *, struct mkroom *); -static boolean invalid_shop_shape(struct mkroom *sroom); +staticfn boolean isbig(struct mkroom *); +staticfn struct mkroom *pick_room(boolean); +staticfn void mkshop(void), mkzoo(int), mkswamp(void); +staticfn void mk_zoo_thronemon(coordxy, coordxy); +staticfn void mktemple(void); +staticfn coord *shrine_pos(int); +staticfn struct permonst *morguemon(void); +staticfn struct permonst *squadmon(void); +staticfn void save_room(NHFILE *, struct mkroom *); +staticfn void rest_room(NHFILE *, struct mkroom *); +staticfn boolean invalid_shop_shape(struct mkroom *sroom); #define sq(x) ((x) * (x)) extern const struct shclass shtypes[]; /* defined in shknam.c */ -static boolean +staticfn boolean isbig(struct mkroom *sroom) { int area = (sroom->hx - sroom->lx + 1) @@ -86,7 +86,7 @@ do_mkroom(int roomtype) } } -static void +staticfn void mkshop(void) { struct mkroom *sroom; @@ -211,7 +211,7 @@ mkshop(void) } /* pick an unused room, preferably with only one door */ -static struct mkroom * +staticfn struct mkroom * pick_room(boolean strict) { struct mkroom *sroom; @@ -235,7 +235,7 @@ pick_room(boolean strict) return (struct mkroom *) 0; } -static void +staticfn void mkzoo(int type) { struct mkroom *sroom; @@ -248,7 +248,7 @@ mkzoo(int type) } } -static void +staticfn void mk_zoo_thronemon(coordxy x, coordxy y) { int i = rnd(level_difficulty()); @@ -465,7 +465,7 @@ mkundead( gl.level.flags.graveyard = TRUE; /* reduced chance for undead corpse */ } -static struct permonst * +staticfn struct permonst * morguemon(void) { int i = rn2(100), hd = rn2(level_difficulty()); @@ -517,7 +517,7 @@ antholemon(void) : &mons[mtyp]); } -static void +staticfn void mkswamp(void) /* Michiel Huisjes & Fred de Wilde */ { struct mkroom *sroom; @@ -564,7 +564,7 @@ mkswamp(void) /* Michiel Huisjes & Fred de Wilde */ } } -static coord * +staticfn coord * shrine_pos(int roomno) { static coord buf; @@ -585,7 +585,7 @@ shrine_pos(int roomno) return &buf; } -static void +staticfn void mktemple(void) { struct mkroom *sroom; @@ -804,7 +804,7 @@ static const struct { { PM_CAPTAIN, 1 } }; /* return soldier types. */ -static struct permonst * +staticfn struct permonst * squadmon(void) { int sel_prob, i, cpro, mndx; @@ -831,7 +831,7 @@ squadmon(void) * save_room : A recursive function that saves a room and its subrooms * (if any). */ -static void +staticfn void save_room(NHFILE *nhfp, struct mkroom *r) { short i; @@ -863,7 +863,7 @@ save_rooms(NHFILE *nhfp) save_room(nhfp, &gr.rooms[i]); } -static void +staticfn void rest_room(NHFILE *nhfp, struct mkroom *r) { short i; @@ -1039,7 +1039,7 @@ cmap_to_type(int sym) * Note that the invalidity of the shape derives from the position of its door * already being chosen. It's quite possible that if the door were somewhere * else on the perimeter of this room, it would work fine as a shop.*/ -static boolean +staticfn boolean invalid_shop_shape(struct mkroom *sroom) { coordxy x, y; diff --git a/src/mon.c b/src/mon.c index f3bf3907a..037adf617 100644 --- a/src/mon.c +++ b/src/mon.c @@ -7,33 +7,33 @@ #include "mfndpos.h" #include -static void sanity_check_single_mon(struct monst *, boolean, const char *); -static struct obj *make_corpse(struct monst *, unsigned); -static int minliquid_core(struct monst *); -static void m_calcdistress(struct monst *); -static boolean monlineu(struct monst *, int, int); -static long mm_2way_aggression(struct monst *, struct monst *); -static long mm_aggression(struct monst *, struct monst *); -static long mm_displacement(struct monst *, struct monst *); -static void mon_leaving_level(struct monst *); -static void m_detach(struct monst *, struct permonst *, boolean); -static void set_mon_min_mhpmax(struct monst *, int); -static void lifesaved_monster(struct monst *); -static boolean vamprises(struct monst *); -static void logdeadmon(struct monst *, int); -static boolean ok_to_obliterate(struct monst *); -static void qst_guardians_respond(void); -static void peacefuls_respond(struct monst *); -static void m_restartcham(struct monst *); -static boolean restrap(struct monst *); -static int pick_animal(void); -static int pickvampshape(struct monst *); -static boolean isspecmon(struct monst *); -static boolean validspecmon(struct monst *, int); -static int wiz_force_cham_form(struct monst *); -static struct permonst *accept_newcham_form(struct monst *, int); -static void kill_eggs(struct obj *) NO_NNARGS; -static void pacify_guard(struct monst *); +staticfn void sanity_check_single_mon(struct monst *, boolean, const char *); +staticfn struct obj *make_corpse(struct monst *, unsigned); +staticfn int minliquid_core(struct monst *); +staticfn void m_calcdistress(struct monst *); +staticfn boolean monlineu(struct monst *, int, int); +staticfn long mm_2way_aggression(struct monst *, struct monst *); +staticfn long mm_aggression(struct monst *, struct monst *); +staticfn long mm_displacement(struct monst *, struct monst *); +staticfn void mon_leaving_level(struct monst *); +staticfn void m_detach(struct monst *, struct permonst *, boolean); +staticfn void set_mon_min_mhpmax(struct monst *, int); +staticfn void lifesaved_monster(struct monst *); +staticfn boolean vamprises(struct monst *); +staticfn void logdeadmon(struct monst *, int); +staticfn boolean ok_to_obliterate(struct monst *); +staticfn void qst_guardians_respond(void); +staticfn void peacefuls_respond(struct monst *); +staticfn void m_restartcham(struct monst *); +staticfn boolean restrap(struct monst *); +staticfn int pick_animal(void); +staticfn int pickvampshape(struct monst *); +staticfn boolean isspecmon(struct monst *); +staticfn boolean validspecmon(struct monst *, int); +staticfn int wiz_force_cham_form(struct monst *); +staticfn struct permonst *accept_newcham_form(struct monst *, int); +staticfn void kill_eggs(struct obj *) NO_NNARGS; +staticfn void pacify_guard(struct monst *); extern const struct shclass shtypes[]; /* defined in shknam.c */ @@ -51,7 +51,7 @@ const char *warnings[] = { #endif /* 0 */ -static void +staticfn void sanity_check_single_mon( struct monst *mtmp, boolean chk_geno, @@ -515,7 +515,7 @@ pm_to_cham(int mndx) * G_NOCORPSE set in order to prevent wishing for one, finding tins of one, * etc.... */ -static struct obj * +staticfn struct obj * make_corpse(struct monst *mtmp, unsigned int corpseflags) { struct permonst *mdat = mtmp->data; @@ -746,7 +746,7 @@ minliquid(struct monst *mtmp) } /* guts of minliquid() */ -static int +staticfn int minliquid_core(struct monst *mtmp) { boolean inpool, inlava, infountain; @@ -944,7 +944,7 @@ mcalcdistress(void) iter_mons(m_calcdistress); } -static void +staticfn void m_calcdistress(struct monst *mtmp) { /* must check non-moving monsters once/turn in case they managed @@ -1824,7 +1824,7 @@ can_carry(struct monst *mtmp, struct obj *otmp) } /* is in direct line with where 'mon' thinks hero is? */ -static boolean +staticfn boolean monlineu(struct monst *mon, int nx, int ny) { return online2(nx, ny, mon->mux, mon->muy); @@ -2151,7 +2151,7 @@ mfndpos( /* Part of mm_aggression that represents two-way aggression. To avoid having to code each case twice, this function contains those cases that ought to happen twice, and mm_aggression will call it twice. */ -static long +staticfn long mm_2way_aggression(struct monst *magr, struct monst *mdef) { /* zombies vs things that can be zombified */ @@ -2166,7 +2166,7 @@ mm_2way_aggression(struct monst *magr, struct monst *mdef) in the absence of Conflict. There is no provision for targeting other monsters; just hand to hand fighting when they happen to be next to each other. */ -static long +staticfn long mm_aggression( struct monst *magr, /* monster that is currently deciding where to move */ struct monst *mdef) /* another monster which is next to it */ @@ -2189,7 +2189,7 @@ mm_aggression( } /* Monster displacing another monster out of the way */ -static long +staticfn long mm_displacement( struct monst *magr, /* monster that is currently deciding where to move */ struct monst *mdef) /* another monster which is next to it */ @@ -2426,7 +2426,7 @@ dealloc_monst(struct monst *mon) /* 'mon' is being removed from level due to migration [relmon from keepdogs or migrate_to_level] or due to death [m_detach from mondead or mongone] */ -static void +staticfn void mon_leaving_level(struct monst *mon) { coordxy mx = mon->mx, my = mon->my; @@ -2464,7 +2464,7 @@ mon_leaving_level(struct monst *mon) } /* 'mtmp' is going away; remove effects of mtmp from other data structures */ -static void +staticfn void m_detach( struct monst *mtmp, struct permonst *mptr, /* reflects mtmp->data _prior_ to mtmp's death */ @@ -2536,7 +2536,7 @@ m_detach( /* give a life-saved monster a reasonable mhpmax value in case it has been the victim of excessive life draining */ -static void +staticfn void set_mon_min_mhpmax( struct monst *mon, int minimum_mhpmax) /* monster life-saving has traditionally used 10 */ @@ -2567,7 +2567,7 @@ mlifesaver(struct monst *mon) return (struct obj *) 0; } -static void +staticfn void lifesaved_monster(struct monst *mtmp) { boolean surviver; @@ -2619,7 +2619,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL /* when a shape-shifted vampire is killed, it reverts to base form instead of dying; moved into separate routine to unclutter mondead() */ -static boolean +staticfn boolean vamprises(struct monst *mtmp) { int mndx = mtmp->cham; @@ -2694,7 +2694,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL /* when a mon has died, maybe record an achievement or issue livelog message; moved into separate routine to unclutter mondead() */ -static void +staticfn void logdeadmon(struct monst *mtmp, int mndx) { int howmany = gm.mvitals[mndx].died; @@ -3528,7 +3528,7 @@ migrate_mon( migrate_to_level(mtmp, target_lev, xyloc, (coord *) 0); } -static boolean +staticfn boolean ok_to_obliterate(struct monst *mtmp) { /* @@ -3786,7 +3786,7 @@ m_respond(struct monst *mtmp) } /* how quest guardians respond when you attack the quest leader */ -static void +staticfn void qst_guardians_respond(void) { struct monst *mon; @@ -3814,7 +3814,7 @@ qst_guardians_respond(void) } /* how other peacefuls react when you attack monster */ -static void +staticfn void peacefuls_respond(struct monst *mtmp) { struct monst *mon; @@ -4226,7 +4226,7 @@ rescham(void) iter_mons(normal_shape); } -static void +staticfn void m_restartcham(struct monst *mtmp) { if (!mtmp->mcan) @@ -4261,7 +4261,7 @@ restore_cham(struct monst *mon) } /* unwatched hiders may hide again; if so, returns True */ -static boolean +staticfn boolean restrap(struct monst *mtmp) { struct trap *t; @@ -4443,7 +4443,7 @@ mon_animal_list(boolean construct) } } -static int +staticfn int pick_animal(void) { int res; @@ -4528,7 +4528,7 @@ decide_to_shapeshift(struct monst *mon, int shiftflags) } } -static int +staticfn int pickvampshape(struct monst *mon) { int mndx = mon->cham, wolfchance = 10; @@ -4565,7 +4565,7 @@ pickvampshape(struct monst *mon) } /* nonshapechangers who warrant special polymorph handling */ -static boolean +staticfn boolean isspecmon(struct monst *mon) { return (mon->isshk || mon->ispriest || mon->isgd @@ -4575,7 +4575,7 @@ isspecmon(struct monst *mon) /* restrict certain special monsters (shopkeepers, aligned priests, vault guards) to forms that allow them to behave sensibly (catching gold, speaking?) so that they don't need too much extra code */ -static boolean +staticfn boolean validspecmon(struct monst *mon, int mndx) { if (mndx == NON_PM) @@ -4659,7 +4659,7 @@ validvamp(struct monst *mon, int *mndx_p, int monclass) return (boolean) (*mndx_p != NON_PM); } -static int +staticfn int wiz_force_cham_form(struct monst *mon) { char pprompt[BUFSZ], parttwo[QBUFSZ], buf[BUFSZ], prevbuf[BUFSZ]; @@ -4810,7 +4810,7 @@ select_newcham_form(struct monst *mon) } /* this used to be inline within newcham() but monpolycontrol needs it too */ -static struct permonst * +staticfn struct permonst * accept_newcham_form(struct monst *mon, int mndx) { struct permonst *mdat; @@ -5168,7 +5168,7 @@ dead_species(int m_idx, boolean egg) } /* kill off any eggs of genocided monsters */ -static void +staticfn void kill_eggs(struct obj *obj_list) { struct obj *otmp; @@ -5325,7 +5325,7 @@ angry_guards(boolean silent) return FALSE; } -static void +staticfn void pacify_guard(struct monst *mtmp) { if (is_watch(mtmp->data)) diff --git a/src/mondata.c b/src/mondata.c index 52a2032cc..dd324b302 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -401,7 +401,7 @@ mstrength(struct permonst *ptr) } /* returns True if monster can attack at range */ -static boolean +staticfn boolean mstrength_ranged_attk(struct permonst *ptr) { int i, j; diff --git a/src/monmove.c b/src/monmove.c index 2c0d62f14..b0a25e3ae 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -7,29 +7,29 @@ #include "mfndpos.h" #include "artifact.h" -static void msg_mon_movement(struct monst *, coordxy, coordxy) NONNULLARG1; -static void watch_on_duty(struct monst *); -static int disturb(struct monst *); -static void release_hero(struct monst *); -static void distfleeck(struct monst *, int *, int *, int *); -static int m_arrival(struct monst *); -static void mind_blast(struct monst *); -static boolean holds_up_web(coordxy, coordxy); -static int count_webbing_walls(coordxy, coordxy); -static boolean soko_allow_web(struct monst *); -static boolean m_search_items(struct monst *, coordxy *, coordxy *, int *, +staticfn void msg_mon_movement(struct monst *, coordxy, coordxy) NONNULLARG1; +staticfn void watch_on_duty(struct monst *); +staticfn int disturb(struct monst *); +staticfn void release_hero(struct monst *); +staticfn void distfleeck(struct monst *, int *, int *, int *); +staticfn int m_arrival(struct monst *); +staticfn void mind_blast(struct monst *); +staticfn boolean holds_up_web(coordxy, coordxy); +staticfn int count_webbing_walls(coordxy, coordxy); +staticfn boolean soko_allow_web(struct monst *); +staticfn boolean m_search_items(struct monst *, coordxy *, coordxy *, int *, int *); -static int postmov(struct monst *, struct permonst *, coordxy, coordxy, int, - boolean, boolean, boolean, boolean); -static boolean leppie_avoidance(struct monst *); -static void leppie_stash(struct monst *); -static boolean m_balks_at_approaching(struct monst *); -static boolean stuff_prevents_passage(struct monst *); -static int vamp_shift(struct monst *, struct permonst *, boolean); -static void maybe_spin_web(struct monst *); +staticfn int postmov(struct monst *, struct permonst *, coordxy, coordxy, int, + boolean, boolean, boolean, boolean); +staticfn boolean leppie_avoidance(struct monst *); +staticfn void leppie_stash(struct monst *); +staticfn boolean m_balks_at_approaching(struct monst *); +staticfn boolean stuff_prevents_passage(struct monst *); +staticfn int vamp_shift(struct monst *, struct permonst *, boolean); +staticfn void maybe_spin_web(struct monst *); /* a11y: give a message when monster moved */ -static void +staticfn void msg_mon_movement(struct monst *mtmp, coordxy omx, coordxy omy) { if (a11y.mon_movement && canspotmon(mtmp) && mtmp->mspotted) { @@ -158,7 +158,7 @@ m_break_boulder(struct monst *mtmp, coordxy x, coordxy y) } } -static void +staticfn void watch_on_duty(struct monst *mtmp) { coordxy x, y; @@ -299,7 +299,7 @@ mon_regen(struct monst *mon, boolean digest_meal) * Possibly awaken the given monster. Return a 1 if the monster has been * jolted awake. */ -static int +staticfn int disturb(struct monst *mtmp) { /* @@ -334,7 +334,7 @@ disturb(struct monst *mtmp) } /* ungrab/expel held/swallowed hero */ -static void +staticfn void release_hero(struct monst *mon) { if (mon == u.ustuck) { @@ -478,7 +478,7 @@ monflee( mon_track_clear(mtmp); } -static void +staticfn void distfleeck( struct monst *mtmp, int *inrange, int *nearby, int *scared) /* output */ @@ -519,7 +519,7 @@ distfleeck( /* perform a special one-time action for a monster; returns -1 if nothing special happened, 0 if monster uses up its turn, 1 if monster is killed */ -static int +staticfn int m_arrival(struct monst *mon) { mon->mstrategy &= ~STRAT_ARRIVE; /* always reset */ @@ -528,7 +528,7 @@ m_arrival(struct monst *mon) } /* a mind flayer unleashes a mind blast */ -static void +staticfn void mind_blast(struct monst *mtmp) { struct monst *m2, *nmon = (struct monst *) 0; @@ -1052,7 +1052,7 @@ m_digweapon_check( } /* does leprechaun want to avoid the hero? */ -static boolean +staticfn boolean leppie_avoidance(struct monst *mtmp) { struct obj *lepgold, *ygold; @@ -1067,7 +1067,7 @@ leppie_avoidance(struct monst *mtmp) } /* unseen leprechaun with gold might stash it */ -static void +staticfn void leppie_stash(struct monst *mtmp) { struct obj *gold; @@ -1088,7 +1088,7 @@ leppie_stash(struct monst *mtmp) } /* does monster want to avoid you? */ -static boolean +staticfn boolean m_balks_at_approaching(struct monst *mtmp) { /* peaceful, far away, or can't see you */ @@ -1115,7 +1115,7 @@ m_balks_at_approaching(struct monst *mtmp) return FALSE; } -static boolean +staticfn boolean holds_up_web(coordxy x, coordxy y) { stairway *sway; @@ -1132,7 +1132,7 @@ holds_up_web(coordxy x, coordxy y) /* returns the number of walls in the four cardinal directions that could hold up a web */ -static int +staticfn int count_webbing_walls(coordxy x, coordxy y) { return (holds_up_web(x, y - 1) + holds_up_web(x + 1, y) @@ -1140,7 +1140,7 @@ count_webbing_walls(coordxy x, coordxy y) } /* reject webs which interfere with solving Sokoban */ -static boolean +staticfn boolean soko_allow_web(struct monst *mon) { stairway *stway; @@ -1157,7 +1157,7 @@ soko_allow_web(struct monst *mon) } /* monster might spin a web */ -static void +staticfn void maybe_spin_web(struct monst *mtmp) { if (webmaker(mtmp->data) @@ -1188,7 +1188,7 @@ maybe_spin_web(struct monst *mtmp) #define SQSRCHRADIUS 5 /* monster looks for items it wants nearby */ -static boolean +staticfn boolean m_search_items( struct monst *mtmp, coordxy *ggx, coordxy *ggy, @@ -1313,7 +1313,7 @@ finish_search: #undef SQSRCHRADIUS -static int +staticfn int postmov( struct monst *mtmp, struct permonst *ptr, @@ -2156,7 +2156,7 @@ undesirable_disp( * Inventory prevents passage under door. * Used by can_ooze() and can_fog(). */ -static boolean +staticfn boolean stuff_prevents_passage(struct monst *mtmp) { struct obj *chain, *obj; @@ -2211,7 +2211,7 @@ can_fog(struct monst *mtmp) return FALSE; } -static int +staticfn int vamp_shift( struct monst *mon, struct permonst *ptr, diff --git a/src/mplayer.c b/src/mplayer.c index 6e76e8b08..a422de3ca 100644 --- a/src/mplayer.c +++ b/src/mplayer.c @@ -4,9 +4,9 @@ #include "hack.h" -static const char *dev_name(void); -static void get_mplname(struct monst *, char *); -static void mk_mplayer_armor(struct monst *, short); +staticfn const char *dev_name(void); +staticfn void get_mplname(struct monst *, char *); +staticfn void mk_mplayer_armor(struct monst *, short); /* These are the names of those who * contributed to the development of NetHack 3.2/3.3/3.4/3.6. @@ -40,7 +40,7 @@ static const char *const developers[] = { }; /* return a randomly chosen developer name */ -static const char * +staticfn const char * dev_name(void) { int i, m = 0, n = SIZE(developers); @@ -68,7 +68,7 @@ dev_name(void) return (developers[i]); } -static void +staticfn void get_mplname(struct monst* mtmp, char *nam) { boolean fmlkind = is_female(mtmp->data); @@ -91,7 +91,7 @@ get_mplname(struct monst* mtmp, char *nam) (boolean) mtmp->female)); } -static void +staticfn void mk_mplayer_armor(struct monst *mon, short typ) { struct obj *obj; diff --git a/src/mthrowu.c b/src/mthrowu.c index 09b67def5..b774fd9c0 100644 --- a/src/mthrowu.c +++ b/src/mthrowu.c @@ -5,13 +5,13 @@ #include "hack.h" -static int monmulti(struct monst *, struct obj *, struct obj *); -static void monshoot(struct monst *, struct obj *, struct obj *); -static boolean ucatchgem(struct obj *, struct monst *); -static const char *breathwep_name(int); -static boolean drop_throw(struct obj *, boolean, coordxy, coordxy); -static boolean blocking_terrain(coordxy, coordxy); -static int m_lined_up(struct monst *, struct monst *) NONNULLARG12; +staticfn int monmulti(struct monst *, struct obj *, struct obj *); +staticfn void monshoot(struct monst *, struct obj *, struct obj *); +staticfn boolean ucatchgem(struct obj *, struct monst *); +staticfn const char *breathwep_name(int); +staticfn boolean drop_throw(struct obj *, boolean, coordxy, coordxy); +staticfn boolean blocking_terrain(coordxy, coordxy); +staticfn int m_lined_up(struct monst *, struct monst *) NONNULLARG12; #define URETREATING(x, y) \ (distmin(u.ux, u.uy, x, y) > distmin(u.ux0, u.uy0, x, y)) @@ -156,7 +156,7 @@ thitu( * dothrow.c (for consistency). --KAA * Returns FALSE if object still exists (not destroyed). */ -static boolean +staticfn boolean drop_throw( struct obj *obj, boolean ohit, @@ -195,7 +195,7 @@ drop_throw( /* calculate multishot volley count for mtmp throwing otmp (if not ammo) or shooting otmp with mwep (if otmp is ammo and mwep appropriate launcher) */ -static int +staticfn int monmulti(struct monst *mtmp, struct obj *otmp, struct obj *mwep) { int multishot = 1; @@ -254,7 +254,7 @@ monmulti(struct monst *mtmp, struct obj *otmp, struct obj *mwep) } /* mtmp throws otmp, or shoots otmp with mwep, at hero or at monster mtarg */ -static void +staticfn void monshoot(struct monst *mtmp, struct obj *otmp, struct obj *mwep) { struct monst *mtarg = gm.mtarget; @@ -498,7 +498,7 @@ ohitmon( } /* hero catches gem thrown by mon iff poly'd into unicorn; might drop it */ -static boolean +staticfn boolean ucatchgem( struct obj *gem, /* caller has verified gem->oclass */ struct monst *mon) @@ -888,7 +888,7 @@ spitmm(struct monst *mtmp, struct attack *mattk, struct monst *mtarg) /* Return the name of a breath weapon. If the player is hallucinating, return * a silly name instead. * typ is AD_MAGM, AD_FIRE, etc */ -static const char * +staticfn const char * breathwep_name(int typ) { if (Hallucination) @@ -1078,7 +1078,7 @@ breamu(struct monst *mtmp, struct attack *mattk) } /* return TRUE if terrain at x,y blocks linedup checks */ -static boolean +staticfn boolean blocking_terrain(coordxy x, coordxy y) { if (!isok(x, y) || IS_ROCK(levl[x][y].typ) || closed_door(x, y) @@ -1172,7 +1172,7 @@ linedup( return FALSE; } -static int +staticfn int m_lined_up(struct monst *mtarg, struct monst *mtmp) { boolean utarget = (mtarg == &gy.youmonst); diff --git a/src/muse.c b/src/muse.c index 5f5edc250..638dd4b9c 100644 --- a/src/muse.c +++ b/src/muse.c @@ -14,43 +14,43 @@ * are confused don't know not to read scrolls, etc.... */ -static int precheck(struct monst *, struct obj *); -static void mzapwand(struct monst *, struct obj *, boolean); -static void mplayhorn(struct monst *, struct obj *, boolean); -static void mreadmsg(struct monst *, struct obj *); -static void mquaffmsg(struct monst *, struct obj *); -static boolean m_use_healing(struct monst *); -static boolean m_sees_sleepy_soldier(struct monst *); -static void m_tele(struct monst *, boolean, boolean, int); -static boolean m_next2m(struct monst *); -static void reveal_trap(struct trap *, boolean); -static boolean linedup_chk_corpse(coordxy, coordxy); -static void m_use_undead_turning(struct monst *, struct obj *); -static boolean hero_behind_chokepoint(struct monst *); -static boolean mon_has_friends(struct monst *); -static int mbhitm(struct monst *, struct obj *); -static void mbhit(struct monst *, int, int (*)(MONST_P, OBJ_P), +staticfn int precheck(struct monst *, struct obj *); +staticfn void mzapwand(struct monst *, struct obj *, boolean); +staticfn void mplayhorn(struct monst *, struct obj *, boolean); +staticfn void mreadmsg(struct monst *, struct obj *); +staticfn void mquaffmsg(struct monst *, struct obj *); +staticfn boolean m_use_healing(struct monst *); +staticfn boolean m_sees_sleepy_soldier(struct monst *); +staticfn void m_tele(struct monst *, boolean, boolean, int); +staticfn boolean m_next2m(struct monst *); +staticfn void reveal_trap(struct trap *, boolean); +staticfn boolean linedup_chk_corpse(coordxy, coordxy); +staticfn void m_use_undead_turning(struct monst *, struct obj *); +staticfn boolean hero_behind_chokepoint(struct monst *); +staticfn boolean mon_has_friends(struct monst *); +staticfn int mbhitm(struct monst *, struct obj *); +staticfn void mbhit(struct monst *, int, int (*)(MONST_P, OBJ_P), int (*)(OBJ_P, OBJ_P), struct obj *); -static struct permonst *muse_newcham_mon(struct monst *); -static int mloot_container(struct monst *mon, struct obj *, boolean); -static void you_aggravate(struct monst *); +staticfn struct permonst *muse_newcham_mon(struct monst *); +staticfn int mloot_container(struct monst *mon, struct obj *, boolean); +staticfn void you_aggravate(struct monst *); #if 0 static boolean necrophiliac(struct obj *, boolean); #endif -static void mon_consume_unstone(struct monst *, struct obj *, boolean, +staticfn void mon_consume_unstone(struct monst *, struct obj *, boolean, boolean); -static boolean cures_stoning(struct monst *, struct obj *, boolean); -static boolean mcould_eat_tin(struct monst *); -static boolean muse_unslime(struct monst *, struct obj *, struct trap *, +staticfn boolean cures_stoning(struct monst *, struct obj *, boolean); +staticfn boolean mcould_eat_tin(struct monst *); +staticfn boolean muse_unslime(struct monst *, struct obj *, struct trap *, boolean); -static int cures_sliming(struct monst *, struct obj *); -static boolean green_mon(struct monst *); +staticfn int cures_sliming(struct monst *, struct obj *); +staticfn boolean green_mon(struct monst *); /* Any preliminary checks which may result in the monster being unable to use * the item. Returns 0 if nothing happened, 2 if the monster can't do * anything (i.e. it teleported) and 1 if it's dead. */ -static int +staticfn int precheck(struct monst *mon, struct obj *obj) { boolean vis; @@ -155,7 +155,7 @@ precheck(struct monst *mon, struct obj *obj) /* when a monster zaps a wand give a message, deduct a charge, and if it isn't directly seen, remove hero's memory of the number of charges */ -static void +staticfn void mzapwand( struct monst *mtmp, struct obj *otmp, @@ -185,7 +185,7 @@ mzapwand( } /* similar to mzapwand() but for magical horns (only instrument mons play) */ -static void +staticfn void mplayhorn( struct monst *mtmp, struct obj *otmp, @@ -228,7 +228,7 @@ mplayhorn( /* see or hear a monster reading a scroll; when scroll hasn't been seen, its label is revealed unless hero is deaf */ -static void +staticfn void mreadmsg(struct monst *mtmp, struct obj *otmp) { char onambuf[BUFSZ]; @@ -276,7 +276,7 @@ mreadmsg(struct monst *mtmp, struct obj *otmp) vismon ? mon_nam(mtmp) : mhe(mtmp)); } -static void +staticfn void mquaffmsg(struct monst *mtmp, struct obj *otmp) { if (canseemon(mtmp)) { @@ -320,7 +320,7 @@ mquaffmsg(struct monst *mtmp, struct obj *otmp) * that if you polymorph into one you teleport at will. */ -static boolean +staticfn boolean m_use_healing(struct monst *mtmp) { struct obj *obj; @@ -344,7 +344,7 @@ m_use_healing(struct monst *mtmp) } /* return TRUE if monster mtmp can see at least one sleeping soldier */ -static boolean +staticfn boolean m_sees_sleepy_soldier(struct monst *mtmp) { coordxy x = mtmp->mx, y = mtmp->my; @@ -367,7 +367,7 @@ m_sees_sleepy_soldier(struct monst *mtmp) return FALSE; } -static void +staticfn void m_tele( struct monst *mtmp, /* monst that might be teleported */ boolean vismon, /* can see it */ @@ -403,7 +403,7 @@ m_tele( * Called from find_defensive() where it is limited to Is_knox() * only, otherwise you could trap two monsters next to each other * in a boulder fort, and they would be happy to stay in there. */ -static boolean +staticfn boolean m_next2m(struct monst *mtmp) { coordxy x, y; @@ -740,7 +740,7 @@ find_defensive(struct monst *mtmp, boolean tryescape) accessible (trap doors and teleporters inside niches are located at secret corridor locations; convert such into normal corridor even if hero doesn't see it happen) */ -static void +staticfn void reveal_trap(struct trap *t, boolean seeit) { struct rm *lev = &levl[t->tx][t->ty]; @@ -1241,13 +1241,13 @@ rnd_defensive_item(struct monst *mtmp) /*#define MUSE_WAN_UNDEAD_TURNING 20*/ /* also a defensive item so don't * redefine; nonconsecutive value is ok */ -static boolean +staticfn boolean linedup_chk_corpse(coordxy x, coordxy y) { return (sobj_at(CORPSE, x, y) != 0); } -static void +staticfn void m_use_undead_turning(struct monst *mtmp, struct obj *obj) { coordxy ax = u.ux + sgn(mtmp->mux - mtmp->mx) * 3, @@ -1293,7 +1293,7 @@ m_use_undead_turning(struct monst *mtmp, struct obj *obj) } /* from monster's point of view, is hero behind a chokepoint? */ -static boolean +staticfn boolean hero_behind_chokepoint(struct monst *mtmp) { coordxy dx = sgn(mtmp->mx - mtmp->mux); @@ -1320,7 +1320,7 @@ hero_behind_chokepoint(struct monst *mtmp) } /* hostile monster has another hostile next to it */ -static boolean +staticfn boolean mon_has_friends(struct monst *mtmp) { coordxy dx, dy; @@ -1514,7 +1514,7 @@ find_offensive(struct monst *mtmp) #undef nomore } -static int +staticfn int mbhitm(struct monst *mtmp, struct obj *otmp) { int tmp; @@ -1624,7 +1624,7 @@ mbhitm(struct monst *mtmp, struct obj *otmp) * zapping you, so we need a special function for it. (Unless someone wants * to merge the two functions...) */ -static void +staticfn void mbhit( struct monst *mon, /* monster shooting the wand */ int range, /* direction and range */ @@ -2148,7 +2148,7 @@ find_misc(struct monst *mtmp) /* type of monster to polymorph into; defaults to one suitable for the current level rather than the totally arbitrary choice of newcham() */ -static struct permonst * +staticfn struct permonst * muse_newcham_mon(struct monst *mon) { struct obj *m_armr; @@ -2162,7 +2162,7 @@ muse_newcham_mon(struct monst *mon) return rndmonst(); } -static int +staticfn int mloot_container( struct monst *mon, struct obj *container, @@ -2498,7 +2498,7 @@ use_misc(struct monst *mtmp) RESTORE_WARNINGS -static void +staticfn void you_aggravate(struct monst *mtmp) { pline("For some reason, %s presence is known to you.", @@ -2773,7 +2773,7 @@ munstone(struct monst *mon, boolean by_you) return FALSE; } -static void +staticfn void mon_consume_unstone( struct monst *mon, struct obj *obj, @@ -2852,7 +2852,7 @@ mon_consume_unstone( } /* decide whether obj can cure petrification; also used when picking up */ -static boolean +staticfn boolean cures_stoning(struct monst *mon, struct obj *obj, boolean tinok) { if (obj->otyp == POT_ACID) @@ -2868,7 +2868,7 @@ cures_stoning(struct monst *mon, struct obj *obj, boolean tinok) || acidic(&mons[obj->corpsenm])); } -static boolean +staticfn boolean mcould_eat_tin(struct monst *mon) { struct obj *obj, *mwep; @@ -2971,7 +2971,7 @@ munslime(struct monst *mon, boolean by_you) } /* mon uses an item--selected by caller--to burn away incipient slime */ -static boolean +staticfn boolean muse_unslime( struct monst *mon, struct obj *obj, @@ -3112,7 +3112,7 @@ muse_unslime( } /* decide whether obj can be used to cure green slime */ -static int +staticfn int cures_sliming(struct monst *mon, struct obj *obj) { /* scroll of fire */ @@ -3135,7 +3135,7 @@ cures_sliming(struct monst *mon, struct obj *obj) seem plausibly green (which didn't necessarily match the categorization by the color of the text). iflags.use_color is not meant for game behavior decisions */ -static boolean +staticfn boolean green_mon(struct monst *mon) { struct permonst *ptr = mon->data; diff --git a/src/music.c b/src/music.c index 06ebe724a..5c808ad0b 100644 --- a/src/music.c +++ b/src/music.c @@ -28,19 +28,19 @@ #include "hack.h" -static void awaken_scare(struct monst *, boolean); -static void awaken_monsters(int); -static void put_monsters_to_sleep(int); -static void charm_snakes(int); -static void calm_nymphs(int); -static void charm_monsters(int); -static void do_earthquake(int); -static const char *generic_lvl_desc(void); -static int do_improvisation(struct obj *); -static char *improvised_notes(boolean *); +staticfn void awaken_scare(struct monst *, boolean); +staticfn void awaken_monsters(int); +staticfn void put_monsters_to_sleep(int); +staticfn void charm_snakes(int); +staticfn void calm_nymphs(int); +staticfn void charm_monsters(int); +staticfn void do_earthquake(int); +staticfn const char *generic_lvl_desc(void); +staticfn int do_improvisation(struct obj *); +staticfn char *improvised_notes(boolean *); /* wake up monster, possibly scare it */ -static void +staticfn void awaken_scare(struct monst *mtmp, boolean scary) { mtmp->msleeping = 0; @@ -62,7 +62,7 @@ awaken_scare(struct monst *mtmp, boolean scary) * Wake every monster in range... */ -static void +staticfn void awaken_monsters(int distance) { struct monst *mtmp; @@ -80,7 +80,7 @@ awaken_monsters(int distance) * Make monsters fall asleep. Note that they may resist the spell. */ -static void +staticfn void put_monsters_to_sleep(int distance) { struct monst *mtmp; @@ -100,7 +100,7 @@ put_monsters_to_sleep(int distance) * Charm snakes in range. Note that the snakes are NOT tamed. */ -static void +staticfn void charm_snakes(int distance) { struct monst *mtmp; @@ -134,7 +134,7 @@ charm_snakes(int distance) * Calm nymphs in range. */ -static void +staticfn void calm_nymphs(int distance) { struct monst *mtmp; @@ -191,7 +191,7 @@ awaken_soldiers(struct monst* bugler /* monster that played instrument */) } /* Charm monsters in range. Note that they may resist the spell. */ -static void +staticfn void charm_monsters(int distance) { struct monst *mtmp, *mtmp2; @@ -218,7 +218,7 @@ charm_monsters(int distance) /* Generate earthquake :-) of desired force. * That is: create random chasms (pits). */ -static void +staticfn void do_earthquake(int force) { static const char into_a_chasm[] = " into a chasm"; @@ -455,7 +455,7 @@ do_earthquake(int force) } } -static const char * +staticfn const char * generic_lvl_desc(void) { if (Is_astralevel(&u.uz)) @@ -480,7 +480,7 @@ const char *beats[] = { /* * The player is trying to extract something from his/her instrument. */ -static int +staticfn int do_improvisation(struct obj *instr) { int damage, mode, do_spec = !(Stunned || Confusion); @@ -709,7 +709,7 @@ do_improvisation(struct obj *instr) return 2; /* That takes time */ } -static char * +staticfn char * improvised_notes(boolean *same_as_last_time) { static const char notes[7] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G' }; diff --git a/src/nhlobj.c b/src/nhlobj.c index 2eefac8b9..411219f0a 100644 --- a/src/nhlobj.c +++ b/src/nhlobj.c @@ -10,28 +10,28 @@ struct _lua_obj { struct obj *obj; }; -static struct _lua_obj *l_obj_check(lua_State *, int); -static int l_obj_add_to_container(lua_State *); -static int l_obj_gc(lua_State *); -static int l_obj_getcontents(lua_State *); -static int l_obj_isnull(lua_State *); -static int l_obj_new_readobjnam(lua_State *); -static int l_obj_nextobj(lua_State *); -static int l_obj_objects_to_table(lua_State *); -static int l_obj_placeobj(lua_State *); -static int l_obj_to_table(lua_State *); -static int l_obj_at(lua_State *); -static int l_obj_container(lua_State *); -static int l_obj_timer_has(lua_State *); -static int l_obj_timer_peek(lua_State *); -static int l_obj_timer_stop(lua_State *); -static int l_obj_timer_start(lua_State *); -static int l_obj_bury(lua_State *); -static struct _lua_obj *l_obj_push(lua_State *, struct obj *); +staticfn struct _lua_obj *l_obj_check(lua_State *, int); +staticfn int l_obj_add_to_container(lua_State *); +staticfn int l_obj_gc(lua_State *); +staticfn int l_obj_getcontents(lua_State *); +staticfn int l_obj_isnull(lua_State *); +staticfn int l_obj_new_readobjnam(lua_State *); +staticfn int l_obj_nextobj(lua_State *); +staticfn int l_obj_objects_to_table(lua_State *); +staticfn int l_obj_placeobj(lua_State *); +staticfn int l_obj_to_table(lua_State *); +staticfn int l_obj_at(lua_State *); +staticfn int l_obj_container(lua_State *); +staticfn int l_obj_timer_has(lua_State *); +staticfn int l_obj_timer_peek(lua_State *); +staticfn int l_obj_timer_stop(lua_State *); +staticfn int l_obj_timer_start(lua_State *); +staticfn int l_obj_bury(lua_State *); +staticfn struct _lua_obj *l_obj_push(lua_State *, struct obj *); #define lobj_is_ok(lo) ((lo) && (lo)->obj && (lo)->obj->where != OBJ_LUAFREE) -static struct _lua_obj * +staticfn struct _lua_obj * l_obj_check(lua_State *L, int indx) { struct _lua_obj *lo; @@ -43,7 +43,7 @@ l_obj_check(lua_State *L, int indx) return lo; } -static int +staticfn int l_obj_gc(lua_State *L) { struct obj *obj, *otmp; @@ -69,7 +69,7 @@ l_obj_gc(lua_State *L) return 0; } -static struct _lua_obj * +staticfn struct _lua_obj * l_obj_push(lua_State *L, struct obj *otmp) { struct _lua_obj *lo = (struct _lua_obj *) lua_newuserdata(L, sizeof(struct _lua_obj)); @@ -92,7 +92,7 @@ nhl_push_obj(lua_State *L, struct obj *otmp) /* local o = obj.new("large chest"); local cobj = o:contents(); */ -static int +staticfn int l_obj_getcontents(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -109,7 +109,7 @@ l_obj_getcontents(lua_State *L) /* local box = obj.new("large chest"); box:addcontent(obj.new("rock")); */ -static int +staticfn int l_obj_add_to_container(lua_State *L) { struct _lua_obj *lobox = l_obj_check(L, 1); @@ -166,7 +166,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* local odata = obj.class(otbl.otyp); */ /* local odata = obj.class(obj.new("rock")); */ /* local odata = o:class(); */ -static int +staticfn int l_obj_objects_to_table(lua_State *L) { int argc = lua_gettop(L); @@ -242,7 +242,7 @@ RESTORE_WARNING_UNREACHABLE_CODE object fields. local o = obj.new("rock"); local otbl = o:totable(); */ -static int +staticfn int l_obj_to_table(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -343,7 +343,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* create a new object via wishing routine */ /* local o = obj.new("rock"); */ -static int +staticfn int l_obj_new_readobjnam(lua_State *L) { int argc = lua_gettop(L); @@ -366,7 +366,7 @@ l_obj_new_readobjnam(lua_State *L) /* Get the topmost object on the map at x,y */ /* local o = obj.at(x, y); */ -static int +staticfn int l_obj_at(lua_State *L) { int argc = lua_gettop(L); @@ -390,7 +390,7 @@ l_obj_at(lua_State *L) /* Place an object on the map at (x,y). local o = obj.new("rock"); o:placeobj(u.ux, u.uy); */ -static int +staticfn int l_obj_placeobj(lua_State *L) { int argc = lua_gettop(L); @@ -422,7 +422,7 @@ RESTORE_WARNING_UNREACHABLE_CODE local o2 = o:next(true); local firstobj = obj.next(); */ -static int +staticfn int l_obj_nextobj(lua_State *L) { int argc = lua_gettop(L); @@ -446,7 +446,7 @@ l_obj_nextobj(lua_State *L) /* Get the container object is in */ /* local box = o:container(); */ -static int +staticfn int l_obj_container(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -460,7 +460,7 @@ l_obj_container(lua_State *L) /* Is the object a null? */ /* local badobj = o:isnull(); */ -static int +staticfn int l_obj_isnull(lua_State *L) { struct _lua_obj *lo = l_obj_check(L, 1); @@ -473,7 +473,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* does object have a timer of certain type? */ /* local hastimer = o:has_timer("rot-organic"); */ -static int +staticfn int l_obj_timer_has(lua_State *L) { int argc = lua_gettop(L); @@ -497,7 +497,7 @@ l_obj_timer_has(lua_State *L) /* peek at an object timer. return the turn when timer triggers. returns 0 if no such timer attached to the object. */ /* local timeout = o:peek_timer("hatch-egg"); */ -static int +staticfn int l_obj_timer_peek(lua_State *L) { int argc = lua_gettop(L); @@ -524,7 +524,7 @@ l_obj_timer_peek(lua_State *L) without a timer type parameter, stops all timers for the object. */ /* local timeout = o:stop_timer("rot-organic"); */ /* o:stop_timer(); */ -static int +staticfn int l_obj_timer_stop(lua_State *L) { int argc = lua_gettop(L); @@ -556,7 +556,7 @@ RESTORE_WARNING_UNREACHABLE_CODE /* start an object timer. */ /* o:start_timer("hatch-egg", 10); */ -static int +staticfn int l_obj_timer_start(lua_State *L) { int argc = lua_gettop(L); @@ -580,7 +580,7 @@ l_obj_timer_start(lua_State *L) false otherwise. */ /* local ogone = o:bury(); */ /* local ogone = o:bury(5,5); */ -static int +staticfn int l_obj_bury(lua_State *L) { int argc = lua_gettop(L); diff --git a/src/nhlsel.c b/src/nhlsel.c index bb3a44451..544df9d4b 100644 --- a/src/nhlsel.c +++ b/src/nhlsel.c @@ -7,41 +7,41 @@ struct selectionvar *l_selection_check(lua_State *, int); -static struct selectionvar *l_selection_push_new(lua_State *); +staticfn struct selectionvar *l_selection_push_new(lua_State *); /* lua_CFunction prototypes */ -static int l_selection_new(lua_State *); -static int l_selection_clone(lua_State *); -static int l_selection_numpoints(lua_State *); -static int l_selection_getpoint(lua_State *); -static int l_selection_setpoint(lua_State *); -static int l_selection_filter_percent(lua_State *); -static int l_selection_rndcoord(lua_State *); -static int l_selection_room(lua_State *); -static int l_selection_getbounds(lua_State *); -static boolean params_sel_2coords(lua_State *, struct selectionvar **, +staticfn int l_selection_new(lua_State *); +staticfn int l_selection_clone(lua_State *); +staticfn int l_selection_numpoints(lua_State *); +staticfn int l_selection_getpoint(lua_State *); +staticfn int l_selection_setpoint(lua_State *); +staticfn int l_selection_filter_percent(lua_State *); +staticfn int l_selection_rndcoord(lua_State *); +staticfn int l_selection_room(lua_State *); +staticfn int l_selection_getbounds(lua_State *); +staticfn boolean params_sel_2coords(lua_State *, struct selectionvar **, coordxy *, coordxy *, coordxy *, coordxy *); -static int l_selection_line(lua_State *); -static int l_selection_randline(lua_State *); -static int l_selection_rect(lua_State *); -static int l_selection_fillrect(lua_State *); -static int l_selection_grow(lua_State *); -static int l_selection_filter_mapchar(lua_State *); -static int l_selection_match(lua_State *); -static int l_selection_flood(lua_State *); -static int l_selection_circle(lua_State *); -static int l_selection_ellipse(lua_State *); -static int l_selection_gradient(lua_State *); -static int l_selection_iterate(lua_State *); -static int l_selection_gc(lua_State *); -static int l_selection_not(lua_State *); -static int l_selection_and(lua_State *); -static int l_selection_or(lua_State *); -static int l_selection_xor(lua_State *); +staticfn int l_selection_line(lua_State *); +staticfn int l_selection_randline(lua_State *); +staticfn int l_selection_rect(lua_State *); +staticfn int l_selection_fillrect(lua_State *); +staticfn int l_selection_grow(lua_State *); +staticfn int l_selection_filter_mapchar(lua_State *); +staticfn int l_selection_match(lua_State *); +staticfn int l_selection_flood(lua_State *); +staticfn int l_selection_circle(lua_State *); +staticfn int l_selection_ellipse(lua_State *); +staticfn int l_selection_gradient(lua_State *); +staticfn int l_selection_iterate(lua_State *); +staticfn int l_selection_gc(lua_State *); +staticfn int l_selection_not(lua_State *); +staticfn int l_selection_and(lua_State *); +staticfn int l_selection_or(lua_State *); +staticfn int l_selection_xor(lua_State *); /* There doesn't seem to be a point in having a l_selection_add since it would * do the same thing as l_selection_or. The addition operator is mapped to * l_selection_or. */ -static int l_selection_sub(lua_State *); +staticfn int l_selection_sub(lua_State *); #if 0 /* the following do not appear to currently be used and because they are static, the OSX @@ -49,8 +49,8 @@ static int l_selection_sub(lua_State *); if ifdef'd out the prototype here and the function body below. */ -static int l_selection_ipairs(lua_State *); -static struct selectionvar *l_selection_to(lua_State *, int); +staticfn int l_selection_ipairs(lua_State *); +staticfn struct selectionvar *l_selection_to(lua_State *, int); #endif struct selectionvar * @@ -65,7 +65,7 @@ l_selection_check(lua_State *L, int index) return sel; } -static int +staticfn int l_selection_gc(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -76,7 +76,7 @@ l_selection_gc(lua_State *L) } #if 0 -static struct selectionvar * +staticfn struct selectionvar * l_selection_to(lua_State *L, int index) { struct selectionvar *sel = (struct selectionvar *) lua_touserdata(L, index); @@ -88,7 +88,7 @@ l_selection_to(lua_State *L, int index) #endif /* push a new selection into lua stack, return the selectionvar */ -static struct selectionvar * +staticfn struct selectionvar * l_selection_push_new(lua_State *L) { struct selectionvar *tmp = selection_new(); @@ -121,7 +121,7 @@ l_selection_push_copy(lua_State *L, struct selectionvar *tmp) /* local sel = selection.new(); */ -static int +staticfn int l_selection_new(lua_State *L) { (void) l_selection_push_new(L); @@ -130,7 +130,7 @@ l_selection_new(lua_State *L) /* Replace the topmost selection in the stack with a clone of it. */ /* local sel = selection.clone(sel); */ -static int +staticfn int l_selection_clone(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -153,7 +153,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* local sel = sel:set(); */ /* local sel = selection.set(sel); */ /* TODO: allow setting multiple coordinates at once: set({x,y}, {x,y}, ...); */ -static int +staticfn int l_selection_setpoint(lua_State *L) { struct selectionvar *sel = (struct selectionvar *) 0; @@ -197,7 +197,7 @@ l_selection_setpoint(lua_State *L) } /* local numpoints = selection.numpoints(sel); */ -static int +staticfn int l_selection_numpoints(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -218,7 +218,7 @@ l_selection_numpoints(lua_State *L) } /* local value = selection.get(sel, x, y); */ -static int +staticfn int l_selection_getpoint(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -253,7 +253,7 @@ RESTORE_WARNING_UNREACHABLE_CODE /* local s = selection.negate(sel); */ /* local s = selection.negate(); */ /* local s = sel:negate(); */ -static int +staticfn int l_selection_not(lua_State *L) { int argc = lua_gettop(L); @@ -274,7 +274,7 @@ l_selection_not(lua_State *L) } /* local sel = selection.area(4,5, 40,10) & selection.rect(7,8, 60,14); */ -static int +staticfn int l_selection_and(lua_State *L) { int x,y; @@ -297,7 +297,7 @@ l_selection_and(lua_State *L) } /* local sel = selection.area(4,5, 40,10) | selection.rect(7,8, 60,14); */ -static int +staticfn int l_selection_or(lua_State *L) { int x,y; @@ -321,7 +321,7 @@ l_selection_or(lua_State *L) } /* local sel = selection.area(4,5, 40,10) ~ selection.rect(7,8, 60,14); */ -static int +staticfn int l_selection_xor(lua_State *L) { int x,y; @@ -348,7 +348,7 @@ l_selection_xor(lua_State *L) /* local sel = selection.area(10,10, 20,20) - selection.area(14,14, 17,17) * - i.e. points that are in A but not in B */ -static int +staticfn int l_selection_sub(lua_State *L) { int x,y; @@ -376,7 +376,7 @@ l_selection_sub(lua_State *L) } /* local s = selection.percentage(sel, 50); */ -static int +staticfn int l_selection_filter_percent(lua_State *L) { int argc = lua_gettop(L); @@ -394,7 +394,7 @@ l_selection_filter_percent(lua_State *L) /* local pt = selection.rndcoord(sel); */ /* local pt = selection.rndcoord(sel, 1); */ -static int +staticfn int l_selection_rndcoord(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -419,7 +419,7 @@ l_selection_rndcoord(lua_State *L) } /* local s = selection.room(); */ -static int +staticfn int l_selection_room(lua_State *L) { struct selectionvar *sel; @@ -441,7 +441,7 @@ l_selection_room(lua_State *L) } /* local rect = sel:bounds(); */ -static int +staticfn int l_selection_getbounds(lua_State *L) { struct selectionvar *sel = l_selection_check(L, 1); @@ -463,7 +463,7 @@ l_selection_getbounds(lua_State *L) */ /* function(selection, x1,y1, x2,y2) */ /* selection:function(x1,y1, x2,y2) */ -static boolean +staticfn boolean params_sel_2coords(lua_State *L, struct selectionvar **sel, coordxy *x1, coordxy *y1, coordxy *x2, coordxy *y2) { @@ -496,7 +496,7 @@ params_sel_2coords(lua_State *L, struct selectionvar **sel, /* local s = selection.line(sel, x1,y1, x2,y2); */ /* local s = selection.line(x1,y1, x2,y2); */ /* s:line(x1,y1, x2,y2); */ -static int +staticfn int l_selection_line(lua_State *L) { struct selectionvar *sel = NULL; @@ -516,7 +516,7 @@ l_selection_line(lua_State *L) } /* local s = selection.rect(sel, x1,y1, x2,y2); */ -static int +staticfn int l_selection_rect(lua_State *L) { struct selectionvar *sel = NULL; @@ -544,7 +544,7 @@ l_selection_rect(lua_State *L) /* local s = selection.fillrect(x1,y1, x2,y2); */ /* s:fillrect(x1,y1, x2,y2); */ /* selection.area(x1,y1, x2,y2); */ -static int +staticfn int l_selection_fillrect(lua_State *L) { struct selectionvar *sel = NULL; @@ -576,7 +576,7 @@ l_selection_fillrect(lua_State *L) /* local s = selection.randline(x1,y1, x2,y2, roughness); */ /* TODO: selection.randline(x1,y1, x2,y2, roughness); */ /* TODO: selection.randline({x1,y1}, {x2,y2}, roughness); */ -static int +staticfn int l_selection_randline(lua_State *L) { int argc = lua_gettop(L); @@ -616,7 +616,7 @@ l_selection_randline(lua_State *L) /* local s = selection.grow(sel); */ /* local s = selection.grow(sel, "north"); */ -static int +staticfn int l_selection_grow(lua_State *L) { int argc = lua_gettop(L); @@ -637,7 +637,7 @@ l_selection_grow(lua_State *L) /* local s = selection.filter_mapchar(sel, mapchar, lit); */ -static int +staticfn int l_selection_filter_mapchar(lua_State *L) { int argc = lua_gettop(L); @@ -662,7 +662,7 @@ l_selection_filter_mapchar(lua_State *L) } /* local s = selection.match([[...]]); */ -static int +staticfn int l_selection_match(lua_State *L) { int argc = lua_gettop(L); @@ -702,7 +702,7 @@ l_selection_match(lua_State *L) /* local s = selection.floodfill(x,y); */ /* local s = selection.floodfill(x,y, diagonals); */ -static int +staticfn int l_selection_flood(lua_State *L) { int argc = lua_gettop(L); @@ -738,7 +738,7 @@ l_selection_flood(lua_State *L) /* local s = selection.circle(x, y, radius, filled); */ /* local s = selection.circle(sel, x, y, radius); */ /* local s = selection.circle(sel, x, y, radius, filled); */ -static int +staticfn int l_selection_circle(lua_State *L) { int argc = lua_gettop(L); @@ -786,7 +786,7 @@ l_selection_circle(lua_State *L) /* local s = selection.ellipse(x, y, radius1, radius2, filled); */ /* local s = selection.ellipse(sel, x, y, radius1, radius2); */ /* local s = selection.ellipse(sel, x, y, radius1, radius2, filled); */ -static int +staticfn int l_selection_ellipse(lua_State *L) { int argc = lua_gettop(L); @@ -838,7 +838,7 @@ l_selection_ellipse(lua_State *L) * non-obvious argument order. */ /* selection.gradient({ type = "radial", x = 3, y = 5, x2 = 10, y2 = 12, * mindist = 4, maxdist = 10, limited = false }); */ -static int +staticfn int l_selection_gradient(lua_State *L) { int argc = lua_gettop(L); @@ -898,7 +898,7 @@ l_selection_gradient(lua_State *L) * The x, y coordinates passed to the function are map- or room-relative * rather than absolute, unless there has been no previous map or room defined. */ -static int +staticfn int l_selection_iterate(lua_State *L) { int argc = lua_gettop(L); diff --git a/src/nhlua.c b/src/nhlua.c index d6bed268f..f02afd79e 100644 --- a/src/nhlua.c +++ b/src/nhlua.c @@ -27,68 +27,68 @@ struct e; /* lua_CFunction prototypes */ #ifdef DUMPLOG -static int nhl_dump_fmtstr(lua_State *); +staticfn int nhl_dump_fmtstr(lua_State *); #endif /* DUMPLOG */ -static int nhl_dnum_name(lua_State *); -static int nhl_stairways(lua_State *); -static int nhl_pushkey(lua_State *); -static int nhl_doturn(lua_State *); -static int nhl_debug_flags(lua_State *); -static int nhl_timer_has_at(lua_State *); -static int nhl_timer_peek_at(lua_State *); -static int nhl_timer_stop_at(lua_State *); -static int nhl_timer_start_at(lua_State *); -static int nhl_get_cmd_key(lua_State *); -static int nhl_callback(lua_State *); -static int nhl_gamestate(lua_State *); -static int nhl_test(lua_State *); -static int nhl_getmap(lua_State *); -static char splev_typ2chr(schar); -static int nhl_gettrap(lua_State *); -static int nhl_deltrap(lua_State *); +staticfn int nhl_dnum_name(lua_State *); +staticfn int nhl_stairways(lua_State *); +staticfn int nhl_pushkey(lua_State *); +staticfn int nhl_doturn(lua_State *); +staticfn int nhl_debug_flags(lua_State *); +staticfn int nhl_timer_has_at(lua_State *); +staticfn int nhl_timer_peek_at(lua_State *); +staticfn int nhl_timer_stop_at(lua_State *); +staticfn int nhl_timer_start_at(lua_State *); +staticfn int nhl_get_cmd_key(lua_State *); +staticfn int nhl_callback(lua_State *); +staticfn int nhl_gamestate(lua_State *); +staticfn int nhl_test(lua_State *); +staticfn int nhl_getmap(lua_State *); +staticfn char splev_typ2chr(schar); +staticfn int nhl_gettrap(lua_State *); +staticfn int nhl_deltrap(lua_State *); #if 0 -static int nhl_setmap(lua_State *); +staticfn int nhl_setmap(lua_State *); #endif -static int nhl_impossible(lua_State *); -static int nhl_pline(lua_State *); -static int nhl_verbalize(lua_State *); -static int nhl_parse_config(lua_State *); -static int nhl_menu(lua_State *); -static int nhl_text(lua_State *); -static int nhl_getlin(lua_State *); -static int nhl_makeplural(lua_State *); -static int nhl_makesingular(lua_State *); -static int nhl_s_suffix(lua_State *); -static int nhl_ing_suffix(lua_State *); -static int nhl_an(lua_State *); -static int nhl_rn2(lua_State *); -static int nhl_random(lua_State *); -static int nhl_level_difficulty(lua_State *); -static void init_nhc_data(lua_State *); -static int nhl_push_anything(lua_State *, int, void *); -static int nhl_meta_u_index(lua_State *); -static int nhl_meta_u_newindex(lua_State *); -static int nhl_u_clear_inventory(lua_State *); -static int nhl_u_giveobj(lua_State *); -static void init_u_data(lua_State *); +staticfn int nhl_impossible(lua_State *); +staticfn int nhl_pline(lua_State *); +staticfn int nhl_verbalize(lua_State *); +staticfn int nhl_parse_config(lua_State *); +staticfn int nhl_menu(lua_State *); +staticfn int nhl_text(lua_State *); +staticfn int nhl_getlin(lua_State *); +staticfn int nhl_makeplural(lua_State *); +staticfn int nhl_makesingular(lua_State *); +staticfn int nhl_s_suffix(lua_State *); +staticfn int nhl_ing_suffix(lua_State *); +staticfn int nhl_an(lua_State *); +staticfn int nhl_rn2(lua_State *); +staticfn int nhl_random(lua_State *); +staticfn int nhl_level_difficulty(lua_State *); +staticfn void init_nhc_data(lua_State *); +staticfn int nhl_push_anything(lua_State *, int, void *); +staticfn int nhl_meta_u_index(lua_State *); +staticfn int nhl_meta_u_newindex(lua_State *); +staticfn int nhl_u_clear_inventory(lua_State *); +staticfn int nhl_u_giveobj(lua_State *); +staticfn void init_u_data(lua_State *); #ifdef notyet -static int nhl_set_package_path(lua_State *, const char *); +staticfn int nhl_set_package_path(lua_State *, const char *); #endif -static int traceback_handler(lua_State *); -static uint32_t nhl_getmeminuse(lua_State *); +staticfn int traceback_handler(lua_State *); +staticfn uint32_t nhl_getmeminuse(lua_State *); #ifdef NHL_SANDBOX -static void nhlL_openlibs(lua_State *, uint32_t); +staticfn void nhlL_openlibs(lua_State *, uint32_t); #endif -static void *nhl_alloc(void *, void *, size_t, size_t); -static lua_State *nhlL_newstate (nhl_sandbox_info *, const char *); -static void end_luapat(void); -static int nhl_get_config(lua_State *); -static int nhl_variable(lua_State *); -static void nhl_clearfromtable(lua_State *, int, int, struct e *); -static void nhl_warn(void *, const char *, int); -static void nhl_clearfromtable(lua_State *, int, int, struct e *); -static int nhl_panic(lua_State *); -static void nhl_hookfn(lua_State *, lua_Debug *); +staticfn void *nhl_alloc(void *, void *, size_t, size_t); +staticfn lua_State *nhlL_newstate (nhl_sandbox_info *, const char *); +staticfn void end_luapat(void); +staticfn int nhl_get_config(lua_State *); +staticfn int nhl_variable(lua_State *); +staticfn void nhl_clearfromtable(lua_State *, int, int, struct e *); +staticfn void nhl_warn(void *, const char *, int); +staticfn void nhl_clearfromtable(lua_State *, int, int, struct e *); +staticfn int nhl_panic(lua_State *); +staticfn void nhl_hookfn(lua_State *, lua_Debug *); static const char *const nhcore_call_names[NUM_NHCORE_CALLS] = { "start_new_game", @@ -389,7 +389,7 @@ check_mapchr(const char *s) return INVALID_TYPE; } -static char +staticfn char splev_typ2chr(schar typ) { int i; @@ -404,7 +404,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* local t = nh.gettrap(x,y); */ /* local t = nh.gettrap({ x = 10, y = 10 }); */ -static int +staticfn int nhl_gettrap(lua_State *L) { lua_Integer lx, ly; @@ -458,7 +458,7 @@ nhl_gettrap(lua_State *L) } /* nh.deltrap(x,y); nh.deltrap({ x = 10, y = 15 }); */ -static int +staticfn int nhl_deltrap(lua_State *L) { lua_Integer lx, ly; @@ -517,7 +517,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* local loc = nh.getmap(x,y); */ /* local loc = nh.getmap({ x = 10, y = 35 }); */ -static int +staticfn int nhl_getmap(lua_State *L) { lua_Integer lx, ly; @@ -607,7 +607,7 @@ nhl_getmap(lua_State *L) } /* impossible("Error!") */ -static int +staticfn int nhl_impossible(lua_State *L) { int argc = lua_gettop(L); @@ -621,7 +621,7 @@ nhl_impossible(lua_State *L) /* pline("It hits!") */ /* pline("It hits!", true) */ -static int +staticfn int nhl_pline(lua_State *L) { int argc = lua_gettop(L); @@ -637,7 +637,7 @@ nhl_pline(lua_State *L) } /* verbalize("Fool!") */ -static int +staticfn int nhl_verbalize(lua_State *L) { int argc = lua_gettop(L); @@ -651,7 +651,7 @@ nhl_verbalize(lua_State *L) } /* parse_config("OPTIONS=!color") */ -static int +staticfn int nhl_parse_config(lua_State *L) { int argc = lua_gettop(L); @@ -665,7 +665,7 @@ nhl_parse_config(lua_State *L) } /* local windowtype = get_config("windowtype"); */ -static int +staticfn int nhl_get_config(lua_State *L) { int argc = lua_gettop(L); @@ -682,7 +682,7 @@ nhl_get_config(lua_State *L) /* str = getlin("What do you want to call this dungeon level?"); */ -static int +staticfn int nhl_getlin(lua_State *L) { int argc = lua_gettop(L); @@ -707,7 +707,7 @@ nhl_getlin(lua_State *L) selected = menu("prompt", default, pickX, { {key:"a", text:"option a"}, {key:"b", text:"option b"}, ... } ) */ -static int +staticfn int nhl_menu(lua_State *L) { static const char *const pickX[] = { "none", "one", "any" }; /* PICK_x */ @@ -796,7 +796,7 @@ nhl_menu(lua_State *L) } /* text("foo\nbar\nbaz") */ -static int +staticfn int nhl_text(lua_State *L) { int argc = lua_gettop(L); @@ -841,7 +841,7 @@ nhl_text(lua_State *L) } /* makeplural("zorkmid") */ -static int +staticfn int nhl_makeplural(lua_State *L) { int argc = lua_gettop(L); @@ -855,7 +855,7 @@ nhl_makeplural(lua_State *L) } /* makesingular("zorkmids") */ -static int +staticfn int nhl_makesingular(lua_State *L) { int argc = lua_gettop(L); @@ -869,7 +869,7 @@ nhl_makesingular(lua_State *L) } /* s_suffix("foo") */ -static int +staticfn int nhl_s_suffix(lua_State *L) { int argc = lua_gettop(L); @@ -883,7 +883,7 @@ nhl_s_suffix(lua_State *L) } /* ing_suffix("foo") */ -static int +staticfn int nhl_ing_suffix(lua_State *L) { int argc = lua_gettop(L); @@ -897,7 +897,7 @@ nhl_ing_suffix(lua_State *L) } /* an("foo") */ -static int +staticfn int nhl_an(lua_State *L) { int argc = lua_gettop(L); @@ -911,7 +911,7 @@ nhl_an(lua_State *L) } /* rn2(10) */ -static int +staticfn int nhl_rn2(lua_State *L) { int argc = lua_gettop(L); @@ -926,7 +926,7 @@ nhl_rn2(lua_State *L) /* random(10); -- is the same as rn2(10); */ /* random(5,8); -- same as 5 + rn2(8); */ -static int +staticfn int nhl_random(lua_State *L) { int argc = lua_gettop(L); @@ -943,7 +943,7 @@ nhl_random(lua_State *L) } /* level_difficulty() */ -static int +staticfn int nhl_level_difficulty(lua_State *L) { int argc = lua_gettop(L); @@ -1070,7 +1070,7 @@ get_table_option(lua_State *L, #ifdef DUMPLOG /* local fname = dump_fmtstr("/tmp/nethack.%n.%d.log"); */ -static int +staticfn int nhl_dump_fmtstr(lua_State *L) { int argc = lua_gettop(L); @@ -1085,7 +1085,7 @@ nhl_dump_fmtstr(lua_State *L) #endif /* DUMPLOG */ /* local dungeon_name = dnum_name(u.dnum); */ -static int +staticfn int nhl_dnum_name(lua_State *L) { int argc = lua_gettop(L); @@ -1108,7 +1108,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* set or get variables which are saved and restored along with the game. nh.variable("test", 10); local ten = nh.variable("test"); */ -static int +staticfn int nhl_variable(lua_State *L) { int argc = lua_gettop(L); @@ -1243,7 +1243,7 @@ restore_luadata(NHFILE *nhfp) } /* local stairs = stairways(); */ -static int +staticfn int nhl_stairways(lua_State *L) { stairway *tmp = gs.stairs; @@ -1274,7 +1274,7 @@ nhl_stairways(lua_State *L) /* test( { x = 123, y = 456 } ); */ -static int +staticfn int nhl_test(lua_State *L) { coordxy x, y; @@ -1298,7 +1298,7 @@ nhl_test(lua_State *L) /* push a key into command queue */ /* nh.pushkey("i"); */ -static int +staticfn int nhl_pushkey(lua_State *L) { int argc = lua_gettop(L); @@ -1314,7 +1314,7 @@ nhl_pushkey(lua_State *L) /* do a turn of moveloop, or until gm.multi is done if param is true. */ /* nh.doturn(); nh.doturn(true); */ -static int +staticfn int nhl_doturn(lua_State *L) { int argc = lua_gettop(L); @@ -1334,7 +1334,7 @@ nhl_doturn(lua_State *L) /* nh.debug_flags({ mongen = false, hunger = false, overwrite_stairs = true }); */ -static int +staticfn int nhl_debug_flags(lua_State *L) { int val; @@ -1377,7 +1377,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* does location at x,y have timer? */ /* local has_melttimer = nh.has_timer_at(x,y, "melt-ice"); */ /* local has_melttimer = nh.has_timer_at({x=4,y=7}, "melt-ice"); */ -static int +staticfn int nhl_timer_has_at(lua_State *L) { boolean ret = FALSE; @@ -1408,7 +1408,7 @@ nhl_timer_has_at(lua_State *L) /* when does location at x,y timer trigger? */ /* local melttime = nh.peek_timer_at(x,y, "melt-ice"); */ /* local melttime = nh.peek_timer_at({x=5,y=6}, "melt-ice"); */ -static int +staticfn int nhl_timer_peek_at(lua_State *L) { long when = 0L; @@ -1436,7 +1436,7 @@ nhl_timer_peek_at(lua_State *L) /* stop timer at location x,y */ /* nh.stop_timer_at(x,y, "melt-ice"); */ /* nh.stop_timer_at({x=6,y=8}, "melt-ice"); */ -static int +staticfn int nhl_timer_stop_at(lua_State *L) { short timertype = nhl_get_timertype(L, -1); @@ -1461,7 +1461,7 @@ nhl_timer_stop_at(lua_State *L) /* start timer at location x,y */ /* nh.start_timer_at(x,y, "melt-ice", 10); */ -static int +staticfn int nhl_timer_start_at(lua_State *L) { short timertype = nhl_get_timertype(L, -2); @@ -1493,7 +1493,7 @@ nhl_timer_start_at(lua_State *L) /* returns the visual interpretation of the key bound to an extended command, or the ext cmd name if not bound to any key */ /* local helpkey = eckey("help"); */ -static int +staticfn int nhl_get_cmd_key(lua_State *L) { int argc = lua_gettop(L); @@ -1513,7 +1513,7 @@ nhl_get_cmd_key(lua_State *L) /* callback("level_enter", "function_name"); */ /* callback("level_enter", "function_name", true); */ /* level_enter, level_leave, cmd_before */ -static int +staticfn int nhl_callback(lua_State *L) { int argc = lua_gettop(L); @@ -1563,7 +1563,7 @@ nhl_callback(lua_State *L) /* currently handles inventory and turns. */ /* gamestate(); -- save state */ /* gamestate(true); -- restore state */ -static int +staticfn int nhl_gamestate(lua_State *L) { static struct obj *gmst_invent = NULL; @@ -1702,7 +1702,7 @@ static const struct { }; /* register and init the constants table */ -static void +staticfn void init_nhc_data(lua_State *L) { int i; @@ -1718,7 +1718,7 @@ init_nhc_data(lua_State *L) lua_setglobal(L, "nhc"); } -static int +staticfn int nhl_push_anything(lua_State *L, int anytype, void *src) { anything any = cg.zeroany; @@ -1742,7 +1742,7 @@ nhl_push_anything(lua_State *L, int anytype, void *src) DISABLE_WARNING_UNREACHABLE_CODE -static int +staticfn int nhl_meta_u_index(lua_State *L) { static const struct { @@ -1809,7 +1809,7 @@ nhl_meta_u_index(lua_State *L) return 0; } -static int +staticfn int nhl_meta_u_newindex(lua_State *L) { nhl_error(L, "Cannot set u table values"); @@ -1819,7 +1819,7 @@ nhl_meta_u_newindex(lua_State *L) RESTORE_WARNING_UNREACHABLE_CODE -static int +staticfn int nhl_u_clear_inventory(lua_State *L UNUSED) { while (gi.invent) @@ -1829,7 +1829,7 @@ nhl_u_clear_inventory(lua_State *L UNUSED) /* Put object into player's inventory */ /* u.giveobj(obj.new("rock")); */ -static int +staticfn int nhl_u_giveobj(lua_State *L) { return nhl_obj_u_giveobj(L); @@ -1841,7 +1841,7 @@ static const struct luaL_Reg nhl_u_functions[] = { { NULL, NULL } }; -static void +staticfn void init_u_data(lua_State *L) { lua_newtable(L); @@ -1856,7 +1856,7 @@ init_u_data(lua_State *L) } #ifdef notyet -static int +staticfn int nhl_set_package_path(lua_State *L, const char *path) { if (LUA_TTABLE != lua_getglobal(L, "package")) { @@ -1870,7 +1870,7 @@ nhl_set_package_path(lua_State *L, const char *path) } #endif -static int +staticfn int traceback_handler(lua_State *L) { luaL_traceback(L, L, lua_tostring(L, 1), 0); @@ -1878,7 +1878,7 @@ traceback_handler(lua_State *L) return 1; } -static uint32_t +staticfn uint32_t nhl_getmeminuse(lua_State *L) { return lua_gc(L, LUA_GCCOUNT) * 1024 + lua_gc(L, LUA_GCCOUNTB); @@ -2377,7 +2377,7 @@ static struct e ct_os_files[] = { #define DROPIF(flag, lib, ct) \ nhl_clearfromtable(L, !!(lflags & flag), lib, ct) -static void +staticfn void nhl_clearfromtable(lua_State *L, int flag, int tndx, struct e *todo) { while (todo->when != EOT) { @@ -2428,7 +2428,7 @@ return values from "call it": * We're going to do #3. */ #ifdef notyet -static boolean +staticfn boolean start_luapat(void) { int rv; @@ -2449,7 +2449,7 @@ start_luapat(void) } #endif -static void +staticfn void end_luapat(void) { if (luapat) { @@ -2459,7 +2459,7 @@ end_luapat(void) } #ifdef notyet -static int +staticfn int opencheckpat(lua_State *L, const char *ename, int param) { /* careful - we're using 2 different and unrelated Lua states */ @@ -2513,7 +2513,7 @@ nhl_pushhooked_open_table(lua_State *L) } #ifdef notyet -static int +staticfn int hooked_open(lua_State *L) { const char *mode; @@ -2581,7 +2581,7 @@ hooked_open(lua_State *L) return (*io_open)(L); } -static boolean +staticfn boolean hook_open(lua_State *L) { boolean rv = FALSE; @@ -2613,7 +2613,7 @@ hook_open(lua_State *L) DISABLE_WARNING_CONDEXPR_IS_CONSTANT #ifdef NHL_SANDBOX -static void +staticfn void nhlL_openlibs(lua_State *L, uint32_t lflags) { /* translate lflags from user-friendly to internal */ @@ -2736,7 +2736,7 @@ UNSAFEIO: RESTORE_WARNING_CONDEXPR_IS_CONSTANT -static void * +staticfn void * nhl_alloc(void *ud, void *ptr, size_t osize UNUSED, size_t nsize) { nhl_user_data *nud = ud; @@ -2759,7 +2759,7 @@ nhl_alloc(void *ud, void *ptr, size_t osize UNUSED, size_t nsize) DISABLE_WARNING_UNREACHABLE_CODE -static int +staticfn int nhl_panic(lua_State *L) { const char *msg = lua_tostring(L, -1); @@ -2775,7 +2775,7 @@ RESTORE_WARNING_UNREACHABLE_CODE /* called when lua issues a warning message; the text of the message is passed to us in pieces across multiple function calls */ -static void +staticfn void nhl_warn( void *userdata UNUSED, const char *msg_fragment, @@ -2796,7 +2796,7 @@ nhl_warn( } #ifdef NHL_SANDBOX -static void +staticfn void nhl_hookfn(lua_State *L, lua_Debug *ar UNUSED) { nhl_user_data *nud; @@ -2811,7 +2811,7 @@ nhl_hookfn(lua_State *L, lua_Debug *ar UNUSED) } #endif -static lua_State * +staticfn lua_State * nhlL_newstate(nhl_sandbox_info *sbi, const char *name) { nhl_user_data *nud = 0; diff --git a/src/nhmd4.c b/src/nhmd4.c index 67966d769..02d9aa74e 100644 --- a/src/nhmd4.c +++ b/src/nhmd4.c @@ -29,7 +29,7 @@ #include "nhmd4.h" -static const unsigned char *nhmd4_body(struct nhmd4_context *, +staticfn const unsigned char *nhmd4_body(struct nhmd4_context *, const unsigned char *, size_t); /* Avoid a conflict from a Lua header */ @@ -79,7 +79,7 @@ static const unsigned char *nhmd4_body(struct nhmd4_context *, * This processes one or more 64-byte data blocks, but does NOT update * the bit counters. There're no alignment requirements. */ -static const unsigned char * +staticfn const unsigned char * nhmd4_body( struct nhmd4_context *ctx, const unsigned char *data, diff --git a/src/o_init.c b/src/o_init.c index d56e0689f..66fd2d801 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -5,20 +5,20 @@ #include "hack.h" -static void setgemprobs(d_level *); -static void randomize_gem_colors(void); -static void shuffle(int, int, boolean); -static void shuffle_all(void); -static int QSORTCALLBACK discovered_cmp(const genericptr, const genericptr); -static char *sortloot_descr(int, char *); -static char *disco_typename(int); -static void disco_append_typename(char *, int); -static void disco_output_sorted(winid, char **, int, boolean); -static char *oclass_to_name(char, char *); +staticfn void setgemprobs(d_level *); +staticfn void randomize_gem_colors(void); +staticfn void shuffle(int, int, boolean); +staticfn void shuffle_all(void); +staticfn int QSORTCALLBACK discovered_cmp(const genericptr, const genericptr); +staticfn char *sortloot_descr(int, char *); +staticfn char *disco_typename(int); +staticfn void disco_append_typename(char *, int); +staticfn void disco_output_sorted(winid, char **, int, boolean); +staticfn char *oclass_to_name(char, char *); #ifdef TILES_IN_GLYPHMAP extern glyph_map glyphmap[MAX_GLYPH]; -static void shuffle_tiles(void); +staticfn void shuffle_tiles(void); /* Shuffle tile assignments to match descriptions, so a red potion isn't * displayed with a blue tile and so on. @@ -29,7 +29,7 @@ static void shuffle_tiles(void); * is restored. So might as well do that the first time instead of writing * another routine. */ -static void +staticfn void shuffle_tiles(void) { int i; @@ -48,7 +48,7 @@ shuffle_tiles(void) } #endif /* TILES_IN_GLYPHMAP */ -static void +staticfn void setgemprobs(d_level *dlev) { int j, first, lev, sum = 0; @@ -79,7 +79,7 @@ setgemprobs(d_level *dlev) } /* some gems can have different colors */ -static void +staticfn void randomize_gem_colors(void) { #define COPY_OBJ_DESCR(o_dst, o_src) \ @@ -107,7 +107,7 @@ randomize_gem_colors(void) } /* shuffle descriptions on objects o_low to o_high */ -static void +staticfn void shuffle(int o_low, int o_high, boolean domaterial) { int i, j, num_to_shuffle; @@ -312,7 +312,7 @@ obj_shuffle_range( } /* randomize object descriptions */ -static void +staticfn void shuffle_all(void) { /* entire classes; obj_shuffle_range() handles their exceptions */ @@ -516,7 +516,7 @@ static const short uniq_objs[] = { }; /* discoveries qsort comparison function */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK discovered_cmp(const genericptr v1, const genericptr v2) { const char *s1 = *(const char **) v1; @@ -530,7 +530,7 @@ discovered_cmp(const genericptr v1, const genericptr v2) return res; } -static char * +staticfn char * sortloot_descr(int otyp, char *outbuf) { Loot sl_cookie; @@ -621,7 +621,7 @@ choose_disco_sort( } /* augment obj_typename() with explanation of Japanese item names */ -static char * +staticfn char * disco_typename(int otyp) { char *result = obj_typename(otyp); @@ -653,7 +653,7 @@ disco_typename(int otyp) } /* append typename(dis) to buf[], possibly truncating in the process */ -static void +staticfn void disco_append_typename(char *buf, int dis) { unsigned len = (unsigned) strlen(buf); @@ -677,7 +677,7 @@ disco_append_typename(char *buf, int dis) } /* sort and output sorted_lines to window and free the lines */ -static void +staticfn void disco_output_sorted(winid tmpwin, char **sorted_lines, int sorted_ct, boolean lootsort) @@ -799,7 +799,7 @@ dodiscovered(void) /* free after Robert Viduya */ } /* lower case let_to_name() output, which differs from def_oc_syms[].name */ -static char * +staticfn char * oclass_to_name(char oclass, char *buf) { char *s; diff --git a/src/objnam.c b/src/objnam.c index 4682624db..617bc1f7a 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -32,30 +32,30 @@ struct _readobjnam_data { char fruitbuf[BUFSZ]; }; -static char *strprepend(char *, const char *); -static char *nextobuf(void); -static void releaseobuf(char *); -static void xcalled(char *, int, const char *, const 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, +staticfn char *strprepend(char *, const char *); +staticfn char *nextobuf(void); +staticfn void releaseobuf(char *); +staticfn void xcalled(char *, int, const char *, const char *); +staticfn char *xname_flags(struct obj *, unsigned); +staticfn char *minimal_xname(struct obj *); +staticfn void add_erosion_words(struct obj *, char *); +staticfn char *doname_base(struct obj *obj, unsigned); +staticfn boolean singplur_lookup(char *, char *, boolean, const char *const *); -static char *singplur_compound(char *); -static boolean ch_ksound(const char *basestr); -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(struct _readobjnam_data *); -static void dbterrainmesg(const char *, coordxy, coordxy) NONNULLARG1; -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 *); +staticfn char *singplur_compound(char *); +staticfn boolean ch_ksound(const char *basestr); +staticfn boolean badman(const char *, boolean); +staticfn boolean wishymatch(const char *, const char *, boolean); +staticfn short rnd_otyp_by_wpnskill(schar); +staticfn short rnd_otyp_by_namedesc(const char *, char, int); +staticfn struct obj *wizterrainwish(struct _readobjnam_data *); +staticfn void dbterrainmesg(const char *, coordxy, coordxy) NONNULLARG1; +staticfn void readobjnam_init(char *, struct _readobjnam_data *); +staticfn int readobjnam_preparse(struct _readobjnam_data *); +staticfn void readobjnam_parse_charges(struct _readobjnam_data *); +staticfn int readobjnam_postparse1(struct _readobjnam_data *); +staticfn int readobjnam_postparse2(struct _readobjnam_data *); +staticfn int readobjnam_postparse3(struct _readobjnam_data *); struct Jitem { int item; @@ -118,7 +118,7 @@ static const struct Jitem Japanese_items[] = { { 0, "" } }; -static char * +staticfn char * strprepend(char *s, const char *pref) { int i = (int) strlen(pref); @@ -136,7 +136,7 @@ strprepend(char *s, const char *pref) static char NEARDATA obufs[NUMOBUF][BUFSZ]; static int obufidx = 0; -static char * +staticfn char * nextobuf(void) { obufidx = (obufidx + 1) % NUMOBUF; @@ -144,7 +144,7 @@ nextobuf(void) } /* put the most recently allocated buffer back if possible */ -static void +staticfn void releaseobuf(char *bufp) { /* caller may not know whether bufp is the most recently allocated @@ -528,7 +528,7 @@ reorder_fruit(boolean forward) } /* add " called " to end of buf, truncating if necessary */ -static void +staticfn void xcalled( char *buf, /* eos(obuf) or eos(&obuf[PREFIX]) */ int siz, /* BUFSZ or BUFSZ-PREFIX */ @@ -551,7 +551,7 @@ xname(struct obj *obj) return xname_flags(obj, CXN_NORMAL); } -static char * +staticfn char * xname_flags( struct obj *obj, unsigned cxn_flags) /* bitmask of CXN_xxx values */ @@ -995,7 +995,7 @@ xname_flags( brown potion -- if oc_name_known not set potion of object detection -- if discovered */ -static char * +staticfn char * minimal_xname(struct obj *obj) { char *bufp; @@ -1098,7 +1098,7 @@ the_unique_pm(struct permonst *ptr) return uniq; } -static void +staticfn void add_erosion_words(struct obj *obj, char *prefix) { boolean iscrys = (obj->otyp == CRYSKNIFE); @@ -1177,7 +1177,7 @@ erosion_matters(struct obj *obj) #define DONAME_FOR_MENU 4 /* [not used anywhere yet] */ /* core of doname() */ -static char * +staticfn char * doname_base( struct obj *obj, /* object to format */ unsigned doname_flags) /* special case requests */ @@ -2596,7 +2596,7 @@ static const char *const as_is[] = { }; /* singularize/pluralize decisions common to both makesingular & makeplural */ -static boolean +staticfn boolean singplur_lookup( char *basestr, char *endstring, /* base string, pointer to eos(string) */ boolean to_plural, /* true => makeplural, false => makesingular */ @@ -2671,7 +2671,7 @@ singplur_lookup( } /* searches for common compounds, ex. lump of royal jelly */ -static char * +staticfn char * singplur_compound(char *str) { /* if new entries are added, be sure to keep compound_start[] in sync */ @@ -3056,7 +3056,7 @@ makesingular(const char *oldstr) } -static boolean +staticfn boolean ch_ksound(const char *basestr) { /* these are some *ch words/suffixes that make a k-sound. They pluralize by @@ -3082,7 +3082,7 @@ ch_ksound(const char *basestr) return FALSE; } -static boolean +staticfn boolean badman( const char *basestr, boolean to_plural) /* True: makeplural, False: makesingular */ @@ -3131,7 +3131,7 @@ badman( } /* compare user string against object name string using fuzzy matching */ -static boolean +staticfn boolean wishymatch( const char *u_str, /* from user, so might be variant spelling */ const char *o_str, /* from objects[], so is in canonical form */ @@ -3318,7 +3318,7 @@ static const struct alt_spellings { { (const char *) 0, 0 }, }; -static short +staticfn short rnd_otyp_by_wpnskill(schar skill) { int i, n = 0; @@ -3341,7 +3341,7 @@ rnd_otyp_by_wpnskill(schar skill) return otyp; } -static short +staticfn short rnd_otyp_by_namedesc( const char *name, char oclass, @@ -3425,7 +3425,7 @@ shiny_obj(char oclass) } /* in wizard mode, readobjnam() can accept wishes for traps and terrain */ -static struct obj * +staticfn struct obj * wizterrainwish(struct _readobjnam_data *d) { struct rm *lev; @@ -3796,7 +3796,7 @@ wizterrainwish(struct _readobjnam_data *d) } /* message common to several wizterrainwish() results */ -static void +staticfn void dbterrainmesg( const char *newtype, coordxy x, coordxy y) @@ -3809,7 +3809,7 @@ dbterrainmesg( #define TIN_EMPTY 1 #define TIN_SPINACH 2 -static void +staticfn void readobjnam_init(char *bp, struct _readobjnam_data *d) { d->otmp = (struct obj *) 0; @@ -3842,7 +3842,7 @@ readobjnam_init(char *bp, struct _readobjnam_data *d) /* return 1 if d->bp is empty or contains only various qualifiers like "blessed", "rustproof", and so on, or 0 if anything else is present */ -static int +staticfn int readobjnam_preparse(struct _readobjnam_data *d) { char *save_bp = 0; @@ -4054,7 +4054,7 @@ readobjnam_preparse(struct _readobjnam_data *d) return res; } -static void +staticfn void readobjnam_parse_charges(struct _readobjnam_data *d) { if (strlen(d->bp) > 1 && (d->p = strrchr(d->bp, '(')) != 0) { @@ -4116,7 +4116,7 @@ readobjnam_parse_charges(struct _readobjnam_data *d) d->rechrg = 7; /* recharge_limit */ } -static int +staticfn int readobjnam_postparse1(struct _readobjnam_data *d) { int i; @@ -4528,7 +4528,7 @@ readobjnam_postparse1(struct _readobjnam_data *d) return 0; } -static int +staticfn int readobjnam_postparse2(struct _readobjnam_data *d) { int i; @@ -4589,7 +4589,7 @@ readobjnam_postparse2(struct _readobjnam_data *d) return 0; } -static int +staticfn int readobjnam_postparse3(struct _readobjnam_data *d) { int i; diff --git a/src/options.c b/src/options.c index f5e562795..e3cf3ed6a 100644 --- a/src/options.c +++ b/src/options.c @@ -315,83 +315,83 @@ static const menu_cmd_t default_menu_cmd_info[] = { { (char *) 0, '\0', (char *) 0 } }; -static void nmcpy(char *, const char *, int); -static void escapes(const char *, char *); -static void rejectoption(const char *); -static char *string_for_opt(char *, boolean); -static char *string_for_env_opt(const char *, char *, boolean); -static void bad_negation(const char *, boolean); -static int change_inv_order(char *); -static boolean warning_opts(char *, const char *); -static int feature_alert_opts(char *, const char *); -static boolean duplicate_opt_detection(int); -static void complain_about_duplicate(int); -static int length_without_val(const char *, int len); -static void determine_ambiguities(void); -static int check_misc_menu_command(char *, char *); -static int opt2roleopt(int); -static char *getoptstr(int, int); -static void saveoptstr(int, const char *); -static void unsaveoptstr(int, int); -static int petname_optfn(int, int, boolean, char *, char *); -static int shared_menu_optfn(int, int, boolean, char *, char *); -static int spcfn_misc_menu_cmd(int, int, boolean, char *, char *); +staticfn void nmcpy(char *, const char *, int); +staticfn void escapes(const char *, char *); +staticfn void rejectoption(const char *); +staticfn char *string_for_opt(char *, boolean); +staticfn char *string_for_env_opt(const char *, char *, boolean); +staticfn void bad_negation(const char *, boolean); +staticfn int change_inv_order(char *); +staticfn boolean warning_opts(char *, const char *); +staticfn int feature_alert_opts(char *, const char *); +staticfn boolean duplicate_opt_detection(int); +staticfn void complain_about_duplicate(int); +staticfn int length_without_val(const char *, int len); +staticfn void determine_ambiguities(void); +staticfn int check_misc_menu_command(char *, char *); +staticfn int opt2roleopt(int); +staticfn char *getoptstr(int, int); +staticfn void saveoptstr(int, const char *); +staticfn void unsaveoptstr(int, int); +staticfn int petname_optfn(int, int, boolean, char *, char *); +staticfn int shared_menu_optfn(int, int, boolean, char *, char *); +staticfn int spcfn_misc_menu_cmd(int, int, boolean, char *, char *); -static const char * msgtype2name(int); -static int query_msgtype(void); -static boolean msgtype_add(int, char *); -static void free_one_msgtype(int); -static int msgtype_count(void); -static boolean test_regex_pattern(const char *, const char *); -static boolean parse_role_opt(int, boolean, const char *, char *, char **); -static char *get_cnf_role_opt(int); -static unsigned int longest_option_name(int, int); -static int doset_simple_menu(void); -static void doset_add_menu(winid, const char *, const char *, int, int); -static int handle_add_list_remove(const char *, int); -static void all_options_conds(strbuf_t *); -static void all_options_menucolors(strbuf_t *); -static void all_options_msgtypes(strbuf_t *); -static void all_options_apes(strbuf_t *); -static void remove_autopickup_exception(struct autopickup_exception *); -static int count_apes(void); -static int count_cond(void); -static void enhance_menu_text(char *, size_t, int, boolean *, +staticfn const char * msgtype2name(int); +staticfn int query_msgtype(void); +staticfn boolean msgtype_add(int, char *); +staticfn void free_one_msgtype(int); +staticfn int msgtype_count(void); +staticfn boolean test_regex_pattern(const char *, const char *); +staticfn boolean parse_role_opt(int, boolean, const char *, char *, char **); +staticfn char *get_cnf_role_opt(int); +staticfn unsigned int longest_option_name(int, int); +staticfn int doset_simple_menu(void); +staticfn void doset_add_menu(winid, const char *, const char *, int, int); +staticfn int handle_add_list_remove(const char *, int); +staticfn void all_options_conds(strbuf_t *); +staticfn void all_options_menucolors(strbuf_t *); +staticfn void all_options_msgtypes(strbuf_t *); +staticfn void all_options_apes(strbuf_t *); +staticfn void remove_autopickup_exception(struct autopickup_exception *); +staticfn int count_apes(void); +staticfn int count_cond(void); +staticfn void enhance_menu_text(char *, size_t, int, boolean *, struct allopt_t *); -static boolean can_set_perm_invent(void); -static int handler_align_misc(int); -static int handler_autounlock(int); -static int handler_disclose(void); -static int handler_menu_headings(void); -static int handler_menustyle(void); -static int handler_msg_window(void); -static int handler_number_pad(void); -static int handler_paranoid_confirmation(void); -static int handler_perminv_mode(void); -static int handler_pickup_burden(void); -static int handler_pickup_types(void); -static int handler_runmode(void); -static int handler_petattr(void); -static int handler_sortloot(void); -static int handler_symset(int); -static int handler_versinfo(void); -static int handler_whatis_coord(void); -static int handler_whatis_filter(void); +staticfn boolean can_set_perm_invent(void); +staticfn int handler_align_misc(int); +staticfn int handler_autounlock(int); +staticfn int handler_disclose(void); +staticfn int handler_menu_headings(void); +staticfn int handler_menustyle(void); +staticfn int handler_msg_window(void); +staticfn int handler_number_pad(void); +staticfn int handler_paranoid_confirmation(void); +staticfn int handler_perminv_mode(void); +staticfn int handler_pickup_burden(void); +staticfn int handler_pickup_types(void); +staticfn int handler_runmode(void); +staticfn int handler_petattr(void); +staticfn int handler_sortloot(void); +staticfn int handler_symset(int); +staticfn int handler_versinfo(void); +staticfn int handler_whatis_coord(void); +staticfn int handler_whatis_filter(void); /* next few are not allopt[] entries, so will only be called directly from doset, not from individual optfn's */ -static int handler_autopickup_exception(void); -static int handler_menu_colors(void); -static int handler_msgtype(void); -static int handler_windowborders(void); +staticfn int handler_autopickup_exception(void); +staticfn int handler_menu_colors(void); +staticfn int handler_msgtype(void); +staticfn int handler_windowborders(void); -static boolean is_wc_option(const char *); -static boolean wc_supported(const char *); -static boolean is_wc2_option(const char *); -static boolean wc2_supported(const char *); -static void wc_set_font_name(int, char *); -static int wc_set_window_colors(char *); -static boolean illegal_menu_cmd_key(uchar); -static const char *term_for_boolean(int, boolean *); +staticfn boolean is_wc_option(const char *); +staticfn boolean wc_supported(const char *); +staticfn boolean is_wc2_option(const char *); +staticfn boolean wc2_supported(const char *); +staticfn void wc_set_font_name(int, char *); +staticfn int wc_set_window_colors(char *); +staticfn boolean illegal_menu_cmd_key(uchar); +staticfn const char *term_for_boolean(int, boolean *); /* ask user if they want a tutorial, except if tutorial boolean option has been set in config - either on or off - in which case just obey that @@ -646,7 +646,7 @@ parseoptions( return FALSE; } -static int +staticfn int check_misc_menu_command(char *opts, char *op UNUSED) { int i; @@ -667,7 +667,7 @@ static int roleopt2opt[4] = { }; /* role => 0, race => 1, gender => 2, alignment =>3 */ -static int +staticfn int opt2roleopt(int roleopt) { switch (roleopt) { @@ -686,7 +686,7 @@ opt2roleopt(int roleopt) } /* fetch saved option string for a particular option phase */ -static char * +staticfn char * getoptstr(int optidx, int ophase) { int roleoptindx = opt2roleopt(optidx); @@ -710,7 +710,7 @@ getoptstr(int optidx, int ophase) } /* to track some unparsed option settings in case #saveoptions needs them */ -static void +staticfn void saveoptstr(int optidx, const char *optstr) { int phase = go.opt_phase, roleoptindx = opt2roleopt(optidx); @@ -728,7 +728,7 @@ saveoptstr(int optidx, const char *optstr) } /* discard specific saved option string */ -static void +staticfn void unsaveoptstr(int optidx, int ophase) { int roleoptindx = opt2roleopt(optidx); @@ -802,7 +802,7 @@ restoptvals(NHFILE *nhfp) #endif /* 0 */ /* common to optfn_catname(), optfn_dogname(), optfn_horsename() */ -static int +staticfn int petname_optfn( int optidx, int req, boolean negated, @@ -839,7 +839,7 @@ petname_optfn( ********************************** */ -static int +staticfn int optfn_alignment( int optidx, int req, @@ -877,7 +877,7 @@ optfn_alignment( } -static int +staticfn int optfn_align_message( int optidx, int req, boolean negated, char *opts, char *op) @@ -927,7 +927,7 @@ optfn_align_message( return optn_ok; } -static int +staticfn int optfn_align_status(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -974,7 +974,7 @@ optfn_align_status(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_altkeyhandling( int optidx UNUSED, int req, @@ -1018,7 +1018,7 @@ optfn_altkeyhandling( return optn_ok; } -static int +staticfn int optfn_autounlock( int optidx, int req, @@ -1123,7 +1123,7 @@ optfn_autounlock( return optn_ok; } -static int +staticfn int optfn_boulder(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -1200,7 +1200,7 @@ optfn_boulder(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_catname( int optidx, int req, boolean negated, @@ -1210,7 +1210,7 @@ optfn_catname( } #ifdef CRASHREPORT -static int +staticfn int optfn_crash_email(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { @@ -1234,7 +1234,7 @@ optfn_crash_email(int optidx UNUSED, int req, boolean negated UNUSED, char *opts return optn_ok; } -static int +staticfn int optfn_crash_name(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { @@ -1258,7 +1258,7 @@ optfn_crash_name(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, return optn_ok; } -static int +staticfn int optfn_crash_urlmax(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { if (req == do_init) { @@ -1288,7 +1288,7 @@ optfn_crash_urlmax(int optidx UNUSED, int req, boolean negated UNUSED, char *opt #endif /* CRASHREPORT */ #ifdef CURSES_GRAPHICS -static int +staticfn int optfn_cursesgraphics(int optidx, int req, boolean negated, char *opts, char *op UNUSED) { @@ -1336,7 +1336,7 @@ optfn_cursesgraphics(int optidx, int req, boolean negated, } #endif -static int +staticfn int optfn_DECgraphics(int optidx, int req, boolean negated, char *opts, char *op UNUSED) { @@ -1383,7 +1383,7 @@ optfn_DECgraphics(int optidx, int req, boolean negated, return optn_ok; } -static int +staticfn int optfn_disclose(int optidx, int req, boolean negated, char *opts, char *op) { int i, idx, prefix_val; @@ -1501,7 +1501,7 @@ optfn_disclose(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_dogname( int optidx, int req, boolean negated, @@ -1510,7 +1510,7 @@ optfn_dogname( return petname_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_dungeon(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -1531,7 +1531,7 @@ optfn_dungeon(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_effects(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -1552,28 +1552,28 @@ optfn_effects(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_font_map(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_menu(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_message(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_size_map( int optidx, int req, boolean negated, char *opts, char *op) @@ -1582,7 +1582,7 @@ optfn_font_size_map( return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_size_menu( int optidx, int req, boolean negated, char *opts, char *op) @@ -1591,7 +1591,7 @@ optfn_font_size_menu( return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_size_message( int optidx, int req, boolean negated, char *opts, char *op) @@ -1600,7 +1600,7 @@ optfn_font_size_message( return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_size_status( int optidx, int req, boolean negated, char *opts, char *op) @@ -1609,7 +1609,7 @@ optfn_font_size_status( return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_size_text( int optidx, int req, boolean negated, char *opts, char *op) @@ -1618,21 +1618,21 @@ optfn_font_size_text( return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_status(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_font_text(int optidx, int req, boolean negated, char *opts, char *op) { /* send them over to the prefix handling for font_ */ return pfxfn_font(optidx, req, negated, opts, op); } -static int +staticfn int optfn_fruit(int optidx UNUSED, int req, boolean negated, char *opts, char *op) { @@ -1702,7 +1702,7 @@ optfn_fruit(int optidx UNUSED, int req, boolean negated, return optn_ok; } -static int +staticfn int optfn_gender( int optidx, int req, @@ -1740,7 +1740,7 @@ optfn_gender( return optn_ok; } -static int +staticfn int optfn_glyph(int optidx UNUSED, int req, boolean negated, char *opts, char *op) { #ifdef ENHANCED_SYMBOLS @@ -1779,7 +1779,7 @@ optfn_glyph(int optidx UNUSED, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_hilite_status( int optidx UNUSED, int req, @@ -1824,7 +1824,7 @@ optfn_hilite_status( return optn_ok; } -static int +staticfn int optfn_horsename( int optidx, int req, boolean negated, @@ -1833,7 +1833,7 @@ optfn_horsename( return petname_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_IBMgraphics(int optidx, int req, boolean negated, char *opts, char *op UNUSED) { @@ -1889,7 +1889,7 @@ optfn_IBMgraphics(int optidx, int req, boolean negated, return optn_ok; } -static int +staticfn int optfn_map_mode(int optidx, int req, boolean negated, char *opts, char *op) { int i; @@ -1969,7 +1969,7 @@ optfn_map_mode(int optidx, int req, boolean negated, char *opts, char *op) /* all the key assignment options for menu_* commands are identical but optlist.h treats them as distinct rather than sharing one */ -static int +staticfn int shared_menu_optfn(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { @@ -1994,91 +1994,91 @@ shared_menu_optfn(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_menu_deselect_all(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_deselect_page(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_first_page(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_invert_all(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_invert_page(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_last_page(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_next_page(int optidx , int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_previous_page(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_search(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_select_all(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_select_page(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_shift_left(int optidx, int req, boolean negated, char *opts, char *op) { return shared_menu_optfn(optidx, req, negated, opts, op); } -static int +staticfn int optfn_menu_shift_right(int optidx, int req, boolean negated, char *opts, char *op) { @@ -2087,7 +2087,7 @@ optfn_menu_shift_right(int optidx, int req, boolean negated, /* end of shared key assignments for menu commands */ -static int +staticfn int optfn_menu_headings( int optidx, int req, boolean negated, @@ -2129,7 +2129,7 @@ optfn_menu_headings( return optn_ok; } -static int +staticfn int optfn_menuinvertmode( int optidx, int req, boolean negated UNUSED, @@ -2159,7 +2159,7 @@ optfn_menuinvertmode( return optn_ok; } -static int +staticfn int optfn_menustyle(int optidx, int req, boolean negated, char *opts, char *op) { int tmp; @@ -2215,7 +2215,7 @@ optfn_menustyle(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_monsters(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -2232,7 +2232,7 @@ optfn_monsters(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_mouse_support( int optidx, int req, boolean negated, char *opts, char *op) @@ -2292,7 +2292,7 @@ optfn_mouse_support( return optn_ok; } -static int +staticfn int optfn_msg_window(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; @@ -2357,7 +2357,7 @@ optfn_msg_window(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_msghistory(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -2381,7 +2381,7 @@ optfn_msghistory(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_name( int optidx, int req, boolean negated UNUSED, char *opts, char *op) @@ -2406,7 +2406,7 @@ optfn_name( return optn_ok; } -static int +staticfn int optfn_number_pad( int optidx, int req, boolean negated, char *opts, char *op) @@ -2480,7 +2480,7 @@ optfn_number_pad( return optn_ok; } -static int +staticfn int optfn_objects(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -2501,7 +2501,7 @@ optfn_objects(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_packorder(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { @@ -2526,7 +2526,7 @@ optfn_packorder(int optidx UNUSED, int req, boolean negated UNUSED, } #ifdef CHANGE_COLOR -static int +staticfn int optfn_palette( int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) @@ -2628,7 +2628,7 @@ optfn_palette( #endif /* CHANGE_COLOR */ /* for "paranoid_confirmation:foo" and alias "[!]prayconfirm" */ -static int +staticfn int optfn_paranoid_confirmation( int optidx, int req, boolean opt_negated, char *opts, char *op) @@ -2856,7 +2856,7 @@ optfn_paranoid_confirmation( return optn_ok; } -static int +staticfn int optfn_perminv_mode( int optidx, int req, boolean negated, char *opts, char *op) @@ -2948,7 +2948,7 @@ optfn_perminv_mode( return retval; } -static int +staticfn int optfn_petattr( int optidx, int req, boolean negated, char *opts, char *op) @@ -3007,7 +3007,7 @@ optfn_petattr( return optn_ok; } -static int +staticfn int optfn_pettype(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -3064,7 +3064,7 @@ optfn_pettype(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_pickup_burden( int optidx, int req, boolean negated UNUSED, char *opts, char *op) @@ -3116,7 +3116,7 @@ optfn_pickup_burden( return optn_ok; } -static int +staticfn int optfn_pickup_types( int optidx, int req, boolean negated, @@ -3213,7 +3213,7 @@ optfn_pickup_types( return optn_ok; } -static int +staticfn int optfn_pile_limit( int optidx, int req, boolean negated, @@ -3248,7 +3248,7 @@ optfn_pile_limit( return optn_ok; } -static int +staticfn int optfn_player_selection( int optidx, int req, boolean negated, char *opts, char *op) @@ -3281,7 +3281,7 @@ optfn_player_selection( return optn_ok; } -static int +staticfn int optfn_playmode(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -3315,7 +3315,7 @@ optfn_playmode(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_race( int optidx, int req, @@ -3353,7 +3353,7 @@ optfn_race( return optn_ok; } -static int +staticfn int optfn_roguesymset(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { @@ -3392,7 +3392,7 @@ optfn_roguesymset(int optidx, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_role( int optidx, int req, @@ -3430,7 +3430,7 @@ optfn_role( return optn_ok; } -static int +staticfn int optfn_runmode(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -3469,7 +3469,7 @@ optfn_runmode(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_scores(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -3560,7 +3560,7 @@ optfn_scores(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_scroll_amount( int optidx, int req, boolean negated, char *opts, char *op) @@ -3591,7 +3591,7 @@ optfn_scroll_amount( return optn_ok; } -static int +staticfn int optfn_scroll_margin( int optidx, int req, boolean negated, char *opts, char *op) @@ -3621,7 +3621,7 @@ optfn_scroll_margin( return optn_ok; } -static int +staticfn int optfn_soundlib(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { @@ -3656,7 +3656,7 @@ optfn_soundlib(int optidx, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_sortdiscoveries( int optidx, int req, boolean negated, char *opts, char *op) @@ -3707,7 +3707,7 @@ optfn_sortdiscoveries( return optn_ok; } -static int +staticfn int optfn_sortloot( int optidx, int req, boolean negated UNUSED, @@ -3752,7 +3752,7 @@ optfn_sortloot( return optn_ok; } -static int +staticfn int optfn_sortvanquished( int optidx, int req, boolean negated, @@ -3808,7 +3808,7 @@ optfn_sortvanquished( return optn_ok; } -static int +staticfn int optfn_statushilites( int optidx UNUSED, int req, @@ -3865,7 +3865,7 @@ optfn_statushilites( return optn_ok; } -static int +staticfn int optfn_statuslines( int optidx, int req, boolean negated, char *opts, char *op) @@ -3909,7 +3909,7 @@ optfn_statuslines( } #ifdef WIN32CON -static int +staticfn int optfn_subkeyvalue( int optidx UNUSED, int req, @@ -3936,7 +3936,7 @@ optfn_subkeyvalue( } #endif /* WIN32CON */ -static int +staticfn int optfn_suppress_alert(int optidx, int req, boolean negated, char *opts, char *op) { @@ -3967,7 +3967,7 @@ optfn_suppress_alert(int optidx, int req, boolean negated, extern const char *const known_handling[]; /* symbols.c */ extern const char *const known_restrictions[]; /* symbols.c */ -static int +staticfn int optfn_symset( int optidx UNUSED, int req, @@ -4044,7 +4044,7 @@ optfn_symset( return optn_ok; } -static int +staticfn int optfn_term_cols(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; @@ -4083,7 +4083,7 @@ optfn_term_cols(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_term_rows(int optidx, int req, boolean negated, char *opts, char *op) { int retval = optn_ok; @@ -4122,7 +4122,7 @@ optfn_term_rows(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_tile_file(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op) { @@ -4154,7 +4154,7 @@ optfn_tile_file(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_tile_height(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -4184,7 +4184,7 @@ optfn_tile_height(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_tile_width(int optidx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -4214,7 +4214,7 @@ optfn_tile_width(int optidx, int req, boolean negated, char *opts, char *op) return optn_ok; } -static int +staticfn int optfn_traps(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -4235,7 +4235,7 @@ optfn_traps(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_vary_msgcount( int optidx, int req, boolean negated, char *opts, char *op) @@ -4267,7 +4267,7 @@ optfn_vary_msgcount( return optn_ok; } -static int +staticfn int optfn_versinfo( int optidx, int req, boolean negated, char *opts, char *op) @@ -4333,7 +4333,7 @@ optfn_versinfo( } #ifdef VIDEOSHADES -static int +staticfn int optfn_videocolors(int optidx, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -4367,7 +4367,7 @@ optfn_videocolors(int optidx, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_videoshades(int optidx, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -4397,7 +4397,7 @@ optfn_videoshades(int optidx, int req, boolean negated UNUSED, #endif /* VIDEOSHADES */ #ifdef MSDOS -static int +staticfn int optfn_video_width(int optidx UNUSED, int req, boolean negated, char *opts, char *op) { @@ -4417,7 +4417,7 @@ optfn_video_width(int optidx UNUSED, int req, boolean negated, return optn_ok; } -static int +staticfn int optfn_video_height(int optidx UNUSED, int req, boolean negated, char *opts, char *op) { @@ -4438,7 +4438,7 @@ optfn_video_height(int optidx UNUSED, int req, boolean negated, } #ifdef NO_TERMS -static int +staticfn int optfn_video(int optidx, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -4472,7 +4472,7 @@ optfn_video(int optidx, int req, boolean negated UNUSED, #endif /* NO_TERMS */ #endif /* MSDOS */ -static int +staticfn int optfn_warnings(int optidx, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -4492,7 +4492,7 @@ optfn_warnings(int optidx, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_whatis_coord( int optidx, int req, boolean negated, char *opts, char *op) @@ -4537,7 +4537,7 @@ optfn_whatis_coord( return optn_ok; } -static int +staticfn int optfn_whatis_filter( int optidx, int req, boolean negated, char *opts, char *op) @@ -4586,7 +4586,7 @@ optfn_whatis_filter( return optn_ok; } -static int +staticfn int optfn_windowborders( int optidx, int req, boolean negated, char *opts, char *op) @@ -4646,7 +4646,7 @@ optfn_windowborders( } #ifdef WINCHAIN -static int +staticfn int optfn_windowchain( int optidx, int req, boolean negated UNUSED, @@ -4674,7 +4674,7 @@ optfn_windowchain( } #endif -static int +staticfn int optfn_windowcolors(int optidx, int req, boolean negated UNUSED, char *opts, char *op) { @@ -4714,7 +4714,7 @@ optfn_windowcolors(int optidx, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_windowtype( int optidx, int req, boolean negated UNUSED, @@ -4762,7 +4762,7 @@ optfn_windowtype( * Prefix-handling functions */ -static int +staticfn int pfxfn_cond_( int optidx UNUSED, int req, @@ -4807,7 +4807,7 @@ pfxfn_cond_( return optn_ok; } -static int +staticfn int pfxfn_font(int optidx, int req, boolean negated, char *opts, char *op) { int opttype = -1; @@ -4960,7 +4960,7 @@ pfxfn_IBM_(int optidx UNUSED, int req, boolean negated UNUSED, * (Use optidx to reference the specific option) */ -static int +staticfn int optfn_boolean( int optidx, int req, boolean negated, char *opts, char *op) @@ -5186,7 +5186,7 @@ optfn_boolean( return optn_ok; } -static int +staticfn int spcfn_misc_menu_cmd(int midx, int req, boolean negated, char *opts, char *op) { if (req == do_init) { @@ -5222,7 +5222,7 @@ spcfn_misc_menu_cmd(int midx, int req, boolean negated, char *opts, char *op) */ /* test whether 'perm_invent' can be toggled On */ -static boolean +staticfn boolean can_set_perm_invent(void) { /* @@ -5263,7 +5263,7 @@ can_set_perm_invent(void) return TRUE; } -static int +staticfn int handler_menustyle(void) { winid tmpwin; @@ -5305,7 +5305,7 @@ handler_menustyle(void) return optn_ok; } -static int +staticfn int handler_align_misc(int optidx) { winid tmpwin; @@ -5343,7 +5343,7 @@ handler_align_misc(int optidx) return optn_ok; } -static int +staticfn int handler_autounlock(int optidx) { winid tmpwin; @@ -5394,7 +5394,7 @@ handler_autounlock(int optidx) return res; } -static int +staticfn int handler_disclose(void) { winid tmpwin; @@ -5499,7 +5499,7 @@ handler_disclose(void) return optn_ok; } -static int +staticfn int handler_menu_headings(void) { boolean gotca = query_color_attr(&iflags.menu_headings, @@ -5514,7 +5514,7 @@ handler_menu_headings(void) return optn_ok; } -static int +staticfn int handler_msg_window(void) { #if PREV_MSGS /* tty or curses */ @@ -5573,7 +5573,7 @@ handler_msg_window(void) return optn_ok; } -static int +staticfn int handler_number_pad(void) { winid tmpwin; @@ -5633,7 +5633,7 @@ handler_number_pad(void) return optn_ok; } -static int +staticfn int handler_paranoid_confirmation(void) { winid tmpwin; @@ -5691,7 +5691,7 @@ handler_paranoid_confirmation(void) return optn_ok; } -static int +staticfn int handler_perminv_mode(void) { winid tmpwin; @@ -5766,7 +5766,7 @@ handler_perminv_mode(void) return optn_ok; } -static int +staticfn int handler_pickup_burden(void) { winid tmpwin; @@ -5794,7 +5794,7 @@ handler_pickup_burden(void) return optn_ok; } -static int +staticfn int handler_pickup_types(void) { char buf[BUFSZ]; @@ -5804,7 +5804,7 @@ handler_pickup_types(void) return optn_ok; } -static int +staticfn int handler_runmode(void) { winid tmpwin; @@ -5832,7 +5832,7 @@ handler_runmode(void) return optn_ok; } -static int +staticfn int handler_petattr(void) { int tmp = query_attr("Select pet highlight attribute", iflags.wc2_petattr); @@ -5846,7 +5846,7 @@ handler_petattr(void) return optn_ok; } -static int +staticfn int handler_sortloot(void) { winid tmpwin; @@ -5885,7 +5885,7 @@ handler_sortloot(void) return optn_ok; } -static int +staticfn int handler_whatis_coord(void) { winid tmpwin; @@ -5958,7 +5958,7 @@ handler_whatis_coord(void) return optn_ok; } -static int +staticfn int handler_whatis_filter(void) { winid tmpwin; @@ -6000,7 +6000,7 @@ handler_whatis_filter(void) return optn_ok; } -static int +staticfn int handler_symset(int optidx) { int reslt; @@ -6010,7 +6010,7 @@ handler_symset(int optidx) return reslt; } -static int +staticfn int handler_autopickup_exception(void) { winid tmpwin; @@ -6086,7 +6086,7 @@ handler_autopickup_exception(void) return optn_ok; } -static int +staticfn int handler_menu_colors(void) { winid tmpwin; @@ -6181,7 +6181,7 @@ handler_menu_colors(void) return optn_ok; } -static int +staticfn int handler_msgtype(void) { winid tmpwin; @@ -6253,7 +6253,7 @@ handler_msgtype(void) } -static int +staticfn int handler_versinfo(void) { winid tmpwin; @@ -6300,7 +6300,7 @@ handler_versinfo(void) return optn_ok; } -static int +staticfn int handler_windowborders(void) { winid tmpwin; @@ -6345,7 +6345,7 @@ handler_windowborders(void) ********************************** */ -static char * +staticfn char * string_for_opt(char *opts, boolean val_optional) { char *colon, *equals; @@ -6363,7 +6363,7 @@ string_for_opt(char *opts, boolean val_optional) return colon; } -static char * +staticfn char * string_for_env_opt(const char *optname, char *opts, boolean val_optional) { if (!go.opt_initial) { @@ -6373,7 +6373,7 @@ string_for_env_opt(const char *optname, char *opts, boolean val_optional) return string_for_opt(opts, val_optional); } -static void +staticfn void bad_negation(const char *optname, boolean with_parameter) { config_error_add("The %s option may not %sbe negated.", optname, @@ -6383,7 +6383,7 @@ bad_negation(const char *optname, boolean with_parameter) /* go through all of the options and set the minmatch value based on what is needed for uniqueness of each individual option. Set a minimum of 3 characters. */ -static void +staticfn void determine_ambiguities(void) { int i, j, len, tmpneeded, needed[SIZE(allopt)]; @@ -6419,7 +6419,7 @@ determine_ambiguities(void) } } -static int +staticfn int length_without_val(const char *user_string, int len) { const char *p = strchr(user_string, ':'), @@ -6462,7 +6462,7 @@ reset_duplicate_opt_detection(void) allopt[k].dupdetected = 0; } -static boolean +staticfn boolean duplicate_opt_detection(int optidx) { if (go.opt_initial && go.opt_from_file) @@ -6470,7 +6470,7 @@ duplicate_opt_detection(int optidx) return FALSE; } -static void +staticfn void complain_about_duplicate(int optidx) { char buf[BUFSZ]; @@ -6492,7 +6492,7 @@ complain_about_duplicate(int optidx) return; } -static void +staticfn void rejectoption(const char *optname) { #ifdef MICRO @@ -6541,7 +6541,7 @@ nh_getenv(const char *ev) /* copy up to maxlen-1 characters; 'dest' must be able to hold maxlen; treat comma as alternate end of 'src' */ -static void +staticfn void nmcpy(char *dest, const char *src, int maxlen) { int count; @@ -6576,7 +6576,7 @@ nmcpy(char *dest, const char *src, int maxlen) * an appropriate digit will also fall through to \ and yield 'X' * or 'O', plus stop if the non-digit is end-of-string. */ -static void +staticfn void escapes(const char *cp, /* might be 'tp', updating in place */ char *tp) /* result is never longer than 'cp' */ { @@ -7160,7 +7160,7 @@ initoptions_finish(void) * Used by: optfn_packorder() * */ -static int +staticfn int change_inv_order(char *op) { int oc_sym, num; @@ -7215,7 +7215,7 @@ change_inv_order(char *op) * */ -static boolean +staticfn boolean warning_opts(char *opts, const char *optype) { uchar translate[WARNCOUNT]; @@ -7252,7 +7252,7 @@ assign_warnings(uchar *graph_chars) * */ -static int +staticfn int feature_alert_opts(char *op, const char *optn) { char buf[BUFSZ]; @@ -7384,7 +7384,7 @@ static const struct { { "norep", MSGTYP_NOREP, "Do not repeat the message" } }; -static const char * +staticfn const char * msgtype2name(int typ) { int i; @@ -7395,7 +7395,7 @@ msgtype2name(int typ) return (char *) 0; } -static int +staticfn int query_msgtype(void) { winid tmpwin; @@ -7425,7 +7425,7 @@ query_msgtype(void) return -1; } -static boolean +staticfn boolean msgtype_add(int typ, char *pattern) { static const char *const re_error = "MSGTYPE regex error"; @@ -7465,7 +7465,7 @@ msgtype_free(void) gp.plinemsg_types = (struct plinemsg_type *) 0; } -static void +staticfn void free_one_msgtype(int idx) /* 0 .. */ { struct plinemsg_type *tmp = gp.plinemsg_types; @@ -7524,7 +7524,7 @@ hide_unhide_msgtypes(boolean hide, int hide_mask) } } -static int +staticfn int msgtype_count(void) { int c = 0; @@ -7564,7 +7564,7 @@ msgtype_parse_add(char *str) /* parse 'str' as a regular expression to check whether it's valid; compiled regexp gets thrown away regardless of the outcome */ -static boolean +staticfn boolean test_regex_pattern(const char *str, const char *errmsg) { static const char def_errmsg[] = "NHregex error"; @@ -7598,7 +7598,7 @@ test_regex_pattern(const char *str, const char *errmsg) } /* parse 'role' or 'race' or 'gender' or 'alignment' */ -static boolean +staticfn boolean parse_role_opt( int optidx, boolean negated, @@ -7714,7 +7714,7 @@ parse_role_opt( /* fetch a saved role|race|gender|alignment value suitable for writing into a new run-time config file */ -static char * +staticfn char * get_cnf_role_opt(int optidx) { int phase; @@ -7730,7 +7730,7 @@ get_cnf_role_opt(int optidx) } /* Check if character c is illegal as a menu command key */ -static boolean +staticfn boolean illegal_menu_cmd_key(uchar c) { if (c == 0 || c == '\r' || c == '\n' || c == '\033' || c == ' ' @@ -8002,7 +8002,7 @@ static const char n_currently_set[] = "(%d currently set)"; DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after show_menucontrols() */ -static int +staticfn int optfn_o_autopickup_exceptions( int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) @@ -8024,7 +8024,7 @@ optfn_o_autopickup_exceptions( return optn_ok; } -static int +staticfn int optfn_o_bind_keys( int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) @@ -8046,7 +8046,7 @@ optfn_o_bind_keys( return optn_ok; } -static int +staticfn int optfn_o_menu_colors(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op UNUSED) { @@ -8067,7 +8067,7 @@ optfn_o_menu_colors(int optidx UNUSED, int req, boolean negated UNUSED, return optn_ok; } -static int +staticfn int optfn_o_message_types( int optidx UNUSED, int req, @@ -8092,7 +8092,7 @@ optfn_o_message_types( return optn_ok; } -static int +staticfn int optfn_o_status_cond( int optidx UNUSED, int req, @@ -8124,7 +8124,7 @@ optfn_o_status_cond( } #ifdef STATUS_HILITES -static int +staticfn int optfn_o_status_hilites( int optidx UNUSED, int req, @@ -8186,7 +8186,7 @@ get_option_value(const char *optname, boolean cnfvalid) return (char *) 0; } -static unsigned int +staticfn unsigned int longest_option_name(int startpass, int endpass) { /* spin through the options to find the longest name */ @@ -8214,7 +8214,7 @@ longest_option_name(int startpass, int endpass) } /* guts of doset_simple(); called repeatedly until no choice is made */ -static int +staticfn int doset_simple_menu(void) { /* unlike doset()'s fmtstr, there is no leading %s for indentation */ @@ -8427,7 +8427,7 @@ doset_simple(void) return ECMD_OK; } -static const char * +staticfn const char * term_for_boolean(int idx, boolean *b) { int i, f_t = (*b) ? 1: 0; @@ -8682,7 +8682,7 @@ doset(void) /* changing options via menu by Per Liboriussen */ #undef HELP_IDX /* doset(#optionsfull command) menu entries for compound options */ -static void +staticfn void doset_add_menu( winid win, /* window to add to */ const char *option, /* option name */ @@ -8843,7 +8843,7 @@ show_menu_controls(winid win, boolean dolist) RESTORE_WARNING_FORMAT_NONLITERAL -static int +staticfn int count_cond(void) { int i, cnt = 0; @@ -8855,7 +8855,7 @@ count_cond(void) return cnt; } -static int +staticfn int count_apes(void) { int numapes = 0; @@ -8872,7 +8872,7 @@ count_apes(void) DISABLE_WARNING_FORMAT_NONLITERAL /* common to msg-types, menu-colors, autopickup-exceptions */ -static int +staticfn int handle_add_list_remove(const char *optname, int numtotal) { winid tmpwin; @@ -8991,7 +8991,7 @@ add_autopickup_exception(const char *mapping) return 1; } -static void +staticfn void remove_autopickup_exception(struct autopickup_exception *whichape) { struct autopickup_exception *ape, *freeape, *prev = 0; @@ -9197,7 +9197,7 @@ option_help(void) entry spread across multiple lines with backslash+newline if needed; conditions with their default settings (cond_blind, !cond_glowhands, &c) are excluded */ -static void +staticfn void all_options_conds(strbuf_t *sbuf) { char buf[BUFSZ], nextcond[BUFSZ]; @@ -9236,7 +9236,7 @@ all_options_conds(strbuf_t *sbuf) } /* append menucolor lines to strbuf */ -static void +staticfn void all_options_menucolors(strbuf_t *sbuf) { int i = 0, ncolors = count_menucolors(); @@ -9269,7 +9269,7 @@ all_options_menucolors(strbuf_t *sbuf) free(arr); } -static void +staticfn void all_options_msgtypes(strbuf_t *sbuf) { struct plinemsg_type *tmp = gp.plinemsg_types; @@ -9284,7 +9284,7 @@ all_options_msgtypes(strbuf_t *sbuf) } } -static void +staticfn void all_options_apes(strbuf_t *sbuf) { struct autopickup_exception *tmp = ga.apelist; @@ -9513,7 +9513,7 @@ set_wc_option_mod_status(unsigned long optmask, int status) } } -static boolean +staticfn boolean is_wc_option(const char *optnam) { int k = 0; @@ -9526,7 +9526,7 @@ is_wc_option(const char *optnam) return FALSE; } -static boolean +staticfn boolean wc_supported(const char *optnam) { int k; @@ -9567,7 +9567,7 @@ set_wc2_option_mod_status(unsigned long optmask, int status) } } -static boolean +staticfn boolean is_wc2_option(const char *optnam) { int k = 0; @@ -9580,7 +9580,7 @@ is_wc2_option(const char *optnam) return FALSE; } -static boolean +staticfn boolean wc2_supported(const char *optnam) { int k; @@ -9593,7 +9593,7 @@ wc2_supported(const char *optnam) return FALSE; } -static void +staticfn void wc_set_font_name(int opttype, char *fontname) { char **fn = (char **) 0; @@ -9627,7 +9627,7 @@ wc_set_font_name(int opttype, char *fontname) return; } -static int +staticfn int wc_set_window_colors(char *op) { /* syntax: @@ -9742,7 +9742,7 @@ set_playmode(void) /* don't need to do anything special for normal play */ } -static void +staticfn void enhance_menu_text( char *buf, size_t sz, diff --git a/src/pager.c b/src/pager.c index 2b2c051be..b0007b687 100644 --- a/src/pager.c +++ b/src/pager.c @@ -11,46 +11,46 @@ #include "hack.h" #include "dlb.h" -static boolean is_swallow_sym(int); -static int append_str(char *, const char *) NONNULLPTRS; -static void trap_description(char *, int, coordxy, coordxy) NONNULLARG1; -static void look_at_object(char *, coordxy, coordxy, int) NONNULLARG1; -static void look_at_monster(char *, char *, struct monst *, +staticfn boolean is_swallow_sym(int); +staticfn int append_str(char *, const char *) NONNULLPTRS; +staticfn void trap_description(char *, int, coordxy, coordxy) NONNULLARG1; +staticfn void look_at_object(char *, coordxy, coordxy, int) NONNULLARG1; +staticfn void look_at_monster(char *, char *, struct monst *, coordxy, coordxy) NONNULLARG13; /* lookat() can return Null */ -static struct permonst *lookat(coordxy, coordxy, char *, char *) NONNULLPTRS; -static boolean checkfile(char *, struct permonst *, unsigned, +staticfn struct permonst *lookat(coordxy, coordxy, char *, char *) NONNULLPTRS; +staticfn boolean checkfile(char *, struct permonst *, unsigned, char *) NO_NNARGS; -static int add_cmap_descr(int, int, int, int, coord, +staticfn int add_cmap_descr(int, int, int, int, coord, const char *, const char *, boolean *, const char **, char *) NONNULLPTRS; -static void look_region_nearby(coordxy *, coordxy *, coordxy *, coordxy *, +staticfn void look_region_nearby(coordxy *, coordxy *, coordxy *, coordxy *, boolean) NONNULLPTRS; -static void look_all(boolean, boolean); -static void look_traps(boolean); -static void look_engrs(boolean); -static void do_supplemental_info(char *, struct permonst *, +staticfn void look_all(boolean, boolean); +staticfn void look_traps(boolean); +staticfn void look_engrs(boolean); +staticfn void do_supplemental_info(char *, struct permonst *, boolean) NONNULLPTRS; -static void whatdoes_help(void); -static void docontact(void); -static void dispfile_help(void); -static void dispfile_shelp(void); -static void dispfile_optionfile(void); -static void dispfile_optmenu(void); -static void dispfile_license(void); -static void dispfile_debughelp(void); -static void dispfile_usagehelp(void); -static void hmenu_doextversion(void); -static void hmenu_dohistory(void); -static void hmenu_dowhatis(void); -static void hmenu_dowhatdoes(void); -static void hmenu_doextlist(void); -static void domenucontrols(void); +staticfn void whatdoes_help(void); +staticfn void docontact(void); +staticfn void dispfile_help(void); +staticfn void dispfile_shelp(void); +staticfn void dispfile_optionfile(void); +staticfn void dispfile_optmenu(void); +staticfn void dispfile_license(void); +staticfn void dispfile_debughelp(void); +staticfn void dispfile_usagehelp(void); +staticfn void hmenu_doextversion(void); +staticfn void hmenu_dohistory(void); +staticfn void hmenu_dowhatis(void); +staticfn void hmenu_dowhatdoes(void); +staticfn void hmenu_doextlist(void); +staticfn void domenucontrols(void); #ifdef PORT_HELP extern void port_help(void); #endif -static char *setopt_cmd(char *) NONNULL NONNULLARG1; -static boolean add_quoted_engraving(coordxy, coordxy, char *) NONNULLARG3; +staticfn char *setopt_cmd(char *) NONNULL NONNULLARG1; +staticfn boolean add_quoted_engraving(coordxy, coordxy, char *) NONNULLARG3; enum checkfileflags { chkfilNone = 0, @@ -63,7 +63,7 @@ static const char invisexplain[] = "remembered, unseen, creature", altinvisexplain[] = "unseen creature"; /* for clairvoyance */ /* Returns "true" for characters that could represent a monster's stomach. */ -static boolean +staticfn boolean is_swallow_sym(int c) { int i; @@ -77,7 +77,7 @@ is_swallow_sym(int c) /* Append " or "+new_str to the end of buf if new_str doesn't already exist as a substring of buf. Return 1 if the string was appended, 0 otherwise. It is expected that buf is of size BUFSZ. */ -static int +staticfn int append_str(char *buf, const char *new_str) { static const char sep[] = " or "; @@ -159,7 +159,7 @@ monhealthdescr(struct monst *mon, boolean addspace, char *outbuf) } /* copy a trap's description into outbuf[] */ -static void +staticfn void trap_description(char *outbuf, int tnum, coordxy x, coordxy y) { /* @@ -310,7 +310,7 @@ object_from_map(int glyph, coordxy x, coordxy y, struct obj **obj_p) return fakeobj; /* when True, caller needs to dealloc *obj_p */ } -static void +staticfn void look_at_object( char *buf, /* output buffer */ coordxy x, coordxy y, @@ -346,7 +346,7 @@ look_at_object( return; } -static void +staticfn void look_at_monster( char *buf, char *monbuf, /* buf: output, monbuf: optional output */ struct monst *mtmp, @@ -578,7 +578,7 @@ ice_descr(coordxy x, coordxy y, char *outbuf) * Return the name of the glyph found at (x,y). * If not hallucinating and the glyph is a monster, also monster data. */ -static struct permonst * +staticfn struct permonst * lookat(coordxy x, coordxy y, char *buf, char *monbuf) { struct monst *mtmp = (struct monst *) 0; @@ -751,7 +751,7 @@ ia_checkfile(struct obj *otmp) * * Returns True if an entry is found, False otherwise. */ -static boolean +staticfn boolean checkfile( char *inp, /* string to look up */ struct permonst *pm, /* monster type to look up (overrides 'inp') */ @@ -1054,7 +1054,7 @@ checkfile( } /* extracted from do_screen_description() */ -static int +staticfn int add_cmap_descr( int found, /* number of matching descriptions so far */ int idx, /* cmap index into defsyms[] */ @@ -1529,7 +1529,7 @@ do_screen_description( } /* when farlook is reporting on an engraving, include its text */ -static boolean +staticfn boolean add_quoted_engraving(coordxy x, coordxy y, char *buf) { char temp_buf[BUFSZ]; @@ -1828,7 +1828,7 @@ do_look(int mode, coord *click_cc) return ECMD_OK; } -static void +staticfn void look_region_nearby( coordxy *lo_x, coordxy *lo_y, coordxy *hi_x, coordxy *hi_y, boolean nearby) @@ -1841,7 +1841,7 @@ look_region_nearby( DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after do_supplemental_info() */ -static void +staticfn void look_all( boolean nearby, /* True => within BOLTLIM, False => entire map */ boolean do_mons) /* True => monsters, False => objects */ @@ -1942,7 +1942,7 @@ look_all( } /* give a /M style display of discovered traps, even when they're covered */ -static void +staticfn void look_traps(boolean nearby) { winid win; @@ -2008,7 +2008,7 @@ look_traps(boolean nearby) /* display of discovered engravings including headstones, even when they're covered provided they've been read */ -static void +staticfn void look_engrs(boolean nearby) { winid win; @@ -2119,7 +2119,7 @@ static const char *suptext2[] = { (char *) 0, }; -static void +staticfn void do_supplemental_info( char *name, struct permonst *pm, @@ -2287,7 +2287,7 @@ doidtrap(void) rest_on_space, #if SHELL, #if SUSPEND) are booleans. */ -static void +staticfn void whatdoes_help(void) { dlb *fp; @@ -2322,9 +2322,9 @@ struct wd_stack_frame { Bitfield(else_seen, 1); }; -static boolean whatdoes_cond(char *, struct wd_stack_frame *, int *, int); +staticfn boolean whatdoes_cond(char *, struct wd_stack_frame *, int *, int); -static boolean +staticfn boolean whatdoes_cond(char *buf, struct wd_stack_frame *stack, int *depth, int lnum) { const char badstackfmt[] = "cmdhlp: too many &%c directives at line %d."; @@ -2584,7 +2584,7 @@ dowhatdoes(void) return ECMD_OK; } -static void +staticfn void docontact(void) { winid cwin = create_nhwindow(NHW_TEXT); @@ -2614,79 +2614,79 @@ docontact(void) destroy_nhwindow(cwin); } -static void +staticfn void dispfile_help(void) { display_file(HELP, TRUE); } -static void +staticfn void dispfile_shelp(void) { display_file(SHELP, TRUE); } -static void +staticfn void dispfile_optionfile(void) { display_file(OPTIONFILE, TRUE); } -static void +staticfn void dispfile_optmenu(void) { display_file(OPTMENUHELP, TRUE); } -static void +staticfn void dispfile_license(void) { display_file(LICENSE, TRUE); } -static void +staticfn void dispfile_debughelp(void) { display_file(DEBUGHELP, TRUE); } -static void +staticfn void dispfile_usagehelp(void) { display_file(USAGEHELP, TRUE); } -static void +staticfn void hmenu_doextversion(void) { (void) doextversion(); } -static void +staticfn void hmenu_dohistory(void) { (void) dohistory(); } -static void +staticfn void hmenu_dowhatis(void) { (void) dowhatis(); } -static void +staticfn void hmenu_dowhatdoes(void) { (void) dowhatdoes(); } -static void +staticfn void hmenu_doextlist(void) { (void) doextlist(); } -static void +staticfn void domenucontrols(void) { winid cwin = create_nhwindow(NHW_TEXT); @@ -2774,7 +2774,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL normally 'O' but could be bound to something else, or not bound at all; with the implementation of a simple options subset, now need 'mO' to get the full options command; format it as 'm O' */ -static char * +staticfn char * setopt_cmd(char *outbuf) { char cmdbuf[QBUFSZ]; diff --git a/src/pickup.c b/src/pickup.c index 3256ff734..a215d4ff8 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -11,47 +11,47 @@ #define CONTAINED_SYM '>' /* from invent.c */ -static void simple_look(struct obj *, boolean); -static boolean query_classes(char *, boolean *, boolean *, const char *, +staticfn void simple_look(struct obj *, boolean); +staticfn boolean query_classes(char *, boolean *, boolean *, const char *, struct obj *, boolean, int *); -static boolean fatal_corpse_mistake(struct obj *, boolean); -static boolean describe_decor(void); -static void check_here(boolean); -static boolean n_or_more(struct obj *); -static boolean all_but_uchain(struct obj *); +staticfn boolean fatal_corpse_mistake(struct obj *, boolean); +staticfn boolean describe_decor(void); +staticfn void check_here(boolean); +staticfn boolean n_or_more(struct obj *); +staticfn boolean all_but_uchain(struct obj *); #if 0 /* not used */ -static boolean allow_cat_no_uchain(struct obj *); +staticfn boolean allow_cat_no_uchain(struct obj *); #endif -static int autopick(struct obj *, int, menu_item **); -static int count_categories(struct obj *, int); -static int delta_cwt(struct obj *, struct obj *); -static long carry_count(struct obj *, struct obj *, long, boolean, int *, +staticfn int autopick(struct obj *, int, menu_item **); +staticfn int count_categories(struct obj *, int); +staticfn int delta_cwt(struct obj *, struct obj *); +staticfn long carry_count(struct obj *, struct obj *, long, boolean, int *, int *); -static int lift_object(struct obj *, struct obj *, long *, boolean); -static void pickup_prinv(struct obj *, long, const char *); -static boolean mbag_explodes(struct obj *, int); -static boolean is_boh_item_gone(void); -static void do_boh_explosion(struct obj *, boolean); -static long boh_loss(struct obj *, boolean); -static int in_container(struct obj *); -static int out_container(struct obj *); -static long mbag_item_gone(boolean, struct obj *, boolean); -static int stash_ok(struct obj *); -static void explain_container_prompt(boolean); -static int traditional_loot(boolean); -static int menu_loot(int, boolean); -static int tip_ok(struct obj *); -static int choose_tip_container_menu(void); -static struct obj *tipcontainer_gettarget(struct obj *, boolean *); -static int tipcontainer_checks(struct obj *, struct obj *, boolean); -static char in_or_out_menu(const char *, struct obj *, boolean, boolean, +staticfn int lift_object(struct obj *, struct obj *, long *, boolean); +staticfn void pickup_prinv(struct obj *, long, const char *); +staticfn boolean mbag_explodes(struct obj *, int); +staticfn boolean is_boh_item_gone(void); +staticfn void do_boh_explosion(struct obj *, boolean); +staticfn long boh_loss(struct obj *, boolean); +staticfn int in_container(struct obj *); +staticfn int out_container(struct obj *); +staticfn long mbag_item_gone(boolean, struct obj *, boolean); +staticfn int stash_ok(struct obj *); +staticfn void explain_container_prompt(boolean); +staticfn int traditional_loot(boolean); +staticfn int menu_loot(int, boolean); +staticfn int tip_ok(struct obj *); +staticfn int choose_tip_container_menu(void); +staticfn struct obj *tipcontainer_gettarget(struct obj *, boolean *); +staticfn int tipcontainer_checks(struct obj *, struct obj *, boolean); +staticfn char in_or_out_menu(const char *, struct obj *, boolean, boolean, boolean, boolean); -static boolean able_to_loot(coordxy, coordxy, boolean); -static boolean reverse_loot(void); -static boolean mon_beside(coordxy, coordxy); -static int do_loot_cont(struct obj **, int, int); -static int doloot_core(void); -static void tipcontainer(struct obj *); +staticfn boolean able_to_loot(coordxy, coordxy, boolean); +staticfn boolean reverse_loot(void); +staticfn boolean mon_beside(coordxy, coordxy); +staticfn int do_loot_cont(struct obj **, int, int); +staticfn int doloot_core(void); +staticfn void tipcontainer(struct obj *); /* define for query_objlist() and autopickup() */ #define FOLLOW(curr, flags) \ @@ -72,7 +72,7 @@ static const char /* BUG: this lets you look at cockatrice corpses while blind without touching them */ /* much simpler version of the look-here code; used by query_classes() */ -static void +staticfn void simple_look(struct obj *otmp, /* list of objects */ boolean here) /* flag for type of obj list linkage */ { @@ -137,7 +137,7 @@ collect_obj_classes(char ilets[], struct obj *otmp, boolean here, * it was changed to enhance menu entry ordering ('A' stands out, but * some players complain that it is too easy to choose accidentally). */ -static boolean +staticfn boolean query_classes( char oclasses[], /* selected classes */ boolean *one_at_a_time, /* to tell caller that user picked 'A' */ @@ -262,7 +262,7 @@ query_classes( } /* check whether hero is bare-handedly touching a cockatrice corpse */ -static boolean +staticfn boolean fatal_corpse_mistake(struct obj *obj, boolean remotely) { if (uarmg || remotely || obj->otyp != CORPSE @@ -331,7 +331,7 @@ deferred_decor( /* handle 'mention_decor' (when walking onto a dungeon feature such as stairs or altar, describe it even if it isn't covered up by an object) */ -static boolean +staticfn boolean describe_decor(void) { char outbuf[BUFSZ], fbuf[QBUFSZ]; @@ -408,7 +408,7 @@ describe_decor(void) } /* look at the objects at our location, unless there are too many of them */ -static void +staticfn void check_here(boolean picked_some) { struct obj *obj; @@ -438,7 +438,7 @@ check_here(boolean picked_some) } /* query_objlist callback: return TRUE if obj's count is >= reference value */ -static boolean +staticfn boolean n_or_more(struct obj *obj) { if (obj == uchain) @@ -487,7 +487,7 @@ add_valid_menu_class(int c) } /* query_objlist callback: return TRUE if not uchain */ -static boolean +staticfn boolean all_but_uchain(struct obj *obj) { return (boolean) (obj != uchain); @@ -575,7 +575,7 @@ allow_category(struct obj *obj) #if 0 /* not used */ /* query_objlist callback: return TRUE if valid category (class), no uchain */ -static boolean +staticfn boolean allow_cat_no_uchain(struct obj *obj) { if (obj != uchain @@ -949,7 +949,7 @@ autopick_testobj(struct obj *otmp, boolean calc_costly) * picked is zero, the pickup list is left alone. The caller of this * function must free the pickup list. */ -static int +staticfn int autopick( struct obj *olist, /* the object list */ int follow, /* how to follow the object list */ @@ -1484,7 +1484,7 @@ query_category( return n; } -static int +staticfn int count_categories(struct obj *olist, int qflags) { char *pack; @@ -1517,7 +1517,7 @@ count_categories(struct obj *olist, int qflags) * object is removed from it. Use before and after weight amounts rather * than trying to match the calculation used by weight() in mkobj.c. */ -static int +staticfn int delta_cwt(struct obj *container, struct obj *obj) { struct obj **prev; @@ -1543,7 +1543,7 @@ delta_cwt(struct obj *container, struct obj *obj) } /* could we carry `obj'? if not, could we carry some of it/them? */ -static long +staticfn long carry_count(struct obj *obj, /* object to pick up... */ struct obj *container, /* ...bag it is coming out of */ long count, @@ -1678,8 +1678,7 @@ carry_count(struct obj *obj, /* object to pick up... */ } /* determine whether character is able and player is willing to carry `obj' */ -static -int +staticfn int lift_object( struct obj *obj, /* object to pick up... */ struct obj *container, /* ...bag it's coming out of */ @@ -1922,7 +1921,7 @@ pick_obj(struct obj *otmp) /* pickup_object()/out_container() helper; print an added-to-invent message for current object, limiting feedback about encumbrance to the first item which causes that to change */ -static void +staticfn void pickup_prinv( struct obj *obj, long count, @@ -2017,7 +2016,7 @@ container_at(coordxy x, coordxy y, boolean countem) return container_count; } -static boolean +staticfn boolean able_to_loot( coordxy x, coordxy y, boolean looting) /* loot vs tip */ @@ -2048,7 +2047,7 @@ able_to_loot( return TRUE; } -static boolean +staticfn boolean mon_beside(coordxy x, coordxy y) { int i, j; @@ -2064,7 +2063,7 @@ mon_beside(coordxy x, coordxy y) return FALSE; } -static int +staticfn int do_loot_cont( struct obj **cobjp, int cindex, /* index of this container (1..N)... */ @@ -2153,7 +2152,7 @@ doloot(void) } /* loot a container on the floor or loot saddle from mon. */ -static int +staticfn int doloot_core(void) { struct obj *cobj, *nobj; @@ -2325,7 +2324,7 @@ doloot_core(void) } /* called when attempting to #loot while confused */ -static boolean +staticfn boolean reverse_loot(void) { struct obj *goldob = 0, *coffers, *otmp, boxdummy; @@ -2462,7 +2461,7 @@ loot_mon(struct monst *mtmp, int *passed_info, boolean *prev_loot) * Decide whether an object being placed into a magic bag will cause * it to explode. If the object is a bag itself, check recursively. */ -static boolean +staticfn boolean mbag_explodes(struct obj *obj, int depthin) { /* these won't cause an explosion when they're empty */ @@ -2484,7 +2483,7 @@ mbag_explodes(struct obj *obj, int depthin) return FALSE; } -static boolean +staticfn boolean is_boh_item_gone(void) { return (boolean) (!rn2(13)); @@ -2492,7 +2491,7 @@ is_boh_item_gone(void) /* Scatter most of Bag of holding contents around. Some items will be destroyed with the same chance as looting a cursed bag. */ -static void +staticfn void do_boh_explosion(struct obj *boh, boolean on_floor) { struct obj *otmp, *nobj; @@ -2511,7 +2510,7 @@ do_boh_explosion(struct obj *boh, boolean on_floor) /* boh is about to be deleted so no need to reset its in_use flag here */ } -static long +staticfn long boh_loss(struct obj *container, boolean held) { /* sometimes toss objects if a cursed magic bag */ @@ -2532,7 +2531,7 @@ boh_loss(struct obj *container, boolean held) } /* Returns: -1 to stop, 1 item was inserted, 0 item was not inserted. */ -static int +staticfn int in_container(struct obj *obj) { boolean floor_container = !carried(gc.current_container); @@ -2699,7 +2698,7 @@ ck_bag(struct obj *obj) } /* Returns: -1 to stop, 1 item was removed, 0 item was not removed. */ -static int +staticfn int out_container(struct obj *obj) { struct obj *otmp; @@ -2775,7 +2774,7 @@ removed_from_icebox(struct obj *obj) } /* an object inside a cursed bag of holding is being destroyed */ -static long +staticfn long mbag_item_gone(boolean held, struct obj *item, boolean silent) { struct monst *shkp; @@ -2869,7 +2868,7 @@ container_gone(int (*fn)(OBJ_P)) && !gc.current_container); } -static void +staticfn void explain_container_prompt(boolean more_containers) { static const char *const explaintext[] = { @@ -2915,7 +2914,7 @@ u_handsy(void) } /* getobj callback for object to be stashed into a container */ -static int +staticfn int stash_ok(struct obj *obj) { if (!obj) @@ -3186,7 +3185,7 @@ use_container( } /* loot current_container (take things out or put things in), by prompting */ -static int +staticfn int traditional_loot(boolean put_in) { int (*actionfunc)(OBJ_P), (*checkfunc)(OBJ_P); @@ -3221,7 +3220,7 @@ traditional_loot(boolean put_in) } /* loot current_container (take things out or put things in), using a menu */ -static int +staticfn int menu_loot(int retry, boolean put_in) { int n, i, n_looted = 0; @@ -3352,7 +3351,7 @@ menu_loot(int retry, boolean put_in) return n_looted ? ECMD_TIME : ECMD_OK; } -static char +staticfn char in_or_out_menu( const char *prompt, struct obj *obj, @@ -3435,7 +3434,7 @@ in_or_out_menu( } /* getobj callback for object to tip */ -static int +staticfn int tip_ok(struct obj *obj) { if (!obj || obj->oclass == COIN_CLASS) @@ -3459,7 +3458,7 @@ tip_ok(struct obj *obj) returns ECMD_CANCEL if menu was canceled, ECMD_TIME if a container was picked, otherwise returns ECMD_OK. */ -static int +staticfn int choose_tip_container_menu(void) { int n, i; @@ -3641,7 +3640,7 @@ enum tipping_check_values { TIPCHECK_EMPTY }; -static void +staticfn void tipcontainer(struct obj *box) /* or bag */ { coordxy ox = u.ux, oy = u.uy; /* #tip only works at hero's location */ @@ -3797,11 +3796,11 @@ tipcontainer(struct obj *box) /* or bag */ } #if 0 -static int count_target_containers(struct obj *, struct obj *); +staticfn int count_target_containers(struct obj *, struct obj *); /* returns number of containers in object chain; does not recurse into containers; skips bags of tricks when they're known */ -static int +staticfn int count_target_containers( struct obj *olist, /* list of objects (invent) */ struct obj *excludo) /* particular object to exclude if found in list */ @@ -3823,7 +3822,7 @@ count_target_containers( /* ask user for a carried container into which they want box to be emptied; cancelled is TRUE if user cancelled the menu pick; hands aren't required when tipping to the floor but are when tipping into another container */ -static struct obj * +staticfn struct obj * tipcontainer_gettarget( struct obj *box, boolean *cancelled) @@ -3906,7 +3905,7 @@ tipcontainer_gettarget( /* Perform check on box if we can tip it. Returns one of TIPCHECK_foo values. If allowempty if TRUE, return TIPCHECK_OK instead of TIPCHECK_EMPTY. */ -static int +staticfn int tipcontainer_checks( struct obj *box, /* container player wants to tip */ struct obj *targetbox, /* destination (used here for horn of plenty) */ diff --git a/src/pline.c b/src/pline.c index 7abba3bf0..09196d4f2 100644 --- a/src/pline.c +++ b/src/pline.c @@ -9,10 +9,10 @@ * config file parsing) with modest decoration; * result will then be truncated to BUFSZ-1 */ -static void putmesg(const char *); -static char *You_buf(int); +staticfn void putmesg(const char *); +staticfn char *You_buf(int); #if defined(MSGHANDLER) -static void execplinehandler(const char *); +staticfn void execplinehandler(const char *); #endif #ifdef USER_SOUNDS extern void maybe_play_sound(const char *); @@ -63,7 +63,7 @@ dumplogfreemessages(void) #endif /* keeps windowprocs usage out of pline() */ -static void +staticfn void putmesg(const char *line) { int attr = ATR_NONE; @@ -78,7 +78,7 @@ putmesg(const char *line) SoundSpeak(line); } -static void vpline(const char *, va_list); +staticfn void vpline(const char *, va_list); DISABLE_WARNING_FORMAT_NONLITERAL @@ -133,7 +133,7 @@ set_msg_xy(coordxy x, coordxy y) a11y.msg_loc.y = y; } -static void +staticfn void vpline(const char *line, va_list the_args) { static int in_pline = 0; @@ -312,7 +312,7 @@ Norep(const char *line, ...) va_end(the_args); } -static char * +staticfn char * You_buf(int siz) { if (siz > gy.you_buf_siz) { @@ -520,7 +520,7 @@ livelog_printf( #endif /* !CHRONICLE */ -static void vraw_printf(const char *, va_list); +staticfn void vraw_printf(const char *, va_list); void raw_printf(const char *line, ...) @@ -536,7 +536,7 @@ raw_printf(const char *line, ...) DISABLE_WARNING_FORMAT_NONLITERAL -static void +staticfn void vraw_printf(const char *line, va_list the_args) { char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */ @@ -609,7 +609,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL #if defined(MSGHANDLER) static boolean use_pline_handler = TRUE; -static void +staticfn void execplinehandler(const char *line) { #if defined(POSIX_TYPES) || defined(__GNUC__) @@ -664,7 +664,7 @@ execplinehandler(const char *line) /* * varargs handling for files.c */ -static void vconfig_error_add(const char *, va_list); +staticfn void vconfig_error_add(const char *, va_list); DISABLE_WARNING_FORMAT_NONLITERAL @@ -678,7 +678,7 @@ config_error_add(const char *str, ...) va_end(the_args); } -static void +staticfn void vconfig_error_add(const char *str, va_list the_args) { /* start of vconf...() or of nested block in USE_OLDARG's conf...() */ int vlen = 0; diff --git a/src/polyself.c b/src/polyself.c index d09d9af30..806192693 100644 --- a/src/polyself.c +++ b/src/polyself.c @@ -21,14 +21,14 @@ #include "hack.h" -static void check_strangling(boolean); -static void polyman(const char *, const char *); -static void dropp(struct obj *); -static void break_armor(void); -static void drop_weapon(int); -static int armor_to_dragon(int); -static void newman(void); -static void polysense(void); +staticfn void check_strangling(boolean); +staticfn void polyman(const char *, const char *); +staticfn void dropp(struct obj *); +staticfn void break_armor(void); +staticfn void drop_weapon(int); +staticfn int armor_to_dragon(int); +staticfn void newman(void); +staticfn void polysense(void); static const char no_longer_petrify_resistant[] = "No longer petrify-resistant, you"; @@ -157,7 +157,7 @@ steed_vs_stealth(void) } /* for changing into form that's immune to strangulation */ -static void +staticfn void check_strangling(boolean on) { /* on -- maybe resume strangling */ @@ -189,7 +189,7 @@ check_strangling(boolean on) DISABLE_WARNING_FORMAT_NONLITERAL /* make a (new) human out of the player */ -static void +staticfn void polyman(const char *fmt, const char *arg) { boolean sticking = (sticks(gy.youmonst.data) && u.ustuck && !u.uswallow), @@ -321,7 +321,7 @@ livelog_newform(boolean viapoly, int oldgend, int newgend) } } -static void +staticfn void newman(void) { const char *newform; @@ -1108,7 +1108,7 @@ uasmon_maxStr(void) } /* dropx() jacket for break_armor() */ -static void +staticfn void dropp(struct obj *obj) { struct obj *otmp; @@ -1133,7 +1133,7 @@ dropp(struct obj *obj) } } -static void +staticfn void break_armor(void) { struct obj *otmp; @@ -1276,7 +1276,7 @@ break_armor(void) /* rings stay worn even when no hands */ } -static void +staticfn void drop_weapon(int alone) { struct obj *otmp; @@ -2160,7 +2160,7 @@ ugolemeffects(int damtype, int dam) } } -static int +staticfn int armor_to_dragon(int atyp) { switch (atyp) { @@ -2205,7 +2205,7 @@ armor_to_dragon(int atyp) } /* some species have awareness of other species */ -static void +staticfn void polysense(void) { short warnidx = NON_PM; diff --git a/src/potion.c b/src/potion.c index f04da9595..c3f3011ed 100644 --- a/src/potion.c +++ b/src/potion.c @@ -5,43 +5,43 @@ #include "hack.h" -static long itimeout(long); -static long itimeout_incr(long, int); -static void ghost_from_bottle(void); -static int drink_ok(struct obj *); -static void peffect_restore_ability(struct obj *); -static void peffect_hallucination(struct obj *); -static void peffect_water(struct obj *); -static void peffect_booze(struct obj *); -static void peffect_enlightenment(struct obj *); -static void peffect_invisibility(struct obj *); -static void peffect_see_invisible(struct obj *); -static void peffect_paralysis(struct obj *); -static void peffect_sleeping(struct obj *); -static int peffect_monster_detection(struct obj *); -static int peffect_object_detection(struct obj *); -static void peffect_sickness(struct obj *); -static void peffect_confusion(struct obj *); -static void peffect_gain_ability(struct obj *); -static void peffect_speed(struct obj *); -static void peffect_blindness(struct obj *); -static void peffect_gain_level(struct obj *); -static void peffect_healing(struct obj *); -static void peffect_extra_healing(struct obj *); -static void peffect_full_healing(struct obj *); -static void peffect_levitation(struct obj *); -static void peffect_gain_energy(struct obj *); -static void peffect_oil(struct obj *); -static void peffect_acid(struct obj *); -static void peffect_polymorph(struct obj *); -static boolean H2Opotion_dip(struct obj *, struct obj *, boolean, +staticfn long itimeout(long); +staticfn long itimeout_incr(long, int); +staticfn void ghost_from_bottle(void); +staticfn int drink_ok(struct obj *); +staticfn void peffect_restore_ability(struct obj *); +staticfn void peffect_hallucination(struct obj *); +staticfn void peffect_water(struct obj *); +staticfn void peffect_booze(struct obj *); +staticfn void peffect_enlightenment(struct obj *); +staticfn void peffect_invisibility(struct obj *); +staticfn void peffect_see_invisible(struct obj *); +staticfn void peffect_paralysis(struct obj *); +staticfn void peffect_sleeping(struct obj *); +staticfn int peffect_monster_detection(struct obj *); +staticfn int peffect_object_detection(struct obj *); +staticfn void peffect_sickness(struct obj *); +staticfn void peffect_confusion(struct obj *); +staticfn void peffect_gain_ability(struct obj *); +staticfn void peffect_speed(struct obj *); +staticfn void peffect_blindness(struct obj *); +staticfn void peffect_gain_level(struct obj *); +staticfn void peffect_healing(struct obj *); +staticfn void peffect_extra_healing(struct obj *); +staticfn void peffect_full_healing(struct obj *); +staticfn void peffect_levitation(struct obj *); +staticfn void peffect_gain_energy(struct obj *); +staticfn void peffect_oil(struct obj *); +staticfn void peffect_acid(struct obj *); +staticfn void peffect_polymorph(struct obj *); +staticfn boolean H2Opotion_dip(struct obj *, struct obj *, boolean, const char *); -static short mixtype(struct obj *, struct obj *); -static int dip_ok(struct obj *); -static int dip_hands_ok(struct obj *); -static void hold_potion(struct obj *, const char *, const char *, +staticfn short mixtype(struct obj *, struct obj *); +staticfn int dip_ok(struct obj *); +staticfn int dip_hands_ok(struct obj *); +staticfn void hold_potion(struct obj *, const char *, const char *, const char *); -static int potion_dip(struct obj *obj, struct obj *potion); +staticfn int potion_dip(struct obj *obj, struct obj *potion); /* used to indicate whether quaff or dip has skipped an opportunity to use a fountain or such, in order to vary the feedback if hero lacks @@ -50,7 +50,7 @@ static int potion_dip(struct obj *obj, struct obj *potion); static int drink_ok_extra = 0; /* force `val' to be within valid range for intrinsic timeout value */ -static long +staticfn long itimeout(long val) { if (val >= TIMEOUT) @@ -62,7 +62,7 @@ itimeout(long val) } /* increment `old' by `incr' and force result to be valid intrinsic timeout */ -static long +staticfn long itimeout_incr(long old, int incr) { return itimeout((old & TIMEOUT) + (long) incr); @@ -475,7 +475,7 @@ self_invis_message(void) : "can't see yourself"); } -static void +staticfn void ghost_from_bottle(void) { struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy, MM_NOMSG); @@ -499,7 +499,7 @@ ghost_from_bottle(void) /* getobj callback for object to drink from, which also does double duty as the callback for dipping into (both just allow potions). */ -static int +staticfn int drink_ok(struct obj *obj) { /* getobj()'s callback to test whether hands/self is a valid "item" to @@ -630,7 +630,7 @@ dopotion(struct obj *otmp) /* potion or spell of restore ability; for spell, otmp is a temporary spellbook object that will be blessed if hero is skilled in healing */ -static void +staticfn void peffect_restore_ability(struct obj *otmp) { gp.potion_unkn++; @@ -677,7 +677,7 @@ peffect_restore_ability(struct obj *otmp) } } -static void +staticfn void peffect_hallucination(struct obj *otmp) { if (Halluc_resistance) { @@ -698,7 +698,7 @@ peffect_hallucination(struct obj *otmp) } } -static void +staticfn void peffect_water(struct obj *otmp) { if (!otmp->blessed && !otmp->cursed) { @@ -752,7 +752,7 @@ peffect_water(struct obj *otmp) } } -static void +staticfn void peffect_booze(struct obj *otmp) { gp.potion_unkn++; @@ -776,7 +776,7 @@ peffect_booze(struct obj *otmp) } } -static void +staticfn void peffect_enlightenment(struct obj *otmp) { if (otmp->cursed) { @@ -792,7 +792,7 @@ peffect_enlightenment(struct obj *otmp) } } -static void +staticfn void peffect_invisibility(struct obj *otmp) { boolean is_spell = (otmp->oclass == SPBOOK_CLASS); @@ -818,7 +818,7 @@ peffect_invisibility(struct obj *otmp) } } -static void +staticfn void peffect_see_invisible(struct obj *otmp) { int msg = Invisible && !Blind; @@ -857,7 +857,7 @@ peffect_see_invisible(struct obj *otmp) } } -static void +staticfn void peffect_paralysis(struct obj *otmp) { if (Free_action) { @@ -877,7 +877,7 @@ peffect_paralysis(struct obj *otmp) } } -static void +staticfn void peffect_sleeping(struct obj *otmp) { if (Sleep_resistance || Free_action) { @@ -890,7 +890,7 @@ peffect_sleeping(struct obj *otmp) } } -static int +staticfn int peffect_monster_detection(struct obj *otmp) { if (otmp->blessed) { @@ -931,7 +931,7 @@ peffect_monster_detection(struct obj *otmp) return 0; } -static int +staticfn int peffect_object_detection(struct obj *otmp) { if (object_detect(otmp, 0)) @@ -940,7 +940,7 @@ peffect_object_detection(struct obj *otmp) return 0; } -static void +staticfn void peffect_sickness(struct obj *otmp) { pline("Yecch! This stuff tastes like poison."); @@ -990,7 +990,7 @@ peffect_sickness(struct obj *otmp) } } -static void +staticfn void peffect_confusion(struct obj *otmp) { if (!Confusion) { @@ -1006,7 +1006,7 @@ peffect_confusion(struct obj *otmp) FALSE); } -static void +staticfn void peffect_gain_ability(struct obj *otmp) { if (otmp->cursed) { @@ -1028,7 +1028,7 @@ peffect_gain_ability(struct obj *otmp) } } -static void +staticfn void peffect_speed(struct obj *otmp) { boolean is_speed = (otmp->otyp == POT_SPEED); @@ -1049,7 +1049,7 @@ peffect_speed(struct obj *otmp) } } -static void +staticfn void peffect_blindness(struct obj *otmp) { if (Blind || ((HBlinded || EBlinded) && BBlinded)) @@ -1059,7 +1059,7 @@ peffect_blindness(struct obj *otmp) (boolean) !Blind); } -static void +staticfn void peffect_gain_level(struct obj *otmp) { if (otmp->cursed) { @@ -1095,7 +1095,7 @@ peffect_gain_level(struct obj *otmp) u.uexp = rndexp(TRUE); } -static void +staticfn void peffect_healing(struct obj *otmp) { You_feel("better."); @@ -1104,7 +1104,7 @@ peffect_healing(struct obj *otmp) exercise(A_CON, TRUE); } -static void +staticfn void peffect_extra_healing(struct obj *otmp) { You_feel("much better."); @@ -1120,7 +1120,7 @@ peffect_extra_healing(struct obj *otmp) heal_legs(0); } -static void +staticfn void peffect_full_healing(struct obj *otmp) { You_feel("completely healed."); @@ -1141,7 +1141,7 @@ peffect_full_healing(struct obj *otmp) heal_legs(0); } -static void +staticfn void peffect_levitation(struct obj *otmp) { /* @@ -1200,7 +1200,7 @@ peffect_levitation(struct obj *otmp) float_vs_flight(); } -static void +staticfn void peffect_gain_energy(struct obj *otmp) { int num; @@ -1236,7 +1236,7 @@ peffect_gain_energy(struct obj *otmp) exercise(A_WIS, TRUE); } -static void +staticfn void peffect_oil(struct obj *otmp) { boolean good_for_you = FALSE, vulnerable; @@ -1273,7 +1273,7 @@ peffect_oil(struct obj *otmp) exercise(A_WIS, good_for_you); } -static void +staticfn void peffect_acid(struct obj *otmp) { if (Acid_resistance) { @@ -1294,7 +1294,7 @@ peffect_acid(struct obj *otmp) gp.potion_unkn++; /* holy/unholy water can burn like acid too */ } -static void +staticfn void peffect_polymorph(struct obj *otmp) { You_feel("a little %s.", Hallucination ? "normal" : "strange"); @@ -1474,7 +1474,7 @@ bottlename(void) } /* handle item dipped into water potion or steed saddle splashed by same */ -static boolean +staticfn boolean H2Opotion_dip( struct obj *potion, /* water */ struct obj *targobj, /* item being dipped into the water */ @@ -2085,7 +2085,7 @@ potionbreathe(struct obj *obj) } /* returns the potion type when o1 is dipped in o2 */ -static short +staticfn short mixtype(struct obj *o1, struct obj *o2) { int o1typ = o1->otyp, o2typ = o2->otyp; @@ -2175,7 +2175,7 @@ mixtype(struct obj *o1, struct obj *o2) /* getobj callback for object to be dipped (not the thing being dipped into, * that uses drink_ok) */ -static int +staticfn int dip_ok(struct obj *obj) { if (!obj) @@ -2192,7 +2192,7 @@ dip_ok(struct obj *obj) } /* getobj callback for object to be dipped when hero has slippery hands */ -static int +staticfn int dip_hands_ok(struct obj *obj) { if (!obj && (Glib && can_reach_floor(FALSE))) @@ -2204,7 +2204,7 @@ dip_hands_ok(struct obj *obj) /* call hold_another_object() to deal with a transformed potion; its weight won't have changed but it might require an extra slot that isn't available or it might merge into some other carried stack */ -static void +staticfn void hold_potion( struct obj *potobj, const char *drop_fmt, const char *drop_arg, @@ -2370,7 +2370,7 @@ dip_into(void) } /* called by dodip() or dip_into() after obj and potion have been chosen */ -static int +staticfn int potion_dip(struct obj *obj, struct obj *potion) { struct obj *singlepotion; diff --git a/src/pray.c b/src/pray.c index 99154656f..5d4b9a0ab 100644 --- a/src/pray.c +++ b/src/pray.c @@ -4,32 +4,32 @@ #include "hack.h" -static int prayer_done(void); -static void maybe_turn_mon_iter(struct monst *); -static struct obj *worst_cursed_item(void); -static int in_trouble(void); -static void fix_curse_trouble(struct obj *, const char *); -static void fix_worst_trouble(int); -static void angrygods(aligntyp); -static void at_your_feet(const char *); -static void gcrownu(void); -static void give_spell(void); -static void pleased(aligntyp); -static void godvoice(aligntyp, const char *); -static void god_zaps_you(aligntyp); -static void fry_by_god(aligntyp, boolean); -static void gods_angry(aligntyp); -static void gods_upset(aligntyp); -static void consume_offering(struct obj *); -static void offer_too_soon(aligntyp); -static void offer_real_amulet(struct obj *, aligntyp); /* NORETURN */ -static void offer_fake_amulet(struct obj *, boolean, aligntyp); -static void offer_different_alignment_altar(struct obj *, aligntyp); -static void sacrifice_your_race(struct obj *, boolean, aligntyp); -static int bestow_artifact(void); -static boolean pray_revive(void); -static boolean water_prayer(boolean); -static boolean blocked_boulder(int, int); +staticfn int prayer_done(void); +staticfn void maybe_turn_mon_iter(struct monst *); +staticfn struct obj *worst_cursed_item(void); +staticfn int in_trouble(void); +staticfn void fix_curse_trouble(struct obj *, const char *); +staticfn void fix_worst_trouble(int); +staticfn void angrygods(aligntyp); +staticfn void at_your_feet(const char *); +staticfn void gcrownu(void); +staticfn void give_spell(void); +staticfn void pleased(aligntyp); +staticfn void godvoice(aligntyp, const char *); +staticfn void god_zaps_you(aligntyp); +staticfn void fry_by_god(aligntyp, boolean); +staticfn void gods_angry(aligntyp); +staticfn void gods_upset(aligntyp); +staticfn void consume_offering(struct obj *); +staticfn void offer_too_soon(aligntyp); +staticfn void offer_real_amulet(struct obj *, aligntyp); /* NORETURN */ +staticfn void offer_fake_amulet(struct obj *, boolean, aligntyp); +staticfn void offer_different_alignment_altar(struct obj *, aligntyp); +staticfn void sacrifice_your_race(struct obj *, boolean, aligntyp); +staticfn int bestow_artifact(void); +staticfn boolean pray_revive(void); +staticfn boolean water_prayer(boolean); +staticfn boolean blocked_boulder(int, int); /* simplify a few tests */ #define Cursed_obj(obj, typ) ((obj) && (obj)->otyp == (typ) && (obj)->cursed) @@ -190,7 +190,7 @@ stuck_in_wall(void) * 3.4.2: make an exception if polymorphed into a form which lacks * hands; that's a case where the ramifications override this doubt. */ -static int +staticfn int in_trouble(void) { struct obj *otmp; @@ -280,7 +280,7 @@ in_trouble(void) } /* select an item for TROUBLE_CURSED_ITEMS */ -static struct obj * +staticfn struct obj * worst_cursed_item(void) { struct obj *otmp; @@ -341,7 +341,7 @@ worst_cursed_item(void) return otmp; } -static void +staticfn void fix_curse_trouble(struct obj *otmp, const char *what) { if (!otmp) { @@ -365,7 +365,7 @@ fix_curse_trouble(struct obj *otmp, const char *what) update_inventory(); } -static void +staticfn void fix_worst_trouble(int trouble) { int i; @@ -601,7 +601,7 @@ fix_worst_trouble(int trouble) * bathroom walls, but who is foiled by bathrobes." --Bertrand Russell, 1943 * Divine wrath, dungeon walls, and armor follow the same principle. */ -static void +staticfn void god_zaps_you(aligntyp resp_god) { if (u.uswallow) { @@ -685,7 +685,7 @@ god_zaps_you(aligntyp resp_god) } } -static void +staticfn void fry_by_god(aligntyp resp_god, boolean via_disintegration) { You("%s!", !via_disintegration ? "fry to a crisp" @@ -695,7 +695,7 @@ fry_by_god(aligntyp resp_god, boolean via_disintegration) done(DIED); } -static void +staticfn void angrygods(aligntyp resp_god) { int maxanger, new_ublesscnt; @@ -776,7 +776,7 @@ angrygods(aligntyp resp_god) } /* helper to print "str appears at your feet", or appropriate */ -static void +staticfn void at_your_feet(const char *str) { if (Blind) @@ -793,7 +793,7 @@ at_your_feet(const char *str) } } -static void +staticfn void gcrownu(void) { struct obj *obj; @@ -986,7 +986,7 @@ gcrownu(void) return; } -static void +staticfn void give_spell(void) { struct obj *otmp; @@ -1057,7 +1057,7 @@ give_spell(void) return; } -static void +staticfn void pleased(aligntyp g_align) { /* don't use p_trouble, worst trouble may get fixed while praying */ @@ -1365,7 +1365,7 @@ pleased(aligntyp g_align) /* either blesses or curses water on the altar, * returns true if it found any water here. */ -static boolean +staticfn boolean water_prayer(boolean bless_water) { struct obj *otmp; @@ -1393,7 +1393,7 @@ water_prayer(boolean bless_water) return (boolean) (changed > 0L); } -static void +staticfn void godvoice(aligntyp g_align, const char *words) { const char *quot = ""; @@ -1407,14 +1407,14 @@ godvoice(aligntyp g_align, const char *words) ROLL_FROM(godvoices), quot, words, quot); } -static void +staticfn void gods_angry(aligntyp g_align) { godvoice(g_align, "Thou hast angered me."); } /* The g_align god is upset with you. */ -static void +staticfn void gods_upset(aligntyp g_align) { if (g_align == u.ualign.type) @@ -1424,7 +1424,7 @@ gods_upset(aligntyp g_align) angrygods(g_align); } -static void +staticfn void consume_offering(struct obj *otmp) { if (Hallucination) @@ -1458,7 +1458,7 @@ consume_offering(struct obj *otmp) /* feedback when attempting to offer the Amulet on a "low altar" (not one of the high altars in the temples on the Astral Plane or Moloch's Sanctum) */ -static void +staticfn void offer_too_soon(aligntyp altaralign) { if (altaralign == A_NONE && Inhell) { @@ -1507,7 +1507,7 @@ desecrate_altar(boolean highaltar, aligntyp altaralign) /* offering the Amulet on a high altar (checked by caller) ends the game; we don't declare this 'NORETURN' because done() can return (if called with some reasons other than ASCENDED and ESCAPED) */ -static void +staticfn void offer_real_amulet(struct obj *otmp, aligntyp altaralign) { static NEARDATA const char @@ -1570,7 +1570,7 @@ offer_real_amulet(struct obj *otmp, aligntyp altaralign) /*NOTREACHED*/ } -static void +staticfn void offer_fake_amulet( struct obj *otmp, boolean highaltar, @@ -1604,7 +1604,7 @@ offer_fake_amulet( } /* possibly convert an altar's alignment or the hero's alignment */ -static void +staticfn void offer_different_alignment_altar( struct obj *otmp, aligntyp altaralign) @@ -1671,7 +1671,7 @@ offer_different_alignment_altar( } } -static void +staticfn void sacrifice_your_race( struct obj *otmp, boolean highaltar, @@ -1754,7 +1754,7 @@ sacrifice_your_race( useupf(otmp, 1L); } -static int +staticfn int bestow_artifact(void) { int nartifacts = nartifact_exist(); @@ -2090,7 +2090,7 @@ can_pray(boolean praying) /* false means no messages should be given */ } /* return TRUE if praying revived a pet corpse */ -static boolean +staticfn boolean pray_revive(void) { struct obj *otmp; @@ -2183,7 +2183,7 @@ dopray(void) return ECMD_TIME; } -static int +staticfn int prayer_done(void) /* M. Stephenson (1.0.3b) */ { aligntyp alignment = gp.p_aligntyp; @@ -2254,7 +2254,7 @@ prayer_done(void) /* M. Stephenson (1.0.3b) */ } /* iterable for undead turning by priest/knight */ -static void +staticfn void maybe_turn_mon_iter(struct monst *mtmp) { /* 3.6.3: used to use cansee() here but the purpose is to prevent @@ -2578,7 +2578,7 @@ altar_wrath(coordxy x, coordxy y) } /* assumes isok() at one space away, but not necessarily at two */ -static boolean +staticfn boolean blocked_boulder(int dx, int dy) { struct obj *otmp; diff --git a/src/priest.c b/src/priest.c index 57969b5f8..108bf11a4 100644 --- a/src/priest.c +++ b/src/priest.c @@ -9,8 +9,8 @@ #define ALGN_SINNED (-4) /* worse than strayed (-1..-3) */ #define ALGN_PIOUS 14 /* better than fervent (9..13) */ -static boolean histemple_at(struct monst *, coordxy, coordxy); -static boolean has_shrine(struct monst *); +staticfn boolean histemple_at(struct monst *, coordxy, coordxy); +staticfn boolean has_shrine(struct monst *); void newepri(struct monst *mtmp) @@ -148,7 +148,7 @@ temple_occupied(char *array) return '\0'; } -static boolean +staticfn boolean histemple_at(struct monst *priest, coordxy x, coordxy y) { return (boolean) (priest && priest->ispriest @@ -377,7 +377,7 @@ p_coaligned(struct monst *priest) return (boolean) (u.ualign.type == mon_aligntyp(priest)); } -static boolean +staticfn boolean has_shrine(struct monst *pri) { struct rm *lev; diff --git a/src/quest.c b/src/quest.c index 9e12604c0..e2c363903 100644 --- a/src/quest.c +++ b/src/quest.c @@ -11,18 +11,18 @@ #define Not_firsttime (on_level(&u.uz0, &u.uz)) #define Qstat(x) (gq.quest_status.x) -static void on_start(void); -static void on_locate(void); -static void on_goal(void); -static boolean not_capable(void); -static int is_pure(boolean); -static void expulsion(boolean); -static void chat_with_leader(struct monst *); -static void chat_with_nemesis(void); -static void chat_with_guardian(void); -static void prisoner_speaks(struct monst *); +staticfn void on_start(void); +staticfn void on_locate(void); +staticfn void on_goal(void); +staticfn boolean not_capable(void); +staticfn int is_pure(boolean); +staticfn void expulsion(boolean); +staticfn void chat_with_leader(struct monst *); +staticfn void chat_with_nemesis(void); +staticfn void chat_with_guardian(void); +staticfn void prisoner_speaks(struct monst *); -static void +staticfn void on_start(void) { if (!Qstat(first_start)) { @@ -36,7 +36,7 @@ on_start(void) } } -static void +staticfn void on_locate(void) { /* the locate messages are phrased in a manner such that they only @@ -58,7 +58,7 @@ on_locate(void) } } -static void +staticfn void on_goal(void) { if (Qstat(killed_nemesis)) { @@ -143,13 +143,13 @@ ok_to_quest(void) && is_pure(FALSE) > 0) || Qstat(killed_leader)); } -static boolean +staticfn boolean not_capable(void) { return (boolean) (u.ulevel < MIN_QUEST_LEVEL); } -static int +staticfn int is_pure(boolean talk) { int purity; @@ -182,7 +182,7 @@ is_pure(boolean talk) * This assumes that the hero is currently _in_ the quest dungeon and that * there is a single branch to and from it. */ -static void +staticfn void expulsion(boolean seal) { branch *br; @@ -278,7 +278,7 @@ finish_quest(struct obj *obj) /* quest artifact or thrown unique item or faux } } -static void +staticfn void chat_with_leader(struct monst *mtmp) { if (!mtmp->mpeaceful || Qstat(pissed_off)) @@ -376,7 +376,7 @@ leader_speaks(struct monst *mtmp) chat_with_leader(mtmp); } -static void +staticfn void chat_with_nemesis(void) { /* The nemesis will do most of the talking, but... */ @@ -423,7 +423,7 @@ nemesis_stinks(coordxy mx, coordxy my) gc.context.mon_moving = save_mon_moving; } -static void +staticfn void chat_with_guardian(void) { /* These guys/gals really don't have much to say... */ @@ -433,7 +433,7 @@ chat_with_guardian(void) qt_pager("guardtalk_before"); } -static void +staticfn void prisoner_speaks(struct monst *mtmp) { if (mtmp->data == &mons[PM_PRISONER] diff --git a/src/questpgr.c b/src/questpgr.c index 7831733d2..bacfbc01d 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -13,19 +13,19 @@ #include "wintty.h" #endif -static const char *intermed(void); +staticfn const char *intermed(void); /* sometimes find_qarti(gi.invent), and gi.invent can be null */ -static struct obj *find_qarti(struct obj *) NO_NNARGS; -static const char *neminame(void); -static const char *guardname(void); -static const char *homebase(void); -static void qtext_pronoun(char, char); -static void convert_arg(char); -static void convert_line(char *,char *); -static void deliver_by_pline(const char *); -static void deliver_by_window(const char *, int); -static boolean skip_pager(boolean); -static boolean com_pager_core(const char *, const char *, boolean, char **); +staticfn struct obj *find_qarti(struct obj *) NO_NNARGS; +staticfn const char *neminame(void); +staticfn const char *guardname(void); +staticfn const char *homebase(void); +staticfn void qtext_pronoun(char, char); +staticfn void convert_arg(char); +staticfn void convert_line(char *,char *); +staticfn void deliver_by_pline(const char *); +staticfn void deliver_by_window(const char *, int); +staticfn boolean skip_pager(boolean); +staticfn boolean com_pager_core(const char *, const char *, boolean, char **); short quest_info(int typ) @@ -57,7 +57,7 @@ ldrname(void) } /* return your intermediate target string */ -static const char * +staticfn const char * intermed(void) { return gu.urole.intermed; @@ -69,7 +69,7 @@ is_quest_artifact(struct obj *otmp) return (boolean) (otmp->oartifact == gu.urole.questarti); } -static struct obj * +staticfn struct obj * find_qarti(struct obj *ochain) { struct obj *otmp, *qarti; @@ -120,7 +120,7 @@ find_quest_artifact(unsigned whichchains) } /* return your role nemesis' name */ -static const char * +staticfn const char * neminame(void) { int i = gu.urole.neminum; @@ -130,7 +130,7 @@ neminame(void) return gn.nambuf; } -static const char * +staticfn const char * guardname(void) /* return your role leader's guard monster name */ { int i = gu.urole.guardnum; @@ -138,7 +138,7 @@ guardname(void) /* return your role leader's guard monster name */ return mons[i].pmnames[NEUTRAL]; } -static const char * +staticfn const char * homebase(void) /* return your role leader's location */ { return gu.urole.homebase; @@ -195,7 +195,7 @@ stinky_nemesis(struct monst *mon) /* replace deity, leader, nemesis, or artifact name with pronoun; overwrites cvt_buf[] */ -static void +staticfn void qtext_pronoun( char who, /* 'd' => deity, 'l' => leader, 'n' => nemesis, 'o' => arti */ char which) /* 'h'|'H'|'i'|'I'|'j'|'J' */ @@ -232,7 +232,7 @@ qtext_pronoun( return; } -static void +staticfn void convert_arg(char c) { const char *str; @@ -324,7 +324,7 @@ convert_arg(char c) Strcpy(gc.cvt_buf, str); } -static void +staticfn void convert_line(char *in_line, char *out_line) { char *c, *cc; @@ -416,7 +416,7 @@ convert_line(char *in_line, char *out_line) return; } -static void +staticfn void deliver_by_pline(const char *str) { char in_line[BUFSZ], out_line[BUFSZ]; @@ -432,7 +432,7 @@ deliver_by_pline(const char *str) } } -static void +staticfn void deliver_by_window(const char *msg, int how) { char in_line[BUFSZ], out_line[BUFSZ]; @@ -452,7 +452,7 @@ deliver_by_window(const char *msg, int how) destroy_nhwindow(datawin); } -static boolean +staticfn boolean skip_pager(boolean common UNUSED) { /* WIZKIT: suppress plot feedback if starting with quest artifact */ @@ -461,7 +461,7 @@ skip_pager(boolean common UNUSED) return FALSE; } -static boolean +staticfn boolean com_pager_core( const char *section, const char *msgid, diff --git a/src/read.c b/src/read.c index 0f52b886d..5f2d2f8f8 100644 --- a/src/read.c +++ b/src/read.c @@ -8,51 +8,51 @@ #define Your_Own_Role(mndx) ((mndx) == gu.urole.mnum) #define Your_Own_Race(mndx) ((mndx) == gu.urace.mnum) -static boolean learnscrolltyp(short); -static void cap_spe(struct obj *); -static char *erode_obj_text(struct obj *, char *); -static char *hawaiian_design(struct obj *, char *); -static int read_ok(struct obj *); -static void stripspe(struct obj *); -static void p_glow1(struct obj *); -static void p_glow2(struct obj *, const char *); -static void forget(int); -static int maybe_tame(struct monst *, struct obj *); -static boolean can_center_cloud(coordxy, coordxy); -static void display_stinking_cloud_positions(boolean); -static void seffect_enchant_armor(struct obj **); -static void seffect_destroy_armor(struct obj **); -static void seffect_confuse_monster(struct obj **); -static void seffect_scare_monster(struct obj **); -static void seffect_remove_curse(struct obj **); -static void seffect_create_monster(struct obj **); -static void seffect_enchant_weapon(struct obj **); -static void seffect_taming(struct obj **); -static void seffect_genocide(struct obj **); -static void seffect_light(struct obj **); -static void seffect_charging(struct obj **); -static void seffect_amnesia(struct obj **); -static void seffect_fire(struct obj **); -static void seffect_earth(struct obj **); -static void seffect_punishment(struct obj **); -static void seffect_stinking_cloud(struct obj **); -static void seffect_blank_paper(struct obj **); -static void seffect_teleportation(struct obj **); -static void seffect_gold_detection(struct obj **); -static void seffect_food_detection(struct obj **); -static void seffect_identify(struct obj **); -static void seffect_magic_mapping(struct obj **); +staticfn boolean learnscrolltyp(short); +staticfn void cap_spe(struct obj *); +staticfn char *erode_obj_text(struct obj *, char *); +staticfn char *hawaiian_design(struct obj *, char *); +staticfn int read_ok(struct obj *); +staticfn void stripspe(struct obj *); +staticfn void p_glow1(struct obj *); +staticfn void p_glow2(struct obj *, const char *); +staticfn void forget(int); +staticfn int maybe_tame(struct monst *, struct obj *); +staticfn boolean can_center_cloud(coordxy, coordxy); +staticfn void display_stinking_cloud_positions(boolean); +staticfn void seffect_enchant_armor(struct obj **); +staticfn void seffect_destroy_armor(struct obj **); +staticfn void seffect_confuse_monster(struct obj **); +staticfn void seffect_scare_monster(struct obj **); +staticfn void seffect_remove_curse(struct obj **); +staticfn void seffect_create_monster(struct obj **); +staticfn void seffect_enchant_weapon(struct obj **); +staticfn void seffect_taming(struct obj **); +staticfn void seffect_genocide(struct obj **); +staticfn void seffect_light(struct obj **); +staticfn void seffect_charging(struct obj **); +staticfn void seffect_amnesia(struct obj **); +staticfn void seffect_fire(struct obj **); +staticfn void seffect_earth(struct obj **); +staticfn void seffect_punishment(struct obj **); +staticfn void seffect_stinking_cloud(struct obj **); +staticfn void seffect_blank_paper(struct obj **); +staticfn void seffect_teleportation(struct obj **); +staticfn void seffect_gold_detection(struct obj **); +staticfn void seffect_food_detection(struct obj **); +staticfn void seffect_identify(struct obj **); +staticfn void seffect_magic_mapping(struct obj **); #ifdef MAIL_STRUCTURES -static void seffect_mail(struct obj **); +staticfn void seffect_mail(struct obj **); #endif /* MAIL_STRUCTURES */ -static void set_lit(coordxy, coordxy, genericptr); -static void do_class_genocide(void); -static void do_stinking_cloud(struct obj *, boolean); -static boolean create_particular_parse(char *, +staticfn void set_lit(coordxy, coordxy, genericptr); +staticfn void do_class_genocide(void); +staticfn void do_stinking_cloud(struct obj *, boolean); +staticfn boolean create_particular_parse(char *, struct _create_particular_data *); -static boolean create_particular_creation(struct _create_particular_data *); +staticfn boolean create_particular_creation(struct _create_particular_data *); -static boolean +staticfn boolean learnscrolltyp(short scrolltyp) { if (!objects[scrolltyp].oc_name_known) { @@ -74,7 +74,7 @@ learnscroll(struct obj *sobj) } /* max spe is +99, min is -99 */ -static void +staticfn void cap_spe(struct obj *obj) { if (obj) { @@ -83,7 +83,7 @@ cap_spe(struct obj *obj) } } -static char * +staticfn char * erode_obj_text(struct obj *otmp, char *buf) { int erosion = greatest_erosion(otmp); @@ -217,7 +217,7 @@ hawaiian_motif(struct obj *shirt, char *buf) return buf; } -static char * +staticfn char * hawaiian_design(struct obj *shirt, char *buf) { static const char *const hawaiian_bgs[] = { @@ -308,7 +308,7 @@ assign_candy_wrapper(struct obj *obj) } /* getobj callback for object to read */ -static int +staticfn int read_ok(struct obj *obj) { if (!obj) @@ -643,7 +643,7 @@ doread(void) RESTORE_WARNING_FORMAT_NONLITERAL -static void +staticfn void stripspe(struct obj *obj) { if (obj->blessed || obj->spe <= 0) { @@ -658,13 +658,13 @@ stripspe(struct obj *obj) } } -static void +staticfn void p_glow1(struct obj *otmp) { pline("%s briefly.", Yobjnam2(otmp, Blind ? "vibrate" : "glow")); } -static void +staticfn void p_glow2(struct obj *otmp, const char *color) { pline("%s%s%s for a moment.", Yobjnam2(otmp, Blind ? "vibrate" : "glow"), @@ -998,7 +998,7 @@ recharge(struct obj *obj, int curse_bless) * Other things are subject to flags: * howmuch & ALL_SPELLS = forget all spells */ -static void +staticfn void forget(int howmuch) { struct monst *mtmp; @@ -1022,7 +1022,7 @@ forget(int howmuch) } /* monster is hit by scroll of taming's effect */ -static int +staticfn int maybe_tame(struct monst *mtmp, struct obj *sobj) { int was_tame = mtmp->mtame; @@ -1057,7 +1057,7 @@ valid_cloud_pos(coordxy x, coordxy y) /* Callback for getpos_sethilite, also used in determining whether a scroll * should have its regular effects, or not because it was out of range. */ -static boolean +staticfn boolean can_center_cloud(coordxy x, coordxy y) { if (!valid_cloud_pos(x, y)) @@ -1065,7 +1065,7 @@ can_center_cloud(coordxy x, coordxy y) return (cansee(x, y) && distu(x, y) < 32); } -static void +staticfn void display_stinking_cloud_positions(boolean on_off) { coordxy x, y, dx, dy; @@ -1092,7 +1092,7 @@ display_stinking_cloud_positions(boolean on_off) } } -static void +staticfn void seffect_enchant_armor(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1242,7 +1242,7 @@ seffect_enchant_armor(struct obj **sobjp) Blind ? "again" : "unexpectedly"); } -static void +staticfn void seffect_destroy_armor(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1290,7 +1290,7 @@ seffect_destroy_armor(struct obj **sobjp) } } -static void +staticfn void seffect_confuse_monster(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1345,7 +1345,7 @@ seffect_confuse_monster(struct obj **sobjp) } } -static void +staticfn void seffect_scare_monster(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1380,7 +1380,7 @@ seffect_scare_monster(struct obj **sobjp) } } -static void +staticfn void seffect_remove_curse(struct obj **sobjp) { struct obj *sobj = *sobjp; /* scroll or fake spellbook */ @@ -1497,7 +1497,7 @@ seffect_remove_curse(struct obj **sobjp) update_inventory(); } -static void +staticfn void seffect_create_monster(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1516,7 +1516,7 @@ seffect_create_monster(struct obj **sobjp) */ } -static void +staticfn void seffect_enchant_weapon(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1566,7 +1566,7 @@ seffect_enchant_weapon(struct obj **sobjp) cap_spe(uwep); } -static void +staticfn void seffect_taming(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1609,7 +1609,7 @@ seffect_taming(struct obj **sobjp) } } -static void +staticfn void seffect_genocide(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1628,7 +1628,7 @@ seffect_genocide(struct obj **sobjp) do_genocide((!scursed) | (2 * !!Confusion)); } -static void +staticfn void seffect_light(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1675,7 +1675,7 @@ seffect_light(struct obj **sobjp) } } -static void +staticfn void seffect_charging(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1717,7 +1717,7 @@ seffect_charging(struct obj **sobjp) recharge(otmp, scursed ? -1 : sblessed ? 1 : 0); } -static void +staticfn void seffect_amnesia(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1737,7 +1737,7 @@ seffect_amnesia(struct obj **sobjp) exercise(A_WIS, FALSE); } -static void +staticfn void seffect_fire(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1806,7 +1806,7 @@ seffect_fire(struct obj **sobjp) #undef ZT_SPELL_O_FIRE } -static void +staticfn void seffect_earth(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1863,7 +1863,7 @@ seffect_earth(struct obj **sobjp) } } -static void +staticfn void seffect_punishment(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1878,7 +1878,7 @@ seffect_punishment(struct obj **sobjp) punish(sobj); } -static void +staticfn void seffect_stinking_cloud(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1892,7 +1892,7 @@ seffect_stinking_cloud(struct obj **sobjp) do_stinking_cloud(sobj, already_known); } -static void +staticfn void seffect_blank_paper(struct obj **sobjp UNUSED) { if (Blind) @@ -1902,7 +1902,7 @@ seffect_blank_paper(struct obj **sobjp UNUSED) gk.known = TRUE; } -static void +staticfn void seffect_teleportation(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1922,7 +1922,7 @@ seffect_teleportation(struct obj **sobjp) } } -static void +staticfn void seffect_gold_detection(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1933,7 +1933,7 @@ seffect_gold_detection(struct obj **sobjp) *sobjp = 0; /* failure: strange_feeling() -> useup() */ } -static void +staticfn void seffect_food_detection(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1942,7 +1942,7 @@ seffect_food_detection(struct obj **sobjp) *sobjp = 0; /* nothing detected: strange_feeling -> useup */ } -static void +staticfn void seffect_identify(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -1989,7 +1989,7 @@ seffect_identify(struct obj **sobjp) } } -static void +staticfn void seffect_magic_mapping(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -2041,7 +2041,7 @@ seffect_magic_mapping(struct obj **sobjp) } #ifdef MAIL_STRUCTURES -static void +staticfn void seffect_mail(struct obj **sobjp) { struct obj *sobj = *sobjp; @@ -2354,7 +2354,7 @@ static struct litmon *gremlins = 0; /* * Low-level lit-field update routine. */ -static void +staticfn void set_lit(coordxy x, coordxy y, genericptr_t val) { struct monst *mtmp; @@ -2510,7 +2510,7 @@ litroom( return; } -static void +staticfn void do_class_genocide(void) { int i, j, immunecnt, gonecnt, goodcnt, class, feel_dead = 0; @@ -2946,7 +2946,7 @@ unpunish(void) /* Prompt the player to create a stinking cloud and then create it if they give * a location. */ -static void +staticfn void do_stinking_cloud(struct obj *sobj, boolean mention_stinking) { coord cc; @@ -3001,7 +3001,7 @@ cant_revive( return FALSE; } -static boolean +staticfn boolean create_particular_parse( char *str, struct _create_particular_data *d) @@ -3116,7 +3116,7 @@ create_particular_parse( return FALSE; } -static boolean +staticfn boolean create_particular_creation( struct _create_particular_data *d) { diff --git a/src/rect.c b/src/rect.c index e0009777d..801af1343 100644 --- a/src/rect.c +++ b/src/rect.c @@ -6,7 +6,7 @@ int get_rect_ind(NhRect *); -static boolean intersect(NhRect *, NhRect *, NhRect *); +staticfn boolean intersect(NhRect *, NhRect *, NhRect *); /* * In this file, we will handle the various rectangle functions we @@ -111,7 +111,7 @@ rnd_rect(void) * otherwise returns FALSE */ -static boolean +staticfn boolean intersect(NhRect *r1, NhRect *r2, NhRect *r3) { if (r2->lx > r1->hx || r2->ly > r1->hy || r2->hx < r1->lx diff --git a/src/region.c b/src/region.c index f7755181d..523fb38af 100644 --- a/src/region.c +++ b/src/region.c @@ -37,8 +37,8 @@ boolean enter_force_field(genericptr,genericptr); NhRegion *create_force_field(coordxy,coordxy,int,long); #endif -static void reset_region_mids(NhRegion *); -static boolean is_hero_inside_gas_cloud(void); +staticfn void reset_region_mids(NhRegion *); +staticfn boolean is_hero_inside_gas_cloud(void); static const callback_proc callbacks[] = { #define INSIDE_GAS_CLOUD 0 @@ -875,7 +875,7 @@ region_stats( RESTORE_WARNING_FORMAT_NONLITERAL /* update monster IDs for region being loaded from bones; `ghostly' implied */ -static void +staticfn void reset_region_mids(NhRegion *reg) { int i = 0, n = reg->n_monst; @@ -1109,7 +1109,7 @@ inside_gas_cloud(genericptr_t p1, genericptr_t p2) return FALSE; /* Monster is still alive */ } -static boolean +staticfn boolean is_hero_inside_gas_cloud(void) { int i; diff --git a/src/restore.c b/src/restore.c index b74473062..c4e136c98 100644 --- a/src/restore.c +++ b/src/restore.c @@ -12,30 +12,30 @@ extern int dotrow; /* shared with save */ #endif #ifdef ZEROCOMP -static void zerocomp_minit(void); -static void zerocomp_mread(int, genericptr_t, unsigned int); -static int zerocomp_mgetc(void); +staticfn void zerocomp_minit(void); +staticfn void zerocomp_mread(int, genericptr_t, unsigned int); +staticfn int zerocomp_mgetc(void); #endif -static void find_lev_obj(void); -static void restlevchn(NHFILE *); -static void restdamage(NHFILE *); -static void restobj(NHFILE *, struct obj *); -static struct obj *restobjchn(NHFILE *, boolean); -static void restmon(NHFILE *, struct monst *); -static struct monst *restmonchn(NHFILE *); -static struct fruit *loadfruitchn(NHFILE *); -static void freefruitchn(struct fruit *); -static void ghostfruit(struct obj *); -static boolean restgamestate(NHFILE *); -static void restlevelstate(void); -static int restlevelfile(xint8); -static void rest_bubbles(NHFILE *); -static void restore_gamelog(NHFILE *); -static void restore_msghistory(NHFILE *); -static void reset_oattached_mids(boolean); -static void rest_levl(NHFILE *, boolean); -static void rest_stairs(NHFILE *); +staticfn void find_lev_obj(void); +staticfn void restlevchn(NHFILE *); +staticfn void restdamage(NHFILE *); +staticfn void restobj(NHFILE *, struct obj *); +staticfn struct obj *restobjchn(NHFILE *, boolean); +staticfn void restmon(NHFILE *, struct monst *); +staticfn struct monst *restmonchn(NHFILE *); +staticfn struct fruit *loadfruitchn(NHFILE *); +staticfn void freefruitchn(struct fruit *); +staticfn void ghostfruit(struct obj *); +staticfn boolean restgamestate(NHFILE *); +staticfn void restlevelstate(void); +staticfn int restlevelfile(xint8); +staticfn void rest_bubbles(NHFILE *); +staticfn void restore_gamelog(NHFILE *); +staticfn void restore_msghistory(NHFILE *); +staticfn void reset_oattached_mids(boolean); +staticfn void rest_levl(NHFILE *, boolean); +staticfn void rest_stairs(NHFILE *); /* * Save a mapping of IDs from ghost levels to the current level. This @@ -50,8 +50,8 @@ struct bucket { } map[N_PER_BUCKET]; }; -static void clear_id_mapping(void); -static void add_id_mapping(unsigned, unsigned); +staticfn void clear_id_mapping(void); +staticfn void add_id_mapping(unsigned, unsigned); #ifdef AMII_GRAPHICS void amii_setpens(int); /* use colors from save file */ @@ -68,7 +68,7 @@ extern int amii_numcolors; #define Mread(fd,adr,siz) mread((fd), (genericptr_t) (adr), (unsigned) (siz)) /* Recalculate gl.level.objects[x][y], since this info was not saved. */ -static void +staticfn void find_lev_obj(void) { struct obj *fobjtmp = (struct obj *) 0; @@ -125,7 +125,7 @@ inven_inuse(boolean quietly) } } -static void +staticfn void restlevchn(NHFILE *nhfp) { int cnt = 0; @@ -151,7 +151,7 @@ restlevchn(NHFILE *nhfp) } } -static void +staticfn void restdamage(NHFILE *nhfp) { unsigned int dmgcount = 0; @@ -179,7 +179,7 @@ restdamage(NHFILE *nhfp) } /* restore one object */ -static void +staticfn void restobj(NHFILE *nhfp, struct obj *otmp) { int buflen = 0; @@ -234,7 +234,7 @@ restobj(NHFILE *nhfp, struct obj *otmp) } } -static struct obj * +staticfn struct obj * restobjchn(NHFILE *nhfp, boolean frozen) { struct obj *otmp, *otmp2 = 0; @@ -303,7 +303,7 @@ restobjchn(NHFILE *nhfp, boolean frozen) } /* restore one monster */ -static void +staticfn void restmon(NHFILE *nhfp, struct monst *mtmp) { int buflen = 0; @@ -373,7 +373,7 @@ restmon(NHFILE *nhfp, struct monst *mtmp) } /* mextra */ } -static struct monst * +staticfn struct monst * restmonchn(NHFILE *nhfp) { struct monst *mtmp, *mtmp2 = 0; @@ -451,7 +451,7 @@ restmonchn(NHFILE *nhfp) return first; } -static struct fruit * +staticfn struct fruit * loadfruitchn(NHFILE *nhfp) { struct fruit *flist, *fnext; @@ -471,7 +471,7 @@ loadfruitchn(NHFILE *nhfp) return flist; } -static void +staticfn void freefruitchn(struct fruit *flist) { struct fruit *fnext; @@ -483,7 +483,7 @@ freefruitchn(struct fruit *flist) } } -static void +staticfn void ghostfruit(struct obj *otmp) { struct fruit *oldf; @@ -504,8 +504,7 @@ ghostfruit(struct obj *otmp) #define SYSOPT_CHECK_SAVE_UID TRUE #endif -static -boolean +staticfn boolean restgamestate(NHFILE *nhfp) { struct flag newgameflags; @@ -700,7 +699,7 @@ restgamestate(NHFILE *nhfp) /* update game state pointers to those valid for the current level (so we don't dereference a wild u.ustuck when saving game state, for instance) */ -static void +staticfn void restlevelstate(void) { /* @@ -711,7 +710,7 @@ restlevelstate(void) } /*ARGSUSED*/ -static int +staticfn int restlevelfile(xint8 ltmp) { char whynot[BUFSZ]; @@ -882,7 +881,7 @@ dorecover(NHFILE *nhfp) return 1; } -static void +staticfn void rest_stairs(NHFILE *nhfp) { int buflen = 0; @@ -937,7 +936,7 @@ restcemetery(NHFILE *nhfp, struct cemetery **cemeteryaddr) } /*ARGSUSED*/ -static void +staticfn void rest_levl( NHFILE *nhfp, #ifdef RLECOMP @@ -1249,7 +1248,7 @@ get_plname_from_file(NHFILE *nhfp, char *plbuf) } /* restore Plane of Water's air bubbles and Plane of Air's clouds */ -static void +staticfn void rest_bubbles(NHFILE *nhfp) { xint8 bbubbly; @@ -1265,7 +1264,7 @@ rest_bubbles(NHFILE *nhfp) restore_waterlevel(nhfp); } -static void +staticfn void restore_gamelog(NHFILE *nhfp) { int slen = 0; @@ -1288,7 +1287,7 @@ restore_gamelog(NHFILE *nhfp) } } -static void +staticfn void restore_msghistory(NHFILE *nhfp) { int msgsize = 0, msgcount = 0; @@ -1313,7 +1312,7 @@ restore_msghistory(NHFILE *nhfp) } /* Clear all structures for object and monster ID mapping. */ -static void +staticfn void clear_id_mapping(void) { struct bucket *curr; @@ -1326,7 +1325,7 @@ clear_id_mapping(void) } /* Add a mapping to the ID map. */ -static void +staticfn void add_id_mapping(unsigned int gid, unsigned int nid) { int idx; @@ -1376,7 +1375,7 @@ lookup_id_mapping(unsigned int gid, unsigned int *nidp) return FALSE; } -static void +staticfn void reset_oattached_mids(boolean ghostly) { struct obj *otmp; diff --git a/src/rip.c b/src/rip.c index 6cd352f3e..dc237d4b2 100644 --- a/src/rip.c +++ b/src/rip.c @@ -19,7 +19,7 @@ #endif #ifdef TEXT_TOMBSTONE -static void center(int, char *); +staticfn void center(int, char *); #ifndef NH320_DEDICATION /* A normal tombstone for end of game display. */ @@ -70,7 +70,7 @@ static const char *const rip_txt[] = { #define DEATH_LINE 8 /* *char[] line # for death description */ #define YEAR_LINE 12 /* *char[] line # for year */ -static void +staticfn void center(int line, char *text) { char *ip, *op; diff --git a/src/rnd.c b/src/rnd.c index 6c9854c0b..beb4992ed 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -7,8 +7,9 @@ #ifdef USE_ISAAC64 #include "isaac64.h" -static int whichrng(int (*fn)(int)); -static int RND(int); +staticfn int whichrng(int (*fn)(int)); +staticfn int RND(int); +staticfn void set_random(unsigned long, int (*)(int)); #if 0 static isaac64_ctx rng_state; @@ -27,7 +28,7 @@ static struct rnglist_t rnglist[] = { { rn2_on_display_rng, FALSE, { 0 } }, /* DISP */ }; -static int +staticfn int whichrng(int (*fn)(int)) { int i; @@ -56,7 +57,7 @@ init_isaac64(unsigned long seed, int (*fn)(int)) (int) sizeof seed); } -static int +staticfn int RND(int x) { return (isaac64_next_uint64(&rnglist[CORE].rng_state) % x); @@ -230,7 +231,7 @@ rnz(int i) /* Sets the seed for the random number generator */ #ifdef USE_ISAAC64 -static void +staticfn void set_random(unsigned long seed, int (*fn)(int)) { @@ -240,7 +241,7 @@ set_random(unsigned long seed, #else /* USE_ISAAC64 */ /*ARGSUSED*/ -static void +staticfn void set_random(unsigned long seed, int (*fn)(int) UNUSED) { diff --git a/src/role.c b/src/role.c index ec03a8b03..608086965 100644 --- a/src/role.c +++ b/src/role.c @@ -696,10 +696,10 @@ const struct Align aligns[] = { { "evil", "unaligned", "Una", 0, A_NONE } }; -static int randrole_filtered(void); -static char *promptsep(char *, int); -static int role_gendercount(int); -static int race_alignmentcount(int); +staticfn int randrole_filtered(void); +staticfn char *promptsep(char *, int); +staticfn int role_gendercount(int); +staticfn int race_alignmentcount(int); /* used by str2XXX() */ static char NEARDATA randomstr[] = "random"; @@ -722,7 +722,7 @@ randrole(boolean for_display) return res; } -static int +staticfn int randrole_filtered(void) { int i, n = 0, set[SIZE(roles)]; @@ -1374,7 +1374,7 @@ clearrolefilter(int which) } } -static char * +staticfn char * promptsep(char *buf, int num_post_attribs) { const char *conjuct = "and "; @@ -1389,7 +1389,7 @@ promptsep(char *buf, int num_post_attribs) return buf; } -static int +staticfn int role_gendercount(int rolenum) { int gendcount = 0; @@ -1405,7 +1405,7 @@ role_gendercount(int rolenum) return gendcount; } -static int +staticfn int race_alignmentcount(int racenum) { int aligncount = 0; diff --git a/src/rumors.c b/src/rumors.c index 643a73968..82794b04b 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -41,14 +41,14 @@ * and placed there by 'makedefs'. */ -static void unpadline(char *); -static void init_rumors(dlb *); -static char *get_rnd_line(dlb *, char *, unsigned, int (*)(int), +staticfn void unpadline(char *); +staticfn void init_rumors(dlb *); +staticfn char *get_rnd_line(dlb *, char *, unsigned, int (*)(int), long, long, unsigned); -static void init_oracles(dlb *); -static void others_check(const char *ftype, const char *, winid *); -static void couldnt_open_file(const char *); -static void init_CapMons(void); +staticfn void init_oracles(dlb *); +staticfn void others_check(const char *ftype, const char *, winid *); +staticfn void couldnt_open_file(const char *); +staticfn void init_CapMons(void); /* used by CapitalMon(); set up by init_CapMons(), released by free_CapMons(); there's no need for these to be put into 'struct instance_globals g' */ @@ -62,7 +62,7 @@ extern const char bogon_codes[]; /* from do_name.c */ /* makedefs pads short rumors, epitaphs, engravings, and hallucinatory monster names with trailing underscores; strip those off */ -static void +staticfn void unpadline(char *line) { char *p = eos(line); @@ -80,7 +80,7 @@ unpadline(char *line) DISABLE_WARNING_FORMAT_NONLITERAL -static void +staticfn void init_rumors(dlb *fp) { static const char rumors_header[] = "%d,%ld,%lx;%d,%ld,%lx;0,0,%lx\n"; @@ -303,7 +303,7 @@ rumor_check(void) DISABLE_WARNING_FORMAT_NONLITERAL /* 3.7: augments rumors_check(); test 'engrave' or 'epitaph' or 'bogusmon' */ -static void +staticfn void others_check( const char *ftype, /* header: "{Engravings|Epitaphs|Bogus monsters}:" */ const char *fname, /* filename: {ENGRAVEFILE|EPITAPHFILE|BOGUSMONFILE} */ @@ -415,7 +415,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL chosen; however, if padlength is 0, lines following long lines are more likely than average to be picked, and lines after short lines are less likely */ -static char * +staticfn char * get_rnd_line( dlb *fh, /* already opened file */ char *buf, /* output buffer */ @@ -571,7 +571,7 @@ outrumor( pline1(line); } -static void +staticfn void init_oracles(dlb *fp) { int i; @@ -760,7 +760,7 @@ doconsult(struct monst *oracl) return ECMD_TIME; } -static void +staticfn void couldnt_open_file(const char *filename) { int save_something = gp.program_state.something_worth_saving; @@ -819,7 +819,7 @@ CapitalMon( having a capitalized type name like Green-elf or Archon, plus unique monsters whose "name" is a title rather than a personal name, plus hallucinatory monster names that fall into either of those categories */ -static void +staticfn void init_CapMons(void) { unsigned pass; diff --git a/src/save.c b/src/save.c index 7c800b2f9..f5fe3e496 100644 --- a/src/save.c +++ b/src/save.c @@ -16,28 +16,28 @@ int dotcnt, dotrow; /* also used in restore */ #endif -static void savelevchn(NHFILE *); -static void savelevl(NHFILE *,boolean); -static void savedamage(NHFILE *); -static void save_bubbles(NHFILE *, xint8); -static void save_stairs(NHFILE *); -static void save_bc(NHFILE *); -static void saveobj(NHFILE *, struct obj *); -static void saveobjchn(NHFILE *, struct obj **) NO_NNARGS; -static void savemon(NHFILE *, struct monst *); -static void savemonchn(NHFILE *, struct monst *) NO_NNARGS; -static void savetrapchn(NHFILE *, struct trap *) NO_NNARGS; -static void save_gamelog(NHFILE *); -static void savegamestate(NHFILE *); -static void savelev_core(NHFILE *, xint8); -static void save_msghistory(NHFILE *); +staticfn void savelevchn(NHFILE *); +staticfn void savelevl(NHFILE *,boolean); +staticfn void savedamage(NHFILE *); +staticfn void save_bubbles(NHFILE *, xint8); +staticfn void save_stairs(NHFILE *); +staticfn void save_bc(NHFILE *); +staticfn void saveobj(NHFILE *, struct obj *); +staticfn void saveobjchn(NHFILE *, struct obj **) NO_NNARGS; +staticfn void savemon(NHFILE *, struct monst *); +staticfn void savemonchn(NHFILE *, struct monst *) NO_NNARGS; +staticfn void savetrapchn(NHFILE *, struct trap *) NO_NNARGS; +staticfn void save_gamelog(NHFILE *); +staticfn void savegamestate(NHFILE *); +staticfn void savelev_core(NHFILE *, xint8); +staticfn void save_msghistory(NHFILE *); #ifdef ZEROCOMP -static void zerocomp_bufon(int); -static void zerocomp_bufoff(int); -static void zerocomp_bflush(int); -static void zerocomp_bwrite(int, genericptr_t, unsigned int); -static void zerocomp_bputc(int); +staticfn void zerocomp_bufon(int); +staticfn void zerocomp_bufoff(int); +staticfn void zerocomp_bflush(int); +staticfn void zerocomp_bwrite(int, genericptr_t, unsigned int); +staticfn void zerocomp_bputc(int); #endif #if defined(HANGUPHANDLING) @@ -238,7 +238,7 @@ dosave0(void) return res; } -static void +staticfn void save_gamelog(NHFILE *nhfp) { struct gamelog_line *tmp = gg.gamelog, *tmp2; @@ -271,7 +271,7 @@ save_gamelog(NHFILE *nhfp) gg.gamelog = NULL; } -static void +staticfn void savegamestate(NHFILE *nhfp) { unsigned long uid; @@ -462,7 +462,7 @@ savelev(NHFILE *nhfp, xint8 lev) gu.uz_save.dnum = gu.uz_save.dlevel = 0; /* unset */ } -static void +staticfn void savelev_core(NHFILE *nhfp, xint8 lev) { #ifdef TOS @@ -574,7 +574,7 @@ savelev_core(NHFILE *nhfp, xint8 lev) return; } -static void +staticfn void savelevl(NHFILE *nhfp, boolean rlecomp) { #ifdef RLECOMP @@ -635,7 +635,7 @@ savelevl(NHFILE *nhfp, boolean rlecomp) } /* save Plane of Water's air bubbles and Plane of Air's clouds */ -static void +staticfn void save_bubbles(NHFILE *nhfp, xint8 lev) { xint8 bbubbly; @@ -682,7 +682,7 @@ savecemetery(NHFILE *nhfp, struct cemetery **cemeteryaddr) *cemeteryaddr = 0; } -static void +staticfn void savedamage(NHFILE *nhfp) { struct damage *damageptr, *tmp_dam; @@ -709,7 +709,7 @@ savedamage(NHFILE *nhfp) gl.level.damagelist = 0; } -static void +staticfn void save_stairs(NHFILE *nhfp) { stairway *stway = gs.stairs; @@ -744,7 +744,7 @@ save_stairs(NHFILE *nhfp) /* if ball and/or chain are loose, make an object chain for it/them and save that separately from other objects */ -static void +staticfn void save_bc(NHFILE *nhfp) { struct obj *bc_objs = 0; @@ -774,7 +774,7 @@ save_bc(NHFILE *nhfp) /* save one object; caveat: this is only for perform_bwrite(); caller handles release_data() */ -static void +staticfn void saveobj(NHFILE *nhfp, struct obj *otmp) { int buflen, zerobuf = 0; @@ -818,7 +818,7 @@ saveobj(NHFILE *nhfp, struct obj *otmp) /* save an object chain; sets head of list to Null when done; handles release_data() for each object in the list */ -static void +staticfn void saveobjchn(NHFILE *nhfp, struct obj **obj_p) { struct obj *otmp = *obj_p; @@ -881,7 +881,7 @@ saveobjchn(NHFILE *nhfp, struct obj **obj_p) } } -static void +staticfn void savemon(NHFILE *nhfp, struct monst *mtmp) { int buflen; @@ -944,7 +944,7 @@ savemon(NHFILE *nhfp, struct monst *mtmp) } } -static void +staticfn void savemonchn(NHFILE *nhfp, struct monst *mtmp) { struct monst *mtmp2; @@ -981,7 +981,7 @@ savemonchn(NHFILE *nhfp, struct monst *mtmp) } /* save traps; gf.ftrap is the only trap chain so the 2nd arg is superfluous */ -static void +staticfn void savetrapchn(NHFILE *nhfp, struct trap *trap) { static struct trap zerotrap; @@ -1039,7 +1039,7 @@ savefruitchn(NHFILE *nhfp) gf.ffruit = 0; } -static void +staticfn void savelevchn(NHFILE *nhfp) { s_level *tmplev, *tmplev2; @@ -1079,7 +1079,7 @@ store_plname_in_file(NHFILE *nhfp) return; } -static void +staticfn void save_msghistory(NHFILE *nhfp) { char *msg; diff --git a/src/selvar.c b/src/selvar.c index eeacabf42..a746be28b 100644 --- a/src/selvar.c +++ b/src/selvar.c @@ -6,8 +6,9 @@ #include "selvar.h" #include "sp_lev.h" -static boolean sel_flood_havepoint(coordxy, coordxy, coordxy *, coordxy *, int); -static long line_dist_coord(long, long, long, long, long, long); +staticfn boolean sel_flood_havepoint(coordxy, coordxy, coordxy *, coordxy *, + int); +staticfn long line_dist_coord(long, long, long, long, long, long); /* selection */ struct selectionvar * @@ -358,7 +359,7 @@ selection_do_grow(struct selectionvar *ov, int dir) selection_free(tmp, TRUE); } -static int (*selection_flood_check_func)(coordxy, coordxy); +staticfn int (*selection_flood_check_func)(coordxy, coordxy); void set_selection_floodfillchk(int (*f)(coordxy, coordxy)) @@ -367,7 +368,7 @@ set_selection_floodfillchk(int (*f)(coordxy, coordxy)) } /* check whethere is already in xs[],ys[] */ -static boolean +staticfn boolean sel_flood_havepoint( coordxy x, coordxy y, coordxy xs[], coordxy ys[], @@ -530,7 +531,7 @@ selection_do_ellipse( } /* square of distance from line segment (x1,y1, x2,y2) to point (x3,y3) */ -static long +staticfn long line_dist_coord(long x1, long y1, long x2, long y2, long x3, long y3) { long px = x2 - x1; diff --git a/src/sfstruct.c b/src/sfstruct.c index 78fc6e694..5d84583bd 100644 --- a/src/sfstruct.c +++ b/src/sfstruct.c @@ -10,7 +10,7 @@ * These were moved here from save.c and restore.c between 3.6.3 and 3.7.0. */ -static int getidx(int, int); +staticfn int getidx(int, int); #if defined(UNIX) || defined(WIN32) #define USE_BUFFERING @@ -66,7 +66,7 @@ static FILE *bw_FILE[MAXFD] = {0,0,0,0,0}; * happen. */ -static int +staticfn int getidx(int fd, int flg) { int i, retval = -1; diff --git a/src/shk.c b/src/shk.c index 086024113..d2392d018 100644 --- a/src/shk.c +++ b/src/shk.c @@ -11,9 +11,9 @@ #define PAY_SKIP (-1) #define PAY_BROKE (-2) -static void makekops(coord *); -static void call_kops(struct monst *, boolean); -static void kops_gone(boolean); +staticfn void makekops(coord *); +staticfn void call_kops(struct monst *, boolean); +staticfn void kops_gone(boolean); #define NOTANGRY(mon) ((mon)->mpeaceful) #define ANGRY(mon) (!NOTANGRY(mon)) @@ -26,61 +26,61 @@ extern const struct shclass shtypes[]; /* defined in shknam.c */ static const char and_its_contents[] = " and its contents"; static const char the_contents_of[] = "the contents of "; -static void append_honorific(char *); -static long addupbill(struct monst *); -static void pacify_shk(struct monst *, boolean); -static struct bill_x *onbill(struct obj *, struct monst *, boolean); -static struct monst *next_shkp(struct monst *, boolean); -static long shop_debt(struct eshk *); -static char *shk_owns(char *, struct obj *); -static char *mon_owns(char *, struct obj *); -static void clear_unpaid_obj(struct monst *, struct obj *); -static void clear_unpaid(struct monst *, struct obj *); -static void clear_no_charge_obj(struct monst *, struct obj *); -static void clear_no_charge(struct monst *, struct obj *); -static long check_credit(long, struct monst *); -static void pay(long, struct monst *); -static long get_cost(struct obj *, struct monst *); -static long set_cost(struct obj *, struct monst *); -static const char *shk_embellish(struct obj *, long); -static long cost_per_charge(struct monst *, struct obj *, boolean); -static long cheapest_item(struct monst *); -static int menu_pick_pay_items(struct monst *); -static int dopayobj(struct monst *, struct bill_x *, struct obj **, int, +staticfn void append_honorific(char *); +staticfn long addupbill(struct monst *); +staticfn void pacify_shk(struct monst *, boolean); +staticfn struct bill_x *onbill(struct obj *, struct monst *, boolean); +staticfn struct monst *next_shkp(struct monst *, boolean); +staticfn long shop_debt(struct eshk *); +staticfn char *shk_owns(char *, struct obj *); +staticfn char *mon_owns(char *, struct obj *); +staticfn void clear_unpaid_obj(struct monst *, struct obj *); +staticfn void clear_unpaid(struct monst *, struct obj *); +staticfn void clear_no_charge_obj(struct monst *, struct obj *); +staticfn void clear_no_charge(struct monst *, struct obj *); +staticfn long check_credit(long, struct monst *); +staticfn void pay(long, struct monst *); +staticfn long get_cost(struct obj *, struct monst *); +staticfn long set_cost(struct obj *, struct monst *); +staticfn const char *shk_embellish(struct obj *, long); +staticfn long cost_per_charge(struct monst *, struct obj *, boolean); +staticfn long cheapest_item(struct monst *); +staticfn int menu_pick_pay_items(struct monst *); +staticfn int dopayobj(struct monst *, struct bill_x *, struct obj **, int, boolean); -static long stolen_container(struct obj *, struct monst *, long, boolean); -static long corpsenm_price_adj(struct obj *); -static long getprice(struct obj *, boolean); -static void shk_names_obj(struct monst *, struct obj *, const char *, long, +staticfn long stolen_container(struct obj *, struct monst *, long, boolean); +staticfn long corpsenm_price_adj(struct obj *); +staticfn long getprice(struct obj *, boolean); +staticfn void shk_names_obj(struct monst *, struct obj *, const char *, long, const char *); -static boolean inherits(struct monst *, int, int, boolean); -static void set_repo_loc(struct monst *); -static struct obj *bp_to_obj(struct bill_x *); -static long get_pricing_units(struct obj *); -static boolean angry_shk_exists(void); -static void home_shk(struct monst *, boolean); -static void rile_shk(struct monst *); -static void rouse_shk(struct monst *, boolean); -static boolean shk_impaired(struct monst *); -static boolean repairable_damage(struct damage *, struct monst *); -static struct damage *find_damage(struct monst *); -static void discard_damage_struct(struct damage *); -static void discard_damage_owned_by(struct monst *); -static void shk_fixes_damage(struct monst *); -static uint8 litter_getpos(uint8 *, coordxy, coordxy, struct monst *); -static void litter_scatter(uint8 *, coordxy, coordxy, struct monst *); -static void litter_newsyms(uint8 *, coordxy, coordxy); -static int repair_damage(struct monst *, struct damage *, boolean); -static void sub_one_frombill(struct obj *, struct monst *); -static void add_one_tobill(struct obj *, boolean, struct monst *); -static void dropped_container(struct obj *, struct monst *, boolean); -static void add_to_billobjs(struct obj *); -static void bill_box_content(struct obj *, boolean, boolean, +staticfn boolean inherits(struct monst *, int, int, boolean); +staticfn void set_repo_loc(struct monst *); +staticfn struct obj *bp_to_obj(struct bill_x *); +staticfn long get_pricing_units(struct obj *); +staticfn boolean angry_shk_exists(void); +staticfn void home_shk(struct monst *, boolean); +staticfn void rile_shk(struct monst *); +staticfn void rouse_shk(struct monst *, boolean); +staticfn boolean shk_impaired(struct monst *); +staticfn boolean repairable_damage(struct damage *, struct monst *); +staticfn struct damage *find_damage(struct monst *); +staticfn void discard_damage_struct(struct damage *); +staticfn void discard_damage_owned_by(struct monst *); +staticfn void shk_fixes_damage(struct monst *); +staticfn uint8 litter_getpos(uint8 *, coordxy, coordxy, struct monst *); +staticfn void litter_scatter(uint8 *, coordxy, coordxy, struct monst *); +staticfn void litter_newsyms(uint8 *, coordxy, coordxy); +staticfn int repair_damage(struct monst *, struct damage *, boolean); +staticfn void sub_one_frombill(struct obj *, struct monst *); +staticfn void add_one_tobill(struct obj *, boolean, struct monst *); +staticfn void dropped_container(struct obj *, struct monst *, boolean); +staticfn void add_to_billobjs(struct obj *); +staticfn void bill_box_content(struct obj *, boolean, boolean, struct monst *); -static boolean rob_shop(struct monst *); -static void deserted_shop(char *); -static boolean special_stock(struct obj *, struct monst *, boolean); -static const char *cad(boolean); +staticfn boolean rob_shop(struct monst *); +staticfn void deserted_shop(char *); +staticfn boolean special_stock(struct obj *, struct monst *, boolean); +staticfn const char *cad(boolean); /* invariants: obj->unpaid iff onbill(obj) [unless bp->useup] @@ -162,7 +162,7 @@ money2u(struct monst *mon, long amount) } } -static struct monst * +staticfn struct monst * next_shkp(struct monst *shkp, boolean withbill) { for (; shkp; shkp = shkp->nmon) { @@ -256,7 +256,7 @@ restshk(struct monst *shkp, boolean ghostly) } /* clear the unpaid bit on a single object and its contents */ -static void +staticfn void clear_unpaid_obj(struct monst *shkp, struct obj *otmp) { if (Has_contents(otmp)) @@ -266,7 +266,7 @@ clear_unpaid_obj(struct monst *shkp, struct obj *otmp) } /* clear the unpaid bit on all of the objects in the list */ -static void +staticfn void clear_unpaid(struct monst *shkp, struct obj *list) { while (list) { @@ -276,7 +276,7 @@ clear_unpaid(struct monst *shkp, struct obj *list) } /* clear the no_charge bit on a single object and its contents */ -static void +staticfn void clear_no_charge_obj( struct monst *shkp, /* if null, clear regardless of shop */ struct obj *otmp) @@ -324,7 +324,7 @@ clear_no_charge_obj( } /* clear the no_charge bit on all of the objects in the list */ -static void +staticfn void clear_no_charge(struct monst *shkp, struct obj *list) { while (list) { @@ -373,7 +373,7 @@ setpaid(struct monst *shkp) } } -static long +staticfn long addupbill(struct monst *shkp) { int ct = ESHK(shkp)->billct; @@ -387,7 +387,7 @@ addupbill(struct monst *shkp) return total; } -static void +staticfn void call_kops(struct monst *shkp, boolean nearshop) { /* Keystone Kops srt@ucla */ @@ -564,7 +564,7 @@ remote_burglary(coordxy x, coordxy y) /* shop merchandise has been taken; pay for it with any credit available; return false if the debt is fully covered by credit, true otherwise */ -static boolean +staticfn boolean rob_shop(struct monst *shkp) { struct eshk *eshkp; @@ -600,7 +600,7 @@ rob_shop(struct monst *shkp) } /* give a message when entering an untended shop (caller has verified that) */ -static void +staticfn void deserted_shop(/*const*/ char *enterstring) { struct monst *mtmp; @@ -867,7 +867,7 @@ same_price(struct obj *obj1, struct obj *obj2) * turning the `$' command into a way to discover that the current * level is bones data which has a shk on the warpath. */ -static long +staticfn long shop_debt(struct eshk *eshkp) { struct bill_x *bp; @@ -1003,7 +1003,7 @@ tended_shop(struct mkroom *sroom) return !mtmp ? FALSE : (boolean) inhishop(mtmp); } -static struct bill_x * +staticfn struct bill_x * onbill(struct obj *obj, struct monst *shkp, boolean silent) { if (shkp) { @@ -1150,7 +1150,7 @@ obfree(struct obj *obj, struct obj *merge) dealloc_obj(obj); } -static long +staticfn long check_credit(long tmp, struct monst *shkp) { long credit = ESHK(shkp)->credit; @@ -1169,7 +1169,7 @@ check_credit(long tmp, struct monst *shkp) return tmp; } -static void +staticfn void pay(long tmp, struct monst *shkp) { long robbed = ESHK(shkp)->robbed; @@ -1189,7 +1189,7 @@ pay(long tmp, struct monst *shkp) } /* return shkp to home position */ -static void +staticfn void home_shk(struct monst *shkp, boolean killkops) { coordxy x = ESHK(shkp)->shk.x, y = ESHK(shkp)->shk.y; @@ -1203,7 +1203,7 @@ home_shk(struct monst *shkp, boolean killkops) after_shk_move(shkp); } -static boolean +staticfn boolean angry_shk_exists(void) { struct monst *shkp; @@ -1216,7 +1216,7 @@ angry_shk_exists(void) } /* remove previously applied surcharge from all billed items */ -static void +staticfn void pacify_shk(struct monst *shkp, boolean clear_surcharge) { NOTANGRY(shkp) = TRUE; /* make peaceful */ @@ -1234,7 +1234,7 @@ pacify_shk(struct monst *shkp, boolean clear_surcharge) } /* add aggravation surcharge to all billed items */ -static void +staticfn void rile_shk(struct monst *shkp) { NOTANGRY(shkp) = FALSE; /* make angry */ @@ -1253,7 +1253,7 @@ rile_shk(struct monst *shkp) } /* wakeup and/or unparalyze shopkeeper */ -static void +staticfn void rouse_shk(struct monst *shkp, boolean verbosely) { if (helpless(shkp)) { @@ -1368,7 +1368,7 @@ static const char not_enough_money[] = "Besides, you don't have enough to interest %s."; /* delivers the cheapest item on the list */ -static long +staticfn long cheapest_item(struct monst *shkp) { int ct = ESHK(shkp)->billct; @@ -1385,7 +1385,7 @@ cheapest_item(struct monst *shkp) /* show items on your bill in a menu, and ask which to pay. returns the number of entries selected. */ -static int +staticfn int menu_pick_pay_items(struct monst *shkp) { struct eshk *eshkp = ESHK(shkp); @@ -1819,7 +1819,7 @@ dopay(void) * -1 if skip this object * -2 if no money/credit left */ -static int +staticfn int dopayobj( struct monst *shkp, struct bill_x *bp, @@ -2026,7 +2026,7 @@ paybill( when this returns True, it should call set_repo_loc() before returning; when it returns False, it should not do such because that might have already been called for some shopkeeper */ -static boolean +staticfn boolean inherits( struct monst *shkp, int numsk, @@ -2131,7 +2131,7 @@ inherits( return taken; } -static void +staticfn void set_repo_loc(struct monst *shkp) { coordxy ox, oy; @@ -2208,7 +2208,7 @@ finish_paybill(void) } /* find obj on one of the lists */ -static struct obj * +staticfn struct obj * bp_to_obj(struct bill_x *bp) { struct obj *obj; @@ -2295,7 +2295,7 @@ get_cost_of_shop_item( return cost; } -static long +staticfn long get_pricing_units(struct obj *obj) { long units = obj->quan; @@ -2326,7 +2326,7 @@ oid_price_adjustment(struct obj *obj, unsigned int oid) } /* calculate the value that the shk will charge for [one of] an object */ -static long +staticfn long get_cost( struct obj *obj, struct monst *shkp) /* if angry, impose a surcharge */ @@ -2506,7 +2506,7 @@ contained_gold( return value; } -static void +staticfn void dropped_container( struct obj *obj, struct monst *shkp, @@ -2545,7 +2545,7 @@ picked_container(struct obj *obj) } } -static boolean +staticfn boolean special_stock( struct obj *obj, struct monst *shkp, @@ -2590,7 +2590,7 @@ special_stock( } /* calculate how much the shk will pay when buying [all of] an object */ -static long +staticfn long set_cost(struct obj *obj, struct monst *shkp) { long tmp, unit_price = getprice(obj, TRUE), multiplier = 1L, divisor = 1L; @@ -2744,7 +2744,7 @@ unpaid_cost( return amt; } -static void +staticfn void add_one_tobill(struct obj *obj, boolean dummy, struct monst *shkp) { struct eshk *eshkp; @@ -2793,7 +2793,7 @@ add_one_tobill(struct obj *obj, boolean dummy, struct monst *shkp) obj->unpaid = 1; } -static void +staticfn void add_to_billobjs(struct obj *obj) { if (obj->where != OBJ_FREE) @@ -2814,7 +2814,7 @@ add_to_billobjs(struct obj *obj) } /* recursive billing of objects within containers. */ -static void +staticfn void bill_box_content( struct obj *obj, boolean ininv, @@ -2840,7 +2840,7 @@ bill_box_content( DISABLE_WARNING_FORMAT_NONLITERAL /* shopkeeper tells you what you bought or sold, sometimes partly IDing it */ -static void +staticfn void shk_names_obj( struct monst *shkp, struct obj *obj, @@ -3026,7 +3026,7 @@ addtobill( } } -static void +staticfn void append_honorific(char *buf) { /* (chooses among [0]..[3] normally; [1]..[4] after the @@ -3085,7 +3085,7 @@ splitbill(struct obj *obj, struct obj *otmp) } } -static void +staticfn void sub_one_frombill(struct obj *obj, struct monst *shkp) { struct bill_x *bp; @@ -3144,7 +3144,7 @@ subfrombill(struct obj *obj, struct monst *shkp) } } -static long +staticfn long stolen_container( struct obj *obj, struct monst *shkp, @@ -3700,7 +3700,7 @@ doinvbill( } /* adjust tin, egg, or corpse price based on monster data */ -static long +staticfn long corpsenm_price_adj(struct obj *obj) { long val = 0L; @@ -3744,7 +3744,7 @@ corpsenm_price_adj(struct obj *obj) return val; } -static long +staticfn long getprice(struct obj *obj, boolean shk_buying) { long tmp = (long) objects[obj->otyp].oc_cost; @@ -3866,7 +3866,7 @@ add_damage( } /* is shopkeeper impaired, so they cannot act? */ -static boolean +staticfn boolean shk_impaired(struct monst *shkp) { if (!shkp || !shkp->isshk || !inhishop(shkp)) @@ -3877,7 +3877,7 @@ shk_impaired(struct monst *shkp) } /* is damage dam repairable by shopkeeper shkp? */ -static boolean +staticfn boolean repairable_damage(struct damage *dam, struct monst *shkp) { coordxy x, y; @@ -3916,7 +3916,7 @@ repairable_damage(struct damage *dam, struct monst *shkp) } /* find any damage shopkeeper shkp could repair. returns NULL is none found */ -static struct damage * +staticfn struct damage * find_damage(struct monst *shkp) { struct damage *dam = gl.level.damagelist; @@ -3934,7 +3934,7 @@ find_damage(struct monst *shkp) return NULL; } -static void +staticfn void discard_damage_struct(struct damage *dam) { if (!dam) @@ -3955,7 +3955,7 @@ discard_damage_struct(struct damage *dam) } /* discard all damage structs owned by shopkeeper */ -static void +staticfn void discard_damage_owned_by(struct monst *shkp) { struct damage *dam = gl.level.damagelist, *dam2, *prevdam = NULL; @@ -3982,7 +3982,7 @@ discard_damage_owned_by(struct monst *shkp) } /* Shopkeeper tries to repair damage belonging to them */ -static void +staticfn void shk_fixes_damage(struct monst *shkp) { struct damage *dam = find_damage(shkp); @@ -4017,7 +4017,7 @@ shk_fixes_damage(struct monst *shkp) shop (possibly in the "free spot" or even in doorway or an adjacent wall gap), but if they are in a gap in a wall shared by two shops they might have started in the other shop */ -static uint8 +staticfn uint8 litter_getpos( uint8 *litter, /* array of 9 uint8's */ coordxy x, coordxy y, @@ -4048,7 +4048,7 @@ litter_getpos( litter[] guarantees that items will end up inside shkp's shop, but if the wall being repaired is shared by two shops the items might have started in the other shop */ -static void +staticfn void litter_scatter( uint8 *litter, coordxy x, coordxy y, @@ -4138,7 +4138,7 @@ litter_scatter( } } -static void +staticfn void litter_newsyms(uint8 *litter, coordxy x, coordxy y) { int i; @@ -4158,7 +4158,7 @@ litter_newsyms(uint8 *litter, coordxy x, coordxy y) * 0: repair postponed, 1: silent repair (no messages), 2: normal repair * 3: untrap */ -static int +staticfn int repair_damage( struct monst *shkp, struct damage *tmp_dam, @@ -4538,7 +4538,7 @@ shopdig(int fall) } } -static void +staticfn void makekops(coord *mm) { static const short k_mndx[4] = { PM_KEYSTONE_KOP, PM_KOP_SERGEANT, @@ -4882,7 +4882,7 @@ price_quote(struct obj *first_obj) destroy_nhwindow(tmpwin); } -static const char * +staticfn const char * shk_embellish(struct obj *itm, long cost) { if (!rn2(3)) { @@ -5020,7 +5020,7 @@ shk_chat(struct monst *shkp) RESTORE_WARNING_FORMAT_NONLITERAL -static void +staticfn void kops_gone(boolean silent) { int cnt = 0; @@ -5041,7 +5041,7 @@ kops_gone(boolean silent) plur(cnt), (cnt == 1) ? "es" : ""); } -static long +staticfn long cost_per_charge( struct monst *shkp, struct obj *otmp, @@ -5299,7 +5299,7 @@ Shk_Your(char *buf, struct obj *obj) return buf; } -static char * +staticfn char * shk_owns(char *buf, struct obj *obj) { struct monst *shkp; @@ -5314,7 +5314,7 @@ shk_owns(char *buf, struct obj *obj) return (char *) 0; } -static char * +staticfn char * mon_owns(char *buf, struct obj *obj) { if (obj->where == OBJ_MINVENT) @@ -5322,7 +5322,7 @@ mon_owns(char *buf, struct obj *obj) return (char *) 0; } -static const char * +staticfn const char * cad( boolean altusage) /* used as a verbalized exclamation: \"Cad! ...\" */ { diff --git a/src/shknam.c b/src/shknam.c index 6a4833942..2f2c16fd2 100644 --- a/src/shknam.c +++ b/src/shknam.c @@ -7,14 +7,14 @@ #include "hack.h" -static boolean stock_room_goodpos(struct mkroom *, int, int, int, int); -static boolean veggy_item(struct obj * obj, int); -static int shkveg(void); -static void mkveggy_at(int, int); -static void mkshobj_at(const struct shclass *, int, int, boolean); -static void nameshk(struct monst *, const char *const *); -static int good_shopdoor(struct mkroom *, coordxy *, coordxy *); -static int shkinit(const struct shclass *, struct mkroom *); +staticfn boolean stock_room_goodpos(struct mkroom *, int, int, int, int); +staticfn boolean veggy_item(struct obj * obj, int); +staticfn int shkveg(void); +staticfn void mkveggy_at(int, int); +staticfn void mkshobj_at(const struct shclass *, int, int, boolean); +staticfn void nameshk(struct monst *, const char *const *); +staticfn int good_shopdoor(struct mkroom *, coordxy *, coordxy *); +staticfn int shkinit(const struct shclass *, struct mkroom *); #define VEGETARIAN_CLASS (MAXOCLASSES + 1) @@ -372,7 +372,7 @@ init_shop_selection() /* decide whether an object or object type is considered vegetarian; for types, items which might go either way are assumed to be veggy */ -static boolean +staticfn boolean veggy_item(struct obj* obj, int otyp /* used iff obj is null */) { int corpsenm; @@ -400,7 +400,7 @@ veggy_item(struct obj* obj, int otyp /* used iff obj is null */) return FALSE; } -static int +staticfn int shkveg(void) { int i, j, maxprob, prob; @@ -435,7 +435,7 @@ shkveg(void) } /* make a random item for health food store */ -static void +staticfn void mkveggy_at(int sx, int sy) { struct obj *obj = mksobj_at(shkveg(), sx, sy, TRUE, TRUE); @@ -446,7 +446,7 @@ mkveggy_at(int sx, int sy) } /* make an object of the appropriate type for a shop square */ -static void +staticfn void mkshobj_at(const struct shclass *shp, int sx, int sy, boolean mkspecl) { struct monst *mtmp; @@ -479,7 +479,7 @@ mkshobj_at(const struct shclass *shp, int sx, int sy, boolean mkspecl) } /* extract a shopkeeper name for the given shop type */ -static void +staticfn void nameshk(struct monst *shk, const char *const *nlp) { int i, trycnt, names_avail; @@ -573,7 +573,7 @@ free_eshk(struct monst *mtmp) /* find a door in room sroom which is good for shop entrance. returns -1 if no good door found, or the gd.doors index and the door coordinates in sx, sy */ -static int +staticfn int good_shopdoor(struct mkroom *sroom, coordxy *sx, coordxy *sy) { int i; @@ -619,7 +619,7 @@ good_shopdoor(struct mkroom *sroom, coordxy *sx, coordxy *sy) } /* create a new shopkeeper in the given room */ -static int +staticfn int shkinit(const struct shclass *shp, struct mkroom *sroom) { int sh; @@ -682,7 +682,7 @@ shkinit(const struct shclass *shp, struct mkroom *sroom) return sh; } -static boolean +staticfn boolean stock_room_goodpos(struct mkroom *sroom, int rmno, int sh, int sx, int sy) { if (sroom->irregular) { diff --git a/src/sit.c b/src/sit.c index 288eb4ffb..d39bd10fd 100644 --- a/src/sit.c +++ b/src/sit.c @@ -6,8 +6,8 @@ #include "hack.h" #include "artifact.h" -static void throne_sit_effect(void); -static int lay_an_egg(void); +staticfn void throne_sit_effect(void); +staticfn int lay_an_egg(void); /* take away the hero's money */ void @@ -33,7 +33,7 @@ take_gold(void) } /* maybe do something when hero sits on a throne */ -static void +staticfn void throne_sit_effect(void) { if (rnd(6) > 4) { @@ -194,7 +194,7 @@ throne_sit_effect(void) } /* hero lays an egg */ -static int +staticfn int lay_an_egg(void) { struct obj *uegg; diff --git a/src/sounds.c b/src/sounds.c index 5c34ffd97..c5b2cded8 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -4,20 +4,20 @@ #include "hack.h" -static boolean throne_mon_sound(struct monst *); -static boolean beehive_mon_sound(struct monst *); -static boolean morgue_mon_sound(struct monst *); -static boolean zoo_mon_sound(struct monst *); -static boolean temple_priest_sound(struct monst *); -static boolean mon_is_gecko(struct monst *); -static int domonnoise(struct monst *); -static int dochat(void); -static struct monst *responsive_mon_at(int, int); -static int mon_in_room(struct monst *, int); -static boolean oracle_sound(struct monst *); +staticfn boolean throne_mon_sound(struct monst *); +staticfn boolean beehive_mon_sound(struct monst *); +staticfn boolean morgue_mon_sound(struct monst *); +staticfn boolean zoo_mon_sound(struct monst *); +staticfn boolean temple_priest_sound(struct monst *); +staticfn boolean mon_is_gecko(struct monst *); +staticfn int domonnoise(struct monst *); +staticfn int dochat(void); +staticfn struct monst *responsive_mon_at(int, int); +staticfn int mon_in_room(struct monst *, int); +staticfn boolean oracle_sound(struct monst *); /* this easily could be a macro, but it might overtax dumb compilers */ -static int +staticfn int mon_in_room(struct monst *mon, int rmtyp) { int rno = levl[mon->mx][mon->my].roomno; @@ -27,7 +27,7 @@ mon_in_room(struct monst *mon, int rmtyp) } -static boolean +staticfn boolean throne_mon_sound(struct monst *mtmp) { if ((mtmp->msleeping || is_lord(mtmp->data) @@ -59,7 +59,7 @@ throne_mon_sound(struct monst *mtmp) } -static boolean +staticfn boolean beehive_mon_sound(struct monst *mtmp) { if ((mtmp->data->mlet == S_ANT && is_flyer(mtmp->data)) @@ -86,7 +86,7 @@ beehive_mon_sound(struct monst *mtmp) return FALSE; } -static boolean +staticfn boolean morgue_mon_sound(struct monst *mtmp) { if ((is_undead(mtmp->data) || is_vampshifter(mtmp)) @@ -112,7 +112,7 @@ morgue_mon_sound(struct monst *mtmp) return FALSE; } -static boolean +staticfn boolean zoo_mon_sound(struct monst *mtmp) { if ((mtmp->msleeping || is_animal(mtmp->data)) @@ -128,7 +128,7 @@ zoo_mon_sound(struct monst *mtmp) return FALSE; } -static boolean +staticfn boolean temple_priest_sound(struct monst *mtmp) { if (mtmp->ispriest && inhistemple(mtmp) @@ -178,7 +178,7 @@ temple_priest_sound(struct monst *mtmp) return FALSE; } -static boolean +staticfn boolean oracle_sound(struct monst *mtmp) { if (mtmp->data != &mons[PM_ORACLE]) @@ -655,7 +655,7 @@ cry_sound(struct monst *mtmp) } /* return True if mon is a gecko or seems to look like one (hallucination) */ -static boolean +staticfn boolean mon_is_gecko(struct monst *mon) { int glyph; @@ -675,7 +675,7 @@ mon_is_gecko(struct monst *mon) DISABLE_WARNING_FORMAT_NONLITERAL -static int /* check calls to this */ +staticfn int /* check calls to this */ domonnoise(struct monst *mtmp) { char verbuf[BUFSZ]; @@ -1248,7 +1248,7 @@ dotalk(void) return result; } -static int +staticfn int dochat(void) { struct monst *mtmp; @@ -1403,7 +1403,7 @@ dochat(void) } /* is there a monster at that can see the hero and react? */ -static struct monst * +staticfn struct monst * responsive_mon_at(int x, int y) { struct monst *mtmp = isok(x, y) ? m_at(x, y) : 0; @@ -1616,7 +1616,7 @@ add_sound_mapping(const char *mapping) return 1; } -static audio_mapping * +staticfn audio_mapping * sound_matches_message(const char *msg) { audio_mapping *snd = soundmap; @@ -1796,7 +1796,7 @@ assign_soundlib(int idx) } #if 0 -static void +staticfn void choose_soundlib(const char *s) { int i; @@ -1878,54 +1878,54 @@ get_soundlib_name(char *dest, int maxlen) */ #if 0 -static void nosound_init_nhsound(void); -static void nosound_exit_nhsound(const char *); -static void nosound_suspend_nhsound(const char *); -static void nosound_resume_nhsound(void); -static void nosound_achievement(schar, schar, int32_t); -static void nosound_soundeffect(int32_t, int32_t); -static void nosound_play_usersound(char *, int32_t, int32_t); -static void nosound_ambience(int32_t, int32_t, int32_t); -static void nosound_verbal(char *text, int32_t gender, int32_t tone, +staticfn void nosound_init_nhsound(void); +staticfn void nosound_exit_nhsound(const char *); +staticfn void nosound_suspend_nhsound(const char *); +staticfn void nosound_resume_nhsound(void); +staticfn void nosound_achievement(schar, schar, int32_t); +staticfn void nosound_soundeffect(int32_t, int32_t); +staticfn void nosound_play_usersound(char *, int32_t, int32_t); +staticfn void nosound_ambience(int32_t, int32_t, int32_t); +staticfn void nosound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol, int32_t moreinfo); -static void +staticfn void nosound_init_nhsound(void) { } -static void +staticfn void nosound_exit_nhsound(const char *reason) { } -static void +staticfn void nosound_achievement(schar ach1, schar ach2, int32_t repeat) { } -static void +staticfn void nosound_soundeffect(int32_t seid, int volume) { } -static void +staticfn void nosound_hero_playnotes(int32_t instr, const char *notes, int32_t vol) { } -static void +staticfn void nosound_play_usersound(char *filename, int volume, int idx) { } -static void +staticfn void nosound_ambience(int32_t ambienceid, int32_t ambience_action, int32_t hero_proximity) { } -static void +staticfn void nosound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol, int32_t moreinfo) { @@ -1949,7 +1949,7 @@ static const struct soundeffect_automapping static const char *semap_basenames[SIZE(se_mappings_init)]; static boolean basenames_initialized = FALSE; -static void +staticfn void initialize_semap_basenames(void) { int i; diff --git a/src/sp_lev.c b/src/sp_lev.c index 28648f8ac..8ea15c0d7 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -16,114 +16,114 @@ extern void mkmap(lev_init *); -static void solidify_map(void); -static void map_cleanup(void); -static void lvlfill_maze_grid(int, int, int, int, schar); -static void lvlfill_solid(schar, schar); -static void lvlfill_swamp(schar, schar, schar); -static void flip_dbridge_horizontal(struct rm *); -static void flip_dbridge_vertical(struct rm *); -static void flip_visuals(int, int, int, int, int); -static int flip_encoded_dir_bits(int, int); -static void flip_vault_guard(int, struct monst *, +staticfn void solidify_map(void); +staticfn void map_cleanup(void); +staticfn void lvlfill_maze_grid(int, int, int, int, schar); +staticfn void lvlfill_solid(schar, schar); +staticfn void lvlfill_swamp(schar, schar, schar); +staticfn void flip_dbridge_horizontal(struct rm *); +staticfn void flip_dbridge_vertical(struct rm *); +staticfn void flip_visuals(int, int, int, int, int); +staticfn int flip_encoded_dir_bits(int, int); +staticfn void flip_vault_guard(int, struct monst *, coordxy, coordxy, coordxy, coordxy); -static void sel_set_wall_property(coordxy, coordxy, genericptr_t); -static void set_wall_property(coordxy, coordxy, coordxy, coordxy, int); -static void remove_boundary_syms(void); -static void set_door_orientation(int, int); -static boolean shared_with_room(int, int, struct mkroom *); -static void maybe_add_door(int, int, struct mkroom *); -static void link_doors_rooms(void); -static int rnddoor(void); -static int rndtrap(void); -static void get_location(coordxy *, coordxy *, getloc_flags_t, +staticfn void sel_set_wall_property(coordxy, coordxy, genericptr_t); +staticfn void set_wall_property(coordxy, coordxy, coordxy, coordxy, int); +staticfn void remove_boundary_syms(void); +staticfn void set_door_orientation(int, int); +staticfn boolean shared_with_room(int, int, struct mkroom *); +staticfn void maybe_add_door(int, int, struct mkroom *); +staticfn void link_doors_rooms(void); +staticfn int rnddoor(void); +staticfn int rndtrap(void); +staticfn void get_location(coordxy *, coordxy *, getloc_flags_t, struct mkroom *); -static void set_ok_location_func(boolean (*)(coordxy, coordxy)); -static boolean is_ok_location(coordxy, coordxy, getloc_flags_t); -static unpacked_coord get_unpacked_coord(long, int); -static void get_room_loc(coordxy *, coordxy *, struct mkroom *); -static void get_free_room_loc(coordxy *, coordxy *, struct mkroom *, +staticfn void set_ok_location_func(boolean (*)(coordxy, coordxy)); +staticfn boolean is_ok_location(coordxy, coordxy, getloc_flags_t); +staticfn unpacked_coord get_unpacked_coord(long, int); +staticfn void get_room_loc(coordxy *, coordxy *, struct mkroom *); +staticfn void get_free_room_loc(coordxy *, coordxy *, struct mkroom *, packed_coord); -static boolean create_subroom(struct mkroom *, coordxy, coordxy, coordxy, +staticfn boolean create_subroom(struct mkroom *, coordxy, coordxy, coordxy, coordxy, xint16, xint16); -static void create_door(room_door *, struct mkroom *); -static void create_trap(spltrap *, struct mkroom *); -static int noncoalignment(aligntyp); -static boolean m_bad_boulder_spot(coordxy, coordxy); -static int pm_to_humidity(struct permonst *); -static unsigned int sp_amask_to_amask(unsigned int sp_amask); -static void create_monster(monster *, struct mkroom *); -static struct obj *create_object(object *, struct mkroom *); -static void create_altar(altar *, struct mkroom *); -static boolean search_door(struct mkroom *, coordxy *, coordxy *, xint16, int); -static void create_corridor(corridor *); -static struct mkroom *build_room(room *, struct mkroom *); -static void light_region(region *); -static void maze1xy(coord *, int); -static void fill_empty_maze(void); -static void splev_initlev(lev_init *); -static boolean generate_way_out_method(coordxy nx, coordxy ny, +staticfn void create_door(room_door *, struct mkroom *); +staticfn void create_trap(spltrap *, struct mkroom *); +staticfn int noncoalignment(aligntyp); +staticfn boolean m_bad_boulder_spot(coordxy, coordxy); +staticfn int pm_to_humidity(struct permonst *); +staticfn unsigned int sp_amask_to_amask(unsigned int sp_amask); +staticfn void create_monster(monster *, struct mkroom *); +staticfn struct obj *create_object(object *, struct mkroom *); +staticfn void create_altar(altar *, struct mkroom *); +staticfn boolean search_door(struct mkroom *, coordxy *, coordxy *, xint16, int); +staticfn void create_corridor(corridor *); +staticfn struct mkroom *build_room(room *, struct mkroom *); +staticfn void light_region(region *); +staticfn void maze1xy(coord *, int); +staticfn void fill_empty_maze(void); +staticfn void splev_initlev(lev_init *); +staticfn boolean generate_way_out_method(coordxy nx, coordxy ny, struct selectionvar *ov); -static void l_push_wid_hei_table(lua_State *, int, int); -static boolean good_stair_loc(coordxy, coordxy); -static void ensure_way_out(void); +staticfn void l_push_wid_hei_table(lua_State *, int, int); +staticfn boolean good_stair_loc(coordxy, coordxy); +staticfn void ensure_way_out(void); #if 0 /* macosx complains that these are unused */ -static long sp_code_jmpaddr(long, long); -static void spo_room(struct sp_coder *); -static void spo_trap(struct sp_coder *); -static void spo_gold(struct sp_coder *); -static void spo_corridor(struct sp_coder *); -static void spo_feature(struct sp_coder *); -static void spo_terrain(struct sp_coder *); -static void spo_replace_terrain(struct sp_coder *); -static void spo_levregion(struct sp_coder *); -static void spo_region(struct sp_coder *); -static void spo_drawbridge(struct sp_coder *); -static void spo_mazewalk(struct sp_coder *); -static void spo_wall_property(struct sp_coder *); -static void spo_room_door(struct sp_coder *); -static void spo_wallify(struct sp_coder *); -static void sel_set_wallify(coordxy, coordxy, genericptr_t); +staticfn long sp_code_jmpaddr(long, long); +staticfn void spo_room(struct sp_coder *); +staticfn void spo_trap(struct sp_coder *); +staticfn void spo_gold(struct sp_coder *); +staticfn void spo_corridor(struct sp_coder *); +staticfn void spo_feature(struct sp_coder *); +staticfn void spo_terrain(struct sp_coder *); +staticfn void spo_replace_terrain(struct sp_coder *); +staticfn void spo_levregion(struct sp_coder *); +staticfn void spo_region(struct sp_coder *); +staticfn void spo_drawbridge(struct sp_coder *); +staticfn void spo_mazewalk(struct sp_coder *); +staticfn void spo_wall_property(struct sp_coder *); +staticfn void spo_room_door(struct sp_coder *); +staticfn void spo_wallify(struct sp_coder *); +staticfn void sel_set_wallify(coordxy, coordxy, genericptr_t); #endif -static void spo_end_moninvent(void); -static void spo_pop_container(void); -static int l_create_stairway(lua_State *, boolean); -static void spo_endroom(struct sp_coder *); -static void l_table_getset_feature_flag(lua_State *, int, int, const char *, +staticfn void spo_end_moninvent(void); +staticfn void spo_pop_container(void); +staticfn int l_create_stairway(lua_State *, boolean); +staticfn void spo_endroom(struct sp_coder *); +staticfn void l_table_getset_feature_flag(lua_State *, int, int, const char *, int); -static void l_get_lregion(lua_State *, lev_region *); -static void sel_set_lit(coordxy, coordxy, genericptr_t); -static void add_doors_to_room(struct mkroom *); -static void get_table_coords_or_region(lua_State *, +staticfn void l_get_lregion(lua_State *, lev_region *); +staticfn void sel_set_lit(coordxy, coordxy, genericptr_t); +staticfn void add_doors_to_room(struct mkroom *); +staticfn void get_table_coords_or_region(lua_State *, coordxy *, coordxy *, coordxy *, coordxy *); -static void sel_set_ter(coordxy, coordxy, genericptr_t); -static void sel_set_door(coordxy, coordxy, genericptr_t); -static void sel_set_feature(coordxy, coordxy, genericptr_t); -static void levregion_add(lev_region *); -static void get_table_xy_or_coord(lua_State *, lua_Integer *, lua_Integer *); -static int get_table_region(lua_State *, const char *, lua_Integer *, +staticfn void sel_set_ter(coordxy, coordxy, genericptr_t); +staticfn void sel_set_door(coordxy, coordxy, genericptr_t); +staticfn void sel_set_feature(coordxy, coordxy, genericptr_t); +staticfn void levregion_add(lev_region *); +staticfn void get_table_xy_or_coord(lua_State *, lua_Integer *, lua_Integer *); +staticfn int get_table_region(lua_State *, const char *, lua_Integer *, lua_Integer *, lua_Integer *, lua_Integer *, boolean); -static void set_wallprop_in_selection(lua_State *, int); -static int floodfillchk_match_under(coordxy, coordxy); -static int floodfillchk_match_accessible(coordxy, coordxy); -static void l_push_mkroom_table(lua_State *, struct mkroom *); -static int get_table_align(lua_State *); -static int get_table_monclass(lua_State *); -static int find_montype(lua_State *, const char *, int *); -static int get_table_montype(lua_State *, int *); -static lua_Integer get_table_int_or_random(lua_State *, const char *, int); -static int get_table_buc(lua_State *); -static int get_table_objclass(lua_State *); -static int find_objtype(lua_State *, const char *); -static int get_table_objtype(lua_State *); -static const char *get_mkroom_name(int) NONNULL; -static int get_table_roomtype_opt(lua_State *, const char *, int); -static int get_table_traptype_opt(lua_State *, const char *, int); -static int get_traptype_byname(const char *); -static lua_Integer get_table_intarray_entry(lua_State *, int, int); -static struct sp_coder *sp_level_coder_init(void); +staticfn void set_wallprop_in_selection(lua_State *, int); +staticfn int floodfillchk_match_under(coordxy, coordxy); +staticfn int floodfillchk_match_accessible(coordxy, coordxy); +staticfn void l_push_mkroom_table(lua_State *, struct mkroom *); +staticfn int get_table_align(lua_State *); +staticfn int get_table_monclass(lua_State *); +staticfn int find_montype(lua_State *, const char *, int *); +staticfn int get_table_montype(lua_State *, int *); +staticfn lua_Integer get_table_int_or_random(lua_State *, const char *, int); +staticfn int get_table_buc(lua_State *); +staticfn int get_table_objclass(lua_State *); +staticfn int find_objtype(lua_State *, const char *); +staticfn int get_table_objtype(lua_State *); +staticfn const char *get_mkroom_name(int) NONNULL; +staticfn int get_table_roomtype_opt(lua_State *, const char *, int); +staticfn int get_table_traptype_opt(lua_State *, const char *, int); +staticfn int get_traptype_byname(const char *); +staticfn lua_Integer get_table_intarray_entry(lua_State *, int, int); +staticfn struct sp_coder *sp_level_coder_init(void); /* lua_CFunction prototypes */ int lspo_altar(lua_State *); @@ -311,7 +311,7 @@ mapfrag_match(struct mapfragment *mf, int x, int y) return TRUE; } -static void +staticfn void solidify_map(void) { coordxy x, y; @@ -324,7 +324,7 @@ solidify_map(void) /* do a post-level-creation cleanup of map, such as removing boulders and traps from lava */ -static void +staticfn void map_cleanup(void) { struct obj *otmp; @@ -355,7 +355,7 @@ map_cleanup(void) } } -static void +staticfn void lvlfill_maze_grid(int x1, int y1, int x2, int y2, schar filling) { int x, y; @@ -370,7 +370,7 @@ lvlfill_maze_grid(int x1, int y1, int x2, int y2, schar filling) } } -static void +staticfn void lvlfill_solid(schar filling, schar lit) { int x, y; @@ -387,7 +387,7 @@ lvlfill_solid(schar filling, schar lit) } } -static void +staticfn void lvlfill_swamp(schar fg, schar bg, schar lit) { int x, y; @@ -424,7 +424,7 @@ lvlfill_swamp(schar fg, schar bg, schar lit) } } -static void +staticfn void flip_dbridge_horizontal(struct rm *lev) { if (IS_DRAWBRIDGE(lev->typ)) { @@ -438,7 +438,7 @@ flip_dbridge_horizontal(struct rm *lev) } } -static void +staticfn void flip_dbridge_vertical(struct rm *lev) { if (IS_DRAWBRIDGE(lev->typ)) { @@ -454,7 +454,7 @@ flip_dbridge_vertical(struct rm *lev) /* for #wizfliplevel; not needed when flipping during level creation; update seen vector for whole flip area and glyph for known walls */ -static void +staticfn void flip_visuals(int flp, int minx, int miny, int maxx, int maxy) { struct rm *lev; @@ -495,7 +495,7 @@ flip_visuals(int flp, int minx, int miny, int maxx, int maxy) } /* transpose an encoded direction */ -static int +staticfn int flip_encoded_dir_bits(int flp, int val) { /* these depend on xdir[] and ydir[] order */ @@ -897,7 +897,7 @@ flip_level( } /* for #wizfliplevel, flip guard's egd data; not needed for level creation */ -static void +staticfn void flip_vault_guard( int flp, /* 1: transpose vertically, 2: transpose horizontally, 3: both */ struct monst *grd, /* the vault guard, has monst->mextra->egd data */ @@ -957,7 +957,7 @@ flip_level_rnd(int flp, boolean extras) } -static void +staticfn void sel_set_wall_property(coordxy x, coordxy y, genericptr_t arg) { int prop = *(int *) arg; @@ -972,7 +972,7 @@ sel_set_wall_property(coordxy x, coordxy y, genericptr_t arg) /* * Make walls of the area (x1, y1, x2, y2) non diggable/non passwall-able */ -static void +staticfn void set_wall_property(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int prop) { coordxy x, y; @@ -987,7 +987,7 @@ set_wall_property(coordxy x1, coordxy y1, coordxy x2, coordxy y2, int prop) } } -static void +staticfn void remove_boundary_syms(void) { /* @@ -1013,7 +1013,7 @@ remove_boundary_syms(void) } /* used by sel_set_door() and link_doors_rooms() */ -static void +staticfn void set_door_orientation(int x, int y) { boolean wleft, wright, wup, wdown; @@ -1060,7 +1060,7 @@ set_door_orientation(int x, int y) } /* is x,y right next to room droom? */ -static boolean +staticfn boolean shared_with_room(int x, int y, struct mkroom *droom) { int rmno = (droom - gr.rooms) + ROOMOFFSET; @@ -1081,7 +1081,7 @@ shared_with_room(int x, int y, struct mkroom *droom) } /* maybe add door at x,y to room droom */ -static void +staticfn void maybe_add_door(int x, int y, struct mkroom *droom) { if (droom->hx >= 0 @@ -1093,7 +1093,7 @@ maybe_add_door(int x, int y, struct mkroom *droom) } /* link all doors in the map to their corresponding rooms */ -static void +staticfn void link_doors_rooms(void) { int x, y; @@ -1119,7 +1119,7 @@ link_doors_rooms(void) /* * Choose randomly the state (nodoor, open, closed or locked) for a door */ -static int +staticfn int rnddoor(void) { static int state[] = { D_NODOOR, D_BROKEN, D_ISOPEN, D_CLOSED, D_LOCKED }; @@ -1130,7 +1130,7 @@ rnddoor(void) /* * Select a random trap */ -static int +staticfn int rndtrap(void) { int rtrap; @@ -1173,7 +1173,7 @@ rndtrap(void) * The "humidity" flag is used to ensure that engravings aren't created * underwater, or eels on dry land. */ -static void +staticfn void get_location( coordxy *x, coordxy *y, getloc_flags_t humidity, @@ -1245,13 +1245,13 @@ get_location( static boolean (*is_ok_location_func)(coordxy, coordxy) = NULL; -static void +staticfn void set_ok_location_func(boolean (*func)(coordxy, coordxy)) { is_ok_location_func = func; } -static boolean +staticfn boolean is_ok_location(coordxy x, coordxy y, getloc_flags_t humidity) { int typ = levl[x][y].typ; @@ -1288,7 +1288,7 @@ pm_good_location(coordxy x, coordxy y, struct permonst *pm) return is_ok_location(x, y, pm_to_humidity(pm)); } -static unpacked_coord +staticfn unpacked_coord get_unpacked_coord(long loc, int defhumidity) { static unpacked_coord c; @@ -1331,7 +1331,7 @@ get_location_coord( * Get a relative position inside a room. * negative values for x or y means RANDOM! */ -static void +staticfn void get_room_loc(coordxy *x, coordxy *y, struct mkroom *croom) { coord c; @@ -1356,7 +1356,7 @@ get_room_loc(coordxy *x, coordxy *y, struct mkroom *croom) * Get a relative position inside a room. * negative values for x or y means RANDOM! */ -static void +staticfn void get_free_room_loc( coordxy *x, coordxy *y, struct mkroom *croom, @@ -1638,7 +1638,7 @@ create_room( * Create a subroom in room proom at pos x,y with width w & height h. * x & y are relative to the parent room. */ -static boolean +staticfn boolean create_subroom( struct mkroom *proom, coordxy x, coordxy y, @@ -1684,7 +1684,7 @@ create_subroom( * Create a new door in a room. * It's placed on a wall (north, south, east or west). */ -static void +staticfn void create_door(room_door *dd, struct mkroom *broom) { int x = 0, y = 0; @@ -1782,7 +1782,7 @@ create_door(room_door *dd, struct mkroom *broom) /* * Create a trap in a room. */ -static void +staticfn void create_trap(spltrap *t, struct mkroom *croom) { coordxy x = -1, y = -1; @@ -1822,7 +1822,7 @@ create_trap(spltrap *t, struct mkroom *croom) /* * Create a monster in a room. */ -static int +staticfn int noncoalignment(aligntyp alignment) { int k; @@ -1834,7 +1834,7 @@ noncoalignment(aligntyp alignment) } /* attempt to screen out locations where a mimic-as-boulder shouldn't occur */ -static boolean +staticfn boolean m_bad_boulder_spot(coordxy x, coordxy y) { struct rm *lev; @@ -1854,7 +1854,7 @@ m_bad_boulder_spot(coordxy x, coordxy y) return FALSE; } -static int +staticfn int pm_to_humidity(struct permonst *pm) { int loc = DRY; @@ -1878,7 +1878,7 @@ pm_to_humidity(struct permonst *pm) * * When random: there is an 80% chance that the altar will be co-aligned. */ -static unsigned int +staticfn unsigned int sp_amask_to_amask(unsigned int sp_amask) { unsigned int amask; @@ -1895,7 +1895,7 @@ sp_amask_to_amask(unsigned int sp_amask) return amask; } -static void +staticfn void create_monster(monster *m, struct mkroom *croom) { struct monst *mtmp; @@ -2149,7 +2149,7 @@ create_monster(monster *m, struct mkroom *croom) /* * Create an object in a room. */ -static struct obj * +staticfn struct obj * create_object(object *o, struct mkroom *croom) { struct obj *otmp; @@ -2400,7 +2400,7 @@ create_object(object *o, struct mkroom *croom) /* * Create an altar in a room. */ -static void +staticfn void create_altar(altar *a, struct mkroom *croom) { schar sproom; @@ -2446,7 +2446,7 @@ create_altar(altar *a, struct mkroom *croom) /* * Search for a door in a room on a specified wall. */ -static boolean +staticfn boolean search_door( struct mkroom *croom, coordxy *x, coordxy *y, @@ -2618,7 +2618,7 @@ dig_corridor( * Basically we search for door coordinates or for endpoints coordinates * (from a distance). */ -static void +staticfn void create_corridor(corridor *c) { coord org, dest; @@ -2754,7 +2754,7 @@ fill_special_room(struct mkroom *croom) } } -static struct mkroom * +staticfn struct mkroom * build_room(room *r, struct mkroom *mkr) { boolean okroom; @@ -2786,7 +2786,7 @@ build_room(room *r, struct mkroom *mkr) /* * set lighting in a region that will not become a room. */ -static void +staticfn void light_region(region *tmpregion) { boolean litstate = tmpregion->rlit ? 1 : 0; @@ -2847,7 +2847,7 @@ wallify_map(coordxy x1, coordxy y1, coordxy x2, coordxy y2) * We want a place not 'touched' by the loader. That is, a place in * the maze outside every part of the special level. */ -static void +staticfn void maze1xy(coord *m, int humidity) { int x, y, tryct = 2000; @@ -2873,7 +2873,7 @@ maze1xy(coord *m, int humidity) * Makes the number of traps, monsters, etc. proportional * to the size of the maze. */ -static void +staticfn void fill_empty_maze(void) { int mapcountmax, mapcount, mapfact; @@ -2924,7 +2924,7 @@ fill_empty_maze(void) } } -static void +staticfn void splev_initlev(lev_init *linit) { switch (linit->init_style) { @@ -2964,7 +2964,7 @@ splev_initlev(lev_init *linit) } #if 0 -static long +staticfn long sp_code_jmpaddr(long curpos, long jmpaddr) { return (curpos + jmpaddr); @@ -2973,7 +2973,7 @@ sp_code_jmpaddr(long curpos, long jmpaddr) /*ARGUSED*/ -static void +staticfn void spo_end_moninvent(void) { if (invent_carrying_monster) @@ -2982,7 +2982,7 @@ spo_end_moninvent(void) } /*ARGUSED*/ -static void +staticfn void spo_pop_container(void) { if (container_idx > 0) { @@ -2992,7 +2992,7 @@ spo_pop_container(void) } /* push a table on lua stack: {width=wid, height=hei} */ -static void +staticfn void l_push_wid_hei_table(lua_State *L, int wid, int hei) { lua_newtable(L); @@ -3001,7 +3001,7 @@ l_push_wid_hei_table(lua_State *L, int wid, int hei) } /* push a table on lua stack containing room data */ -static void +staticfn void l_push_mkroom_table(lua_State *L, struct mkroom *tmpr) { lua_newtable(L); @@ -3056,7 +3056,7 @@ lspo_message(lua_State *L) RESTORE_WARNING_UNREACHABLE_CODE -static int +staticfn int get_table_align(lua_State *L) { static const char *const gtaligns[] = { @@ -3073,7 +3073,7 @@ get_table_align(lua_State *L) return a; } -static int +staticfn int get_table_monclass(lua_State *L) { char *s = get_table_str_opt(L, "class", NULL); @@ -3085,7 +3085,7 @@ get_table_monclass(lua_State *L) return ret; } -static int +staticfn int find_montype( lua_State *L UNUSED, const char *s, @@ -3109,7 +3109,7 @@ find_montype( return NON_PM; } -static int +staticfn int get_table_montype(lua_State *L, int *mgender) { char *s = get_table_str_opt(L, "id", NULL); @@ -3130,7 +3130,7 @@ get_table_montype(lua_State *L, int *mgender) * Returns absolute rather than map-relative coordinates; the caller of this * function must decide if it wants to interpret the coordinates as * map-relative and adjust accordingly. */ -static void +staticfn void get_table_xy_or_coord( lua_State *L, lua_Integer *x, @@ -3332,7 +3332,7 @@ DISABLE_WARNING_UNREACHABLE_CODE /* the hash key 'name' is an integer or "random", or if not existent, also return rndval */ -static lua_Integer +staticfn lua_Integer get_table_int_or_random(lua_State *L, const char *name, int rndval) { lua_Integer ret; @@ -3367,7 +3367,7 @@ get_table_int_or_random(lua_State *L, const char *name, int rndval) RESTORE_WARNING_UNREACHABLE_CODE -static int +staticfn int get_table_buc(lua_State *L) { static const char *const bucs[] = { @@ -3380,7 +3380,7 @@ get_table_buc(lua_State *L) return curse_state; } -static int +staticfn int get_table_objclass(lua_State *L) { char *s = get_table_str_opt(L, "class", NULL); @@ -3392,7 +3392,7 @@ get_table_objclass(lua_State *L) return ret; } -static int +staticfn int find_objtype(lua_State *L, const char *s) { if (s && *s) { @@ -3460,7 +3460,7 @@ find_objtype(lua_State *L, const char *s) return STRANGE_OBJECT; } -static int +staticfn int get_table_objtype(lua_State *L) { char *s = get_table_str_opt(L, "id", NULL); @@ -3909,7 +3909,7 @@ static const struct { { 0, 0 } }; -static const char * +staticfn const char * get_mkroom_name(int rtype) { int i; @@ -3922,7 +3922,7 @@ get_mkroom_name(int rtype) return "unknown"; /* not NULL */ } -static int +staticfn int get_table_roomtype_opt(lua_State *L, const char *name, int defval) { char *roomstr = get_table_str_opt(L, name, emptystr); @@ -4037,7 +4037,7 @@ lspo_room(lua_State *L) return 0; } -static void +staticfn void spo_endroom(struct sp_coder *coder UNUSED) { if (gc.coder->n_subroom > 1) { @@ -4057,7 +4057,7 @@ spo_endroom(struct sp_coder *coder UNUSED) /* callback for is_ok_location. stairs generated at random location shouldn't overwrite special terrain */ -static boolean +staticfn boolean good_stair_loc(coordxy x, coordxy y) { schar typ = levl[x][y].typ; @@ -4065,7 +4065,7 @@ good_stair_loc(coordxy x, coordxy y) return (typ == ROOM || typ == CORR || typ == ICE); } -static int +staticfn int l_create_stairway(lua_State *L, boolean using_ladder) { static const char *const stairdirs[] = { "down", "up", NULL }; @@ -4268,7 +4268,7 @@ static const struct { { "random", -1 }, { 0, NO_TRAP } }; -static int +staticfn int get_table_traptype_opt(lua_State *L, const char *name, int defval) { char *trapstr = get_table_str_opt(L, name, emptystr); @@ -4297,7 +4297,7 @@ get_trapname_bytype(int ttyp) return NULL; } -static int +staticfn int get_traptype_byname(const char *trapname) { int i; @@ -4493,7 +4493,7 @@ random_wdir(void) static schar floodfillchk_match_under_typ; -static int +staticfn int floodfillchk_match_under(coordxy x, coordxy y) { return (floodfillchk_match_under_typ == levl[x][y].typ); @@ -4506,7 +4506,7 @@ set_floodfillchk_match_under(coordxy typ) set_selection_floodfillchk(floodfillchk_match_under); } -static int +staticfn int floodfillchk_match_accessible(coordxy x, coordxy y) { return (ACCESSIBLE(levl[x][y].typ) @@ -4515,7 +4515,7 @@ floodfillchk_match_accessible(coordxy x, coordxy y) } /* change map location terrain type during level creation */ -static void +staticfn void sel_set_ter(coordxy x, coordxy y, genericptr_t arg) { terrain terr; @@ -4539,7 +4539,7 @@ sel_set_ter(coordxy x, coordxy y, genericptr_t arg) } } -static void +staticfn void sel_set_feature(coordxy x, coordxy y, genericptr_t arg) { if (!isok(x, y)) { @@ -4553,7 +4553,7 @@ sel_set_feature(coordxy x, coordxy y, genericptr_t arg) levl[x][y].typ = (*(int *) arg); } -static void +staticfn void sel_set_door(coordxy dx, coordxy dy, genericptr_t arg) { coordxy typ = *(coordxy *) arg; @@ -4644,7 +4644,7 @@ lspo_door(lua_State *L) RESTORE_WARNING_UNREACHABLE_CODE -static void +staticfn void l_table_getset_feature_flag( lua_State *L, int x, int y, @@ -5051,7 +5051,7 @@ lspo_replace_terrain(lua_State *L) return 0; } -static boolean +staticfn boolean generate_way_out_method( coordxy nx, coordxy ny, struct selectionvar *ov) @@ -5122,7 +5122,7 @@ generate_way_out_method( return res; } -static void +staticfn void ensure_way_out(void) { struct selectionvar *ov = selection_new(); @@ -5165,7 +5165,7 @@ ensure_way_out(void) DISABLE_WARNING_UNREACHABLE_CODE -static lua_Integer +staticfn lua_Integer get_table_intarray_entry(lua_State *L, int tableidx, int entrynum) { lua_Integer ret = 0; @@ -5187,7 +5187,7 @@ get_table_intarray_entry(lua_State *L, int tableidx, int entrynum) return ret; } -static int +staticfn int get_table_region( lua_State *L, const char *name, @@ -5276,7 +5276,7 @@ get_coord(lua_State *L, int i, lua_Integer *x, lua_Integer *y) RESTORE_WARNING_UNREACHABLE_CODE -static void +staticfn void levregion_add(lev_region *lregion) { if (!lregion->in_islev) { @@ -5315,7 +5315,7 @@ levregion_add(lev_region *lregion) - exclude = {x1,y1,x2,y2} (optional) - region_islev=true, exclude_islev=true (optional) - negative x and y are invalid */ -static void +staticfn void l_get_lregion(lua_State *L, lev_region *tmplregion) { lua_Integer x1,y1,x2,y2; @@ -5431,7 +5431,7 @@ lspo_exclusion(lua_State *L) return 0; } -static void +staticfn void sel_set_lit(coordxy x, coordxy y, genericptr_t arg) { int lit = *(int *) arg; @@ -5440,7 +5440,7 @@ sel_set_lit(coordxy x, coordxy y, genericptr_t arg) } /* Add to the room any doors within/bordering it */ -static void +staticfn void add_doors_to_room(struct mkroom *croom) { coordxy x, y; @@ -5457,7 +5457,7 @@ add_doors_to_room(struct mkroom *croom) DISABLE_WARNING_UNREACHABLE_CODE /* inside a lua table, get fields x1,y1,x2,y2 or region table */ -static void +staticfn void get_table_coords_or_region(lua_State *L, coordxy *dx1, coordxy *dy1, coordxy *dx2, coordxy *dy2) @@ -5807,7 +5807,7 @@ lspo_wall_property(lua_State *L) return 0; } -static void +staticfn void set_wallprop_in_selection(lua_State *L, int prop) { int argc = lua_gettop(L); @@ -5851,7 +5851,7 @@ lspo_non_passwall(lua_State *L) #if 0 /*ARGSUSED*/ -static void +staticfn void sel_set_wallify(coordxy x, coordxy y, genericptr_t arg UNUSED) { wallify_map(x, y, x, y); @@ -6227,7 +6227,7 @@ update_croom(void) gc.coder->croom = NULL; } -static struct sp_coder * +staticfn struct sp_coder * sp_level_coder_init(void) { int tmpi; diff --git a/src/spell.c b/src/spell.c index 0ea9adfe9..47ce6633f 100644 --- a/src/spell.c +++ b/src/spell.c @@ -28,30 +28,30 @@ struct chain_lightning_queue; struct chain_lightning_zap; -static int spell_let_to_idx(char); -static boolean cursed_book(struct obj * bp); -static boolean confused_book(struct obj *); -static void deadbook_pacify_undead(struct monst *); -static void deadbook(struct obj *); -static int learn(void); -static boolean rejectcasting(void); -static boolean getspell(int *); -static int QSORTCALLBACK spell_cmp(const genericptr, const genericptr); -static void sortspells(void); -static boolean spellsortmenu(void); -static boolean dospellmenu(const char *, int, int *); -static int percent_success(int); -static char *spellretention(int, char *); -static int throwspell(void); -static void cast_protection(void); -static void cast_chain_lightning(void); -static void spell_backfire(int); -static boolean spelleffects_check(int, int *, int *); -static const char *spelltypemnemonic(int); -static boolean can_center_spell_location(coordxy, coordxy); -static void display_spell_target_positions(boolean); -static boolean spell_aim_step(genericptr_t, coordxy, coordxy); -static void propagate_chain_lightning(struct chain_lightning_queue *, +staticfn int spell_let_to_idx(char); +staticfn boolean cursed_book(struct obj * bp); +staticfn boolean confused_book(struct obj *); +staticfn void deadbook_pacify_undead(struct monst *); +staticfn void deadbook(struct obj *); +staticfn int learn(void); +staticfn boolean rejectcasting(void); +staticfn boolean getspell(int *); +staticfn int QSORTCALLBACK spell_cmp(const genericptr, const genericptr); +staticfn void sortspells(void); +staticfn boolean spellsortmenu(void); +staticfn boolean dospellmenu(const char *, int, int *); +staticfn int percent_success(int); +staticfn char *spellretention(int, char *); +staticfn int throwspell(void); +staticfn void cast_protection(void); +staticfn void cast_chain_lightning(void); +staticfn void spell_backfire(int); +staticfn boolean spelleffects_check(int, int *, int *); +staticfn const char *spelltypemnemonic(int); +staticfn boolean can_center_spell_location(coordxy, coordxy); +staticfn void display_spell_target_positions(boolean); +staticfn boolean spell_aim_step(genericptr_t, coordxy, coordxy); +staticfn void propagate_chain_lightning(struct chain_lightning_queue *, struct chain_lightning_zap); /* The roles[] table lists the role-specific values for tuning @@ -110,7 +110,7 @@ static void propagate_chain_lightning(struct chain_lightning_queue *, static const char explodes[] = "radiates explosive energy"; /* convert a letter into a number in the range 0..51, or -1 if not a letter */ -static int +staticfn int spell_let_to_idx(char ilet) { int indx; @@ -125,7 +125,7 @@ spell_let_to_idx(char ilet) } /* TRUE: book should be destroyed by caller */ -static boolean +staticfn boolean cursed_book(struct obj *bp) { boolean was_in_use; @@ -184,7 +184,7 @@ cursed_book(struct obj *bp) } /* study while confused: returns TRUE if the book is destroyed */ -static boolean +staticfn boolean confused_book(struct obj *spellbook) { boolean gone = FALSE; @@ -206,7 +206,7 @@ confused_book(struct obj *spellbook) } /* pacify or tame an undead monster */ -static void +staticfn void deadbook_pacify_undead(struct monst *mtmp) { if ((is_undead(mtmp->data) || is_vampshifter(mtmp)) @@ -226,7 +226,7 @@ deadbook_pacify_undead(struct monst *mtmp) /* special effects for The Book of the Dead; reading it while blind is allowed so that needs to be taken into account too */ -static void +staticfn void deadbook(struct obj *book2) { struct monst *mtmp; @@ -352,7 +352,7 @@ book_cursed(struct obj *book) DISABLE_WARNING_FORMAT_NONLITERAL -static int +staticfn int learn(void) { int i; @@ -669,7 +669,7 @@ age_spells(void) /* return True if spellcasting is inhibited; only covers a small subset of reasons why casting won't work */ -static boolean +staticfn boolean rejectcasting(void) { /* rejections which take place before selecting a particular spell */ @@ -697,7 +697,7 @@ rejectcasting(void) * Return TRUE if a spell was picked, with the spell index in the return * parameter. Otherwise return FALSE. */ -static boolean +staticfn boolean getspell(int *spell_no) { int nspells, idx; @@ -808,7 +808,7 @@ docast(void) return ECMD_FAIL; } -static const char * +staticfn const char * spelltypemnemonic(int skill) { switch (skill) { @@ -922,7 +922,7 @@ struct chain_lightning_queue { zap is passed by value, so the move-forward doesn't change the passed argument. */ -static void +staticfn void propagate_chain_lightning( struct chain_lightning_queue *clq, struct chain_lightning_zap zap) @@ -973,7 +973,7 @@ propagate_chain_lightning( tmp_at(zap.x, zap.y); } -static void +staticfn void cast_chain_lightning(void) { struct chain_lightning_queue clq = { @@ -1054,7 +1054,7 @@ cast_chain_lightning(void) } -static void +staticfn void cast_protection(void) { int l = u.ulevel, loglev = 0, @@ -1131,7 +1131,7 @@ cast_protection(void) } /* attempting to cast a forgotten spell will cause disorientation */ -static void +staticfn void spell_backfire(int spell) { long duration = (long) ((spellev(spell) + 1) * 3), /* 6..24 */ @@ -1170,7 +1170,7 @@ spell_backfire(int spell) return; } -static boolean +staticfn boolean spelleffects_check(int spell, int *res, int *energy) { int chance; @@ -1542,7 +1542,7 @@ spelleffects(int spell_otyp, boolean atme, boolean force) } /*ARGSUSED*/ -static boolean +staticfn boolean spell_aim_step(genericptr_t arg UNUSED, coordxy x, coordxy y) { if (!isok(x,y)) @@ -1554,7 +1554,7 @@ spell_aim_step(genericptr_t arg UNUSED, coordxy x, coordxy y) } /* not quite the same as throwspell limits, but close enough */ -static boolean +staticfn boolean can_center_spell_location(coordxy x, coordxy y) { if (distmin(u.ux, u.uy, x, y) > 10) @@ -1562,7 +1562,7 @@ can_center_spell_location(coordxy x, coordxy y) return (isok(x, y) && cansee(x, y) && !(IS_STWALL(levl[x][y].typ))); } -static void +staticfn void display_spell_target_positions(boolean on_off) { coordxy x, y, dx, dy; @@ -1590,7 +1590,7 @@ display_spell_target_positions(boolean on_off) } /* Choose location where spell takes effect. */ -static int +staticfn int throwspell(void) { coord cc, uc; @@ -1805,7 +1805,7 @@ static const char *const spl_sortchoices[NUM_SPELL_SORTBY] = { }; /* qsort callback routine */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK spell_cmp(const genericptr vptr1, const genericptr vptr2) { /* @@ -1862,7 +1862,7 @@ spell_cmp(const genericptr vptr1, const genericptr vptr2) /* sort the index used for display order of the "view known spells" list (sortmode == SORTBY_xxx), or sort the spellbook itself to make the current display order stick (sortmode == SORTRETAINORDER) */ -static void +staticfn void sortspells(void) { int i; @@ -1911,7 +1911,7 @@ sortspells(void) } /* called if the [sort spells] entry in the view spells menu gets chosen */ -static boolean +staticfn boolean spellsortmenu(void) { winid tmpwin; @@ -1996,7 +1996,7 @@ DISABLE_WARNING_FORMAT_NONLITERAL /* shows menu of known spells, with options to sort them. return FALSE on cancel, TRUE otherwise. spell_no is set to the internal spl_book index, if any selected */ -static boolean +staticfn boolean dospellmenu( const char *prompt, int splaction, /* SPELLMENU_CAST, SPELLMENU_VIEW, or gs.spl_book[] index */ @@ -2089,7 +2089,7 @@ dospellmenu( RESTORE_WARNING_FORMAT_NONLITERAL -static int +staticfn int percent_success(int spell) { /* Intrinsic and learned ability are combined to calculate @@ -2211,7 +2211,7 @@ percent_success(int spell) return chance; } -static char * +staticfn char * spellretention(int idx, char * outbuf) { long turnsleft, percent, accuracy; diff --git a/src/steal.c b/src/steal.c index 8327b6147..a183f504b 100644 --- a/src/steal.c +++ b/src/steal.c @@ -5,12 +5,12 @@ #include "hack.h" -static const char *equipname(struct obj *); -static int unstolenarm(void); -static int stealarm(void); -static void worn_item_removal(struct monst *, struct obj *); +staticfn const char *equipname(struct obj *); +staticfn int unstolenarm(void); +staticfn int stealarm(void); +staticfn void worn_item_removal(struct monst *, struct obj *); -static const char * +staticfn const char * equipname(struct obj *otmp) { return ((otmp == uarmu) ? shirt_simple_name(otmp) @@ -156,7 +156,7 @@ unresponsive(void) /* called via (*ga.afternmv)() when hero finishes taking off armor that was slated to be stolen but the thief died in the interim */ -static int +staticfn int unstolenarm(void) { struct obj *obj; @@ -174,7 +174,7 @@ unstolenarm(void) } /* finish stealing an item of armor which takes multiple turns to take off */ -static int +staticfn int stealarm(void) { struct monst *mtmp; @@ -313,7 +313,7 @@ remove_worn_item( } /* during theft of a worn item: remove_worn_item(), prefaced by a message */ -static void +staticfn void worn_item_removal( struct monst *mon, struct obj *obj) diff --git a/src/steed.c b/src/steed.c index bd2b3ec24..7866939f9 100644 --- a/src/steed.c +++ b/src/steed.c @@ -9,8 +9,8 @@ static NEARDATA const char steeds[] = { S_QUADRUPED, S_UNICORN, S_ANGEL, S_CENTAUR, S_DRAGON, S_JABBERWOCK, '\0' }; -static boolean landing_spot(coord *, int, int); -static void maybewakesteed(struct monst *); +staticfn boolean landing_spot(coord *, int, int); +staticfn void maybewakesteed(struct monst *); /* caller has decided that hero can't reach something while mounted */ void @@ -444,7 +444,7 @@ kick_steed(void) * room's walls, which is not what we want. * Adapted from mail daemon code. */ -static boolean +staticfn boolean landing_spot( coord *spot, /* landing position (we fill it in) */ int reason, @@ -810,7 +810,7 @@ dismount_steed( /* when attempting to saddle or mount a sleeping steed, try to wake it up (for the saddling case, it won't be u.usteed yet) */ -static void +staticfn void maybewakesteed(struct monst *steed) { int frozen = (int) steed->mfrozen; diff --git a/src/strutil.c b/src/strutil.c index 82b10d11b..b12e5b194 100644 --- a/src/strutil.c +++ b/src/strutil.c @@ -97,11 +97,11 @@ Strlen_( return (unsigned) len; } -static boolean pmatch_internal(const char *, const char *, boolean, +staticfn boolean pmatch_internal(const char *, const char *, boolean, const char *); /* guts of pmatch(), pmatchi(), and pmatchz(); match a string against a pattern */ -static boolean +staticfn boolean pmatch_internal(const char *patrn, const char *strng, boolean ci, /* True => case-insensitive, False => case-sensitive */ diff --git a/src/symbols.c b/src/symbols.c index c11dfe81b..17a902e94 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -5,10 +5,10 @@ #include "hack.h" #include "tcap.h" -static void savedsym_add(const char *, const char *, int); -static struct _savedsym *savedsym_find(const char *, int); +staticfn void savedsym_add(const char *, const char *, int); +staticfn struct _savedsym *savedsym_find(const char *, int); #ifdef ENHANCED_SYMBOLS -static void purge_custom_entries(enum graphics_sets which_set); +staticfn void purge_custom_entries(enum graphics_sets which_set); #endif extern const uchar def_r_oc_syms[MAXOCLASSES]; /* drawing.c */ @@ -716,7 +716,7 @@ savedsym_free(void) } } -static struct _savedsym * +staticfn struct _savedsym * savedsym_find(const char *name, int which_set) { struct _savedsym *tmp = saved_symbols; @@ -729,7 +729,7 @@ savedsym_find(const char *name, int which_set) return NULL; } -static void +staticfn void savedsym_add(const char *name, const char *val, int which_set) { struct _savedsym *tmp = NULL; @@ -1113,7 +1113,7 @@ struct customization_detail *find_display_urep_customization( const char *customization_name, int glyphidx, enum graphics_sets which_set); extern glyph_map glyphmap[MAX_GLYPH]; -static void shuffle_customizations(void); +staticfn void shuffle_customizations(void); void apply_customizations_to_symset(enum graphics_sets which_set) @@ -1141,7 +1141,7 @@ apply_customizations_to_symset(enum graphics_sets which_set) /* Shuffle the customizations to match shuffled object descriptions, * so a red potion isn't displayed with a blue customization, and so on. */ -static void +staticfn void shuffle_customizations(void) { static const int offsets[2] = { GLYPH_OBJ_OFF, GLYPH_OBJ_PILETOP_OFF }; @@ -1209,7 +1209,7 @@ find_matching_symset_customiz( return (struct customization_detail *) 0; } -static void +staticfn void purge_custom_entries(enum graphics_sets which_set) { struct symset_customization *gdc = &gs.sym_customizations[which_set]; diff --git a/src/teleport.c b/src/teleport.c index 2d5b22b8a..cb3b518ec 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -6,18 +6,18 @@ #include "hack.h" #define NEW_ENEXTO -static boolean goodpos_onscary(coordxy, coordxy, struct permonst *); -static boolean tele_jump_ok(coordxy, coordxy, coordxy, coordxy); -static boolean teleok(coordxy, coordxy, boolean); -static void vault_tele(void); -static boolean rloc_pos_ok(coordxy, coordxy, struct monst *); -static void rloc_to_core(struct monst *, coordxy, coordxy, unsigned); -static void mvault_tele(struct monst *); -static boolean m_blocks_teleporting(struct monst *); -static stairway *stairway_find_forwiz(boolean, boolean); +staticfn boolean goodpos_onscary(coordxy, coordxy, struct permonst *); +staticfn boolean tele_jump_ok(coordxy, coordxy, coordxy, coordxy); +staticfn boolean teleok(coordxy, coordxy, boolean); +staticfn void vault_tele(void); +staticfn boolean rloc_pos_ok(coordxy, coordxy, struct monst *); +staticfn void rloc_to_core(struct monst *, coordxy, coordxy, unsigned); +staticfn void mvault_tele(struct monst *); +staticfn boolean m_blocks_teleporting(struct monst *); +staticfn stairway *stairway_find_forwiz(boolean, boolean); /* does monster block others from teleporting? */ -static boolean +staticfn boolean m_blocks_teleporting(struct monst *mtmp) { if (is_dlord(mtmp->data) || is_dprince(mtmp->data)) @@ -44,7 +44,7 @@ noteleport_level(struct monst *mon) /* this is an approximation of onscary() that doesn't use any 'struct monst' fields aside from 'monst->data'; used primarily for new monster creation and monster teleport destination, not for ordinary monster movement */ -static boolean +staticfn boolean goodpos_onscary( coordxy x, coordxy y, struct permonst *mptr) @@ -363,7 +363,7 @@ enexto_core( * need to be augmented to allow deliberate passage in wizard mode, but * only for explicitly chosen destinations.) */ -static boolean +staticfn boolean tele_jump_ok(coordxy x1, coordxy y1, coordxy x2, coordxy y2) { if (!isok(x2, y2)) @@ -397,7 +397,7 @@ tele_jump_ok(coordxy x1, coordxy y1, coordxy x2, coordxy y2) return TRUE; } -static boolean +staticfn boolean teleok(coordxy x, coordxy y, boolean trapok) { if (!trapok) { @@ -750,7 +750,7 @@ safe_teleds(int teleds_flags) return FALSE; } -static void +staticfn void vault_tele(void) { struct mkroom *croom = search_special(VAULT); @@ -1491,7 +1491,7 @@ level_tele_trap(struct trap *trap, unsigned int trflags) } /* check whether monster can arrive at location via Tport (or fall) */ -static boolean +staticfn boolean rloc_pos_ok( coordxy x, coordxy y, /* coordinates of candidate location */ struct monst *mtmp) @@ -1558,7 +1558,7 @@ rloc_pos_ok( * a value because mtmp is a migrating_mon. Worm tails are always * placed randomly around the head of the worm. */ -static void +staticfn void rloc_to_core( struct monst *mtmp, coordxy x, coordxy y, @@ -1689,7 +1689,7 @@ rloc_to_flag( rloc_to_core(mtmp, x, y, rlocflags); } -static stairway * +staticfn stairway * stairway_find_forwiz(boolean isladder, boolean up) { stairway *stway = gs.stairs; @@ -1840,7 +1840,7 @@ control_mon_tele( return FALSE; } -static void +staticfn void mvault_tele(struct monst *mtmp) { struct mkroom *croom = search_special(VAULT); diff --git a/src/timeout.c b/src/timeout.c index 62dbb8707..27a8d4bfc 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -5,20 +5,20 @@ #include "hack.h" -static void stoned_dialogue(void); -static void vomiting_dialogue(void); -static void sleep_dialogue(void); -static void choke_dialogue(void); -static void levitation_dialogue(void); -static void slime_dialogue(void); -static void slimed_to_death(struct kinfo *) NO_NNARGS; -static void sickness_dialogue(void); -static void phaze_dialogue(void); -static void done_timeout(int, int); -static void slip_or_trip(void); -static void see_lamp_flicker(struct obj *, const char *) NONNULLPTRS; -static void lantern_message(struct obj *) NONNULLARG1; -static void cleanup_burn(ANY_P *, long) NONNULLARG1; +staticfn void stoned_dialogue(void); +staticfn void vomiting_dialogue(void); +staticfn void sleep_dialogue(void); +staticfn void choke_dialogue(void); +staticfn void levitation_dialogue(void); +staticfn void slime_dialogue(void); +staticfn void slimed_to_death(struct kinfo *) NO_NNARGS; +staticfn void sickness_dialogue(void); +staticfn void phaze_dialogue(void); +staticfn void done_timeout(int, int); +staticfn void slip_or_trip(void); +staticfn void see_lamp_flicker(struct obj *, const char *) NONNULLPTRS; +staticfn void lantern_message(struct obj *) NONNULLARG1; +staticfn void cleanup_burn(ANY_P *, long) NONNULLARG1; /* used by wizard mode #timeout and #wizintrinsic; order by 'interest' for timeout countdown, where most won't occur in normal play */ @@ -129,7 +129,7 @@ static NEARDATA const char *const stoned_texts[] = { "You are a statue." /* 1 */ }; -static void +staticfn void stoned_dialogue(void) { long i = (Stoned & TIMEOUT); @@ -189,7 +189,7 @@ static NEARDATA const char *const vomiting_texts[] = { "are about to vomit." /* 2 */ }; -static void +staticfn void vomiting_dialogue(void) { const char *txt = 0; @@ -259,7 +259,7 @@ vomiting_dialogue(void) exercise(A_CON, FALSE); } -static void +staticfn void sleep_dialogue(void) { long i = (HSleepy & TIMEOUT); @@ -286,7 +286,7 @@ static NEARDATA const char *const choke_texts2[] = { "You suffocate." }; -static void +staticfn void choke_dialogue(void) { long i = (Strangled & TIMEOUT); @@ -314,7 +314,7 @@ static NEARDATA const char *const sickness_texts[] = { "You are at Death's door.", }; -static void +staticfn void sickness_dialogue(void) { long j = (Sick & TIMEOUT), i = j / 2L; @@ -344,7 +344,7 @@ static NEARDATA const char *const levi_texts[] = { "You wobble unsteadily %s the %s." }; -static void +staticfn void levitation_dialogue(void) { /* -1 because the last message comes via float_down() */ @@ -380,7 +380,7 @@ static NEARDATA const char *const slime_texts[] = { "You have become %s." /* 1 */ }; -static void +staticfn void slime_dialogue(void) { long t = (Slimed & TIMEOUT), i = t / 2L; @@ -448,7 +448,7 @@ burn_away_slime(void) } /* countdown timer for turning into green slime has run out; kill our hero */ -static void +staticfn void slimed_to_death(struct kinfo *kptr) { uchar save_mvflags; @@ -525,7 +525,7 @@ static NEARDATA const char *const phaze_texts[] = { "You are feeling rather flabby.", }; -static void +staticfn void phaze_dialogue(void) { long i = ((HPasses_walls & TIMEOUT) / 2L); @@ -540,7 +540,7 @@ phaze_dialogue(void) /* when a status timeout is fatal, keep the status line indicator shown during end of game rundown (and potential dumplog); timeout has already counted down to 0 by the time we get here */ -static void +staticfn void done_timeout(int how, int which) { long *intrinsic_p = &u.uprops[which].intrinsic; @@ -1169,7 +1169,7 @@ attach_fig_transform_timeout(struct obj *figurine) } /* give a fumble message */ -static void +staticfn void slip_or_trip(void) { struct obj *otmp = vobj_at(u.ux, u.uy), *otmp2, *saddle; @@ -1292,7 +1292,7 @@ slip_or_trip(void) } /* Print a lamp flicker message with tailer. Only called if seen. */ -static void +staticfn void see_lamp_flicker(struct obj *obj, const char *tailer) { switch (obj->where) { @@ -1307,7 +1307,7 @@ see_lamp_flicker(struct obj *obj, const char *tailer) } /* Print a dimming message for brass lanterns. Only called if seen. */ -static void +staticfn void lantern_message(struct obj *obj) { /* from adventure */ @@ -1771,7 +1771,7 @@ end_burn(struct obj *obj, boolean timer_attached) /* * Cleanup a burning object if timer stopped. */ -static void +staticfn void cleanup_burn(anything *arg, long expire_time) { struct obj *obj = arg->a_obj; @@ -1897,14 +1897,14 @@ do_storms(void) * Check whether object has a timer of type timer_type. */ -static const char *kind_name(short); -static void print_queue(winid, timer_element *); -static void insert_timer(timer_element *); -static timer_element *remove_timer(timer_element **, short, ANY_P *); -static void write_timer(NHFILE *, timer_element *); -static boolean mon_is_local(struct monst *); -static boolean timer_is_local(timer_element *); -static int maybe_write_timer(NHFILE *, int, boolean); +staticfn const char *kind_name(short); +staticfn void print_queue(winid, timer_element *); +staticfn void insert_timer(timer_element *); +staticfn timer_element *remove_timer(timer_element **, short, ANY_P *); +staticfn void write_timer(NHFILE *, timer_element *); +staticfn boolean mon_is_local(struct monst *); +staticfn boolean timer_is_local(timer_element *); +staticfn int maybe_write_timer(NHFILE *, int, boolean); /* If defined, then include names when printing out the timer queue */ #define VERBOSE_TIMER @@ -1938,7 +1938,7 @@ static const ttable timeout_funcs[NUM_TIME_FUNCS] = { }; #undef TTAB -static const char * +staticfn const char * kind_name(short kind) { switch (kind) { @@ -1954,7 +1954,7 @@ kind_name(short kind) return "unknown"; } -static void +staticfn void print_queue(winid win, timer_element *base) { timer_element *curr; @@ -2386,7 +2386,7 @@ spot_time_left(coordxy x, coordxy y, short func_index) } /* Insert timer into the global queue */ -static void +staticfn void insert_timer(timer_element *gnu) { timer_element *curr, *prev; @@ -2402,7 +2402,7 @@ insert_timer(timer_element *gnu) gt.timer_base = gnu; } -static timer_element * +staticfn timer_element * remove_timer( timer_element **base, short func_index, @@ -2424,7 +2424,7 @@ remove_timer( return curr; } -static void +staticfn void write_timer(NHFILE *nhfp, timer_element *timer) { anything arg_save; @@ -2508,7 +2508,7 @@ obj_is_local(struct obj *obj) * Return TRUE if the given monster will stay on the level when the * level is saved. */ -static boolean +staticfn boolean mon_is_local(struct monst *mon) { struct monst *curr; @@ -2527,7 +2527,7 @@ mon_is_local(struct monst *mon) * Return TRUE if the timer is attached to something that will stay on the * level when the level is saved. */ -static boolean +staticfn boolean timer_is_local(timer_element *timer) { switch (timer->kind) { @@ -2551,7 +2551,7 @@ RESTORE_WARNING_UNREACHABLE_CODE * Part of the save routine. Count up the number of timers that would * be written. If write_it is true, actually write the timer. */ -static int +staticfn int maybe_write_timer(NHFILE *nhfp, int range, boolean write_it) { int count = 0; diff --git a/src/topten.c b/src/topten.c index 2d608a8cb..efe575f07 100644 --- a/src/topten.c +++ b/src/topten.c @@ -59,29 +59,29 @@ struct toptenentry { static struct toptenentry zerott; -static void topten_print(const char *); -static void topten_print_bold(const char *); -static void outheader(void); -static void outentry(int, struct toptenentry *, boolean); -static void discardexcess(FILE *); -static void readentry(FILE *, struct toptenentry *); -static void writeentry(FILE *, struct toptenentry *); +staticfn void topten_print(const char *); +staticfn void topten_print_bold(const char *); +staticfn void outheader(void); +staticfn void outentry(int, struct toptenentry *, boolean); +staticfn void discardexcess(FILE *); +staticfn void readentry(FILE *, struct toptenentry *); +staticfn void writeentry(FILE *, struct toptenentry *); #ifdef XLOGFILE -static void writexlentry(FILE *, struct toptenentry *, int); -static long encodexlogflags(void); -static long encodeconduct(void); -static long encodeachieve(boolean); -static void add_achieveX(char *, const char *, boolean); -static char *encode_extended_achievements(char *); -static char *encode_extended_conducts(char *); +staticfn void writexlentry(FILE *, struct toptenentry *, int); +staticfn long encodexlogflags(void); +staticfn long encodeconduct(void); +staticfn long encodeachieve(boolean); +staticfn void add_achieveX(char *, const char *, boolean); +staticfn char *encode_extended_achievements(char *); +staticfn char *encode_extended_conducts(char *); #endif -static void free_ttlist(struct toptenentry *); -static int classmon(char *); -static int score_wanted(boolean, int, struct toptenentry *, int, +staticfn void free_ttlist(struct toptenentry *); +staticfn int classmon(char *); +staticfn int score_wanted(boolean, int, struct toptenentry *, int, const char **, int); #ifdef NO_SCAN_BRACK -static void nsb_mung_line(char *); -static void nsb_unmung_line(char *); +staticfn void nsb_mung_line(char *); +staticfn void nsb_unmung_line(char *); #endif /* "killed by",&c ["an"] 'gk.killer.name' */ @@ -158,7 +158,7 @@ formatkiller( } } -static void +staticfn void topten_print(const char *x) { if (gt.toptenwin == WIN_ERR) @@ -167,7 +167,7 @@ topten_print(const char *x) putstr(gt.toptenwin, ATR_NONE, x); } -static void +staticfn void topten_print_bold(const char *x) { if (gt.toptenwin == WIN_ERR) @@ -201,7 +201,7 @@ observable_depth(d_level *lev) } /* throw away characters until current record has been entirely consumed */ -static void +staticfn void discardexcess(FILE *rfile) { int c; @@ -213,7 +213,7 @@ discardexcess(FILE *rfile) DISABLE_WARNING_FORMAT_NONLITERAL -static void +staticfn void readentry(FILE *rfile, struct toptenentry *tt) { char inbuf[SCANBUFSZ], s1[SCANBUFSZ], s2[SCANBUFSZ], s3[SCANBUFSZ], @@ -294,7 +294,7 @@ readentry(FILE *rfile, struct toptenentry *tt) } } -static void +staticfn void writeentry(FILE *rfile, struct toptenentry *tt) { static const char fmt32[] = "%c%c "; /* role,gender */ @@ -333,7 +333,7 @@ RESTORE_WARNING_FORMAT_NONLITERAL #ifdef XLOGFILE /* as tab is never used in eg. gp.plname or death, no need to mangle those. */ -static void +staticfn void writexlentry(FILE *rfile, struct toptenentry *tt, int how) { #define Fprintf (void) fprintf @@ -386,7 +386,7 @@ writexlentry(FILE *rfile, struct toptenentry *tt, int how) #undef XLOG_SEP } -static long +staticfn long encodexlogflags(void) { long e = 0L; @@ -401,7 +401,7 @@ encodexlogflags(void) return e; } -static long +staticfn long encodeconduct(void) { long e = 0L; @@ -445,7 +445,7 @@ encodeconduct(void) return e; } -static long +staticfn long encodeachieve( boolean secondlong) /* False: handle achievements 1..31, True: 32..62 */ { @@ -470,7 +470,7 @@ encodeachieve( } /* add the achievement or conduct comma-separated to string */ -static void +staticfn void add_achieveX(char *buf, const char *achievement, boolean condition) { if (condition) { @@ -481,7 +481,7 @@ add_achieveX(char *buf, const char *achievement, boolean condition) } } -static char * +staticfn char * encode_extended_achievements(char *buf) { char rnkbuf[40]; @@ -574,7 +574,7 @@ encode_extended_achievements(char *buf) return buf; } -static char * +staticfn char * encode_extended_conducts(char *buf) { buf[0] = '\0'; @@ -603,7 +603,7 @@ encode_extended_conducts(char *buf) #endif /* XLOGFILE */ -static void +staticfn void free_ttlist(struct toptenentry *tt) { struct toptenentry *ttnext; @@ -917,7 +917,7 @@ topten(int how, time_t when) } } -static void +staticfn void outheader(void) { char linebuf[BUFSZ]; @@ -934,7 +934,7 @@ outheader(void) DISABLE_WARNING_FORMAT_NONLITERAL /* so>0: standout line; so=0: ordinary line */ -static void +staticfn void outentry(int rank, struct toptenentry *t1, boolean so) { boolean second_line = TRUE; @@ -1100,7 +1100,7 @@ outentry(int rank, struct toptenentry *t1, boolean so) RESTORE_WARNING_FORMAT_NONLITERAL -static int +staticfn int score_wanted( boolean current_ver, int rank, @@ -1344,7 +1344,7 @@ prscore(int argc, char **argv) #endif } -static int +staticfn int classmon(char *plch) { int i; @@ -1459,7 +1459,7 @@ tt_doppel(struct monst *mon) { /* Lattice scanf isn't up to reading the scorefile. What */ /* follows deals with that; I admit it's ugly. (KL) */ /* Now generally available (KL) */ -static void +staticfn void nsb_mung_line(p) char *p; { @@ -1467,7 +1467,7 @@ char *p; *p = '|'; } -static void +staticfn void nsb_unmung_line(p) char *p; { diff --git a/src/trap.c b/src/trap.c index 46cf717a8..82b9ab692 100644 --- a/src/trap.c +++ b/src/trap.c @@ -7,70 +7,70 @@ extern const char *const destroy_strings[][3]; /* from zap.c */ -static void mk_trap_statue(coordxy, coordxy); -static int dng_bottom(d_level *lev); -static void hole_destination(d_level *); -static boolean keep_saddle_with_steedcorpse(unsigned, struct obj *, +staticfn void mk_trap_statue(coordxy, coordxy); +staticfn int dng_bottom(d_level *lev); +staticfn void hole_destination(d_level *); +staticfn boolean keep_saddle_with_steedcorpse(unsigned, struct obj *, struct obj *); -static boolean mu_maybe_destroy_web(struct monst *, boolean, struct trap *); -static struct obj *t_missile(int, struct trap *); -static boolean floor_trigger(int); -static boolean check_in_air(struct monst *, unsigned); -static int trapeffect_arrow_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_dart_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_rocktrap(struct monst *, struct trap *, unsigned); -static int trapeffect_sqky_board(struct monst *, struct trap *, unsigned); -static int trapeffect_bear_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_slp_gas_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_rust_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_fire_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_pit(struct monst *, struct trap *, unsigned); -static int trapeffect_hole(struct monst *, struct trap *, unsigned); -static int trapeffect_telep_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_level_telep(struct monst *, struct trap *, unsigned); -static int trapeffect_web(struct monst *, struct trap *, unsigned); -static int trapeffect_statue_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_magic_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_anti_magic(struct monst *, struct trap *, unsigned); -static int trapeffect_poly_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_landmine(struct monst *, struct trap *, unsigned); -static int trapeffect_rolling_boulder_trap(struct monst *, struct trap *, +staticfn boolean mu_maybe_destroy_web(struct monst *, boolean, struct trap *); +staticfn struct obj *t_missile(int, struct trap *); +staticfn boolean floor_trigger(int); +staticfn boolean check_in_air(struct monst *, unsigned); +staticfn int trapeffect_arrow_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_dart_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_rocktrap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_sqky_board(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_bear_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_slp_gas_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_rust_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_fire_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_pit(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_hole(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_telep_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_level_telep(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_web(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_statue_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_magic_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_anti_magic(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_poly_trap(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_landmine(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_rolling_boulder_trap(struct monst *, struct trap *, unsigned); -static int trapeffect_magic_portal(struct monst *, struct trap *, unsigned); -static int trapeffect_vibrating_square(struct monst *, struct trap *, - unsigned); -static int trapeffect_selector(struct monst *, struct trap *, unsigned); -static char *trapnote(struct trap *, boolean); -static int choose_trapnote(struct trap *); -static int steedintrap(struct trap *, struct obj *); -static void launch_drop_spot(struct obj *, coordxy, coordxy); -static boolean find_random_launch_coord(struct trap *, coord *); -static int mkroll_launch(struct trap *, coordxy, coordxy, short, long); -static boolean isclearpath(coord *, int, schar, schar); -static void dofiretrap(struct obj *); -static void domagictrap(void); -static void pot_acid_damage(struct obj *, boolean, boolean); -static boolean emergency_disrobe(boolean *); -static int untrap_prob(struct trap *); -static void move_into_trap(struct trap *); -static int try_disarm(struct trap *, boolean); -static void reward_untrap(struct trap *, struct monst *); -static int disarm_holdingtrap(struct trap *); -static int disarm_landmine(struct trap *); -static int unsqueak_ok(struct obj *); -static int disarm_squeaky_board(struct trap *); -static int disarm_shooting_trap(struct trap *, int); -static void clear_conjoined_pits(struct trap *); -static boolean adj_nonconjoined_pit(struct trap *); -static int try_lift(struct monst *, struct trap *, int, boolean); -static int help_monster_out(struct monst *, struct trap *); -static void untrap_box(struct obj *, boolean, boolean); +staticfn int trapeffect_magic_portal(struct monst *, struct trap *, unsigned); +staticfn int trapeffect_vibrating_square(struct monst *, struct trap *, + unsigned); +staticfn int trapeffect_selector(struct monst *, struct trap *, unsigned); +staticfn char *trapnote(struct trap *, boolean); +staticfn int choose_trapnote(struct trap *); +staticfn int steedintrap(struct trap *, struct obj *); +staticfn void launch_drop_spot(struct obj *, coordxy, coordxy); +staticfn boolean find_random_launch_coord(struct trap *, coord *); +staticfn int mkroll_launch(struct trap *, coordxy, coordxy, short, long); +staticfn boolean isclearpath(coord *, int, schar, schar); +staticfn void dofiretrap(struct obj *); +staticfn void domagictrap(void); +staticfn void pot_acid_damage(struct obj *, boolean, boolean); +staticfn boolean emergency_disrobe(boolean *); +staticfn int untrap_prob(struct trap *); +staticfn void move_into_trap(struct trap *); +staticfn int try_disarm(struct trap *, boolean); +staticfn void reward_untrap(struct trap *, struct monst *); +staticfn int disarm_holdingtrap(struct trap *); +staticfn int disarm_landmine(struct trap *); +staticfn int unsqueak_ok(struct obj *); +staticfn int disarm_squeaky_board(struct trap *); +staticfn int disarm_shooting_trap(struct trap *, int); +staticfn void clear_conjoined_pits(struct trap *); +staticfn boolean adj_nonconjoined_pit(struct trap *); +staticfn int try_lift(struct monst *, struct trap *, int, boolean); +staticfn int help_monster_out(struct monst *, struct trap *); +staticfn void untrap_box(struct obj *, boolean, boolean); #if 0 -static void join_adjacent_pits(struct trap *); +staticfn void join_adjacent_pits(struct trap *); #endif -static boolean thitm(int, struct monst *, struct obj *, int, +staticfn boolean thitm(int, struct monst *, struct obj *, int, boolean) NONNULLARG2; -static void maybe_finish_sokoban(void); +staticfn void maybe_finish_sokoban(void); static const char *const a_your[2] = { "a", "your" }; static const char *const A_Your[2] = { "A", "Your" }; @@ -384,7 +384,7 @@ grease_protect( } /* create a "living" statue at x,y */ -static void +staticfn void mk_trap_statue(coordxy x, coordxy y) { struct monst *mtmp; @@ -412,7 +412,7 @@ mk_trap_statue(coordxy x, coordxy y) } /* find "bottom" level of specified dungeon, stopping at quest locate */ -static int +staticfn int dng_bottom(d_level *lev) { int bottom = dunlevs_in_dungeon(lev); @@ -436,7 +436,7 @@ dng_bottom(d_level *lev) } /* destination dlevel for holes or trapdoors */ -static void +staticfn void hole_destination(d_level *dst) { int bottom = dng_bottom(&u.uz); @@ -895,7 +895,7 @@ activate_statue_trap( return mtmp; } -static boolean +staticfn boolean keep_saddle_with_steedcorpse( unsigned steed_mid, struct obj *objchn, @@ -928,7 +928,7 @@ keep_saddle_with_steedcorpse( /* monster or you go through and possibly destroy a web. return TRUE if could go through. */ -static boolean +staticfn boolean mu_maybe_destroy_web( struct monst *mtmp, boolean domsg, @@ -972,7 +972,7 @@ mu_maybe_destroy_web( } /* make a single arrow/dart/rock for a trap to shoot or drop */ -static struct obj * +staticfn struct obj * t_missile(int otyp, struct trap *trap) { struct obj *otmp = mksobj(otyp, TRUE, FALSE); @@ -1015,7 +1015,7 @@ reset_utrap(boolean msg) } /* is trap type ttyp triggered by touching the floor? */ -static boolean +staticfn boolean floor_trigger(int ttyp) { switch (ttyp) { @@ -1040,7 +1040,7 @@ floor_trigger(int ttyp) } /* return TRUE if monster mtmp is up in the air, considering trap flags */ -static boolean +staticfn boolean check_in_air(struct monst *mtmp, unsigned trflags) { boolean is_you = mtmp == &gy.youmonst, @@ -1133,7 +1133,7 @@ m_harmless_trap(struct monst *mtmp, struct trap *ttmp) return FALSE; } -static int +staticfn int trapeffect_arrow_trap( struct monst *mtmp, struct trap *trap, @@ -1191,7 +1191,7 @@ trapeffect_arrow_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_dart_trap( struct monst *mtmp, struct trap *trap, @@ -1262,7 +1262,7 @@ trapeffect_dart_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_rocktrap( struct monst *mtmp, struct trap *trap, @@ -1340,7 +1340,7 @@ trapeffect_rocktrap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_sqky_board( struct monst *mtmp, struct trap *trap, @@ -1414,7 +1414,7 @@ trapeffect_sqky_board( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_bear_trap( struct monst *mtmp, struct trap *trap, @@ -1492,7 +1492,7 @@ trapeffect_bear_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_slp_gas_trap( struct monst *mtmp, struct trap *trap, @@ -1523,7 +1523,7 @@ trapeffect_slp_gas_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_rust_trap( struct monst *mtmp, struct trap *trap, @@ -1653,7 +1653,7 @@ trapeffect_rust_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_fire_trap( struct monst *mtmp, struct trap *trap, @@ -1745,7 +1745,7 @@ trapeffect_fire_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_pit( struct monst *mtmp, struct trap *trap, @@ -1926,7 +1926,7 @@ trapeffect_pit( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_hole( struct monst *mtmp, struct trap *trap, @@ -1985,7 +1985,7 @@ trapeffect_hole( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_telep_trap( struct monst *mtmp, struct trap *trap, @@ -2003,7 +2003,7 @@ trapeffect_telep_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_level_telep( struct monst *mtmp, struct trap *trap, @@ -2021,7 +2021,7 @@ trapeffect_level_telep( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_web( struct monst *mtmp, struct trap *trap, @@ -2190,7 +2190,7 @@ trapeffect_web( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_statue_trap( struct monst *mtmp, struct trap *trap, @@ -2204,7 +2204,7 @@ trapeffect_statue_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_magic_trap( struct monst *mtmp, struct trap *trap, @@ -2234,7 +2234,7 @@ trapeffect_magic_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_anti_magic( struct monst *mtmp, /* monster, possibly youmonst */ struct trap *trap, /* trap->ttyp == ANTI_MAGIC */ @@ -2345,7 +2345,7 @@ trapeffect_anti_magic( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_poly_trap( struct monst *mtmp, struct trap *trap, @@ -2396,7 +2396,7 @@ trapeffect_poly_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_landmine( struct monst *mtmp, struct trap *trap, @@ -2521,7 +2521,7 @@ trapeffect_landmine( } #undef MINE_TRIGGER_WT -static int +staticfn int trapeffect_rolling_boulder_trap( struct monst *mtmp, struct trap *trap, @@ -2571,7 +2571,7 @@ trapeffect_rolling_boulder_trap( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_magic_portal( struct monst *mtmp, struct trap *trap, @@ -2586,7 +2586,7 @@ trapeffect_magic_portal( return Trap_Effect_Finished; } -static int +staticfn int trapeffect_vibrating_square( struct monst *mtmp, struct trap *trap, @@ -2795,7 +2795,7 @@ immune_to_trap(struct monst *mon, unsigned ttype) return TRAP_NOT_IMMUNE; } -static int +staticfn int trapeffect_selector( struct monst *mtmp, struct trap *trap, @@ -2916,7 +2916,7 @@ dotrap(struct trap *trap, unsigned trflags) (void) trapeffect_selector(&gy.youmonst, trap, trflags); } -static char * +staticfn char * trapnote(struct trap *trap, boolean noprefix) { static const char *const tnnames[] = { @@ -2936,7 +2936,7 @@ trapnote(struct trap *trap, boolean noprefix) /* choose a note not used by any trap on current level, ignoring ttmp; if all are in use, pick a random one */ -static int +staticfn int choose_trapnote(struct trap *ttmp) { int tavail[12], tpick[12], tcnt = 0, k; @@ -2955,7 +2955,7 @@ choose_trapnote(struct trap *ttmp) return ((tcnt > 0) ? tpick[rn2(tcnt)] : rn2(12)); } -static int +staticfn int steedintrap(struct trap *trap, struct obj *otmp) { struct monst *steed = u.usteed; @@ -3071,7 +3071,7 @@ blow_up_landmine(struct trap *trap) spot_checks(x, y, old_typ); } -static void +staticfn void launch_drop_spot(struct obj *obj, coordxy x, coordxy y) { if (!obj) { @@ -3418,7 +3418,7 @@ feeltrap(struct trap *trap) /* try to find a random coordinate where launching a rolling boulder could work. return TRUE if found, with coordinate in cc. */ -static boolean +staticfn boolean find_random_launch_coord(struct trap *ttmp, coord *cc) { int tmp; @@ -3478,7 +3478,7 @@ find_random_launch_coord(struct trap *ttmp, coord *cc) return success; } -static int +staticfn int mkroll_launch( struct trap *ttmp, coordxy x, @@ -3514,7 +3514,7 @@ mkroll_launch( return 1; } -static boolean +staticfn boolean isclearpath( coord *cc, int distance, @@ -4031,7 +4031,7 @@ climb_pit(void) } } -static void +staticfn void dofiretrap( struct obj *box) /* null for floor trap */ { @@ -4115,7 +4115,7 @@ dofiretrap( melt_ice(u.ux, u.uy, (char *) 0); } -static void +staticfn void domagictrap(void) { int fate = rnd(20); @@ -4448,7 +4448,7 @@ acid_damage(struct obj *obj) erode_obj(obj, (char *) 0, ERODE_CORRODE, EF_GREASE | EF_VERBOSE); } -static void +staticfn void pot_acid_damage( struct obj *obj, boolean in_invent, @@ -4696,7 +4696,7 @@ water_damage_chain( * Returns TRUE if disrobing made player unencumbered enough to * crawl out of the current predicament. */ -static boolean +staticfn boolean emergency_disrobe(boolean *lostsome) { int invc = inv_cnt(TRUE); @@ -5084,7 +5084,7 @@ could_untrap(boolean verbosely, boolean check_floor) /* Probability of disabling a trap. Helge Hafting; Returns 0 for success, non-0 for failure. */ -static int +staticfn int untrap_prob( struct trap *ttmp) /* must not be Null */ { @@ -5170,7 +5170,7 @@ cnv_trap_obj( } /* while attempting to disarm an adjacent trap, we've fallen into it */ -static void +staticfn void move_into_trap(struct trap *ttmp) { int bc = 0; @@ -5209,7 +5209,7 @@ move_into_trap(struct trap *ttmp) } /* 0: doesn't even try; 1: tries and fails; 2: succeeds */ -static int +staticfn int try_disarm( struct trap *ttmp, boolean force_failure) @@ -5298,7 +5298,7 @@ try_disarm( return 2; } -static void +staticfn void reward_untrap(struct trap *ttmp, struct monst *mtmp) { if (!ttmp->madeby_u) { @@ -5321,7 +5321,7 @@ reward_untrap(struct trap *ttmp, struct monst *mtmp) /* Help a monster out of a bear trap or web, or if no monster is present, disarm a bear trap or destroy a web. Helge Hafting */ -static int +staticfn int disarm_holdingtrap(struct trap *ttmp) { struct monst *mtmp; @@ -5362,7 +5362,7 @@ disarm_holdingtrap(struct trap *ttmp) return 1; } -static int +staticfn int disarm_landmine(struct trap *ttmp) /* Helge Hafting */ { int fails = try_disarm(ttmp, FALSE); @@ -5375,7 +5375,7 @@ disarm_landmine(struct trap *ttmp) /* Helge Hafting */ } /* getobj callback for object to disarm a squeaky board with */ -static int +staticfn int unsqueak_ok(struct obj *obj) { if (!obj) @@ -5398,7 +5398,7 @@ unsqueak_ok(struct obj *obj) } /* it may not make much sense to use grease on floor boards, but so what? */ -static int +staticfn int disarm_squeaky_board(struct trap *ttmp) { struct obj *obj; @@ -5432,7 +5432,7 @@ disarm_squeaky_board(struct trap *ttmp) } /* removes traps that shoot arrows, darts, etc. */ -static int +staticfn int disarm_shooting_trap(struct trap *ttmp, int otyp) { int fails = try_disarm(ttmp, FALSE); @@ -5445,7 +5445,7 @@ disarm_shooting_trap(struct trap *ttmp, int otyp) } /* trying to #untrap a monster from a pit; is the weight too heavy? */ -static int +staticfn int try_lift( struct monst *mtmp, /* trapped monster */ struct trap *ttmp, /* pit, possibly made by hero, or spiked pit */ @@ -5468,7 +5468,7 @@ try_lift( } /* Help trapped monster (out of a (spiked) pit) */ -static int +staticfn int help_monster_out( struct monst *mtmp, struct trap *ttmp) @@ -5563,7 +5563,7 @@ help_monster_out( } /* check a particular container for a trap and optionally disarm it */ -static void +staticfn void untrap_box( struct obj *box, boolean force, @@ -6302,7 +6302,7 @@ conjoined_pits( return FALSE; } -static void +staticfn void clear_conjoined_pits(struct trap *trap) { int diridx, adjidx; @@ -6326,7 +6326,7 @@ clear_conjoined_pits(struct trap *trap) } } -static boolean +staticfn boolean adj_nonconjoined_pit(struct trap *adjtrap) { struct trap *trap_with_u = t_at(u.ux0, u.uy0); @@ -6344,7 +6344,7 @@ adj_nonconjoined_pit(struct trap *adjtrap) * Mark all neighboring pits as conjoined pits. * (currently not called from anywhere) */ -static void +staticfn void join_adjacent_pits(struct trap *trap) { struct trap *t; @@ -6433,7 +6433,7 @@ b_trapped(const char *item, int bodypart) } /* Monster is hit by trap. */ -static boolean +staticfn boolean thitm( int tlev, /* missile's attack level */ struct monst *mon, /* target */ @@ -6775,7 +6775,7 @@ sokoban_guilt(void) } /* called when a trap has been deleted or had its ttyp replaced */ -static void +staticfn void maybe_finish_sokoban(void) { struct trap *t; diff --git a/src/u_init.c b/src/u_init.c index 8167213dc..910e32eea 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -13,19 +13,19 @@ struct trobj { Bitfield(trbless, 2); }; -static struct obj *ini_inv_mkobj_filter(int, boolean); -static short ini_inv_obj_substitution(struct trobj *, +staticfn struct obj *ini_inv_mkobj_filter(int, boolean); +staticfn short ini_inv_obj_substitution(struct trobj *, struct obj *) NONNULLPTRS; -static void ini_inv_adjust_obj(struct trobj *, +staticfn void ini_inv_adjust_obj(struct trobj *, struct obj *) NONNULLPTRS; -static void ini_inv_use_obj(struct obj *) NONNULLARG1; -static void ini_inv(struct trobj *) NONNULLARG1; -static void knows_object(int); -static void knows_class(char); -static void u_init_role(void); -static void u_init_race(void); -static void u_init_carry_attr_boost(void); -static boolean restricted_spell_discipline(int); +staticfn void ini_inv_use_obj(struct obj *) NONNULLARG1; +staticfn void ini_inv(struct trobj *) NONNULLARG1; +staticfn void knows_object(int); +staticfn void knows_class(char); +staticfn void u_init_role(void); +staticfn void u_init_race(void); +staticfn void u_init_carry_attr_boost(void); +staticfn boolean restricted_spell_discipline(int); #define UNDEF_TYP 0 #define UNDEF_SPE '\177' @@ -558,7 +558,7 @@ static const struct def_skill Skill_W[] = { { P_NONE, 0 } }; -static void +staticfn void knows_object(int obj) { discover_object(obj, TRUE, FALSE); @@ -567,7 +567,7 @@ knows_object(int obj) /* Know ordinary (non-magical) objects of a certain class, like all gems except the loadstone and luckstone. */ -static void +staticfn void knows_class(char sym) { struct obj odummy, *o; @@ -609,7 +609,7 @@ knows_class(char sym) } /* role-specific initializations */ -static void +staticfn void u_init_role(void) { int i; @@ -766,7 +766,7 @@ u_init_role(void) } /* race-specific initializations */ -static void +staticfn void u_init_race(void) { switch (Race_switch) { @@ -839,7 +839,7 @@ u_init_race(void) } /* boost STR and CON until hero can carry inventory */ -static void +staticfn void u_init_carry_attr_boost(void) { /* make sure you can carry all you have - especially for Tourists */ @@ -968,7 +968,7 @@ u_init(void) } /* skills aren't initialized, so we use the role-specific skill lists */ -static boolean +staticfn boolean restricted_spell_discipline(int otyp) { const struct def_skill *skills; @@ -1028,7 +1028,7 @@ restricted_spell_discipline(int otyp) } /* create random object of certain class, filtering out too powerful items */ -static struct obj * +staticfn struct obj * ini_inv_mkobj_filter(int oclass, boolean got_level1_spellbook) { struct obj *obj; @@ -1092,7 +1092,7 @@ ini_inv_mkobj_filter(int oclass, boolean got_level1_spellbook) /* substitute object with something else based on race. only changes otyp, and returns it. */ -static short +staticfn short ini_inv_obj_substitution(struct trobj *trop, struct obj *obj) { if (gu.urace.mnum != PM_HUMAN) { @@ -1116,7 +1116,7 @@ ini_inv_obj_substitution(struct trobj *trop, struct obj *obj) return obj->otyp; } -static void +staticfn void ini_inv_adjust_obj(struct trobj *trop, struct obj *obj) { if (trop->trclass == COIN_CLASS) { @@ -1159,7 +1159,7 @@ ini_inv_adjust_obj(struct trobj *trop, struct obj *obj) } /* initial inventory: wear, wield, learn the spell/obj */ -static void +staticfn void ini_inv_use_obj(struct obj *obj) { /* Make the type known if necessary */ @@ -1206,7 +1206,7 @@ ini_inv_use_obj(struct obj *obj) initialspell(obj); } -static void +staticfn void ini_inv(struct trobj *trop) { struct obj *obj; diff --git a/src/uhitm.c b/src/uhitm.c index 6932d12af..3c01e7258 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -8,66 +8,67 @@ static const char brief_feeling[] = "have a %s feeling for a moment, then it passes."; -static boolean mhitm_mgc_atk_negated(struct monst *, struct monst *, +staticfn boolean mhitm_mgc_atk_negated(struct monst *, struct monst *, boolean) NONNULLPTRS; -static boolean known_hitum(struct monst *, struct obj *, int *, int, int, +staticfn boolean known_hitum(struct monst *, struct obj *, int *, int, int, struct attack *, int) NONNULLARG13; -static boolean theft_petrifies(struct obj *) NONNULLARG1; -static void steal_it(struct monst *, struct attack *) NONNULLARG1; +staticfn boolean theft_petrifies(struct obj *) NONNULLARG1; +staticfn void steal_it(struct monst *, struct attack *) NONNULLARG1; /* hitum_cleave() has contradictory information. There's a comment * beside the 1st arg 'target' stating non-null, but later on there * is a test for 'target' being null */ -static boolean hitum_cleave(struct monst *, struct attack *) NO_NNARGS; -static boolean double_punch(void); -static boolean hitum(struct monst *, struct attack *) NONNULLARG1; -static void hmon_hitmon_barehands(struct _hitmon_data *, - struct monst *) NONNULLARG12; -static void hmon_hitmon_weapon_ranged(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_weapon_melee(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_weapon(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_potion(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_misc_obj(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_do_hit(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static void hmon_hitmon_dmg_recalc(struct _hitmon_data *, struct obj *); -static void hmon_hitmon_poison(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_jousting(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG123; -static void hmon_hitmon_stagger(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static void hmon_hitmon_pet(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static void hmon_hitmon_splitmon(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static void hmon_hitmon_msg_hit(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static void hmon_hitmon_msg_silver(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static void hmon_hitmon_msg_lightobj(struct _hitmon_data *, struct monst *, - struct obj *) NONNULLARG12; -static boolean hmon_hitmon(struct monst *, struct obj *, int, int) NONNULLARG1; -static int joust(struct monst *, struct obj *) NONNULLARG12; -static void demonpet(void); -static boolean m_slips_free(struct monst *, struct attack *) NONNULLPTRS; -static void start_engulf(struct monst *) NONNULLARG1; -static void end_engulf(void); -static int gulpum(struct monst *, struct attack *) NONNULLPTRS; -static boolean hmonas(struct monst *) NONNULLARG1; -static void nohandglow(struct monst *) NONNULLARG1; -static boolean mhurtle_to_doom(struct monst *, int, - struct permonst **) NONNULLARG13; -static void first_weapon_hit(struct obj *) NONNULLARG1; -static boolean shade_aware(struct obj *) NO_NNARGS; +staticfn boolean hitum_cleave(struct monst *, struct attack *) NO_NNARGS; +staticfn boolean double_punch(void); +staticfn boolean hitum(struct monst *, struct attack *) NONNULLARG1; +staticfn void hmon_hitmon_barehands(struct _hitmon_data *, + struct monst *) NONNULLARG12; +staticfn void hmon_hitmon_weapon_ranged(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_weapon_melee(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_weapon(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_potion(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_misc_obj(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_do_hit(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn void hmon_hitmon_dmg_recalc(struct _hitmon_data *, struct obj *); +staticfn void hmon_hitmon_poison(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_jousting(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG123; +staticfn void hmon_hitmon_stagger(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn void hmon_hitmon_pet(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn void hmon_hitmon_splitmon(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn void hmon_hitmon_msg_hit(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn void hmon_hitmon_msg_silver(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn void hmon_hitmon_msg_lightobj(struct _hitmon_data *, struct monst *, + struct obj *) NONNULLARG12; +staticfn boolean hmon_hitmon(struct monst *, struct obj *, int, int) + NONNULLARG1; +staticfn int joust(struct monst *, struct obj *) NONNULLARG12; +staticfn void demonpet(void); +staticfn boolean m_slips_free(struct monst *, struct attack *) NONNULLPTRS; +staticfn void start_engulf(struct monst *) NONNULLARG1; +staticfn void end_engulf(void); +staticfn int gulpum(struct monst *, struct attack *) NONNULLPTRS; +staticfn boolean hmonas(struct monst *) NONNULLARG1; +staticfn void nohandglow(struct monst *) NONNULLARG1; +staticfn boolean mhurtle_to_doom(struct monst *, int, + struct permonst **) NONNULLARG13; +staticfn void first_weapon_hit(struct obj *) NONNULLARG1; +staticfn boolean shade_aware(struct obj *) NO_NNARGS; #define PROJECTILE(obj) ((obj) && is_ammo(obj)) -static boolean +staticfn boolean mhitm_mgc_atk_negated( struct monst *magr, struct monst *mdef, boolean verbosely) /* give mesg if magical cancellation prevents damage */ @@ -578,7 +579,7 @@ do_attack(struct monst *mtmp) } /* really hit target monster; returns TRUE if it still lives */ -static boolean +staticfn boolean known_hitum( struct monst *mon, /* target */ struct obj *weapon, /* uwep or uswapwep */ @@ -642,7 +643,7 @@ known_hitum( /* hit the monster next to you and the monsters to the left and right of it; return False if the primary target is killed, True otherwise */ -static boolean +staticfn boolean hitum_cleave( struct monst *target, /* non-Null; forcefight at nothing doesn't cleave +*/ struct attack *uattk) /*+ but we don't enforce that here; Null works ok */ @@ -727,7 +728,7 @@ hitum_cleave( /* returns True if hero is fighting without a weapon and without a shield and has sufficient skill in bare-handed/martial arts to attack twice */ -static boolean +staticfn boolean double_punch(void) { /* note: P_BARE_HANDED_COMBAT and P_MARTIAL_ARTS are equivalent */ @@ -749,7 +750,7 @@ double_punch(void) } /* hit target monster; returns TRUE if it still lives */ -static boolean +staticfn boolean hitum(struct monst *mon, struct attack *uattk) { boolean malive, wep_was_destroyed = FALSE; @@ -829,7 +830,7 @@ hmon(struct monst *mon, } /* hero hits monster bare handed */ -static void +staticfn void hmon_hitmon_barehands(struct _hitmon_data *hmd, struct monst *mon) { long spcdmgflg, silverhit = 0L; /* worn masks */ @@ -876,7 +877,7 @@ hmon_hitmon_barehands(struct _hitmon_data *hmd, struct monst *mon) hmd->silvermsg = TRUE; } -static void +staticfn void hmon_hitmon_weapon_ranged( struct _hitmon_data *hmd, struct monst *mon, @@ -911,7 +912,7 @@ hmon_hitmon_weapon_ranged( } } -static void +staticfn void hmon_hitmon_weapon_melee( struct _hitmon_data *hmd, struct monst *mon, @@ -1023,7 +1024,7 @@ hmon_hitmon_weapon_melee( } } -static void +staticfn void hmon_hitmon_weapon( struct _hitmon_data *hmd, struct monst *mon, @@ -1047,7 +1048,7 @@ hmon_hitmon_weapon( } } -static void +staticfn void hmon_hitmon_potion( struct _hitmon_data *hmd, struct monst *mon, @@ -1071,7 +1072,7 @@ hmon_hitmon_potion( hmd->dmg = (hmd->mdat == &mons[PM_SHADE]) ? 0 : 1; } -static void +staticfn void hmon_hitmon_misc_obj( struct _hitmon_data *hmd, struct monst *mon, @@ -1323,7 +1324,7 @@ hmon_hitmon_misc_obj( } /* do the actual hitting monster with obj/fists */ -static void +staticfn void hmon_hitmon_do_hit( struct _hitmon_data *hmd, struct monst *mon, @@ -1372,7 +1373,7 @@ hmon_hitmon_do_hit( } } -static void +staticfn void hmon_hitmon_dmg_recalc(struct _hitmon_data *hmd, struct obj *obj) { int dmgbonus = 0, strbonus, absbonus; @@ -1446,7 +1447,7 @@ hmon_hitmon_dmg_recalc(struct _hitmon_data *hmd, struct obj *obj) hmd->dmg = 1; } -static void +staticfn void hmon_hitmon_poison( struct _hitmon_data *hmd, struct monst *mon, @@ -1477,7 +1478,7 @@ hmon_hitmon_poison( hmd->poiskilled = TRUE; } -static void +staticfn void hmon_hitmon_jousting( struct _hitmon_data *hmd, struct monst *mon, /* target */ @@ -1506,7 +1507,7 @@ hmon_hitmon_jousting( hmd->hittxt = TRUE; } -static void +staticfn void hmon_hitmon_stagger( struct _hitmon_data *hmd, struct monst *mon, @@ -1524,7 +1525,7 @@ hmon_hitmon_stagger( } } -static void +staticfn void hmon_hitmon_pet( struct _hitmon_data *hmd, struct monst *mon, @@ -1540,7 +1541,7 @@ hmon_hitmon_pet( } } -static void +staticfn void hmon_hitmon_splitmon( struct _hitmon_data *hmd, struct monst *mon, @@ -1573,7 +1574,7 @@ hmon_hitmon_splitmon( } } -static void +staticfn void hmon_hitmon_msg_hit( struct _hitmon_data *hmd, struct monst *mon, @@ -1599,7 +1600,7 @@ hmon_hitmon_msg_hit( } } -static void +staticfn void hmon_hitmon_msg_silver( struct _hitmon_data *hmd, struct monst *mon, @@ -1638,7 +1639,7 @@ hmon_hitmon_msg_silver( RESTORE_WARNING_FORMAT_NONLITERAL } -static void +staticfn void hmon_hitmon_msg_lightobj( struct _hitmon_data *hmd, struct monst *mon, @@ -1690,7 +1691,7 @@ hmon_hitmon_msg_lightobj( */ /* guts of hmon(); returns True if 'mon' survives */ -static boolean +staticfn boolean hmon_hitmon( struct monst *mon, struct obj *obj, @@ -1849,7 +1850,7 @@ hmon_hitmon( /* joust or martial arts punch is knocking the target back; that might kill 'mon' (via trap) before known_hitum() has a chance to do so; return True if we kill mon, False otherwise */ -static boolean +staticfn boolean mhurtle_to_doom( struct monst *mon, /* target monster */ int tmp, /* amount of pending damage */ @@ -1870,7 +1871,7 @@ mhurtle_to_doom( /* gamelog version of "you've broken never-hit-with-wielded-weapon conduct; the conduct is tracked in known_hitum(); we're called by hmon_hitmon() */ -static void +staticfn void first_weapon_hit(struct obj *weapon) { char buf[BUFSZ]; @@ -1899,7 +1900,7 @@ first_weapon_hit(struct obj *weapon) "hit with a wielded weapon (%s) for the first time", buf); } -static boolean +staticfn boolean shade_aware(struct obj *obj) { if (!obj) @@ -1963,7 +1964,7 @@ shade_miss( /* check whether slippery clothing protects from hug or wrap attack */ /* [currently assumes that you are the attacker] */ -static boolean +staticfn boolean m_slips_free(struct monst *mdef, struct attack *mattk) { struct obj *obj; @@ -2005,7 +2006,7 @@ m_slips_free(struct monst *mdef, struct attack *mattk) /* used when hitting a monster with a lance while mounted; 1: joust hit; 0: ordinary hit; -1: joust but break lance */ -static int +staticfn int joust(struct monst *mon, /* target */ struct obj *obj) /* weapon */ { @@ -2035,7 +2036,7 @@ joust(struct monst *mon, /* target */ } /* send in a demon pet for the hero; exercise wisdom */ -static void +staticfn void demonpet(void) { int i; @@ -2050,7 +2051,7 @@ demonpet(void) exercise(A_WIS, TRUE); } -static boolean +staticfn boolean theft_petrifies(struct obj *otmp) { if (uarmg || otmp->otyp != CORPSE @@ -2076,7 +2077,7 @@ theft_petrifies(struct obj *otmp) * If the target is wearing body armor, take all of its possessions; * otherwise, take one object. [Is this really the behavior we want?] */ -static void +staticfn void steal_it(struct monst *mdef, struct attack *mattk) { struct obj *otmp, *gold = 0, *ustealo, **minvent_ptr; @@ -4783,7 +4784,7 @@ explum(struct monst *mdef, struct attack *mattk) return M_ATTK_HIT; } -static void +staticfn void start_engulf(struct monst *mdef) { boolean u_digest = digests(gy.youmonst.data), @@ -4801,7 +4802,7 @@ start_engulf(struct monst *mdef) nh_delay_output(); } -static void +staticfn void end_engulf(void) { if (!Invisible) { @@ -4810,7 +4811,7 @@ end_engulf(void) } } -static int +staticfn int gulpum(struct monst *mdef, struct attack *mattk) { static char msgbuf[BUFSZ]; /* for gn.nomovemsg */ @@ -5244,7 +5245,7 @@ mhitm_knockback( } /* attack monster as a monster; returns True if mon survives */ -static boolean +staticfn boolean hmonas(struct monst *mon) { struct attack *mattk, alt_attk; @@ -6050,7 +6051,7 @@ stumble_onto_mimic(struct monst *mtmp) RESTORE_WARNING_FORMAT_NONLITERAL -static void +staticfn void nohandglow(struct monst *mon) { char *hands; diff --git a/src/utf8map.c b/src/utf8map.c index 1dcd8fc21..8b3666669 100644 --- a/src/utf8map.c +++ b/src/utf8map.c @@ -37,24 +37,25 @@ static struct glyphid_cache_t *glyphid_cache; static unsigned glyphid_cache_lsize; static size_t glyphid_cache_size; struct find_struct glyphcache_find, to_custom_symbol_find; -static void init_glyph_cache(void); -static void add_glyph_to_cache(int glyphnum, const char *id); -static int find_glyph_in_cache(const char *id); -static uint32 glyph_hash(const char *id); -static void to_custom_symset_entry_callback(int glyph, + +staticfn void init_glyph_cache(void); +staticfn void add_glyph_to_cache(int glyphnum, const char *id); +staticfn int find_glyph_in_cache(const char *id); +staticfn uint32 glyph_hash(const char *id); +staticfn void to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat); -static int unicode_val(const char *cp); -static int parse_id(const char *id, struct find_struct *findwhat); -static int glyph_find_core(const char *id, struct find_struct *findwhat); -static char *fix_glyphname(char *str); -static int32_t rgbstr_to_int32(const char *rgbstr); +staticfn int unicode_val(const char *cp); +staticfn int parse_id(const char *id, struct find_struct *findwhat); +staticfn int glyph_find_core(const char *id, struct find_struct *findwhat); +staticfn char *fix_glyphname(char *str); +staticfn int32_t rgbstr_to_int32(const char *rgbstr); boolean closest_color(uint32_t lcolor, uint32_t *closecolor, int *clridx); -static int color_distance(uint32_t, uint32_t); -static boolean onlyhexdigits(const char *buf); +staticfn int color_distance(uint32_t, uint32_t); +staticfn boolean onlyhexdigits(const char *buf); static const long nonzero_black = CLR_BLACK | NH_BASIC_COLOR; -static void +staticfn void to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat) { #ifdef NO_PARSING_SYMSET @@ -146,7 +147,7 @@ glyphrep_to_custom_map_entries(const char *op, int *glyphptr) static const char hex[] = "00112233445566778899aAbBcCdDeEfF"; -static boolean +staticfn boolean onlyhexdigits(const char *buf) { const char *dp = buf; @@ -158,7 +159,7 @@ onlyhexdigits(const char *buf) return TRUE; } -static int32_t +staticfn int32_t rgbstr_to_int32(const char *rgbstr) { int r, g, b, milestone = 0; @@ -214,7 +215,7 @@ rgbstr_to_int32(const char *rgbstr) return -1; } -static char * +staticfn char * fix_glyphname(char *str) { char *c; @@ -230,7 +231,7 @@ fix_glyphname(char *str) return str; } -static int +staticfn int unicode_val(const char *cp) { const char *dp; @@ -278,7 +279,7 @@ set_map_u(glyph_map *gmap, uint32 utf32ch, const uint8 *utf8str, long ucolor) } -static int +staticfn int glyph_find_core(const char *id, struct find_struct *findwhat) { int glyph; @@ -374,7 +375,7 @@ void fill_glyphid_cache(void) * to traverse the entire table. */ -static void +staticfn void init_glyph_cache(void) { size_t glyph; @@ -411,7 +412,7 @@ void free_glyphid_cache(void) glyphid_cache = (struct glyphid_cache_t *) 0; } -static void +staticfn void add_glyph_to_cache(int glyphnum, const char *id) { uint32 hash = glyph_hash(id); @@ -434,7 +435,7 @@ add_glyph_to_cache(int glyphnum, const char *id) panic("glyphid_cache full"); } -static int +staticfn int find_glyph_in_cache(const char *id) { uint32 hash = glyph_hash(id); @@ -457,7 +458,7 @@ find_glyph_in_cache(const char *id) return -1; } -static uint32 +staticfn uint32 glyph_hash(const char *id) { uint32 hash = 0; @@ -669,7 +670,7 @@ add_custom_urep_entry( return 1; } -static int +staticfn int parse_id(const char *id, struct find_struct *findwhat) { FILE *fp = (FILE *) 0; @@ -1107,7 +1108,7 @@ static struct { * https://www.compuphase.com/cmetric.htm **/ -static int +staticfn int color_distance(uint32_t rgb1, uint32_t rgb2) { int r1 = (rgb1 >> 16) & 0xFF; @@ -1165,12 +1166,12 @@ static struct { #undef PCHAR_TILES }; -static int glyphs_to_unicode(const char *id, const char *unicode_val, +staticfn int glyphs_to_unicode(const char *id, const char *unicode_val, long clr); -static int find_glyphs(const char *id); -static void just_find_callback(int glyph, struct find_struct *findwhat); -static void to_unicode_callback(int glyph, struct find_struct *findwhat); -static struct customization_detail *find_display_urep_customization( +staticfn int find_glyphs(const char *id); +staticfn void just_find_callback(int glyph, struct find_struct *findwhat); +staticfn void to_unicode_callback(int glyph, struct find_struct *findwhat); +staticfn struct customization_detail *find_display_urep_customization( const char *customization_name, int glyphidx, enum graphics_sets which_set); @@ -1187,13 +1188,13 @@ test_glyphnames(void) reslt = glyphs_to_unicode("S_dog", "U+130E6", 0L); } -static void +staticfn void just_find_callback(int glyph UNUSED, struct find_struct *findwhat UNUSED) { return; } -static int +staticfn int find_glyphs(const char *id) { struct find_struct find_only = zero_find; @@ -1203,7 +1204,7 @@ find_glyphs(const char *id) return glyph_find_core(id, &find_only); } -static void +staticfn void to_unicode_callback(int glyph UNUSED, struct find_struct *findwhat) { int uval; diff --git a/src/vault.c b/src/vault.c index c2b279738..667b657df 100644 --- a/src/vault.c +++ b/src/vault.c @@ -5,18 +5,19 @@ #include "hack.h" -static boolean clear_fcorr(struct monst *, boolean) NONNULLARG1; -static void blackout(coordxy, coordxy); -static void restfakecorr(struct monst *) NONNULLARG1; -static void parkguard(struct monst *) NONNULLARG1; -static boolean in_fcorridor(struct monst *, coordxy, coordxy) NONNULLARG1; -static boolean find_guard_dest(struct monst *, coordxy *, coordxy *) NONNULLARG23; -static void move_gold(struct obj *, int) NONNULLARG1; -static void wallify_vault(struct monst *) NONNULLARG1; -static void gd_mv_monaway(struct monst *, int, int) NONNULLARG1; -static void gd_pick_corridor_gold(struct monst *, int, int) NONNULLARG1; -static int gd_move_cleanup(struct monst *, boolean, boolean) NONNULLARG1; -static void gd_letknow(struct monst *) NONNULLARG1; +staticfn boolean clear_fcorr(struct monst *, boolean) NONNULLARG1; +staticfn void blackout(coordxy, coordxy); +staticfn void restfakecorr(struct monst *) NONNULLARG1; +staticfn void parkguard(struct monst *) NONNULLARG1; +staticfn boolean in_fcorridor(struct monst *, coordxy, coordxy) NONNULLARG1; +staticfn boolean find_guard_dest(struct monst *, coordxy *, coordxy *) + NONNULLARG23; +staticfn void move_gold(struct obj *, int) NONNULLARG1; +staticfn void wallify_vault(struct monst *) NONNULLARG1; +staticfn void gd_mv_monaway(struct monst *, int, int) NONNULLARG1; +staticfn void gd_pick_corridor_gold(struct monst *, int, int) NONNULLARG1; +staticfn int gd_move_cleanup(struct monst *, boolean, boolean) NONNULLARG1; +staticfn void gd_letknow(struct monst *) NONNULLARG1; void newegd(struct monst *mtmp) @@ -42,7 +43,7 @@ free_egd(struct monst *mtmp) /* try to remove the temporary corridor (from vault to rest of map) being maintained by guard 'grd'; if guard is still in it, removal will fail, to be tried again later */ -static boolean +staticfn boolean clear_fcorr(struct monst *grd, boolean forceshow) { coordxy fcx, fcy, fcbeg; @@ -118,7 +119,7 @@ clear_fcorr(struct monst *grd, boolean forceshow) spots to unlit; if player used scroll/wand/spell of light while inside the corridor, we don't want the light to reappear if/when a new tunnel goes through the same area */ -static void +staticfn void blackout(coordxy x, coordxy y) { struct rm *lev; @@ -139,7 +140,7 @@ blackout(coordxy x, coordxy y) } } -static void +staticfn void restfakecorr(struct monst *grd) { /* it seems you left the corridor - let the guard disappear */ @@ -150,7 +151,7 @@ restfakecorr(struct monst *grd) } /* move guard--dead to alive--to <0,0> until temporary corridor is removed */ -static void +staticfn void parkguard(struct monst *grd) { /* either guard is dead or will now be treated as if so; @@ -187,7 +188,7 @@ grddead(struct monst *grd) return dispose; } -static boolean +staticfn boolean in_fcorridor(struct monst *grd, coordxy x, coordxy y) { int fci; @@ -276,7 +277,7 @@ uleftvault(struct monst *grd) } } -static boolean +staticfn boolean find_guard_dest(struct monst *guard, coordxy *rx, coordxy *ry) { coordxy x, y, dd, lx, ly; @@ -615,7 +616,7 @@ invault(void) } } -static void +staticfn void move_gold(struct obj *gold, int vroom) { coordxy nx, ny; @@ -629,7 +630,7 @@ move_gold(struct obj *gold, int vroom) newsym(nx, ny); } -static void +staticfn void wallify_vault(struct monst *grd) { int typ; @@ -716,7 +717,7 @@ wallify_vault(struct monst *grd) } } -static void +staticfn void gd_mv_monaway(struct monst *grd, int nx, int ny) { struct monst *mtmp = m_at(nx, ny); @@ -733,7 +734,7 @@ gd_mv_monaway(struct monst *grd, int nx, int ny) /* have guard pick gold off the floor, possibly moving to the gold's position before message and back to his current spot after */ -static void +staticfn void gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy) { struct obj *gold; @@ -817,7 +818,7 @@ gd_pick_corridor_gold(struct monst *grd, int goldx, int goldy) /* return 1: guard moved, -2: died */ -static int +staticfn int gd_move_cleanup( struct monst *grd, boolean semi_dead, @@ -850,7 +851,7 @@ gd_move_cleanup( return -2; } -static void +staticfn void gd_letknow(struct monst *grd) { if (!cansee(grd->mx, grd->my) || !mon_visible(grd)) diff --git a/src/version.c b/src/version.c index c25785069..33eb254bf 100644 --- a/src/version.c +++ b/src/version.c @@ -10,7 +10,7 @@ #define OPTIONS_AT_RUNTIME #endif -static void insert_rtoption(char *) NONNULLARG1; +staticfn void insert_rtoption(char *) NONNULLARG1; /* fill buffer with short version (so caller can avoid including date.h) * buf cannot be NULL */ @@ -340,7 +340,7 @@ static struct rt_opt { * it depends which of several object files got linked into the * game image, so we insert those options here. */ -static void +staticfn void insert_rtoption(char *buf) { int i; diff --git a/src/vision.c b/src/vision.c index 64b1aaea1..6eb9541c6 100644 --- a/src/vision.c +++ b/src/vision.c @@ -86,14 +86,14 @@ static coordxy left_ptrs[ROWNO][COLNO]; /* LOS algorithm helpers */ static coordxy right_ptrs[ROWNO][COLNO]; /* Forward declarations. */ -static void fill_point(int, int); -static void dig_point(int, int); -static void view_init(void); -static void view_from(coordxy, coordxy, seenV **, coordxy *, coordxy *, int, +staticfn void fill_point(int, int); +staticfn void dig_point(int, int); +staticfn void view_init(void); +staticfn void view_from(coordxy, coordxy, seenV **, coordxy *, coordxy *, int, void (*)(coordxy, coordxy, genericptr_t), genericptr_t); -static void get_unused_cs(seenV ***, coordxy **, coordxy **); -static void rogue_vision(seenV **, coordxy *, coordxy *); +staticfn void get_unused_cs(seenV ***, coordxy **, coordxy **); +staticfn void rogue_vision(seenV **, coordxy *, coordxy *); /* Macro definitions that I can't find anywhere. */ #define sign(z) ((z) < 0 ? -1 : ((z) ? 1 : 0)) @@ -260,7 +260,7 @@ vision_reset(void) * Called from vision_recalc() and at least one light routine. Get pointers * to the unused vision work area. */ -static void +staticfn void get_unused_cs(seenV ***rows, coordxy **rmin, coordxy **rmax) { int row; @@ -300,7 +300,7 @@ get_unused_cs(seenV ***rows, coordxy **rmin, coordxy **rmax) * We set the in_sight bit here as well to escape a bug that shows up * due to the one-sided lit wall hack. */ -static void +staticfn void rogue_vision(seenV **next, coordxy *rmin, coordxy *rmax) { int rnum = levl[u.ux][u.uy].roomno - ROOMOFFSET; /* no SHARED... */ @@ -357,7 +357,7 @@ rogue_vision(seenV **next, coordxy *rmin, coordxy *rmax) #ifdef EXTEND_SPINE -static int new_angle(struct rm *, unsigned char *, int, int); +staticfn int new_angle(struct rm *, unsigned char *, int, int); /* * new_angle() * @@ -400,7 +400,7 @@ static int new_angle(struct rm *, unsigned char *, int, int); * many exceptions. I may have to bite the bullet and do more * checks. - Dean 2/11/93 */ -static int +staticfn int new_angle(struct rm *lev, unsigned char *sv, int row, int col) { int res = *sv; @@ -933,7 +933,7 @@ unblock_point(int x, int y) * This means that a right-edge (a blocked spot that has an open * spot on its right) will point to itself. */ -static void +staticfn void dig_point(int row, int col) { int i; @@ -1017,7 +1017,7 @@ dig_point(int row, int col) } } -static void +staticfn void fill_point(int row, int col) { int i; @@ -1372,10 +1372,10 @@ static genericptr_t varg; #else /* !MACRO_CPATH -- quadrants are really functions */ -static int _q1_path(int, int, int, int); -static int _q2_path(int, int, int, int); -static int _q3_path(int, int, int, int); -static int _q4_path(int, int, int, int); +staticfn int _q1_path(int, int, int, int); +staticfn int _q2_path(int, int, int, int); +staticfn int _q3_path(int, int, int, int); +staticfn int _q4_path(int, int, int, int); #define q1_path(sy, sx, y, x, dummy) result = _q1_path(sy, sx, y, x) #define q2_path(sy, sx, y, x, dummy) result = _q2_path(sy, sx, y, x) @@ -1385,7 +1385,7 @@ static int _q4_path(int, int, int, int); /* * Quadrant I (step < 0). */ -static int +staticfn int _q1_path(int scol, int srow, int y2, int x2) { int dx, dy; @@ -1432,7 +1432,7 @@ _q1_path(int scol, int srow, int y2, int x2) /* * Quadrant IV (step > 0). */ -static int +staticfn int _q4_path(int scol, int srow, int y2, int x2) { int dx, dy; @@ -1479,7 +1479,7 @@ _q4_path(int scol, int srow, int y2, int x2) /* * Quadrant II (step < 0). */ -static int +staticfn int _q2_path(int scol, int srow, int y2, int x2) { int dx, dy; @@ -1526,7 +1526,7 @@ _q2_path(int scol, int srow, int y2, int x2) /* * Quadrant III (step > 0). */ -static int +staticfn int _q3_path(int scol, int srow, int y2, int x2) { int dx, dy; @@ -1613,11 +1613,11 @@ clear_path(int col1, int row1, int col2, int row2) /* * Defines local to Algorithm C. */ -static void right_side(int, int, int, const coordxy *); -static void left_side(int, int, int, const coordxy *); +staticfn void right_side(int, int, int, const coordxy *); +staticfn void left_side(int, int, int, const coordxy *); /* Initialize algorithm C (nothing). */ -static void +staticfn void view_init(void) { } @@ -1632,7 +1632,7 @@ view_init(void) * right_mark last (right side) visible spot on prev row * limits points at range limit for current row, or NULL */ -static void +staticfn void right_side( int row, int left, @@ -1824,7 +1824,7 @@ right_side( * This routine is the mirror image of right_side(). See right_side() for * extensive comments. */ -static void +staticfn void left_side( int row, int left_mark, @@ -1968,7 +1968,7 @@ left_side( * func function to call on each spot * arg argument for func */ -static void +staticfn void view_from( coordxy srow, coordxy scol, seenV **loc_cs_rows, diff --git a/src/weapon.c b/src/weapon.c index e98386cb2..85622a3e7 100644 --- a/src/weapon.c +++ b/src/weapon.c @@ -10,12 +10,12 @@ */ #include "hack.h" -static void give_may_advance_msg(int); -static void finish_towel_change(struct obj *obj, int); -static boolean could_advance(int); -static boolean peaked_skill(int); -static int slots_required(int); -static void skill_advance(int); +staticfn void give_may_advance_msg(int); +staticfn void finish_towel_change(struct obj *obj, int); +staticfn boolean could_advance(int); +staticfn boolean peaked_skill(int); +staticfn int slots_required(int); +staticfn void skill_advance(int); /* Categories whose names don't come from OBJ_NAME(objects[type]) */ @@ -69,7 +69,7 @@ static NEARDATA const char *const barehands_or_martial[] = { static NEARDATA const char kebabable[] = { S_XORN, S_DRAGON, S_JABBERWOCK, S_NAGA, S_GIANT, '\0' }; -static void +staticfn void give_may_advance_msg(int skill) { You_feel("more confident in your %sskills.", @@ -461,14 +461,14 @@ silver_sears(struct monst *magr UNUSED, struct monst *mdef, } } -static struct obj *oselect(struct monst *, int); +staticfn struct obj *oselect(struct monst *, int); #define Oselect(x) \ do { \ if ((otmp = oselect(mtmp, x)) != 0) \ return otmp; \ } while (0) -static struct obj * +staticfn struct obj * oselect(struct monst *mtmp, int type) { struct obj *otmp; @@ -957,7 +957,7 @@ dbon(void) } /* called when wet_a_towel() or dry_a_towel() is changing a towel's wetness */ -static void +staticfn void finish_towel_change(struct obj *obj, int newspe) { /* towel wetness is always between 0 (dry) and 7, inclusive */ @@ -1069,7 +1069,7 @@ skill_name(int skill) } /* return the # of slots required to advance the skill */ -static int +staticfn int slots_required(int skill) { int tmp = P_SKILL(skill); @@ -1110,7 +1110,7 @@ can_advance(int skill, boolean speedy) } /* return true if this skill could be advanced if more slots were available */ -static boolean +staticfn boolean could_advance(int skill) { if (P_RESTRICTED(skill) @@ -1124,7 +1124,7 @@ could_advance(int skill) /* return true if this skill has reached its maximum and there's been enough practice to become eligible for the next step if that had been possible */ -static boolean +staticfn boolean peaked_skill(int skill) { if (P_RESTRICTED(skill)) @@ -1135,7 +1135,7 @@ peaked_skill(int skill) >= practice_needed_to_advance(P_SKILL(skill)))); } -static void +staticfn void skill_advance(int skill) { u.weapon_slots -= slots_required(skill); diff --git a/src/wield.c b/src/wield.c index dd040020b..6bb329367 100644 --- a/src/wield.c +++ b/src/wield.c @@ -52,10 +52,10 @@ * No item may be in more than one of these slots. */ -static boolean cant_wield_corpse(struct obj *) NONNULLARG1; -static int ready_weapon(struct obj *) NO_NNARGS; -static int ready_ok(struct obj *) NO_NNARGS; -static int wield_ok(struct obj *) NO_NNARGS; +staticfn boolean cant_wield_corpse(struct obj *) NONNULLARG1; +staticfn int ready_weapon(struct obj *) NO_NNARGS; +staticfn int ready_ok(struct obj *) NO_NNARGS; +staticfn int wield_ok(struct obj *) NO_NNARGS; /* used by will_weld() */ /* probably should be renamed */ @@ -128,7 +128,7 @@ setuwep(struct obj *obj) gu.unweapon = TRUE; /* for "bare hands" message */ } -static boolean +staticfn boolean cant_wield_corpse(struct obj *obj) { char kbuf[BUFSZ]; @@ -159,7 +159,7 @@ empty_handed(void) : "not wielding anything"; } -static int +staticfn int ready_weapon(struct obj *wep) { /* Separated function so swapping works easily */ @@ -284,7 +284,7 @@ setuswapwep(struct obj *obj) /* getobj callback for object to ready for throwing/shooting; this filter lets worn items through so that caller can reject them */ -static int +staticfn int ready_ok(struct obj *obj) { if (!obj) /* '-', will empty quiver slot if chosen */ @@ -321,7 +321,7 @@ ready_ok(struct obj *obj) } /* getobj callback for object to wield */ -static int +staticfn int wield_ok(struct obj *obj) { if (!obj) diff --git a/src/windows.c b/src/windows.c index 525bb00da..0c37ec988 100644 --- a/src/windows.c +++ b/src/windows.c @@ -60,25 +60,23 @@ extern void *trace_procs_chain(int, int, void *, void *, void *); #endif #if defined(WINCHAIN) || defined(TTY_GRAPHICS) -static struct win_choices *win_choices_find(const char *s) NONNULLARG1; +staticfn struct win_choices *win_choices_find(const char *s) NONNULLARG1; #endif -static void def_raw_print(const char *s) NONNULLARG1; -static void def_wait_synch(void); -static boolean get_menu_coloring(const char *, int *, int *) NONNULLPTRS; +staticfn void def_raw_print(const char *s) NONNULLARG1; +staticfn void def_wait_synch(void); +staticfn boolean get_menu_coloring(const char *, int *, int *) NONNULLPTRS; -#ifdef DUMPLOG -static winid dump_create_nhwindow(int); -static void dump_clear_nhwindow(winid); -static void dump_display_nhwindow(winid, boolean); -static void dump_destroy_nhwindow(winid); -static void dump_start_menu(winid, unsigned long); -static void dump_add_menu(winid, const glyph_info *, const ANY_P *, char, +staticfn winid dump_create_nhwindow(int); +staticfn void dump_clear_nhwindow(winid); +staticfn void dump_display_nhwindow(winid, boolean); +staticfn void dump_destroy_nhwindow(winid); +staticfn void dump_start_menu(winid, unsigned long); +staticfn void dump_add_menu(winid, const glyph_info *, const ANY_P *, char, char, int, int, const char *, unsigned int); -static void dump_end_menu(winid, const char *); -static int dump_select_menu(winid, int, MENU_ITEM_P **); -static void dump_putstr(winid, int, const char *); -#endif /* DUMPLOG */ +staticfn void dump_end_menu(winid, const char *); +staticfn int dump_select_menu(winid, int, MENU_ITEM_P **); +staticfn void dump_putstr(winid, int, const char *); #ifdef HANGUPHANDLING volatile @@ -155,7 +153,7 @@ struct winlink { static struct winlink *chain = 0; -static struct winlink * +staticfn struct winlink * wl_new(void) { struct winlink *wl = (struct winlink *) alloc(sizeof *wl); @@ -167,14 +165,14 @@ wl_new(void) return wl; } -static void +staticfn void wl_addhead(struct winlink *wl) { wl->nextlink = chain; chain = wl; } -static void +staticfn void wl_addtail(struct winlink *wl) { struct winlink *p = chain; @@ -203,14 +201,14 @@ genl_can_suspend_yes(void) return TRUE; } -static +staticfn void def_raw_print(const char *s) { puts(s); } -static +staticfn void def_wait_synch(void) { @@ -249,7 +247,7 @@ check_tty_wincap2(unsigned long wincap2) #endif #if defined(WINCHAIN) || defined(TTY_GRAPHICS) -static struct win_choices * +staticfn struct win_choices * win_choices_find(const char *s) { int i; @@ -520,44 +518,44 @@ genl_putmsghistory(const char *msg, boolean is_restoring) * in order to avoid all terminal I/O after hangup/disconnect. */ -static int hup_nhgetch(void); -static char hup_yn_function(const char *, const char *, char); -static int hup_nh_poskey(coordxy *, coordxy *, int *); -static void hup_getlin(const char *, char *); -static void hup_init_nhwindows(int *, char **); -static void hup_exit_nhwindows(const char *); -static winid hup_create_nhwindow(int); -static int hup_select_menu(winid, int, MENU_ITEM_P **); -static void hup_add_menu(winid, const glyph_info *, const anything *, char, +staticfn int hup_nhgetch(void); +staticfn char hup_yn_function(const char *, const char *, char); +staticfn int hup_nh_poskey(coordxy *, coordxy *, int *); +staticfn void hup_getlin(const char *, char *); +staticfn void hup_init_nhwindows(int *, char **); +staticfn void hup_exit_nhwindows(const char *); +staticfn winid hup_create_nhwindow(int); +staticfn int hup_select_menu(winid, int, MENU_ITEM_P **); +staticfn void hup_add_menu(winid, const glyph_info *, const anything *, char, char, int, int, const char *, unsigned int); -static void hup_end_menu(winid, const char *); -static void hup_putstr(winid, int, const char *); -static void hup_print_glyph(winid, coordxy, coordxy, const glyph_info *, +staticfn void hup_end_menu(winid, const char *); +staticfn void hup_putstr(winid, int, const char *); +staticfn void hup_print_glyph(winid, coordxy, coordxy, const glyph_info *, const glyph_info *); -static void hup_outrip(winid, int, time_t); -static void hup_curs(winid, int, int); -static void hup_display_nhwindow(winid, boolean); -static void hup_display_file(const char *, boolean); +staticfn void hup_outrip(winid, int, time_t); +staticfn void hup_curs(winid, int, int); +staticfn void hup_display_nhwindow(winid, boolean); +staticfn void hup_display_file(const char *, boolean); #ifdef CLIPPING -static void hup_cliparound(int, int); +staticfn void hup_cliparound(int, int); #endif #ifdef CHANGE_COLOR -static void hup_change_color(int, long, int); +staticfn void hup_change_color(int, long, int); #ifdef MAC -static short hup_set_font_name(winid, char *); +staticfn short hup_set_font_name(winid, char *); #endif -static char *hup_get_color_string(void); +staticfn char *hup_get_color_string(void); #endif /* CHANGE_COLOR */ -static void hup_status_update(int, genericptr_t, int, int, int, +staticfn void hup_status_update(int, genericptr_t, int, int, int, unsigned long *); -static int hup_int_ndecl(void); -static void hup_void_ndecl(void); -static void hup_void_fdecl_int(int); -static void hup_void_fdecl_winid(winid); -static void hup_void_fdecl_winid_ulong(winid, unsigned long); -static void hup_void_fdecl_constchar_p(const char *); -static win_request_info *hup_ctrl_nhwindow(winid, int, win_request_info *); +staticfn int hup_int_ndecl(void); +staticfn void hup_void_ndecl(void); +staticfn void hup_void_fdecl_int(int); +staticfn void hup_void_fdecl_winid(winid); +staticfn void hup_void_fdecl_winid_ulong(winid, unsigned long); +staticfn void hup_void_fdecl_constchar_p(const char *); +staticfn win_request_info *hup_ctrl_nhwindow(winid, int, win_request_info *); static struct window_procs hup_procs = { WPID(hup), 0L, 0L, @@ -641,7 +639,7 @@ nhwindows_hangup(void) windowprocs.win_getmsghistory = previnterface_getmsghistory; } -static void +staticfn void hup_exit_nhwindows(const char *lastgasp) { /* core has called exit_nhwindows(); call the previous interface's @@ -655,14 +653,14 @@ hup_exit_nhwindows(const char *lastgasp) iflags.window_inited = FALSE; } -static int +staticfn int hup_nhgetch(void) { return '\033'; /* ESC */ } /*ARGSUSED*/ -static char +staticfn char hup_yn_function( const char *prompt UNUSED, const char *resp UNUSED, @@ -674,35 +672,35 @@ hup_yn_function( } /*ARGSUSED*/ -static int +staticfn int hup_nh_poskey(coordxy *x UNUSED, coordxy *y UNUSED, int *mod UNUSED) { return '\033'; } /*ARGSUSED*/ -static void +staticfn void hup_getlin(const char *prompt UNUSED, char *outbuf) { Strcpy(outbuf, "\033"); } /*ARGSUSED*/ -static void +staticfn void hup_init_nhwindows(int *argc_p UNUSED, char **argv UNUSED) { iflags.window_inited = TRUE; } /*ARGUSED*/ -static winid +staticfn winid hup_create_nhwindow(int type UNUSED) { return WIN_ERR; } /*ARGSUSED*/ -static int +staticfn int hup_select_menu( winid window UNUSED, int how UNUSED, @@ -712,7 +710,7 @@ hup_select_menu( } /*ARGSUSED*/ -static void +staticfn void hup_add_menu( winid window UNUSED, const glyph_info *glyphinfo UNUSED, @@ -728,21 +726,21 @@ hup_add_menu( } /*ARGSUSED*/ -static void +staticfn void hup_end_menu(winid window UNUSED, const char *prompt UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void hup_putstr(winid window UNUSED, int attr UNUSED, const char *text UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void hup_print_glyph( winid window UNUSED, coordxy x UNUSED, coordxy y UNUSED, @@ -753,28 +751,28 @@ hup_print_glyph( } /*ARGSUSED*/ -static void +staticfn void hup_outrip(winid tmpwin UNUSED, int how UNUSED, time_t when UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void hup_curs(winid window UNUSED, int x UNUSED, int y UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void hup_display_nhwindow(winid window UNUSED, boolean blocking UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void hup_display_file(const char *fname UNUSED, boolean complain UNUSED) { return; @@ -782,7 +780,7 @@ hup_display_file(const char *fname UNUSED, boolean complain UNUSED) #ifdef CLIPPING /*ARGSUSED*/ -static void +staticfn void hup_cliparound(int x UNUSED, int y UNUSED) { return; @@ -791,7 +789,7 @@ hup_cliparound(int x UNUSED, int y UNUSED) #ifdef CHANGE_COLOR /*ARGSUSED*/ -static void +staticfn void hup_change_color(int color, int reverse, long rgb) { return; @@ -799,14 +797,14 @@ hup_change_color(int color, int reverse, long rgb) #ifdef MAC /*ARGSUSED*/ -static short +staticfn short hup_set_font_name(winid window, char *fontname) { return 0; } #endif /* MAC */ -static char * +staticfn char * hup_get_color_string(void) { return (char *) 0; @@ -814,7 +812,7 @@ hup_get_color_string(void) #endif /* CHANGE_COLOR */ /*ARGSUSED*/ -static void +staticfn void hup_status_update( int idx UNUSED, genericptr_t ptr UNUSED, int chg UNUSED, int pc UNUSED, @@ -827,34 +825,34 @@ hup_status_update( * Non-specific stubs. */ -static int +staticfn int hup_int_ndecl(void) { return -1; } -static void +staticfn void hup_void_ndecl(void) { return; } /*ARGUSED*/ -static void +staticfn void hup_void_fdecl_int(int arg UNUSED) { return; } /*ARGUSED*/ -static void +staticfn void hup_void_fdecl_winid(winid window UNUSED) { return; } /*ARGUSED*/ -static void +staticfn void hup_void_fdecl_winid_ulong( winid window UNUSED, unsigned long mbehavior UNUSED) @@ -863,7 +861,7 @@ hup_void_fdecl_winid_ulong( } /*ARGUSED*/ -static void +staticfn void hup_void_fdecl_constchar_p(const char *string UNUSED) { return; @@ -1283,49 +1281,49 @@ dump_forward_putstr(winid win, int attr, const char *str, int no_forward) } /*ARGSUSED*/ -static void +staticfn void dump_putstr(winid win UNUSED, int attr UNUSED, const char *str) { if (dumplog_file) fprintf(dumplog_file, "%s\n", str); } -static winid +staticfn winid dump_create_nhwindow(int type UNUSED) { return WIN_ERR; } /*ARGUSED*/ -static void +staticfn void dump_clear_nhwindow(winid win UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void dump_display_nhwindow(winid win UNUSED, boolean p UNUSED) { return; } /*ARGUSED*/ -static void +staticfn void dump_destroy_nhwindow(winid win UNUSED) { return; } /*ARGUSED*/ -static void +staticfn void dump_start_menu(winid win UNUSED, unsigned long mbehavior UNUSED) { return; } /*ARGSUSED*/ -static void +staticfn void dump_add_menu(winid win UNUSED, const glyph_info *glyphinfo, const anything *identifier UNUSED, @@ -1345,7 +1343,7 @@ dump_add_menu(winid win UNUSED, } /*ARGSUSED*/ -static void +staticfn void dump_end_menu(winid win UNUSED, const char *str) { if (dumplog_file) { @@ -1356,7 +1354,7 @@ dump_end_menu(winid win UNUSED, const char *str) } } -static int +staticfn int dump_select_menu(winid win UNUSED, int how UNUSED, menu_item **item) { *item = (menu_item *) 0; @@ -1830,7 +1828,7 @@ add_menu_str(winid tmpwin, const char *buf) buf, MENU_ITEMFLAGS_NONE); } -static boolean +staticfn boolean get_menu_coloring(const char *str, int *color, int *attr) { struct menucoloring *tmpmc; diff --git a/src/wizard.c b/src/wizard.c index b5101f96d..0a35f66f9 100644 --- a/src/wizard.c +++ b/src/wizard.c @@ -10,16 +10,16 @@ #include "hack.h" -static short which_arti(int); -static boolean mon_has_arti(struct monst *, short) NONNULLARG1; +staticfn short which_arti(int); +staticfn boolean mon_has_arti(struct monst *, short) NONNULLARG1; /* other_mon_has_arti() won't blow up if passed a NULL monst, * but its caller target_on() passes it a nonnull monst; * it may return a NULL monst pointer */ -static struct monst *other_mon_has_arti(struct monst *, short) NONNULLARG1; -static struct obj *on_ground(short); /* might return NULL obj pointer */ -static boolean you_have(int); -static unsigned long target_on(int, struct monst *) NONNULLARG2; -static unsigned long strategy(struct monst *) NONNULLARG1; +staticfn struct monst *other_mon_has_arti(struct monst *, short) NONNULLARG1; +staticfn struct obj *on_ground(short); /* might return NULL obj pointer */ +staticfn boolean you_have(int); +staticfn unsigned long target_on(int, struct monst *) NONNULLARG2; +staticfn unsigned long strategy(struct monst *) NONNULLARG1; /* adding more neutral creatures will tend to reduce the number of monsters summoned by nasty(); adding more lawful creatures will reduce the number @@ -141,7 +141,7 @@ mon_has_special(struct monst *mtmp) #define M_Wants(mask) (mtmp->data->mflags3 & (mask)) -static short +staticfn short which_arti(int mask) { switch (mask) { @@ -164,7 +164,7 @@ which_arti(int mask) * since bell, book, candle, and amulet are all objects, not really * artifacts right now. [MRS] */ -static boolean +staticfn boolean mon_has_arti(struct monst *mtmp, short otyp) { struct obj *otmp; @@ -183,7 +183,7 @@ mon_has_arti(struct monst *mtmp, short otyp) * Returns some monster other than mtmp that * has artifact, or NULL monst pointer. */ -static struct monst * +staticfn struct monst * other_mon_has_arti(struct monst *mtmp, short otyp) { struct monst *mtmp2; @@ -201,7 +201,7 @@ other_mon_has_arti(struct monst *mtmp, short otyp) * Returns obj of type specified if there is one * on the ground, otherwise returns NULL obj pointer. */ -static struct obj * +staticfn struct obj * on_ground(short otyp) { struct obj *otmp; @@ -215,7 +215,7 @@ on_ground(short otyp) return (struct obj *) 0; } -static boolean +staticfn boolean you_have(int mask) { switch (mask) { @@ -235,7 +235,7 @@ you_have(int mask) return 0; } -static unsigned long +staticfn unsigned long target_on(int mask, struct monst *mtmp) { short otyp; @@ -261,7 +261,7 @@ target_on(int mask, struct monst *mtmp) return (unsigned long) STRAT_NONE; } -static unsigned long +staticfn unsigned long strategy(struct monst *mtmp) { unsigned long strat, dstrat; diff --git a/src/wizcmds.c b/src/wizcmds.c index b663e5d82..fbcee86c4 100644 --- a/src/wizcmds.c +++ b/src/wizcmds.c @@ -8,21 +8,21 @@ extern const char unavailcmd[]; /* cmd.c [27] */ extern const char *levltyp[MAX_TYPE + 2]; /* cmd.c */ -static int size_monst(struct monst *, boolean); -static int size_obj(struct obj *); -static void count_obj(struct obj *, long *, long *, boolean, boolean); -static void obj_chain(winid, const char *, struct obj *, boolean, long *, +staticfn int size_monst(struct monst *, boolean); +staticfn int size_obj(struct obj *); +staticfn void count_obj(struct obj *, long *, long *, boolean, boolean); +staticfn void obj_chain(winid, const char *, struct obj *, boolean, long *, long *); -static void mon_invent_chain(winid, const char *, struct monst *, long *, +staticfn void mon_invent_chain(winid, const char *, struct monst *, long *, long *); -static void mon_chain(winid, const char *, struct monst *, boolean, long *, +staticfn void mon_chain(winid, const char *, struct monst *, boolean, long *, long *); -static void contained_stats(winid, const char *, long *, long *); -static void misc_stats(winid, long *, long *); -static void you_sanity_check(void); -static void makemap_unmakemon(struct monst *, boolean); -static int QSORTCALLBACK migrsort_cmp(const genericptr, const genericptr); -static void list_migrating_mons(d_level *); +staticfn void contained_stats(winid, const char *, long *, long *); +staticfn void misc_stats(winid, long *, long *); +staticfn void you_sanity_check(void); +staticfn void makemap_unmakemon(struct monst *, boolean); +staticfn int QSORTCALLBACK migrsort_cmp(const genericptr, const genericptr); +staticfn void list_migrating_mons(d_level *); DISABLE_WARNING_FORMAT_NONLITERAL @@ -1099,7 +1099,7 @@ static const char template[] = "%-27s %4ld %6ld"; static const char stats_hdr[] = " count bytes"; static const char stats_sep[] = "--------------------------- ----- -------"; -static int +staticfn int size_obj(struct obj *otmp) { int sz = (int) sizeof (struct obj); @@ -1117,7 +1117,7 @@ size_obj(struct obj *otmp) return sz; } -static void +staticfn void count_obj(struct obj *chain, long *total_count, long *total_size, boolean top, boolean recurse) { @@ -1138,7 +1138,7 @@ count_obj(struct obj *chain, long *total_count, long *total_size, DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE_WARNING follows wiz_show_stats */ -static void +staticfn void obj_chain( winid win, const char *src, @@ -1159,7 +1159,7 @@ obj_chain( } } -static void +staticfn void mon_invent_chain( winid win, const char *src, @@ -1181,7 +1181,7 @@ mon_invent_chain( } } -static void +staticfn void contained_stats( winid win, const char *src, @@ -1210,7 +1210,7 @@ contained_stats( } } -static int +staticfn int size_monst(struct monst *mtmp, boolean incl_wsegs) { int sz = (int) sizeof (struct monst); @@ -1237,7 +1237,7 @@ size_monst(struct monst *mtmp, boolean incl_wsegs) return sz; } -static void +staticfn void mon_chain( winid win, const char *src, @@ -1264,7 +1264,7 @@ mon_chain( } } -static void +staticfn void misc_stats( winid win, long *total_count, long *total_size) @@ -1382,7 +1382,7 @@ misc_stats( } } -static void +staticfn void you_sanity_check(void) { struct monst *mtmp; @@ -1428,7 +1428,7 @@ sanity_check(void) } /* qsort() comparison routine for use in list_migrating_mons() */ -static int QSORTCALLBACK +staticfn int QSORTCALLBACK migrsort_cmp(const genericptr vptr1, const genericptr vptr2) { const struct monst *m1 = *(const struct monst **) vptr1, @@ -1449,7 +1449,7 @@ migrsort_cmp(const genericptr vptr1, const genericptr vptr2) /* called by #migratemons; displays count of migrating monsters, optionally displays them as well */ -static void +staticfn void list_migrating_mons( d_level *nextlevl) /* default destination for wiz_migrate_mons() */ { diff --git a/src/worm.c b/src/worm.c index 6d1266ed9..479c9d75e 100644 --- a/src/worm.c +++ b/src/worm.c @@ -14,12 +14,12 @@ struct wseg { coordxy wx, wy; /* the segment's position */ }; -static void toss_wsegs(struct wseg *, boolean) NO_NNARGS; -static void shrink_worm(int); +staticfn void toss_wsegs(struct wseg *, boolean) NO_NNARGS; +staticfn void shrink_worm(int); #if 0 -static void random_dir(int, int, int *, int *); +staticfn void random_dir(int, int, int *, int *); #endif -static struct wseg *create_worm_tail(int); /* may return NULL */ +staticfn struct wseg *create_worm_tail(int); /* may return NULL */ /* Description of long worm implementation. * @@ -138,8 +138,7 @@ initworm(struct monst *worm, int wseg_count) * Get rid of all worm segments on and following the given pointer curr. * The display may or may not need to be updated as we free the segments. */ -static -void +staticfn void toss_wsegs(struct wseg *curr, boolean display_update) { struct wseg *nxtseg; @@ -168,8 +167,7 @@ toss_wsegs(struct wseg *curr, boolean display_update) * * Remove the tail segment of the worm (the starting segment of the list). */ -static -void +staticfn void shrink_worm(int wnum) /* worm number */ { struct wseg *seg; @@ -803,7 +801,7 @@ place_worm_tail_randomly(struct monst *worm, coordxy x, coordxy y) * This function, and the loop it serves, could be eliminated by coding * enexto() with a search radius. */ -static void +staticfn void random_dir(int x, int y, int *nx, int *ny) { *nx = x + (x > 1 /* extreme left ? */ @@ -852,8 +850,7 @@ count_wsegs(struct monst *mtmp) /* create_worm_tail() * will create a worm tail chain of (num_segs + 1) and return pointer to it. */ -static -struct wseg * +staticfn struct wseg * create_worm_tail(int num_segs) { int i = 0; diff --git a/src/worn.c b/src/worn.c index be646bbdf..d4f9f15f8 100644 --- a/src/worn.c +++ b/src/worn.c @@ -5,10 +5,10 @@ #include "hack.h" -static void m_lose_armor(struct monst *, struct obj *, boolean) NONNULLPTRS; -static void clear_bypass(struct obj *) NO_NNARGS; -static void m_dowear_type(struct monst *, long, boolean, boolean) NONNULLARG1; -static int extra_pref(struct monst *, struct obj *) NONNULLARG1; +staticfn void m_lose_armor(struct monst *, struct obj *, boolean) NONNULLPTRS; +staticfn void clear_bypass(struct obj *) NO_NNARGS; +staticfn void m_dowear_type(struct monst *, long, boolean, boolean) NONNULLARG1; +staticfn int extra_pref(struct monst *, struct obj *) NONNULLARG1; const struct worn { long w_mask; @@ -698,7 +698,7 @@ m_dowear(struct monst *mon, boolean creation) m_dowear_type(mon, W_ARM, creation, RACE_EXCEPTION); } -static void +staticfn void m_dowear_type( struct monst *mon, long flag, /* wornmask value */ @@ -922,7 +922,7 @@ which_armor(struct monst *mon, long flag) } /* remove an item of armor and then drop it */ -static void +staticfn void m_lose_armor( struct monst *mon, struct obj *obj, @@ -937,7 +937,7 @@ m_lose_armor( } /* clear bypass bits for an object chain, plus contents if applicable */ -static void +staticfn void clear_bypass(struct obj *objchn) { struct obj *o; @@ -1214,7 +1214,7 @@ mon_break_armor(struct monst *mon, boolean polyspot) } /* bias a monster's preferences towards armor that has special benefits. */ -static int +staticfn int extra_pref(struct monst *mon, struct obj *obj) { /* currently only does speed boots, but might be expanded if monsters diff --git a/src/write.c b/src/write.c index 1d060fdd7..4536b864e 100644 --- a/src/write.c +++ b/src/write.c @@ -3,15 +3,15 @@ #include "hack.h" -static int cost(struct obj *) NONNULLARG1; -static boolean label_known(int, struct obj *) NO_NNARGS; -static int write_ok(struct obj *) NO_NNARGS; -static char *new_book_description(int, char *) NONNULL NONNULLPTRS; +staticfn int cost(struct obj *) NONNULLARG1; +staticfn boolean label_known(int, struct obj *) NO_NNARGS; +staticfn int write_ok(struct obj *) NO_NNARGS; +staticfn char *new_book_description(int, char *) NONNULL NONNULLPTRS; /* * returns basecost of a scroll or a spellbook */ -static int +staticfn int cost(struct obj *otmp) { if (otmp->oclass == SPBOOK_CLASS) @@ -61,7 +61,7 @@ cost(struct obj *otmp) unfortunately, we can't track things that haven't been added to the discoveries list and aren't present in current inventory, so some scrolls with ought to yield True will end up False */ -static boolean +staticfn boolean label_known(int scrolltype, struct obj *objlist) { struct obj *otmp; @@ -86,7 +86,7 @@ label_known(int scrolltype, struct obj *objlist) } /* getobj callback for object to write on */ -static int +staticfn int write_ok(struct obj *obj) { if (!obj || (obj->oclass != SCROLL_CLASS && obj->oclass != SPBOOK_CLASS)) @@ -421,7 +421,7 @@ dowrite(struct obj *pen) looks funny, so we want to insert "into " prior to such descriptions; even that's rather iffy, indicating that such descriptions probably ought to be eliminated (especially "cloth"!) */ -static char * +staticfn char * new_book_description(int booktype, char *outbuf) { /* subset of description strings from objects.c; if it grows