armor description for status lines */
| 556 | |
| 557 | /* armor description for status lines */ |
| 558 | char * |
| 559 | armor_status(char *armbuf) |
| 560 | { |
| 561 | int n = !!uarmg + !!uarmc + !!uarm + !!uarmu + !!uarmh + !!uarmf + !!uarms; |
| 562 | |
| 563 | /* |
| 564 | * FIXME: ^X needs to provide non-abbreviated version of this info. |
| 565 | * At present it just reports the "no armor" case. |
| 566 | */ |
| 567 | if (n == 0) { /* no armor */ |
| 568 | Strcpy(armbuf, "naked"); |
| 569 | } else if (n == 1) { /* just one piece; spell it out */ |
| 570 | Strcpy(armbuf, uarmg ? "gloves" |
| 571 | : uarmc ? "cloak" |
| 572 | : uarm ? "suit" |
| 573 | : uarmu ? "shirt" |
| 574 | : uarmh ? helm_simple_name(uarmh) /* hat|helm */ |
| 575 | : uarmf ? "boots" |
| 576 | : uarms ? "shield" |
| 577 | : ""); /* not possible */ |
| 578 | } else { /* more than one piece */ |
| 579 | char *p = armbuf; |
| 580 | |
| 581 | /* gloves first since this is expected to follow weapon_status(); |
| 582 | cloak next since it tends to provide the most protection |
| 583 | aside from raw AC */ |
| 584 | if (uarmg) |
| 585 | *p++ = 'G'; /* gloves */ |
| 586 | if (uarmc) |
| 587 | *p++ = 'C'; /* cloak */ |
| 588 | if (uarm) |
| 589 | *p++ = 'A'; /* suit but 's' is for shield */ |
| 590 | if (uarmu) |
| 591 | *p++ = 'U'; /* underwear? => shirt */ |
| 592 | if (uarmh) |
| 593 | *p++ = 'H'; /* hat/helm */ |
| 594 | if (uarmf) |
| 595 | *p++ = 'B'; /* footwear => boots */ |
| 596 | if (uarms) |
| 597 | *p++ = 'S'; /* shield */ |
| 598 | *p = '\0'; |
| 599 | } |
| 600 | /* |
| 601 | * Add a hint about MC by appending a plus sign if that's augmented. |
| 602 | * Bug: we should modfiy magical_negation() to return extra info and |
| 603 | * call it to scan whole inventory looking for sources of protection. |
| 604 | * This is a hack for efficiency to avoid that during status updates. |
| 605 | */ |
| 606 | if ((uright && uright->otyp == RIN_PROTECTION) |
| 607 | || (uleft && uleft->otyp == RIN_PROTECTION) |
| 608 | || (uamul && uamul->otyp == AMULET_OF_GUARDING) |
| 609 | || (uarmc && uarmc->otyp == CLOAK_OF_PROTECTION) |
| 610 | || (uarmh && uarmh->oartifact == ART_MITRE_OF_HOLINESS) |
| 611 | || (uwep && uwep->oartifact == ART_TSURUGI_OF_MURAMASA)) |
| 612 | (void) strkitten(armbuf, '+'); |
| 613 | |
| 614 | return upstart(armbuf); |
| 615 | } |
no test coverage detected