summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/effects.cc2
-rw-r--r--crawl-ref/source/item_use.cc2
-rw-r--r--crawl-ref/source/itemname.cc43
3 files changed, 26 insertions, 21 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc
index f3116be7f2..7f7d2b70dd 100644
--- a/crawl-ref/source/effects.cc
+++ b/crawl-ref/source/effects.cc
@@ -1419,7 +1419,7 @@ bool recharge_wand(void)
if (wand.base_type == OBJ_WANDS)
{
// remove "empty" autoinscription
- const char* empty_inscription = "[empty]";
+ const char* empty_inscription = "empty";
size_t p = wand.inscription.find(empty_inscription);
if ( p != std::string::npos ) {
// found it, delete it
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index a52bdcddc6..d98c6369b6 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -2500,7 +2500,7 @@ void zap_wand(void)
if ( !you.inv[item_slot].inscription.empty() )
you.inv[item_slot].inscription += ' ';
- you.inv[item_slot].inscription += "[empty]";
+ you.inv[item_slot].inscription += "empty";
}
}
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index 4524ab919b..38d1ba862c 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -46,11 +46,27 @@ static const char *item_name_2(
const item_def &item, char buff[ ITEMNAME_SIZE ], bool terse );
static char retvow(int sed);
-static char retlet(int sed );
+static char retlet(int sed);
// [dshaligram] For calls to item_name without a pre-allocated buffer.
static char default_itembuf[ITEMNAME_SIZE];
+static bool is_tried_type( int basetype, int subtype )
+{
+ switch ( basetype )
+ {
+ case OBJ_SCROLLS:
+ return id[IDTYPE_SCROLLS][subtype] == ID_TRIED_TYPE;
+ case OBJ_POTIONS:
+ return id[IDTYPE_POTIONS][subtype] == ID_TRIED_TYPE;
+ case OBJ_WANDS:
+ return id[IDTYPE_WANDS][subtype] == ID_TRIED_TYPE;
+ default:
+ return false;
+ }
+}
+
+
bool is_vowel( const char chr )
{
const char low = tolower( chr );
@@ -273,13 +289,17 @@ const char *item_name( const item_def &item, char descrip,
strncat( buff, " (around neck)", ITEMNAME_SIZE );
}
}
- /*** HP CHANGE -- warning -- possible stack overflow error ***/
- if ( item.inscription.size() > 0 ) // has an inscription
+
+ if ( !item.inscription.empty() )
{
strncat( buff, " {", 2 );
+ if ( is_tried_type(item.base_type, item.sub_type) )
+ strncat(buff, "tried, ", 10);
strncat( buff, item.inscription.c_str(), ITEMNAME_SIZE );
strncat( buff, "}", 1 );
}
+ else if ( is_tried_type(item.base_type, item.sub_type) )
+ strncat(buff, " {tried}", 10);
return (buff);
} // end item_name()
@@ -303,7 +323,7 @@ static const char *item_name_2(
int brand;
unsigned char sparm;
- buff[0] = '\0';
+ buff[0] = 0;
switch (item_clas)
{
@@ -814,11 +834,6 @@ static const char *item_name_2(
(primary == 11) ? "plastic" : "buggy", ITEMNAME_SIZE);
strncat(buff, " wand", ITEMNAME_SIZE );
-
- if (id[ IDTYPE_WANDS ][item_typ] == ID_TRIED_TYPE)
- {
- strncat( buff, " {tried}" , ITEMNAME_SIZE );
- }
}
if (item_ident( item, ISFLAG_KNOW_PLUSES ))
@@ -902,11 +917,6 @@ static const char *item_name_2(
if (it_quant > 1)
strncat(buff, "s", ITEMNAME_SIZE );
-
- if (id[ IDTYPE_POTIONS ][item_typ] == ID_TRIED_TYPE)
- {
- strncat( buff, " {tried}" , ITEMNAME_SIZE );
- }
}
break;
@@ -1048,11 +1058,6 @@ static const char *item_name_2(
+ (static_cast<unsigned long>(item_clas) << 16);
make_name( sseed, true, buff3 );
strncat( buff, buff3 , ITEMNAME_SIZE );
-
- if (id[ IDTYPE_SCROLLS ][item_typ] == ID_TRIED_TYPE)
- {
- strncat( buff, " {tried}" , ITEMNAME_SIZE );
- }
}
break;