summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-28 18:43:36 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-09-28 18:43:36 +0000
commit21c54e7245bb00f366db098092362e9c84f2e59b (patch)
treeaa9aa0faeefe0a8513a24d0b469141ce5eaf7ca0 /crawl-ref/source/travel.cc
parentcc38b1d0b48c8083b0762eae2072b553fe7f5ed8 (diff)
downloadcrawl-ref-21c54e7245bb00f366db098092362e9c84f2e59b.tar.gz
crawl-ref-21c54e7245bb00f366db098092362e9c84f2e59b.zip
Better messages for explore finding multiple non-stacking items (say "two leather armours" instead of "leather armour and leather armour").
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2245 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc24
1 files changed, 15 insertions, 9 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index eb87f9ea47..2b9af1ac94 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -3783,18 +3783,24 @@ void explore_discoveries::add_stair(
void explore_discoveries::add_item(const item_def &i)
{
- if (is_stackable_item(i))
+ item_def copy = i;
+ copy.quantity = 1;
+ const std::string cname = copy.name(DESC_PLAIN);
+
+ // Try to find something to stack it with, stacking by name.
+ for (int j = 0, size = items.size(); j < size; ++j)
{
- // Try to find something to stack it with.
- for (int j = 0, size = items.size(); j < size; ++j)
+ const int orig_quantity = items[j].thing.quantity;
+ items[j].thing.quantity = 1;
+ if (cname == items[j].thing.name(DESC_PLAIN))
{
- if (items_stack(i, items[j].thing))
- {
- items[j].thing.quantity += i.quantity;
- items[j].name = items[j].thing.name(DESC_NOCAP_A);
- return;
- }
+ items[j].thing.quantity = orig_quantity + i.quantity;
+ items[j].name =
+ items[j].thing.name(DESC_NOCAP_A, false, false, true,
+ !is_stackable_item(i));
+ return;
}
+ items[j].thing.quantity = orig_quantity;
}
items.push_back( named_thing<item_def>(i.name(DESC_NOCAP_A), i) );