| 1490 | } |
| 1491 | |
| 1492 | staticfn boolean |
| 1493 | eval_notify_windowport_field( |
| 1494 | int fld, |
| 1495 | boolean *valsetlist, |
| 1496 | int idx) |
| 1497 | { |
| 1498 | static int oldrndencode = 0; |
| 1499 | static nhsym oldgoldsym = 0; |
| 1500 | int pc, chg, color = NO_COLOR; |
| 1501 | unsigned anytype; |
| 1502 | boolean updated = FALSE, reset; |
| 1503 | struct istat_s *curr, *prev; |
| 1504 | enum statusfields fldmax; |
| 1505 | |
| 1506 | /* |
| 1507 | * Now pass the changed values to window port. |
| 1508 | */ |
| 1509 | anytype = gb.blstats[idx][fld].anytype; |
| 1510 | curr = &gb.blstats[idx][fld]; |
| 1511 | prev = &gb.blstats[1 - idx][fld]; |
| 1512 | color = NO_COLOR; |
| 1513 | |
| 1514 | chg = gu.update_all ? 0 : compare_blstats(prev, curr); |
| 1515 | /* |
| 1516 | * TODO: |
| 1517 | * Dynamically update 'percent_matters' as rules are added or |
| 1518 | * removed to track whether any of them are percentage rules. |
| 1519 | * Then there'll be no need to assume that non-Null 'thresholds' |
| 1520 | * means that percentages need to be kept up to date. |
| 1521 | * [Affects exp_percent_changing() too.] |
| 1522 | */ |
| 1523 | if (((chg || gu.update_all || fld == BL_XP) |
| 1524 | && curr->percent_matters |
| 1525 | #ifdef STATUS_HILITES |
| 1526 | && curr->thresholds |
| 1527 | #endif |
| 1528 | ) |
| 1529 | /* when 'hitpointbar' is On, percent matters even if HP |
| 1530 | hasn't changed and has no percentage rules (in case HPmax |
| 1531 | has changed when HP hasn't, where we ordinarily wouldn't |
| 1532 | update HP so would miss an update of the hitpoint bar) */ |
| 1533 | || (fld == BL_HP && iflags.wc2_hitpointbar)) { |
| 1534 | fldmax = curr->idxmax; |
| 1535 | pc = (fldmax == BL_EXP) ? exp_percentage() |
| 1536 | : (fldmax >= 0 && fldmax < MAXBLSTATS) |
| 1537 | ? percentage(curr, &gb.blstats[idx][fldmax]) |
| 1538 | : 0; /* bullet proofing; can't get here */ |
| 1539 | if (pc != prev->percent_value) |
| 1540 | chg = (pc < prev->percent_value) ? -1 : 1; |
| 1541 | curr->percent_value = pc; |
| 1542 | } else { |
| 1543 | pc = 0; |
| 1544 | } |
| 1545 | |
| 1546 | /* Temporary? hack: moveloop()'s prolog for a new game sets |
| 1547 | * svc.context.rndencode after the status window has been init'd, |
| 1548 | * so $:0 has already been encoded and cached by the window |
| 1549 | * port. Without this hack, gold's \G sequence won't be |
no test coverage detected