diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-12 21:10:29 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-12 21:10:29 +0000 |
commit | d0f739d802e77186463731df1d6736db7daf983e (patch) | |
tree | b773d5a652297c57c22114dbd18faaac3473c0b8 /crawl-ref/source/spl-book.cc | |
parent | 7e10afcafb398a0a9eeb39560facba3ec242d5dd (diff) | |
download | crawl-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/spl-book.cc')
-rw-r--r-- | crawl-ref/source/spl-book.cc | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index ecdf5945ea..f5953b0fd6 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -954,20 +954,21 @@ bool is_valid_spell_in_book( int splbook, int spell ) return which_spell_in_book(splbook, spell) != SPELL_NO_SPELL; } -static bool which_spellbook( int &book, int &spell ) +static int which_spellbook( void ) { + int book = -1; const int avail_levels = player_spell_levels(); // Knowing delayed fireball will allow Fireball to be learned for free -bwr if (avail_levels < 1 && !player_has_spell(SPELL_DELAYED_FIREBALL)) { mpr("You can't memorise any more spells yet."); - return (false); + return (-1); } else if (inv_count() < 1) { canned_msg(MSG_NOTHING_CARRIED); - return (false); + return (-1); } mprf("You can memorise %d more level%s of spells.", @@ -978,26 +979,23 @@ static bool which_spellbook( int &book, int &spell ) if (book == PROMPT_ABORT) { canned_msg( MSG_OK ); - return (false); + return (-1); } if (you.inv[book].base_type != OBJ_BOOKS || you.inv[book].sub_type == BOOK_MANUAL) { mpr("That isn't a spellbook!"); - return (false); + return (-1); } if (you.inv[book].sub_type == BOOK_DESTRUCTION) { tome_of_power( book ); - return (false); + return (-1); } - spell = read_book( you.inv[book], RBOOK_MEMORISE ); - clrscr(); - - return (true); + return (book); } // end which_spellbook() // Returns false if the player cannot read/memorize from the book, @@ -1178,11 +1176,10 @@ bool player_can_memorise(const item_def &book) return false; } -bool learn_spell(void) +bool learn_spell(int book) { int chance = 0; int levels_needed = 0; - int book, spell; int index; int i; @@ -1212,9 +1209,15 @@ bool learn_spell(void) return (false); } - if (!which_spellbook( book, spell )) + if (book < 0) + book = which_spellbook(); + + if (book < 0) // still -1? return (false); + int spell = read_book( you.inv[book], RBOOK_MEMORISE ); + clrscr(); + mesclr(true); redraw_screen(); |