From 2bd8f39fa42d7c774a27121c2ce3bf82e0104993 Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 13 Nov 2007 18:55:53 +0000 Subject: Made Tome of Destruction more consistent for those with high Evoc. Made manuals visibly different from spellbooks. Also, you can't cancel reading a manual; so you risk wasting it if you read all unIDed books. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2851 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/item_use.cc | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'crawl-ref/source/item_use.cc') diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 522b130787..3e048b4b97 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3672,20 +3672,17 @@ static bool enchant_armour( void ) static void handle_read_book( int item_slot ) { - int spell, spell_index; + item_def& book(you.inv[item_slot]); - if (you.inv[item_slot].sub_type == BOOK_DESTRUCTION) + if (book.sub_type == BOOK_DESTRUCTION) { if (silenced(you.x_pos, you.y_pos)) - { mpr("This book does not work if you cannot read it aloud!"); - return; - } - - tome_of_power(item_slot); + else + tome_of_power(item_slot); return; } - else if (you.inv[item_slot].sub_type == BOOK_MANUAL) + else if (book.sub_type == BOOK_MANUAL) { skill_manual(item_slot); return; @@ -3694,25 +3691,23 @@ static void handle_read_book( int item_slot ) while (true) { // Spellbook - spell = read_book( you.inv[item_slot], RBOOK_READ_SPELL ); + const int ltr = read_book( book, RBOOK_READ_SPELL ); - if (spell < 'a' || spell > 'h') //jmf: was 'g', but 8=h + if (ltr < 'a' || ltr > 'h') //jmf: was 'g', but 8=h { mesclr( true ); return; } - spell_index = letter_to_index( spell ); - - const spell_type nthing = - which_spell_in_book(you.inv[item_slot].sub_type, spell_index); - if (nthing == SPELL_NO_SPELL) + const spell_type spell = which_spell_in_book(book.sub_type, + letter_to_index(ltr)); + if (spell == SPELL_NO_SPELL) { mesclr( true ); return; } - describe_spell( nthing ); + describe_spell( spell ); } } -- cgit v1.2.3-54-g00ecf