summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/items.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-12 15:29:36 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-12 15:29:36 +0000
commit4c5c3809dea65983966d591877b1f150dc2244fb (patch)
tree2a502f030442f735a93a178935fc182905fee113 /crawl-ref/source/items.cc
parentc6d355577af7769cf5464c91fcf365cbbbbf6aca (diff)
downloadcrawl-ref-4c5c3809dea65983966d591877b1f150dc2244fb.tar.gz
crawl-ref-4c5c3809dea65983966d591877b1f150dc2244fb.zip
Applying Matthew's stacking patch. (1793051)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2076 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/items.cc')
-rw-r--r--crawl-ref/source/items.cc29
1 files changed, 26 insertions, 3 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index 812a42632d..a4146a1475 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -1212,10 +1212,16 @@ bool items_stack( const item_def &item1, const item_def &item2,
if (ident_flags(item1) != ident_flags(item2))
return false;
- // Check the non-ID flags
- if ((item1.flags & (~ISFLAG_IDENT_MASK)) !=
- (item2.flags & (~ISFLAG_IDENT_MASK)))
+ // Check the non-ID flags, but ignore dropped, thrown, cosmetic,
+ // and note flags
+#define NON_IDENT_FLAGS ~(ISFLAG_IDENT_MASK | ISFLAG_COSMETIC_MASK | \
+ ISFLAG_DROPPED | ISFLAG_THROWN | \
+ ISFLAG_NOTED_ID | ISFLAG_NOTED_GET)
+ if ((item1.flags & NON_IDENT_FLAGS) !=
+ (item2.flags & NON_IDENT_FLAGS))
+ {
return false;
+ }
// Thanks to mummy cursing, we can have potions of decay
// that don't look alike... so we don't stack potions
@@ -1226,6 +1232,14 @@ bool items_stack( const item_def &item1, const item_def &item2,
return false;
}
+ // The inscriptions can differ if one of them is blank, but if they
+ // are differing non-blank inscriptions then don't stack.
+ if (item1.inscription != item2.inscription
+ && item1.inscription != "" && item2.inscription != "")
+ {
+ return false;
+ }
+
return (true);
}
@@ -1362,6 +1376,15 @@ int move_item_to_player( int obj, int quant_got, bool quiet )
check_note_item(mitm[obj]);
+ // If the object on the ground is inscribed, but not
+ // the one in inventory, then the inventory object
+ // picks up the other's inscription.
+ if (mitm[obj].inscription != ""
+ && you.inv[m].inscription == "")
+ {
+ you.inv[m].inscription = mitm[obj].inscription;
+ }
+
inc_inv_item_quantity( m, quant_got );
dec_mitm_item_quantity( obj, quant_got );
burden_change();