summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/food.cc
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-13 17:01:47 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-13 17:01:47 +0000
commit40b67090ce5ff65d918b7297858cf2d6f182afd5 (patch)
tree814a96db9c0e75fe28fc43e498148fac30d0fac7 /crawl-ref/source/food.cc
parent84912ad5cf2a8bbc40a7a6e4f3aa8607c04238d6 (diff)
downloadcrawl-ref-40b67090ce5ff65d918b7297858cf2d6f182afd5.tar.gz
crawl-ref-40b67090ce5ff65d918b7297858cf2d6f182afd5.zip
Clean up the routine to let vampires eat (drink?) from their inventory,
so that you don't have to press Escape twice to abort out of the prompt. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3624 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/food.cc')
-rw-r--r--crawl-ref/source/food.cc39
1 files changed, 21 insertions, 18 deletions
diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc
index 26d07231a2..318f59a38a 100644
--- a/crawl-ref/source/food.cc
+++ b/crawl-ref/source/food.cc
@@ -502,23 +502,27 @@ bool prompt_eat_from_inventory(int slot)
return (false);
}
- if (slot == -1 && you.species == SP_VAMPIRE)
+ int which_inventory_slot;
+
+ if (you.species != SP_VAMPIRE)
{
- slot = prompt_invent_item( "Drain what?",
- MT_INVLIST,
- OSEL_VAMP_EAT,
- true, true, true, 0, NULL,
- OPER_EAT );
+ which_inventory_slot = (slot != -1) ? slot :
+ prompt_invent_item( "Eat which item?",
+ MT_INVLIST,
+ OBJ_FOOD,
+ true, true, true, 0, NULL,
+ OPER_EAT );
}
-
- int which_inventory_slot = (slot != -1)? slot:
- prompt_invent_item(
- "Eat which item?",
- MT_INVLIST,
- OBJ_FOOD,
- true, true, true, 0, NULL,
- OPER_EAT );
-
+ else
+ {
+ which_inventory_slot = (slot != -1) ? slot :
+ prompt_invent_item( "Drain what?",
+ MT_INVLIST,
+ OSEL_VAMP_EAT,
+ true, true, true, 0, NULL,
+ OPER_EAT );
+ }
+
if (which_inventory_slot == PROMPT_ABORT)
{
canned_msg( MSG_OK );
@@ -533,15 +537,14 @@ bool prompt_eat_from_inventory(int slot)
mpr("You can't eat that!");
return (false);
}
-
- if (you.species == SP_VAMPIRE &&
+ else if (you.species == SP_VAMPIRE &&
(you.inv[which_inventory_slot].base_type != OBJ_CORPSES
|| you.inv[which_inventory_slot].sub_type != CORPSE_BODY))
{
mpr("You crave blood!");
return (false);
}
-
+
if (!can_ingest( you.inv[which_inventory_slot].base_type,
you.inv[which_inventory_slot].sub_type, false ))
{