summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemname.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-22 09:21:32 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-22 09:21:32 +0000
commitfaa6d08c428ad8280f84707fa8d4586440b98631 (patch)
tree9efc32b7df06c6ecc579766f5b0a7ab24c4a73d1 /crawl-ref/source/itemname.cc
parentcce90fadce5dca04e3000cf488e619975bddd8ae (diff)
downloadcrawl-ref-faa6d08c428ad8280f84707fa8d4586440b98631.tar.gz
crawl-ref-faa6d08c428ad8280f84707fa8d4586440b98631.zip
Added additional optional parameter to item_def::name(), ignore_flags,
which will cause the name to be constructed as if those item flags had been unset. Give an auxiliary cause of death for a stat going below 1. (Death by stat loss is already pretty rare, and death by stat loss with confusion as to what caused the stat loss must be *really* rare, but still, if you were confused about what caused the stat loss that lead to death, that'd be pretty frustrating) ouch() is now called from within modify_stat() and lose_stat() right after the stat is lowered, rather than when the stat is updated on the screen. This incidentally fixes the minor annoyance of saying "no" to stat loss death in wizard mode, only to be asked if you want to die every time the screen is updated until you fix having a non-positive stat. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2179 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/itemname.cc')
-rw-r--r--crawl-ref/source/itemname.cc37
1 files changed, 26 insertions, 11 deletions
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 783951d8b9..79f8a34fe4 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -73,11 +73,13 @@ 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
{
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)
@@ -943,7 +945,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;
@@ -954,14 +957,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;
@@ -1012,15 +1021,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;
}
}
@@ -1117,11 +1128,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)
{
@@ -1135,11 +1148,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;
}
}