| 673 | } |
| 674 | |
| 675 | string Items::getDescription(df::item *item, int type, bool decorate) { |
| 676 | CHECK_NULL_POINTER(item); |
| 677 | string tmp; |
| 678 | item->getItemDescription(&tmp, type); |
| 679 | |
| 680 | if (decorate) { |
| 681 | // Special indicators get added in a specific order |
| 682 | // Innermost is at the top, and outermost is at the bottom |
| 683 | |
| 684 | // First, figure out the quality levels we're going to display |
| 685 | int craftquality = item->getQuality(); |
| 686 | int craftquality_only_imps = item->getImprovementQuality(); |
| 687 | bool has_displayed_item_improvements = item->isImproved(); |
| 688 | if (!has_displayed_item_improvements && (craftquality < craftquality_only_imps)) |
| 689 | craftquality = craftquality_only_imps; |
| 690 | |
| 691 | // First, actual item quality |
| 692 | addQuality(tmp, craftquality); |
| 693 | |
| 694 | // Next, magic enchants |
| 695 | if (item->getMagic() != NULL) |
| 696 | tmp = '\x11' + tmp + '\x10'; // <| |> |
| 697 | |
| 698 | // Next, improvements |
| 699 | if (has_displayed_item_improvements) { |
| 700 | tmp = '\xAE' + tmp + '\xAF'; // («) + tmp + (») |
| 701 | if (df::global::d_init->display.flags.is_set(d_init_flags1::SHOW_IMP_QUALITY)) |
| 702 | addQuality(tmp, craftquality_only_imps); |
| 703 | } |
| 704 | |
| 705 | // Dwarf mode only, forbid/foreign |
| 706 | if (*df::global::gamemode == game_mode::DWARF) { |
| 707 | if (item->flags.bits.forbid) |
| 708 | tmp = '{' + tmp + '}'; |
| 709 | if (item->flags.bits.foreign) |
| 710 | tmp = '(' + tmp + ')'; |
| 711 | } |
| 712 | |
| 713 | // Wear |
| 714 | switch (item->getWear()) |
| 715 | { |
| 716 | case 1: tmp = 'x' + tmp + 'x'; break; |
| 717 | case 2: tmp = 'X' + tmp + 'X'; break; |
| 718 | case 3: tmp = "XX" + tmp + "XX"; break; |
| 719 | } |
| 720 | |
| 721 | // Fire |
| 722 | if (item->flags.bits.on_fire) |
| 723 | tmp = '\x13' + tmp + '\x13'; // !! !! |
| 724 | |
| 725 | // Finally, Adventure civzone |
| 726 | if ((*df::global::gamemode == game_mode::ADVENTURE) && |
| 727 | Items::getGeneralRef(item, general_ref_type::BUILDING_CIVZONE_ASSIGNED) != NULL) |
| 728 | tmp = '$' + tmp + '$'; |
| 729 | } |
| 730 | return tmp; |
| 731 | } |
| 732 |
no test coverage detected