summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorChris Oelmueller <chris.oelmueller@gmail.com>2014-04-10 00:51:14 +0200
committerNicholas Feinberg <pleasingfung@gmail.com>2014-06-13 23:41:47 -0700
commitfb1f07938f338f48beaa5f386ca8431d4474e460 (patch)
treef78cf96874bbafdf75f2a9bb18741750fe312548 /crawl-ref
parent3832802e78ab0fb923eb014c907b8b8fbc1f9715 (diff)
downloadcrawl-ref-fb1f07938f338f48beaa5f386ca8431d4474e460.tar.gz
crawl-ref-fb1f07938f338f48beaa5f386ca8431d4474e460.zip
Simplify some code now that slaying only uses item.plus
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/acquire.cc7
-rw-r--r--crawl-ref/source/artefact.cc7
-rw-r--r--crawl-ref/source/enum.h2
-rw-r--r--crawl-ref/source/item_use.cc1
-rw-r--r--crawl-ref/source/itemname.cc7
-rw-r--r--crawl-ref/source/itemprop.cc12
-rw-r--r--crawl-ref/source/itemprop.h2
-rw-r--r--crawl-ref/source/items.cc3
-rw-r--r--crawl-ref/source/makeitem.cc5
-rw-r--r--crawl-ref/source/mon-util.cc4
-rw-r--r--crawl-ref/source/player.cc20
-rw-r--r--crawl-ref/source/shopping.cc18
12 files changed, 17 insertions, 71 deletions
diff --git a/crawl-ref/source/acquire.cc b/crawl-ref/source/acquire.cc
index e1385df57f..d13ad0f171 100644
--- a/crawl-ref/source/acquire.cc
+++ b/crawl-ref/source/acquire.cc
@@ -1352,16 +1352,11 @@ int acquirement_create_item(object_class_type class_wanted,
case RING_INTELLIGENCE:
case RING_DEXTERITY:
case RING_EVASION:
+ case RING_SLAYING:
// Make sure plus is >= 1.
acq_item.plus = max(abs((int) acq_item.plus), 1);
break;
- case RING_SLAYING:
- // Two plusses to handle here, and accuracy can be +0.
- acq_item.plus = abs(acq_item.plus);
- acq_item.plus2 = max(abs((int) acq_item.plus2), 2);
- break;
-
case RING_LOUDNESS:
case AMU_INACCURACY:
// These are the only truly bad pieces of jewellery.
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc
index e4dffc188a..a1fcd9be62 100644
--- a/crawl-ref/source/artefact.cc
+++ b/crawl-ref/source/artefact.cc
@@ -1624,7 +1624,6 @@ static bool _randart_is_redundant(const item_def &item,
return false;
artefact_prop_type provides = ARTP_NUM_PROPERTIES;
- artefact_prop_type provides2 = ARTP_NUM_PROPERTIES;
switch (item.sub_type)
{
@@ -1717,12 +1716,6 @@ static bool _randart_is_redundant(const item_def &item,
if (proprt[provides] != 0)
return true;
- if (provides2 == ARTP_NUM_PROPERTIES)
- return false;
-
- if (proprt[provides2] != 0)
- return true;
-
return false;
}
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 642670490f..18f7aa328b 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -1924,7 +1924,9 @@ enum equipment_type
EQ_STAFF = 100, // weapon with base_type OBJ_STAVES
EQ_RINGS, // check both rings
EQ_RINGS_PLUS, // check both rings and sum plus
+#if TAG_MAJOR_VERSION == 34
EQ_RINGS_PLUS2, // check both rings and sum plus2
+#endif
EQ_ALL_ARMOUR, // check all armour types
};
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 3c736ebbbe..70cf8da570 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -1186,7 +1186,6 @@ static bool _swap_rings(int ring_slot)
{
if (ring->sub_type != first_ring->sub_type
|| ring->plus != first_ring->plus
- || ring->plus2 != first_ring->plus2
|| is_artefact(*ring) || is_artefact(*first_ring))
{
all_same = false;
diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc
index e12c32c4a4..d2e9fe187f 100644
--- a/crawl-ref/source/itemname.cc
+++ b/crawl-ref/source/itemname.cc
@@ -1662,12 +1662,7 @@ string item_def::name_aux(description_level_type desc, bool terse, bool ident,
if (know_type)
{
if (know_pluses && ring_has_pluses(*this))
- {
- if (ring_has_pluses(*this) == 2)
- buff << make_stringf("%+d,%+d ", it_plus, item_plus2);
- else
- buff << make_stringf("%+d ", it_plus);
- }
+ buff << make_stringf("%+d ", it_plus);
buff << jewellery_type_name(item_typ);
}
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index c7b20339a6..32a0e85774 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -1836,14 +1836,14 @@ bool item_is_spellbook(const item_def &item)
//
// Ring functions:
-// Returns number of pluses on jewellery (always none for amulets yet).
-int ring_has_pluses(const item_def &item)
+// Returns whether jewellery has plusses.
+bool ring_has_pluses(const item_def &item)
{
ASSERT(item.base_type == OBJ_JEWELLERY);
- // not known -> no pluses
+ // not known -> no plusses
if (!item_type_known(item))
- return 0;
+ return false;
switch (item.sub_type)
{
@@ -1853,13 +1853,13 @@ int ring_has_pluses(const item_def &item)
case RING_STRENGTH:
case RING_INTELLIGENCE:
case RING_DEXTERITY:
- return 1;
+ return true;
default:
break;
}
- return 0;
+ return false;
}
// Returns true if having two rings of the same type on at the same
diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h
index 7473163ceb..38b6816abf 100644
--- a/crawl-ref/source/itemprop.h
+++ b/crawl-ref/source/itemprop.h
@@ -135,7 +135,7 @@ bool is_xp_evoker(const item_def &item);
bool evoker_is_charged(const item_def &item);
// ring functions:
-int ring_has_pluses(const item_def &item) PURE;
+bool ring_has_pluses(const item_def &item) PURE;
bool ring_has_stackable_effect(const item_def &item) PURE;
// food functions:
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index da31f373a2..1e9d234c30 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -3928,10 +3928,7 @@ item_info get_item_info(const item_def& item)
else
ii.sub_type = jewellery_is_amulet(item) ? NUM_JEWELLERY : NUM_RINGS;
if (item_ident(ii, ISFLAG_KNOW_PLUSES))
- {
ii.plus = item.plus; // str/dex/int/ac/ev ring plus
- ii.plus2 = item.plus2; // slaying damage bonus
- }
ii.special = item.special; // appearance
ii.rnd = item.rnd; // randart appearance
break;
diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc
index 7603377d7b..d4799b2f5d 100644
--- a/crawl-ref/source/makeitem.cc
+++ b/crawl-ref/source/makeitem.cc
@@ -2592,11 +2592,8 @@ static void _generate_jewellery_item(item_def& item, bool allow_uniques,
&& --tries > 0);
}
- // Everything begins as uncursed, unenchanted jewellery {dlb}:
- item.plus = 0;
- item.plus2 = 0;
-
item.plus = _determine_ring_plus(item.sub_type);
+
if (item.plus < 0)
do_curse_item(item);
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 6b21584dd7..0a590f347f 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -473,7 +473,6 @@ int monster::wearing(equipment_type slot, int sub_type, bool calc_unid) const
case EQ_AMULET:
case EQ_RINGS:
case EQ_RINGS_PLUS:
- case EQ_RINGS_PLUS2:
item = mslot_item(MSLOT_JEWELLERY);
if (item && item->base_type == OBJ_JEWELLERY
&& item->sub_type == sub_type
@@ -481,8 +480,6 @@ int monster::wearing(equipment_type slot, int sub_type, bool calc_unid) const
{
if (slot == EQ_RINGS_PLUS)
ret += item->plus;
- else if (slot == EQ_RINGS_PLUS2)
- ret += item->plus2;
else
ret++;
}
@@ -549,7 +546,6 @@ int monster::wearing_ego(equipment_type slot, int special, bool calc_unid) const
case EQ_STAFF:
case EQ_RINGS:
case EQ_RINGS_PLUS:
- case EQ_RINGS_PLUS2:
// No egos.
break;
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 08da72dd44..b961b95e34 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -834,8 +834,6 @@ bool you_tran_can_wear(int eq, bool check_mutation)
if (eq == EQ_STAFF)
eq = EQ_WEAPON;
- else if (eq >= EQ_RINGS && eq <= EQ_RINGS_PLUS2)
- eq = EQ_RINGS;
// Everybody but porcupines and wisps can wear at least some type of armour.
if (eq == EQ_ALL_ARMOUR)
@@ -1029,22 +1027,6 @@ int player::wearing(equipment_type slot, int sub_type, bool calc_unid) const
}
break;
- case EQ_RINGS_PLUS2:
- for (int slots = EQ_LEFT_RING; slots < NUM_EQUIP; ++slots)
- {
- if (slots == EQ_AMULET)
- continue;
-
- if ((item = slot_item(static_cast<equipment_type>(slots)))
- && item->sub_type == sub_type
- && (calc_unid
- || item_type_known(*item)))
- {
- ret += item->plus2;
- }
- }
- break;
-
case EQ_ALL_ARMOUR:
// Doesn't make much sense here... be specific. -- bwr
die("EQ_ALL_ARMOUR is not a proper slot");
@@ -1092,7 +1074,6 @@ int player::wearing_ego(equipment_type slot, int special, bool calc_unid) const
case EQ_STAFF:
case EQ_RINGS:
case EQ_RINGS_PLUS:
- case EQ_RINGS_PLUS2:
// no ego types for these slots
break;
@@ -1169,7 +1150,6 @@ bool player_equip_unrand(int unrand_index)
case EQ_LEFT_RING:
case EQ_RIGHT_RING:
case EQ_RINGS_PLUS:
- case EQ_RINGS_PLUS2:
case EQ_ALL_ARMOUR:
// no unrandarts for these slots.
break;
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc
index a7d4205322..730f635483 100644
--- a/crawl-ref/source/shopping.cc
+++ b/crawl-ref/source/shopping.cc
@@ -2234,14 +2234,8 @@ unsigned int ShoppingList::cull_identical_items(const item_def& item,
// Ignore stat-modification rings which reduce a stat, since they're
// worthless.
- if (item.base_type == OBJ_JEWELLERY)
- {
- if (item.sub_type == RING_SLAYING && item.plus < 0 && item.plus2 < 0)
- return 0;
-
- if (item.plus < 0)
- return 0;
- }
+ if (item.base_type == OBJ_JEWELLERY && item.plus < 0)
+ return 0;
// Manuals are consumable, and interesting enough to keep on list.
if (item.base_type == OBJ_BOOKS && item.sub_type == BOOK_MANUAL)
@@ -2283,14 +2277,12 @@ unsigned int ShoppingList::cull_identical_items(const item_def& item,
// known pluses when the new ring's pluses are unknown.
if (item.base_type == OBJ_JEWELLERY)
{
- const int nplus = ring_has_pluses(item);
+ const bool has_plus = ring_has_pluses(item);
const int delta_p = item.plus - list_item.plus;
- const int delta_p2 = nplus >= 2 ? item.plus2 - list_item.plus2 : 0;
- if (nplus
+ if (has_plus
&& item_ident(list_item, ISFLAG_KNOW_PLUSES)
&& (!item_ident(item, ISFLAG_KNOW_PLUSES)
- || delta_p <= 0 && delta_p2 <= 0
- && (delta_p < 0 || delta_p2 < 0)))
+ || delta_p < 0))
{
continue;
}