summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-02 09:08:25 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2009-06-02 09:08:25 +0000
commitc70705a813e3a43c321f024f952a07291bf28a5c (patch)
treec3ffa681497312aa6ceba134a894d5b762ef4d8a /crawl-ref/source/spl-cast.cc
parentb8b49ddd428d786879014d4623996f0dc37f7115 (diff)
downloadcrawl-ref-c70705a813e3a43c321f024f952a07291bf28a5c.tar.gz
crawl-ref-c70705a813e3a43c321f024f952a07291bf28a5c.zip
FR 2722830 and related changes:
* Memorization now lists all spells in all carried books (minus spells which are already memorized or which can never be memorized because of the player's species), sorted by easy of memorization. * Miscast effects from failing to memorize from out of the Necronomicon, the book of Demonology and the book of Annihilations is commented out, pending figuring out how to do it with the new interface. * Spells which can't be memorized because of the player's species are highlighted as light red when reading a spell book, and a note is added when describing the spell. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9883 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc31
1 files changed, 20 insertions, 11 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 37d8e99a2b..800ddad4e7 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -143,17 +143,7 @@ static std::string _spell_base_description(spell_type spell, bool grey = false)
desc << std::setw(30) << spell_title(spell);
// spell schools
- bool already = false;
- for (int i = 0; i <= SPTYP_LAST_EXPONENT; ++i)
- {
- if (spell_typematch(spell, (1<<i)))
- {
- if (already)
- desc << '/';
- desc << spelltype_name(1 << i);
- already = true;
- }
- }
+ desc << spell_schools_string(spell);
const int so_far = desc.str().length() - (grey ? 10 : 0);
if (so_far < 60)
@@ -2351,3 +2341,22 @@ std::string spell_range_string(spell_type spell)
+ "</darkgrey>";
}
}
+
+std::string spell_schools_string(spell_type spell)
+{
+ std::string desc;
+
+ bool already = false;
+ for (int i = 0; i <= SPTYP_LAST_EXPONENT; ++i)
+ {
+ if (spell_typematch(spell, (1<<i)))
+ {
+ if (already)
+ desc += "/";
+ desc += spelltype_name(1 << i);
+ already = true;
+ }
+ }
+
+ return (desc);
+}