summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemname.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-19 05:05:08 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-19 05:05:08 +0000
commit9c825029344d1ab8e5e85987a375cbae9109e2ce (patch)
treee91919f2187d78c1e703b837b642a6cf2eeb6216 /crawl-ref/source/itemname.cc
parent587b2392103a4d9bcaa9cda91f945e874216d232 (diff)
downloadcrawl-ref-9c825029344d1ab8e5e85987a375cbae9109e2ce.tar.gz
crawl-ref-9c825029344d1ab8e5e85987a375cbae9109e2ce.zip
For jewellery with pluses and wands, only make an ident note when the
first item of the type is identified, not when the charges/pluses of any item of the type is identified. Make sure that artefacts have nothing to do with the identification level of jewellery by making versions of set_ident_type() and get_ident_type() which accept a full item_def as a parameter. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5973 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r--crawl-ref/source/itemname.cc35
1 files changed, 33 insertions, 2 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index ca737c6d78..a7ac833bcf 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -248,7 +248,7 @@ std::string item_def::name(description_level_type descrip,
if (tried)
{
item_type_id_state_type id_type =
- get_ident_type(this->base_type, this->sub_type);
+ get_ident_type(*this);
if (id_type == ID_MON_TRIED_TYPE)
tried_str = "tried by monster";
else
@@ -1751,6 +1751,29 @@ id_arr& get_typeid_array()
return type_ids;
}
+void set_ident_type( item_def &item, item_type_id_state_type setting,
+ bool force )
+{
+ if (is_artefact(item))
+ return;
+
+ item_type_id_state_type old_setting = get_ident_type(item);
+ set_ident_type(item.base_type, item.sub_type, setting, force);
+
+ if (setting == ID_KNOWN_TYPE && old_setting != ID_KNOWN_TYPE
+ && notes_are_active() && is_interesting_item(item)
+ && !(item.flags & (ISFLAG_NOTED_ID | ISFLAG_NOTED_GET)))
+ {
+ // Make a note of it.
+ take_note(Note(NOTE_ID_ITEM, 0, 0, item.name(DESC_NOCAP_A).c_str(),
+ origin_desc(item).c_str()));
+
+ // Sometimes (e.g. shops) you can ID an item before you get it;
+ // don't note twice in those cases.
+ item.flags |= (ISFLAG_NOTED_ID | ISFLAG_NOTED_GET);
+ }
+}
+
void set_ident_type( object_class_type basetype, int subtype,
item_type_id_state_type setting, bool force )
{
@@ -1775,6 +1798,14 @@ void set_ident_type( object_class_type basetype, int subtype,
}
}
+item_type_id_state_type get_ident_type(const item_def &item)
+{
+ if (is_artefact(item))
+ return ID_UNKNOWN_TYPE;
+
+ return get_ident_type(item.base_type, item.sub_type);
+}
+
item_type_id_state_type get_ident_type(object_class_type basetype, int subtype)
{
const item_type_id_type idt = objtype_to_idtype(basetype);
@@ -2488,7 +2519,7 @@ const std::string menu_colour_item_prefix(const item_def &item, bool temp)
prefixes.push_back("identified");
else
{
- if (get_ident_type(item.base_type, item.sub_type) == ID_KNOWN_TYPE)
+ if (get_ident_type(item) == ID_KNOWN_TYPE)
{
// Wands are only fully identified if we know the
// number of charges.