From cbb457d13f09655c81aa5a0e942fbb34f4a76712 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 21 Jan 2008 13:41:10 +0000 Subject: 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 --- crawl-ref/source/food.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'crawl-ref/source/food.cc') 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) -- cgit v1.2.3-54-g00ecf