diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-19 15:22:25 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-04-19 15:22:25 +0000 |
commit | f867bed2e7c45126ec6b5013178ca2d631cc3318 (patch) | |
tree | 3e12bc01d865fa91d96e130fa4a1e5e8e6038653 /crawl-ref/source/itemname.cc | |
parent | 047dbc83010295b9937e88293d627f52792d182f (diff) | |
download | crawl-ref-f867bed2e7c45126ec6b5013178ca2d631cc3318.tar.gz crawl-ref-f867bed2e7c45126ec6b5013178ca2d631cc3318.zip |
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
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r-- | crawl-ref/source/itemname.cc | 23 |
1 files changed, 17 insertions, 6 deletions
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<randart_prop_type>(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) |