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>2009-09-14 15:20:59 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-14 15:20:59 +0000
commit33bfc8a3d44515f59a0f2ad840ac03fe55606bab (patch)
treef3669ecc533ea3f2fc791d5ac401046f5c4d872d /crawl-ref/source/spl-book.cc
parenta58a5788137ad5c8e81286c534ade1e82840041c (diff)
downloadcrawl-ref-33bfc8a3d44515f59a0f2ad840ac03fe55606bab.tar.gz
crawl-ref-33bfc8a3d44515f59a0f2ad840ac03fe55606bab.zip
Fix multiple mouseclicks causing the same spell to be memorised several
times. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10676 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-book.cc')
-rw-r--r--crawl-ref/source/spl-book.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index e204e24dfd..123ff8debe 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -1707,6 +1707,9 @@ static bool _learn_spell_checks(spell_type specspell)
if (!can_learn_spell())
return (false);
+ if (already_learning_spell((int) specspell))
+ return (false);
+
if (you_cannot_memorise(specspell))
{
mprf("You cannot memorise that spell because you are a %s.",
@@ -1767,6 +1770,8 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book)
"attempt fails. Attempt to memorise anyway?",
fakebook.name(DESC_NOCAP_THE).c_str());
+ // Deactivate choice from tile inventory.
+ mouse_control mc(MOUSE_MODE_MORE);
if (!yesno(prompt.c_str(), false, 'n'))
{
canned_msg( MSG_OK );
@@ -1797,6 +1802,8 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book)
spell_levels_required(specspell) > 1 ? "s" : "",
player_spell_levels() - spell_levels_required(specspell));
+ // Deactivate choice from tile inventory.
+ mouse_control mc(MOUSE_MODE_MORE);
if (!yesno(info, true, 'n', false))
{
canned_msg( MSG_OK );
@@ -1854,7 +1861,7 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book)
did_god_conduct( DID_SPELL_CASTING, 2 + random2(5) );
return (true);
-} // end which_spell()
+}
int count_staff_spells(const item_def &item, bool need_id)
{