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-18 00:31:16 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-18 00:31:16 +0000
commit2d552e655e12190228e8f737961ccf33875791a5 (patch)
tree77ed5e2f473edce1ec0660f9fb6e3cc66ab690d4 /crawl-ref/source/item_use.cc
parenta64069c6cb00d8eee7655ee1b6162b9b6ab0dbf7 (diff)
downloadcrawl-ref-2d552e655e12190228e8f737961ccf33875791a5.tar.gz
crawl-ref-2d552e655e12190228e8f737961ccf33875791a5.zip
Some more improvements for (you guessed it) the tiles.
Hey, I can't help it! :) Fix 1872624: Detect creatures revealing too much info The tiles drawn for detected monsters are now mons_genus(monster). It's not quite as strict as only showing the letter in ASCII (e.g. merfolk, minotaur and elephant slug have different genus but one common letter), but it's certainly better than showing the actual monster. Some more changes to L-click action in inventory, this time adding rods to the mix that can now be evoked rather than unwielded. Also: * Fix cut-off of first digit in item quantities > 99 * show friendly monsters on map overview as lightred (hostiles remain darkred) * show player on map overview as white even when zooming around in X-mode * general clean-up And, not tile-related: FR 1819454: * add mutation line for gourmand behaviour of Ogres and Troll. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3295 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r--crawl-ref/source/item_use.cc93
1 files changed, 38 insertions, 55 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc
index 33d2800ecc..594201e9c7 100644
--- a/crawl-ref/source/item_use.cc
+++ b/crawl-ref/source/item_use.cc
@@ -4484,60 +4484,51 @@ void tile_use_item(int idx, InvAction act)
return;
}
-
// Use it
- switch (you.inv[idx].base_type)
+ const int type = you.inv[idx].base_type;
+ switch (type)
{
case OBJ_WEAPONS:
case OBJ_STAVES:
- if (!check_warning_inscriptions(you.inv[idx], OPER_WIELD))
- return;
- if (equipped)
- wield_weapon(true, PROMPT_GOT_SPECIAL);
- else
- wield_weapon(true, idx);
- return;
-
case OBJ_MISCELLANY:
- if (equipped)
+ // wield any unwielded item of these types
+ if (!equipped)
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_EVOKE))
- return;
- evoke_wielded();
+ if (check_warning_inscriptions(you.inv[idx], OPER_WIELD))
+ wield_weapon(true, idx);
+ return;
}
- else
+ // evoke misc. items and known rods
+ if (type == OBJ_MISCELLANY
+ ||item_is_rod(you.inv[idx]) && item_type_known(you.inv[idx]))
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_WIELD))
- return;
- wield_weapon(true, idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_EVOKE))
+ evoke_wielded();
+ return;
}
+ // unwield unknown rods, other staves or weapons
+ if (check_warning_inscriptions(you.inv[idx], OPER_WIELD))
+ wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield
return;
-
+
case OBJ_MISSILES:
- if (!check_warning_inscriptions(you.inv[idx], OPER_THROW))
- return;
- throw_anything(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_THROW))
+ throw_anything(idx);
return;
case OBJ_ARMOUR:
if (equipped && !equipped_weapon)
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_TAKEOFF))
- return;
- takeoff_armour(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_TAKEOFF))
+ takeoff_armour(idx);
}
- else
- {
- if (!check_warning_inscriptions(you.inv[idx], OPER_WEAR))
- return;
+ else if (check_warning_inscriptions(you.inv[idx], OPER_WEAR))
wear_armour(idx);
- }
return;
case OBJ_WANDS:
- if (!check_warning_inscriptions(you.inv[idx], OPER_ZAP))
- return;
- zap_wand(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_ZAP))
+ zap_wand(idx);
return;
case OBJ_CORPSES:
@@ -4549,47 +4540,39 @@ void tile_use_item(int idx, InvAction act)
}
// intentional fall-through for Vampires
case OBJ_FOOD:
- if (!check_warning_inscriptions(you.inv[idx], OPER_EAT))
- return;
- eat_food(false, idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_EAT))
+ eat_food(false, idx);
return;
case OBJ_BOOKS:
if (you.inv[idx].sub_type == BOOK_MANUAL
|| you.inv[idx].sub_type == BOOK_DESTRUCTION)
{
- handle_read_book(idx);
- return;
- }
- // else it's a spellbook
- learn_spell(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_READ))
+ handle_read_book(idx);
+ } // else it's a spellbook
+ else if (check_warning_inscriptions(you.inv[idx], OPER_MEMORISE))
+ learn_spell(idx);
return;
case OBJ_SCROLLS:
- if (!check_warning_inscriptions(you.inv[idx], OPER_READ))
- return;
- read_scroll(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_READ))
+ read_scroll(idx);
return;
case OBJ_JEWELLERY:
if (equipped && !equipped_weapon)
{
- if (!check_warning_inscriptions(you.inv[idx], OPER_REMOVE))
- return;
- remove_ring(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_REMOVE))
+ remove_ring(idx);
}
- else
- {
- if (!check_warning_inscriptions(you.inv[idx], OPER_PUTON))
- return;
+ else if (check_warning_inscriptions(you.inv[idx], OPER_PUTON))
puton_ring(idx, false);
- }
return;
case OBJ_POTIONS:
- if (!check_warning_inscriptions(you.inv[idx], OPER_QUAFF))
- return;
- drink(idx);
+ if (check_warning_inscriptions(you.inv[idx], OPER_QUAFF))
+ drink(idx);
return;
default: