summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/food.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-21 13:41:10 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-21 13:41:10 +0000
commitcbb457d13f09655c81aa5a0e942fbb34f4a76712 (patch)
tree33ae292819a64b31a12a0b2209aa0bbbf6ad036e /crawl-ref/source/food.cc
parentb30aacda1fd2b82ae1436f3ac24e3c588d8209d1 (diff)
downloadcrawl-ref-cbb457d13f09655c81aa5a0e942fbb34f4a76712.tar.gz
crawl-ref-cbb457d13f09655c81aa5a0e942fbb34f4a76712.zip
Tiles: allow direct selection of corpse to be butchered from floor
or to drink blood from for vampires git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3313 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 2874c207c1..90197b4bba 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -195,7 +195,7 @@ static bool find_butchering_implement( bool fallback )
return (you.equip[EQ_WEAPON] != old_weapon);
}
-bool butchery()
+bool butchery(int which_corpse)
{
bool new_cursed = false;
int old_weapon = you.equip[EQ_WEAPON];
@@ -246,7 +246,8 @@ bool butchery()
// First determine how many things there are to butcher.
int num_corpses = 0;
- int corpse_id = -1;
+ int corpse_id = -1;
+ bool prechosen = (which_corpse != -1);
for (int o = igrd[you.x_pos][you.y_pos]; o != NON_ITEM; o = mitm[o].link)
{
if (mitm[o].base_type == OBJ_CORPSES &&
@@ -254,8 +255,15 @@ bool butchery()
{
corpse_id = o;
num_corpses++;
+
+ // return pre-chosen corpse if it exists
+ if (prechosen && corpse_id == which_corpse)
+ break;
}
}
+ // pre-chosen corpse not found?
+ if (prechosen && corpse_id != which_corpse)
+ prechosen = false;
bool canceled_butcher = false;
@@ -266,7 +274,7 @@ bool butchery()
mpr("There isn't anything to dissect here.");
return false;
}
- else if ( num_corpses > 1 || Options.always_confirm_butcher )
+ else if ( !prechosen && (num_corpses > 1 || Options.always_confirm_butcher) )
{
corpse_id = -1;
for (int o=igrd[you.x_pos][you.y_pos]; o != NON_ITEM; o = mitm[o].link)