summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--crawl-ref/source/item_use.cc3
-rw-r--r--crawl-ref/source/libutil.cc2
-rw-r--r--crawl-ref/source/travel.cc24
3 files changed, 19 insertions, 10 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 060b994f5b..212e2ea00e 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -479,7 +479,8 @@ void wield_effects(int item_wield_2, bool showMsgs)
case SPWPN_ELECTROCUTION:
if (!silenced(you.x_pos, you.y_pos))
- mpr("You hear the crackle of electricity.", MSGCH_SOUND);
+ mpr("You hear the crackle of electricity.",
+ MSGCH_SOUND);
else
mpr("You see sparks fly.");
break;
diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc
index 001e3c7128..ef40fe2af3 100644
--- a/crawl-ref/source/libutil.cc
+++ b/crawl-ref/source/libutil.cc
@@ -297,6 +297,8 @@ std::string pluralise(const std::string &name,
else if (ends_with(name, "efreet"))
// efreet -> efreeti. Not sure this is correct.
return name + "i";
+ else if (ends_with(name, "staff"))
+ return name.substr(0, name.length() - 2) + "ves";
return name + "s";
}
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) );