From f867bed2e7c45126ec6b5013178ca2d631cc3318 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sat, 19 Apr 2008 15:22:25 +0000 Subject: Restrict randart names to a maximum length of 30. (I'd really like to restrict it to about 25, but "The Shining One's" needs 20 letters, so that's out.) Don't automatically regard unID'd jewellery randarts as {tried}, instead use a (very) rough estimate: if you know at least one property, the item will be marked as tried, otherwise (e.g. if the only property is +Dam, or prevents spellcasting) it won't be marked at all. I'm not actually sure this is better than never outputting {tried} for randarts, but we'll see... git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4374 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/itemname.cc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'crawl-ref/source/itemname.cc') diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 365e03110f..63faef7768 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -235,10 +235,7 @@ std::string item_def::name(description_level_type descrip, if (descrip != DESC_PLAIN && descrip != DESC_BASENAME) { - const bool tried = !ident && !equipped - && (item_type_tried(*this) - || this->base_type == OBJ_JEWELLERY - && is_artefact && !item_type_known(*this)); + const bool tried = !ident && !equipped && item_type_tried(*this); std::string tried_str = ""; if (tried) @@ -1697,15 +1694,29 @@ bool item_type_known(const object_class_type base_type, const int sub_type) return false; } +static bool _randart_has_known_property(const item_def &item) +{ + for (int rap = 0; rap < RAP_NUM_PROPERTIES; rap++) + if (randart_wpn_known_prop( item, static_cast(rap) )) + return true; + + return false; +} + bool item_type_tried( const item_def& item ) { if ( item_type_known(item) ) return false; - // Well, if we ever put in scroll or potion artefacts, this - // might be necessary... if ( is_artefact(item) ) + { + if (item.base_type == OBJ_JEWELLERY + && _randart_has_known_property(item)) + { + return true; + } return false; + } const item_type_id_type idt = objtype_to_idtype(item.base_type); if (idt != NUM_IDTYPE && item.sub_type < 50) -- cgit v1.2.3-54-g00ecf