diff options
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r-- | crawl-ref/source/itemname.cc | 86 |
1 files changed, 68 insertions, 18 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index efb6c64895..0ca583f975 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -73,14 +73,16 @@ std::string quant_name( const item_def &item, int quant, std::string item_def::name(description_level_type descrip, bool terse, bool ident, bool with_inscription, - bool quantity_words) const + bool quantity_words, + unsigned long ignore_flags) const { if (descrip == DESC_NONE) return (""); std::ostringstream buff; - const std::string auxname = this->name_aux(descrip, terse, ident); + const std::string auxname = this->name_aux(descrip, terse, ident, + ignore_flags); const bool startvowel = is_vowel(auxname[0]); if (descrip == DESC_INVENTORY_EQUIP || descrip == DESC_INVENTORY) @@ -530,7 +532,7 @@ static const char* scroll_type_name(int scrolltype) case SCR_BLINKING: return "blinking"; case SCR_PAPER: return "paper"; case SCR_MAGIC_MAPPING: return "magic mapping"; - case SCR_FORGETFULNESS: return "forgetfulness"; + case SCR_FOG: return "fog"; case SCR_ACQUIREMENT: return "acquirement"; case SCR_ENCHANT_WEAPON_II: return "enchant weapon II"; case SCR_VORPALISE_WEAPON: return "vorpalise weapon"; @@ -952,7 +954,8 @@ static void output_with_sign(std::ostream& os, int val) // Note that "terse" is only currently used for the "in hand" listing on // the game screen. std::string item_def::name_aux( description_level_type desc, - bool terse, bool ident ) const + bool terse, bool ident, + unsigned long ignore_flags) const { // Shortcuts const int item_typ = this->sub_type; @@ -963,14 +966,20 @@ std::string item_def::name_aux( description_level_type desc, const bool qualname = desc == DESC_QUALNAME; const bool know_curse = - !basename && !qualname + !basename && !qualname && !testbits(ignore_flags, ISFLAG_KNOW_CURSE) && (ident || item_ident(*this, ISFLAG_KNOW_CURSE)); const bool know_type = ident || item_type_known(*this); - const bool know_pluses = + const bool __know_pluses = !basename && !qualname && (ident || item_ident(*this, ISFLAG_KNOW_PLUSES)); + const bool know_cosmetic = !__know_pluses && !terse & !basename; + + // So that know_cosmetic won't be affected by ignore_flags + const bool know_pluses = __know_pluses + && !testbits(ignore_flags, ISFLAG_KNOW_PLUSES); + bool need_plural = true; int brand; @@ -1021,15 +1030,17 @@ std::string item_def::name_aux( description_level_type desc, // Now that we can have "glowing elven" weapons, it's // probably a good idea to cut out the descriptive // term once it's become obsolete. -- bwr - if (!know_pluses && !terse && !basename) + if (know_cosmetic) { switch (get_equip_desc( *this )) { case ISFLAG_RUNED: - buff << "runed "; + if (!testbits(ignore_flags, ISFLAG_RUNED)) + buff << "runed "; break; case ISFLAG_GLOWING: - buff << "glowing "; + if (!testbits(ignore_flags, ISFLAG_GLOWING)) + buff << "glowing "; break; } } @@ -1126,11 +1137,13 @@ std::string item_def::name_aux( description_level_type desc, // Now that we can have "glowing elven" armour, it's // probably a good idea to cut out the descriptive // term once it's become obsolete. -- bwr - if (!know_pluses && !terse & !basename) + if (know_cosmetic) { switch (get_equip_desc( *this )) { case ISFLAG_EMBROIDERED_SHINY: + if (testbits(ignore_flags, ISFLAG_EMBROIDERED_SHINY)) + break; if (item_typ == ARM_ROBE || item_typ == ARM_CLOAK || item_typ == ARM_GLOVES || item_typ == ARM_BOOTS) { @@ -1144,11 +1157,13 @@ std::string item_def::name_aux( description_level_type desc, break; case ISFLAG_RUNED: - buff << "runed "; + if (!testbits(ignore_flags, ISFLAG_RUNED)) + buff << "runed "; break; case ISFLAG_GLOWING: - buff << "glowing "; + if (!testbits(ignore_flags, ISFLAG_GLOWING)) + buff << "glowing "; break; } } @@ -1382,15 +1397,41 @@ std::string item_def::name_aux( description_level_type desc, buff << "deck of cards"; break; } + else if (bad_deck(*this)) + { + buff << "BUGGY deck of cards"; + break; + } buff << deck_rarity_name(deck_rarity(*this)) << ' '; } buff << misc_type_name(item_typ, know_type); - if ( is_deck(*this) && item_plus2 != 0 ) + if ( is_deck(*this) + && (top_card_is_known(*this) || this->plus2 != 0)) { - // an inscribed deck! - buff << " {" - << card_name(static_cast<card_type>(item_plus2 - 1)) - << "}"; + buff << " {"; + // A marked deck! + if (top_card_is_known(*this)) + buff << card_name(top_card(*this)); + + // How many cards have been drawn, or how many are + // left. + if (this->plus2 != 0) + { + if(top_card_is_known(*this)) + buff << ", "; + + buff << abs(this->plus2) << " card"; + + if (abs(this->plus2) > 1) + buff << "s"; + + if (this->plus2 > 0) + buff << " drawn"; + else + buff << " left"; + } + + buff << "}"; } } break; @@ -1400,7 +1441,7 @@ std::string item_def::name_aux( description_level_type desc, { buff << book_secondary_string(this->special / 10) << book_primary_string(this->special % 10) - << "book"; + << (item_typ == BOOK_MANUAL ? "manual" : "book"); } else if (item_typ == BOOK_MANUAL) buff << "manual of " << skill_name(it_plus); @@ -1564,6 +1605,15 @@ bool item_type_known( const item_def& item ) return false; } +bool item_type_known(const object_class_type base_type, const int sub_type) +{ + const item_type_id_type idt = objtype_to_idtype(base_type); + if ( idt != NUM_IDTYPE && sub_type < 50 ) + return ( type_ids[idt][sub_type] == ID_KNOWN_TYPE ); + else + return false; +} + bool item_type_tried( const item_def& item ) { if ( item_type_known(item) ) |