From: PatR Date: Sat, 6 Apr 2019 08:08:16 +0000 (-0700) Subject: botl.c functions X-Git-Tag: NetHack-3.6.2_Released~24^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7a884289dfe3ec304986923eebf443f7b398fc9;p=nethack botl.c functions Put the prototypes for routines in botl.c into the same order as the corresponding functions are in the file. Also a few were missing and another few used STATIC_OVL when STATIC_DCL was appropriate. --- diff --git a/include/extern.h b/include/extern.h index 92f320c9c..4f764fda7 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1554045807 2019/03/31 15:23:27 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.697 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1554538087 2019/04/06 08:08:07 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.698 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -146,28 +146,28 @@ E int NDECL(getbones); /* ### botl.c ### */ -E const char *FDECL(bl_idx_to_fldname, (int)); E char *NDECL(do_statusline1); E void NDECL(check_gold_symbol); E char *NDECL(do_statusline2); +E void NDECL(bot); +E void NDECL(timebot); E int FDECL(xlev_to_rank, (int)); +E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P)); E int FDECL(title_to_mon, (const char *, int *, int *)); E void NDECL(max_rank_sz); #ifdef SCORE_ON_BOTL E long NDECL(botl_score); #endif E int FDECL(describe_level, (char *)); -E const char *FDECL(rank_of, (int, SHORT_P, BOOLEAN_P)); -E void NDECL(bot); -E void NDECL(timebot); +E void NDECL(status_eval_next_unhilite); E void FDECL(status_initialize, (BOOLEAN_P)); E void NDECL(status_finish); -E void FDECL(status_notify_windowport, (BOOLEAN_P)); -E void NDECL(status_eval_next_unhilite); +E const char *FDECL(bl_idx_to_fldname, (int)); #ifdef STATUS_HILITES +E void NDECL(reset_status_hilites); E boolean FDECL(parse_status_hl1, (char *op, BOOLEAN_P)); +E void FDECL(status_notify_windowport, (BOOLEAN_P)); E void NDECL(clear_status_hilites); -E void NDECL(reset_status_hilites); E int NDECL(count_status_hilites); E boolean NDECL(status_hilite_menu); #endif diff --git a/src/botl.c b/src/botl.c index 860835189..96b2db9be 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1554045809 2019/03/31 15:23:29 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.140 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1554538091 2019/04/06 08:08:11 $ $NHDT-Branch: NetHack-3.6.2-beta01 $:$NHDT-Revision: 1.141 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -448,26 +448,35 @@ struct istat_s { #endif }; -STATIC_DCL void NDECL(init_blstats); -STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int)); -STATIC_OVL int FDECL(percentage, (struct istat_s *, struct istat_s *)); -STATIC_OVL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); STATIC_DCL boolean FDECL(eval_notify_windowport_field, (int, boolean *, int)); STATIC_DCL void FDECL(evaluate_and_notify_windowport, (boolean *, int)); +STATIC_DCL void NDECL(init_blstats); +STATIC_DCL int FDECL(compare_blstats, (struct istat_s *, struct istat_s *)); +STATIC_DCL char *FDECL(anything_to_s, (char *, anything *, int)); +STATIC_DCL int FDECL(percentage, (struct istat_s *, struct istat_s *)); #ifdef STATUS_HILITES -STATIC_DCL boolean FDECL(hilite_reset_needed, (struct istat_s *, long)); STATIC_DCL void FDECL(s_to_anything, (anything *, char *, int)); -STATIC_DCL boolean FDECL(is_ltgt_percentnumber, (const char *)); -STATIC_DCL boolean FDECL(has_ltgt_percentnumber, (const char *)); -STATIC_DCL boolean FDECL(parse_status_hl2, (char (*)[QBUFSZ], BOOLEAN_P)); -STATIC_DCL boolean FDECL(parse_condition, (char (*)[QBUFSZ], int)); +STATIC_DCL enum statusfields FDECL(fldname_to_bl_indx, (const char *)); +STATIC_DCL boolean FDECL(hilite_reset_needed, (struct istat_s *, long)); STATIC_DCL boolean FDECL(noneoftheabove, (const char *)); STATIC_DCL struct hilite_s *FDECL(get_hilite, (int, int, genericptr_t, int, int, int *)); +STATIC_DCL void FDECL(split_clridx, (int, int *, int *)); +STATIC_DCL boolean FDECL(is_ltgt_percentnumber, (const char *)); +STATIC_DCL boolean FDECL(has_ltgt_percentnumber, (const char *)); +STATIC_DCL int FDECL(splitsubfields, (char *, char ***, int)); +STATIC_DCL boolean FDECL(is_fld_arrayvalues, (const char *, + const char *const *, + int, int, int *)); +STATIC_DCL int FDECL(query_arrayvalue, (const char *, const char *const *, + int, int)); +STATIC_DCL void FDECL(status_hilite_add_threshold, (int, struct hilite_s *)); +STATIC_DCL boolean FDECL(parse_status_hl2, (char (*)[QBUFSZ], BOOLEAN_P)); +STATIC_DCL char *FDECL(conditionbitmask2str, (unsigned long)); STATIC_DCL unsigned long FDECL(match_str2conditionbitmask, (const char *)); STATIC_DCL unsigned long FDECL(str2conditionbitmask, (char *)); -STATIC_DCL void FDECL(split_clridx, (int, int *, int *)); +STATIC_DCL boolean FDECL(parse_condition, (char (*)[QBUFSZ], int)); STATIC_DCL char *FDECL(hlattr2attrname, (int, char *, int)); STATIC_DCL void FDECL(status_hilite_linestr_add, (int, struct hilite_s *, unsigned long, const char *)); @@ -499,7 +508,7 @@ STATIC_DCL boolean FDECL(status_hilite_menu_add, (int)); wid, maxfld, fld INIT_THRESH } /* If entries are added to this, botl.h will require updating too */ -STATIC_DCL struct istat_s initblstats[MAXBLSTATS] = { +STATIC_VAR struct istat_s initblstats[MAXBLSTATS] = { INIT_BLSTAT("title", "%s", ANY_STR, MAXVALWIDTH, BL_TITLE), INIT_BLSTAT("strength", " St:%s", ANY_INT, 10, BL_STR), INIT_BLSTAT("dexterity", " Dx:%s", ANY_INT, 10, BL_DX), @@ -726,6 +735,11 @@ bot_via_windowport() evaluate_and_notify_windowport(valset, idx); } +#ifdef STATUS_HILITES + /* stat_update_time() isn't really a STATUS_HILITES routine + * but timebot() will only ever call it for that configuration. + */ + /* update just the status lines' 'time' field */ STATIC_OVL void stat_update_time() @@ -743,6 +757,7 @@ stat_update_time() NO_COLOR, (unsigned long *) 0); return; } +#endif STATIC_OVL boolean eval_notify_windowport_field(fld, valsetlist, idx) @@ -835,7 +850,7 @@ boolean *valsetlist; return updated; } -static void +STATIC_OVL void evaluate_and_notify_windowport(valsetlist, idx) int idx; boolean *valsetlist; @@ -892,6 +907,7 @@ boolean *valsetlist; update_all = FALSE; } +/* called from moveloop(); sets context.botl if temp hilites have timed out */ void status_eval_next_unhilite() { @@ -1286,6 +1302,15 @@ struct istat_s *bl, *maxbl; return result; } +/* used by X11 for "tty status" even when STATUS_HILITES is disabled */ +const char * +bl_idx_to_fldname(idx) +int idx; +{ + if (idx >= 0 && idx < MAXBLSTATS) + return initblstats[idx].fldname; + return (const char *) 0; +} #ifdef STATUS_HILITES @@ -1328,15 +1353,6 @@ static const char threshold_value[] = "hilite_status threshold ", is_out_of_range[] = " is out of range"; -const char * -bl_idx_to_fldname(idx) -int idx; -{ - if (idx >= 0 && idx < MAXBLSTATS) - return initblstats[idx].fldname; - return (const char *) 0; -} - /* field name to bottom line index */ STATIC_OVL enum statusfields fldname_to_bl_indx(name) @@ -1794,7 +1810,7 @@ int maxsf; } #undef MAX_SUBFIELDS -boolean +STATIC_OVL boolean is_fld_arrayvalues(str, arr, arrmin, arrmax, retidx) const char *str; const char *const *arr; @@ -1811,7 +1827,7 @@ int *retidx; return FALSE; } -int +STATIC_OVL int query_arrayvalue(querystr, arr, arrmin, arrmax) const char *querystr; const char *const *arr; @@ -1845,7 +1861,7 @@ int arrmin, arrmax; return ret; } -void +STATIC_OVL void status_hilite_add_threshold(fld, hilite) int fld; struct hilite_s *hilite;