| 2811 | } |
| 2812 | |
| 2813 | staticfn boolean |
| 2814 | parse_status_hl2(char (*s)[QBUFSZ], boolean from_configfile) |
| 2815 | { |
| 2816 | static const char *const aligntxt[] = { "chaotic", "neutral", "lawful" }; |
| 2817 | /* hu_stat[] from eat.c has trailing spaces which foul up comparisons; |
| 2818 | for the "not hungry" case, there's no text hence no way to highlight */ |
| 2819 | static const char *const hutxt[] = { |
| 2820 | "Satiated", "", "Hungry", "Weak", "Fainting", "Fainted", "Starved" |
| 2821 | }; |
| 2822 | char *tmp, *how; |
| 2823 | int sidx = 0, i = -1, dt = ANY_INVALID; |
| 2824 | int coloridx = -1, successes = 0; |
| 2825 | int disp_attrib = 0; |
| 2826 | boolean percent, changed, numeric, down, up, |
| 2827 | grt, lt, gte, le, eq, txtval, always, criticalhp; |
| 2828 | const char *txt; |
| 2829 | enum statusfields fld = BL_FLUSH; |
| 2830 | struct hilite_s hilite; |
| 2831 | char tmpbuf[BUFSZ]; |
| 2832 | |
| 2833 | /* Examples: |
| 2834 | 3.6.1: |
| 2835 | OPTION=hilite_status: hitpoints/<10%/red |
| 2836 | OPTION=hilite_status: hitpoints/<10%/red/<5%/purple/1/red&blink+inverse |
| 2837 | OPTION=hilite_status: experience/down/red/up/green |
| 2838 | OPTION=hilite_status: cap/strained/yellow/overtaxed/orange |
| 2839 | OPTION=hilite_status: title/always/blue |
| 2840 | OPTION=hilite_status: title/blue |
| 2841 | */ |
| 2842 | |
| 2843 | /* field name to statusfield */ |
| 2844 | fld = fldname_to_bl_indx(s[sidx]); |
| 2845 | |
| 2846 | if (fld == BL_CHARACTERISTICS) { |
| 2847 | boolean res = FALSE; |
| 2848 | |
| 2849 | /* recursively set each of strength, dexterity, constitution, &c */ |
| 2850 | for (fld = BL_STR; fld <= BL_CH; fld++) { |
| 2851 | Strcpy(s[sidx], initblstats[fld].fldname); |
| 2852 | res = parse_status_hl2(s, from_configfile); |
| 2853 | if (!res) |
| 2854 | return FALSE; |
| 2855 | } |
| 2856 | return TRUE; |
| 2857 | } |
| 2858 | if (fld == BL_FLUSH) { |
| 2859 | config_error_add("Unknown status field '%s'", s[sidx]); |
| 2860 | return FALSE; |
| 2861 | } |
| 2862 | if (fld == BL_CONDITION) |
| 2863 | return parse_condition(s, sidx); |
| 2864 | |
| 2865 | ++sidx; |
| 2866 | while (s[sidx][0]) { |
| 2867 | char buf[BUFSZ], **subfields; |
| 2868 | int sf = 0; /* subfield count */ |
| 2869 | int kidx; |
| 2870 |
no test coverage detected