summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/itemprop.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-10-31 02:16:00 -0700
committerMatthew Cline <zelgadis@sourceforge.net>2009-10-31 02:16:00 -0700
commit59068ce8dae39e2f6a35861d371d0ce6b01732d9 (patch)
treed60a7415f571bc2afcdc5b377bb8bdd349408492 /crawl-ref/source/itemprop.cc
parentea0a802d98e069bd95b350423546ca727c1b3a2a (diff)
downloadcrawl-ref-59068ce8dae39e2f6a35861d371d0ce6b01732d9.tar.gz
crawl-ref-59068ce8dae39e2f6a35861d371d0ce6b01732d9.zip
Auto-update shopping-list when new items seen
Automatically update the shopping list if you see the same item for less cost in another shop, or if you get an item identical to one on the shopping list (currently only applies to jewellery, books and staves).
Diffstat (limited to 'crawl-ref/source/itemprop.cc')
-rw-r--r--crawl-ref/source/itemprop.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc
index 04854a0fd0..b271b715ce 100644
--- a/crawl-ref/source/itemprop.cc
+++ b/crawl-ref/source/itemprop.cc
@@ -32,6 +32,7 @@
#include "player.h"
#include "quiver.h"
#include "random.h"
+#include "shopping.h"
#include "stuff.h"
#include "transfor.h"
#include "xom.h"
@@ -617,6 +618,9 @@ void set_ident_flags( item_def &item, unsigned long flags )
{
item.flags |= flags;
request_autoinscribe();
+
+ if (in_inventory(item))
+ shopping_list.cull_identical_items(item);
}
if (notes_are_active() && !(item.flags & ISFLAG_NOTED_ID)
@@ -2260,7 +2264,7 @@ bool item_is_staff( 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 )
{
@@ -2289,6 +2293,37 @@ int ring_has_pluses( const item_def &item )
return (0);
}
+// Returns true if having two rings of the same type on at the same
+// has more effect than just having one on.
+bool ring_has_stackable_effect( const item_def &item )
+{
+ ASSERT (item.base_type == OBJ_JEWELLERY);
+ ASSERT (!jewellery_is_amulet(item));
+
+ if (!item_type_known(item))
+ return (false);
+
+ if (ring_has_pluses(item))
+ return (true);
+
+ switch (item.sub_type)
+ {
+ case RING_PROTECTION_FROM_FIRE:
+ case RING_PROTECTION_FROM_COLD:
+ case RING_LIFE_PROTECTION:
+ case RING_SUSTENANCE:
+ case RING_WIZARDRY:
+ case RING_FIRE:
+ case RING_ICE:
+ return (true);
+
+ default:
+ break;
+ }
+
+ return (false);
+}
+
//
// Food functions:
//