MCPcopy Create free account
hub / github.com/NetHack/NetHack / status_hilite_menu_add

Function status_hilite_menu_add

src/botl.c:3889–4302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3887}
3888
3889staticfn boolean
3890status_hilite_menu_add(int origfld)
3891{
3892 int fld;
3893 int behavior;
3894 int lt_gt_eq;
3895 int clr = NO_COLOR, atr = HL_UNDEF;
3896 struct hilite_s hilite;
3897 unsigned long cond = 0UL;
3898 char colorqry[BUFSZ];
3899 char attrqry[BUFSZ];
3900 int retry = 0;
3901
3902 choose_field:
3903 fld = origfld;
3904 if (fld == BL_FLUSH) {
3905 fld = status_hilite_menu_choose_field();
3906 /* isn't this redundant given what follows? */
3907 if (fld == BL_FLUSH)
3908 return FALSE;
3909 }
3910
3911 if (fld == BL_FLUSH)
3912 return FALSE;
3913
3914 colorqry[0] = '\0';
3915 attrqry[0] = '\0';
3916
3917 memset((genericptr_t) &hilite, 0, sizeof (struct hilite_s));
3918 hilite.next = (struct hilite_s *) 0;
3919 hilite.set = FALSE; /* mark it "unset" */
3920 hilite.fld = fld;
3921
3922 choose_behavior:
3923 behavior = status_hilite_menu_choose_behavior(fld);
3924
3925 if (behavior == (BL_TH_NONE - 1)) {
3926 return FALSE;
3927 } else if (behavior == BL_TH_NONE) {
3928 if (origfld == BL_FLUSH)
3929 goto choose_field;
3930 return FALSE;
3931 }
3932
3933 hilite.behavior = behavior;
3934
3935 choose_value:
3936 if (retry++ > 5) {
3937 pline("That's enough tries.");
3938 return FALSE;
3939 }
3940 if (behavior == BL_TH_VAL_PERCENTAGE
3941 || behavior == BL_TH_VAL_ABSOLUTE) {
3942 char inbuf[BUFSZ], buf[BUFSZ];
3943 anything aval;
3944 int val, dt;
3945 boolean gotnum = FALSE, percent = (behavior == BL_TH_VAL_PERCENTAGE);
3946 char *inp, *numstart;

Callers 1

status_hilite_menu_fldFunction · 0.85

Calls 15

getlinFunction · 0.85
trimspacesFunction · 0.85
digitFunction · 0.85
s_to_anythingFunction · 0.85
query_conditionsFunction · 0.85
conditionbitmask2strFunction · 0.85
query_arrayvalueFunction · 0.85
dupstrFunction · 0.85
query_colorFunction · 0.85

Tested by

no test coverage detected