summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-book.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-29 11:11:32 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-12-29 11:11:32 +0000
commit7fcfce7d250e09f85bc09f9e720dda5cf723e68e (patch)
treef70f14cb977e44bcded985b8527e7cd01ad50663 /crawl-ref/source/spl-book.cc
parent10a49dc866d7cb5b0d5fe0400ae02f30e8be4d85 (diff)
downloadcrawl-ref-7fcfce7d250e09f85bc09f9e720dda5cf723e68e.tar.gz
crawl-ref-7fcfce7d250e09f85bc09f9e720dda5cf723e68e.zip
* Dump spells contained in randart spellbooks, marking memorised spells
with an asterisk. * Sif Muna no longer gifts the books specific to Kiku and Vehumet (Necronomicon, Annihilations, Demonology) though the spells contained there-in may crop up in randart books. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8011 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-book.cc')
-rw-r--r--crawl-ref/source/spl-book.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index dad9800e5d..b8ecd5d7c0 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1137,8 +1137,8 @@ void mark_had_book(const item_def &book)
int level = book.plus;
ASSERT(level > 0 && level <= 9);
- if (origin_is_acquirement(book) ||
- origin_is_god_gift(book, &god) && god == GOD_SIF_MUNA)
+ if (origin_is_acquirement(book)
+ || origin_is_god_gift(book, &god) && god == GOD_SIF_MUNA)
{
you.attribute[ATTR_RND_LVL_BOOKS] |= (1 << level);
}
@@ -1191,6 +1191,7 @@ int read_book( item_def &book, read_book_action_type action )
// from memorise as well.
set_ident_flags( book, ISFLAG_KNOW_TYPE );
+ set_ident_flags( book, ISFLAG_IDENT_MASK);
return (keyin);
}
@@ -1714,13 +1715,11 @@ static bool _compare_spells(spell_type a, spell_type b)
return (strcmp(spell_title(a), spell_title(b)));
}
-static bool _is_memorised(spell_type spell)
+bool is_memorised(spell_type spell)
{
for (int i = 0; i < 25; i++)
- {
if (you.spells[i] == spell)
return (true);
- }
return (false);
}
@@ -1802,8 +1801,7 @@ static void _get_spell_list(std::vector<spell_type> &spell_list, int level,
}
-bool make_book_level_randart(item_def &book, int level,
- int num_spells)
+bool make_book_level_randart(item_def &book, int level, int num_spells)
{
ASSERT(book.base_type == OBJ_BOOKS);
@@ -1815,7 +1813,7 @@ bool make_book_level_randart(item_def &book, int level,
if (!is_random_artefact(book))
{
- // Stuf parameters into book.plus and book.plus2, then call
+ // Stuff parameters into book.plus and book.plus2, then call
// make_item_randart(), which will call us back.
if (level == -1)
{
@@ -1922,7 +1920,7 @@ bool make_book_level_randart(item_def &book, int level,
spell_type spell = spell_list[spell_pos];
ASSERT(spell != SPELL_NO_SPELL);
- if (avoid_memorised[spell_pos] && _is_memorised(spell))
+ if (avoid_memorised[spell_pos] && is_memorised(spell))
{
// Only once.
avoid_memorised[spell_pos] = false;
@@ -2044,12 +2042,14 @@ static bool _get_weighted_discs(bool completely_random, god_type god,
}
}
- do {
+ do
+ {
disc1 = ok_discs[choose_random_weighted(skill_weights,
skill_weights + num_discs)];
disc2 = ok_discs[choose_random_weighted(apt_weights,
apt_weights + num_discs)];
- } while(disciplines_conflict(disc1, disc2));
+ }
+ while(disciplines_conflict(disc1, disc2));
return (true);
}
@@ -2093,7 +2093,7 @@ static void _get_weighted_spells(bool completely_random, god_type god,
int c = 1;
if (!you.seen_spell[spell])
c = 4;
- else if (!_is_memorised(spell))
+ else if (!is_memorised(spell))
c = 2;
int total_skill = 0;
@@ -2124,7 +2124,7 @@ static void _get_weighted_spells(bool completely_random, god_type god,
int book_pos = 0;
int spells_left = spell_list.size();
- while(book_pos < num_spells && max_levels > 0 && spells_left > 0)
+ while (book_pos < num_spells && max_levels > 0 && spells_left > 0)
{
spell_type spell =
(spell_type) choose_random_weighted(spell_weights,