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

Function exp_percent_changing

src/botl.c:2089–2125  ·  view source on GitHub ↗

experience points have changed but experience level hasn't; decide whether botl update is needed for a different percentage highlight rule for Xp */

Source from the content-addressed store, hash-verified

2087/* experience points have changed but experience level hasn't; decide whether
2088 botl update is needed for a different percentage highlight rule for Xp */
2089boolean
2090exp_percent_changing(void)
2091{
2092 int pc;
2093 anything a;
2094#ifdef STATUS_HILITES
2095 int color_dummy;
2096 struct hilite_s *rule;
2097#endif
2098 struct istat_s *curr;
2099
2100 /* if status update is already requested, skip this processing */
2101 if (!disp.botl) {
2102 /*
2103 * Status update is warranted iff percent integer changes and the new
2104 * percentage results in a different highlighting rule being selected.
2105 */
2106 curr = &gb.blstats[gn.now_or_before_idx][BL_XP];
2107 /* TODO: [see eval_notify_windowport_field() about percent_matters
2108 and the check against 'thresholds'] */
2109 if (curr->percent_matters
2110#ifdef STATUS_HILITES
2111 && curr->thresholds
2112#endif
2113 && (pc = exp_percentage()) != curr->percent_value) {
2114 a = cg.zeroany;
2115 a.a_int = (int) u.ulevel;
2116#ifdef STATUS_HILITES
2117 rule = get_hilite(gn.now_or_before_idx, BL_XP,
2118 (genericptr_t) &a, 0, pc, &color_dummy);
2119 if (rule != curr->hilite_rule)
2120 return TRUE; /* caller should set 'disp.botl' to True */
2121#endif
2122 }
2123 }
2124 return FALSE;
2125}
2126
2127/* callback so that interface can get capacity index rather than trying
2128 to reconstruct that from the encumbrance string or asking the general

Callers 1

more_experiencedFunction · 0.85

Calls 2

exp_percentageFunction · 0.85
get_hiliteFunction · 0.85

Tested by

no test coverage detected