summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Kozlov <zaba@thorium.homeunix.org>2009-12-27 21:23:53 +0300
committerVsevolod Kozlov <zaba@thorium.homeunix.org>2009-12-27 21:23:53 +0300
commit25249b3649e5684062a8f1bca74b852f3d6fd71c (patch)
treec2f8f0633a0c73893524a66a110a2c8e9a4bfe0c
parentdc3e12a4da48363a7cadb77f30b8e784d5f82acf (diff)
downloadcrawl-ref-25249b3649e5684062a8f1bca74b852f3d6fd71c.tar.gz
crawl-ref-25249b3649e5684062a8f1bca74b852f3d6fd71c.zip
Make item_is_mundane a method of item_def.
-rw-r--r--crawl-ref/source/artefact.cc2
-rw-r--r--crawl-ref/source/externs.h3
-rw-r--r--crawl-ref/source/itemprop.cc27
-rw-r--r--crawl-ref/source/itemprop.h3
-rw-r--r--crawl-ref/source/items.cc27
-rw-r--r--crawl-ref/source/makeitem.cc8
6 files changed, 35 insertions, 35 deletions
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index 9b2cc6feed..71ae7b27cd 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -1923,7 +1923,7 @@ bool make_item_randart( item_def &item, bool force_mundane )
if (item.flags & ISFLAG_UNRANDART)
return (false);
- if (item_is_mundane(item) && !one_chance_in(5) && !force_mundane)
+ if (item.is_mundane() && !one_chance_in(5) && !force_mundane)
return (false);
ASSERT(!item.props.exists(KNOWN_PROPS_KEY));
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h
index cf2b98d8d0..5f4f5e7e40 100644
--- a/crawl-ref/source/externs.h
+++ b/crawl-ref/source/externs.h
@@ -536,6 +536,9 @@ public:
// Returns true if this item should be preserved as far as possible.
bool is_critical() const;
+ // Returns true if this item should not normally be enchanted.
+ bool is_mundane() const;
+
private:
std::string name_aux(description_level_type desc,
bool terse, bool ident,
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index ea2f8bd7b3..bf47f3ab96 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -562,33 +562,6 @@ bool item_ident( const item_def &item, unsigned long flags )
return ((item.flags & flags) == flags);
}
-// Is item something that no one would usually bother enchanting?
-bool item_is_mundane(const item_def &item)
-{
- switch (item.base_type)
- {
- case OBJ_WEAPONS:
- if (item.sub_type == WPN_CLUB
- || item.sub_type == WPN_GIANT_CLUB
- || item.sub_type == WPN_GIANT_SPIKED_CLUB
- || item.sub_type == WPN_KNIFE)
- {
- return (true);
- }
- break;
-
- case OBJ_ARMOUR:
- if (item.sub_type == ARM_ANIMAL_SKIN)
- return (true);
- break;
-
- default:
- break;
- }
-
- return (false);
-}
-
void set_ident_flags( item_def &item, unsigned long flags )
{
preserve_quiver_slots p;
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 99c861da67..5604d352f5 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -14,9 +14,6 @@ struct bolt;
void init_properties(void);
-// Returns true if this item should not normally be enchanted.
-bool item_is_mundane(const item_def &item);
-
// cursed:
bool item_known_cursed( const item_def &item );
bool item_known_uncursed( const item_def &item );
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 7543da8ea5..29b25a021b 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2934,6 +2934,33 @@ bool item_def::is_critical() const
&& plus != RUNE_ABYSSAL);
}
+// Is item something that no one would usually bother enchanting?
+bool item_def::is_mundane() const
+{
+ switch (base_type)
+ {
+ case OBJ_WEAPONS:
+ if (sub_type == WPN_CLUB
+ || sub_type == WPN_GIANT_CLUB
+ || sub_type == WPN_GIANT_SPIKED_CLUB
+ || sub_type == WPN_KNIFE)
+ {
+ return (true);
+ }
+ break;
+
+ case OBJ_ARMOUR:
+ if (sub_type == ARM_ANIMAL_SKIN)
+ return (true);
+ break;
+
+ default:
+ break;
+ }
+
+ return (false);
+}
+
static void _rune_from_specs(const char* _specs, item_def &item)
{
char specs[80];
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 977198929d..442b500112 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -1699,7 +1699,7 @@ brand_ok:
}
else if ((force_good || is_demonic(item) || forced_ego
|| x_chance_in_y(51 + item_level, 200))
- && (!item_is_mundane(item) || force_good))
+ && (!item.is_mundane() || force_good))
{
// Make a better item (possibly ego).
if (!no_brand)
@@ -2399,7 +2399,7 @@ static void _generate_armour_item(item_def& item, bool allow_uniques,
}
else if ((force_good || forced_ego || item.sub_type == ARM_WIZARD_HAT
|| x_chance_in_y(51 + item_level, 250))
- && (!item_is_mundane(item) || force_good))
+ && (!item.is_mundane() || force_good))
{
// Make a good item...
item.plus += random2(3);
@@ -3233,7 +3233,7 @@ static bool _weapon_is_visibly_special(const item_def &item)
if (visibly_branded || is_artefact(item))
return (true);
- if (item_is_mundane(item))
+ if (item.is_mundane())
return (false);
if ((item.plus || item.plus2)
@@ -3256,7 +3256,7 @@ static bool _armour_is_visibly_special(const item_def &item)
if (visibly_branded || is_artefact(item))
return (true);
- if (item_is_mundane(item))
+ if (item.is_mundane())
return (false);
if (item.plus && !one_chance_in(3))