summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/randart.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-16 21:31:23 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-16 21:31:23 +0000
commita3b6953864e93bab790e1de9ffa0092fd8383d2b (patch)
tree4be6142f31cf07ab24687473592d2df897f75c00 /crawl-ref/source/randart.cc
parent1e6ed3ddb747d9ac3e8d6b0b6944277006a160f0 (diff)
downloadcrawl-ref-a3b6953864e93bab790e1de9ffa0092fd8383d2b.tar.gz
crawl-ref-a3b6953864e93bab790e1de9ffa0092fd8383d2b.zip
Fix randart jewellery always named "of Bugginess".
Fix pickup.lua trying to find a butcher tool if the wielded edged weapon happens to be cursed. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5889 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/randart.cc')
-rw-r--r--crawl-ref/source/randart.cc33
1 files changed, 19 insertions, 14 deletions
diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc
index ad70985692..d5ee3b2243 100644
--- a/crawl-ref/source/randart.cc
+++ b/crawl-ref/source/randart.cc
@@ -1252,19 +1252,24 @@ bool randart_wpn_known_prop( const item_def &item, randart_prop_type prop )
return known;
}
-static std::string _get_artefact_type(const item_def &item)
+static std::string _get_artefact_type(const item_def &item,
+ bool appear = false)
{
switch (item.base_type)
{
- case OBJ_WEAPONS:
- return "weapon";
- case OBJ_ARMOUR:
- return "armour";
- case OBJ_JEWELLERY:
- if (jewellery_is_amulet(item))
- return "amulet";
- else
- return "ring";
+ case OBJ_WEAPONS:
+ return "weapon";
+ case OBJ_ARMOUR:
+ return "armour";
+ case OBJ_JEWELLERY:
+ // Only in appearance distinguish between amulets and rings.
+ if (!appear)
+ return "jewellery";
+
+ if (jewellery_is_amulet(item))
+ return "amulet";
+ else
+ return "ring";
default:
return "artefact";
}
@@ -1322,7 +1327,7 @@ std::string randart_name(const item_def &item, bool appearance)
}
// get base type
- lookup += _get_artefact_type(item);
+ lookup += _get_artefact_type(item, appearance);
rng_save_excursion rng_state;
seed_rng( seed );
@@ -1331,7 +1336,7 @@ std::string randart_name(const item_def &item, bool appearance)
{
std::string appear = getRandNameString(lookup, " appearance");
if (appear.empty() // nothing found for lookup
- // don't allow "jewelled jewelled helmet"
+ // Don't allow "jewelled jewelled helmet".
|| item.base_type == OBJ_ARMOUR
&& item.sub_type == ARM_HELMET
&& appear == "jewelled"
@@ -1360,13 +1365,13 @@ std::string randart_name(const item_def &item, bool appearance)
if (name.empty() && god_gift)
{
- // if nothing found, try god name alone
+ // If nothing found, try god name alone.
name = getRandNameString(
god_name(static_cast<god_type>(item_orig), false));
if (name.empty())
{
- // if still nothing found, try base type alone
+ // If still nothing found, try base type alone.
name = getRandNameString(
_get_artefact_type(item).c_str());
}