diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-11-28 06:05:01 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-11-28 06:05:01 +0000 |
commit | 1dba47b22e2f068f767b0c01537d99594e569343 (patch) | |
tree | 2aa835c6d6d91f99d85cb1c592d487fd97095e44 | |
parent | 0e246112e173375465ee611b5365cb941106658a (diff) | |
download | crawl-ref-1dba47b22e2f068f767b0c01537d99594e569343.tar.gz crawl-ref-1dba47b22e2f068f767b0c01537d99594e569343.zip |
Changed '[empty]' autoinscription to 'empty'.
Made 'empty' and 'tried' play nice with each other.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@513 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/effects.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/item_use.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/itemname.cc | 43 |
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; |