summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/item_use.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-12 21:10:29 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-12 21:10:29 +0000
commitd0f739d802e77186463731df1d6736db7daf983e (patch)
treeb773d5a652297c57c22114dbd18faaac3473c0b8 /crawl-ref/source/item_use.cc
parent7e10afcafb398a0a9eeb39560facba3ec242d5dd (diff)
downloadcrawl-ref-d0f739d802e77186463731df1d6736db7daf983e.tar.gz
crawl-ref-d0f739d802e77186463731df1d6736db7daf983e.zip
Tile changes. *waves to Enne*
Fix assertion error when unwielding items. FR 1838216: Make R-click on map *really* show grid information. FR 1838219: Add more diverse action verbs for items in inventory ("eat", "unwield" etc. rather than plain "use") and allow memorizing by L-clicking on books. Bug 1858432: Show 0 charge icon for empty but unID'd wands. Also: Don't regard enslavement on friendlies as attack attempt. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3264 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc58
1 files changed, 30 insertions, 28 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index ff65a9e8ed..4e28412557 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -209,8 +209,8 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages)
// If the swap slot has a bad (but valid) item in it,
// the swap will be to bare hands.
- const bool good_swap =
- you.inv[item_slot].base_type == OBJ_WEAPONS
+ const bool good_swap = item_slot == PROMPT_GOT_SPECIAL
+ || you.inv[item_slot].base_type == OBJ_WEAPONS
|| you.inv[item_slot].base_type == OBJ_STAVES
|| (you.inv[item_slot].base_type == OBJ_MISCELLANY
&& you.inv[item_slot].sub_type != MISC_RUNE_OF_ZOT);
@@ -230,31 +230,30 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages)
true, true, true, '-', NULL, OPER_WIELD);
else
item_slot = PROMPT_GOT_SPECIAL;
+ }
- if (item_slot == PROMPT_ABORT)
- {
- canned_msg( MSG_OK );
- return (false);
- }
- else if (item_slot == PROMPT_GOT_SPECIAL) // '-' or bare hands
+ if (item_slot == PROMPT_ABORT)
+ {
+ canned_msg( MSG_OK );
+ return (false);
+ }
+ else if (item_slot == PROMPT_GOT_SPECIAL) // '-' or bare hands
+ {
+ if (you.equip[EQ_WEAPON] != -1)
{
- if (you.equip[EQ_WEAPON] != -1)
- {
- if (!unwield_item(show_weff_messages))
- return (false);
+ if (!unwield_item(show_weff_messages))
+ return (false);
- canned_msg( MSG_EMPTY_HANDED );
+ canned_msg( MSG_EMPTY_HANDED );
- you.turn_is_over = true;
- you.time_taken *= 3;
- you.time_taken /= 10;
- }
- else
- {
- mpr( "You are already empty-handed." );
- }
- return (true);
+ you.turn_is_over = true;
+ you.time_taken *= 3;
+ you.time_taken /= 10;
}
+ else
+ mpr( "You are already empty-handed." );
+
+ return (true);
}
if (item_slot == you.equip[EQ_WEAPON])
@@ -4396,7 +4395,7 @@ bool wearing_slot(int inv_slot)
#ifdef USE_TILE
// Interactive menu for item drop/use
-void use_item(int idx, InvAction act)
+void tile_use_item(int idx, InvAction act)
{
if (act == INV_PICKUP)
{
@@ -4405,9 +4404,7 @@ void use_item(int idx, InvAction act)
}
else if (act == INV_DROP)
{
-#ifdef USE_TILE
TileMoveInvCursor(-1);
-#endif
drop_item(idx, you.inv[idx].quantity);
return;
}
@@ -4427,9 +4424,7 @@ void use_item(int idx, InvAction act)
}
}
-#ifdef USE_TILE
TileMoveInvCursor(-1);
-#endif
// Special case for folks who are wielding something
// that they shouldn't be wielding.
@@ -4497,14 +4492,21 @@ void use_item(int idx, InvAction act)
zap_wand(idx);
return;
+ case OBJ_CORPSES:
+ if (you.species != SP_VAMPIRE)
+ break;
+ // intentional fall-through for Vampires
case OBJ_FOOD:
if (!check_warning_inscriptions(you.inv[idx], OPER_EAT))
return;
eat_food(false, idx);
return;
- case OBJ_SCROLLS:
case OBJ_BOOKS:
+ learn_spell(idx);
+ return;
+
+ case OBJ_SCROLLS:
if (!check_warning_inscriptions(you.inv[idx], OPER_READ))
return;
read_scroll(idx);