summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/food.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-27 08:41:39 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-05-27 08:41:39 +0000
commit05d3781c9f84d761b4f0aa7c3241aea9523710f8 (patch)
tree4787d98c8a3d5cfc6045b8366ef456ff97fb1d97 /crawl-ref/source/food.cc
parentf277a34ed301dd18bb51f008b812dba151be4916 (diff)
downloadcrawl-ref-05d3781c9f84d761b4f0aa7c3241aea9523710f8.tar.gz
crawl-ref-05d3781c9f84d761b4f0aa7c3241aea9523710f8.zip
If you try to butcher when there's no corpse on the ground but there's
corpses in your pack the game will tell you to drop them so they can be butchered. And if when you butcher a corpse on the ground there's also one in your pack the game will remind you about it, suggesting that you might want to also butcher the corpse in your pack. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5290 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc68
1 files changed, 64 insertions, 4 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index ba293e99d2..b759a82cd8 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -325,11 +325,61 @@ static void _terminate_butchery(bool wpn_switch, bool removed_gloves,
you.turn_is_over = true;
}
+static bool _have_corpses_in_pack(bool remind)
+{
+ int num = 0;
+
+ for (int i = 0; i < ENDOFPACK; i++)
+ {
+ item_def &obj(you.inv[i]);
+
+ if (!is_valid_item( obj ))
+ continue;
+
+ if (obj.base_type == OBJ_CORPSES)
+ num++;
+ }
+
+ if (num == 0)
+ return false;
+
+ std::string verb = (you.species == SP_VAMPIRE
+ && you.experience_level > 5) ? "bottle" : "butcher";
+ std::string noun, pronoun;
+
+ if (num == 1)
+ {
+ noun = "corpse";
+ pronoun = "it";
+ }
+ else
+ {
+ noun = "corpses";
+ pronoun = "them";
+ }
+
+ std::ostringstream text;
+
+ if (remind)
+ text << "You might want to also " << verb << " the " << noun
+ << " in your pack.";
+ else
+ text << "If you dropped the " << noun << " in your pack on solid "
+ << "ground or into shallow water then you could " << verb
+ << " " << pronoun << ".";
+
+ mpr(text.str().c_str());
+
+ return true;
+}
+
+
bool butchery(int which_corpse)
{
if (igrd[you.x_pos][you.y_pos] == NON_ITEM)
{
- mpr("There isn't anything here!");
+ if (!_have_corpses_in_pack(false))
+ mpr("There isn't anything here!");
return (false);
}
@@ -392,9 +442,10 @@ bool butchery(int which_corpse)
if (num_corpses == 0)
{
- mprf("There isn't anything to %s here.",
- you.species == SP_VAMPIRE && you.experience_level > 5 ? "bottle"
- : "butcher");
+ if (!_have_corpses_in_pack(false))
+ mprf("There isn't anything to %s here.",
+ (you.species == SP_VAMPIRE
+ && you.experience_level > 5) ? "bottle" : "butcher");
return (false);
}
@@ -433,6 +484,9 @@ bool butchery(int which_corpse)
_terminate_butchery(wpn_switch, removed_gloves, new_cursed,
old_weapon, old_gloves);
+ // Remind player of corpses in pack that could be butchered or
+ // bottled.
+ _have_corpses_in_pack(true);
return success;
}
@@ -524,6 +578,12 @@ bool butchery(int which_corpse)
old_weapon, old_gloves);
}
+
+ if (success)
+ // Remind player of corpses in pack that could be butchered or
+ // bottled.
+ _have_corpses_in_pack(true);
+
return success;
} // end butchery()