diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-09-11 21:35:05 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-09-11 21:35:05 +0000 |
commit | 2d4d6508f4d44036aa16052d7764432fe2fc06f9 (patch) | |
tree | 747bf8d870f88a164d5bc4bc96b070378437f96a /crawl-ref/source/spl-book.cc | |
parent | 0f0706a062f83b945f01d5b5ab5a9eec3dbe6c1d (diff) | |
download | crawl-ref-2d4d6508f4d44036aa16052d7764432fe2fc06f9.tar.gz crawl-ref-2d4d6508f4d44036aa16052d7764432fe2fc06f9.zip |
Add a button to memorise spells to the new spell display. All this does
at the moment is call learn_spell(), but I'm planning to reuse the spell
display for this purpose.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10655 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-book.cc')
-rw-r--r-- | crawl-ref/source/spl-book.cc | 42 |
1 files changed, 35 insertions, 7 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 6d335f6334..a1dec30b5a 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -1300,7 +1300,8 @@ typedef std::map<spell_type, int> spells_to_books; static bool _get_mem_list(spell_list &mem_spells, spells_to_books &book_hash, unsigned int &num_unreadable, - unsigned int &num_race) + unsigned int &num_race, + bool just_check = false) { bool book_errors = false; unsigned int num_books = 0; @@ -1359,19 +1360,26 @@ static bool _get_mem_list(spell_list &mem_spells, if (num_books == 0) { - mpr("You aren't carrying any spellbooks.", MSGCH_PROMPT); + if (!just_check) + mpr("You aren't carrying any spellbooks.", MSGCH_PROMPT); return (false); } else if (num_unreadable == num_books) { - mpr("All of the spellbooks you're carrying are beyond your " - "current level of comprehension.", MSGCH_PROMPT); + if (!just_check) + { + mpr("All of the spellbooks you're carrying are beyond your " + "current level of comprehension.", MSGCH_PROMPT); + } return (false); } else if (book_hash.size() == 0) { - mpr("None of the spellbooks you are carrying contain any spells.", - MSGCH_PROMPT); + if (!just_check) + { + mpr("None of the spellbooks you are carrying contain any spells.", + MSGCH_PROMPT); + } return (false); } @@ -1419,13 +1427,17 @@ static bool _get_mem_list(spell_list &mem_spells, return (true); } - mpr("Your head is already too full of spells!"); + if (!just_check) + mpr("Your head is already too full of spells!"); return (false); } if (num_memable) return (true); + if (just_check) + return (false); + unsigned int total = num_known + num_race + num_low_xl + num_low_levels; if (num_known == total) @@ -1438,14 +1450,20 @@ static bool _get_mem_list(spell_list &mem_spells, "are a %s.", lowercase_string(species).c_str()); } else if (num_low_levels > 0) + { mpr("You do not have enough free spell levels to memorise any of the " "available spells.", MSGCH_PROMPT); + } else if (num_low_xl > 0) + { mpr("You aren't experienced enough yet to memorise any of the " "available spells.", MSGCH_PROMPT); + } else + { mpr("You can't memorise any new spells for an unknown reason; " "please file a bug report.", MSGCH_PROMPT); + } if (num_unreadable) { @@ -1457,6 +1475,16 @@ static bool _get_mem_list(spell_list &mem_spells, return (false); } +bool has_spells_to_memorise() +{ + spell_list mem_spells; + spells_to_books book_hash; + unsigned int num_unreadable; + unsigned int num_race; + + return _get_mem_list(mem_spells, book_hash, num_unreadable, num_race, true); +} + static bool _sort_mem_spells(spell_type a, spell_type b) { if (spell_fail(a) != spell_fail(b)) |