summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-cast.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-10 15:58:46 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-09-10 15:58:46 +0000
commit1d23ad9eae6203fcabc6b1f9a933174bc907f2a9 (patch)
tree8182fbaccc51eecf655ed3feda605e4fff97ad67 /crawl-ref/source/spl-cast.cc
parent383d392c17f076384fc37e631b6506739ca634fe (diff)
downloadcrawl-ref-1d23ad9eae6203fcabc6b1f9a933174bc907f2a9.tar.gz
crawl-ref-1d23ad9eae6203fcabc6b1f9a933174bc907f2a9.zip
Add an inventory-like region for the Tiles version to make spells
clickable. '_' toggles between inventory and spell display. Actual tiles are still missing, but everything works as it should. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10648 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-cast.cc')
-rw-r--r--crawl-ref/source/spl-cast.cc71
1 files changed, 37 insertions, 34 deletions
diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc
index 79a6c369cf..a58e66ff1f 100644
--- a/crawl-ref/source/spl-cast.cc
+++ b/crawl-ref/source/spl-cast.cc
@@ -661,7 +661,7 @@ static int _get_dist_to_nearest_monster()
}
// Returns false if spell failed, and true otherwise.
-bool cast_a_spell(bool check_range)
+bool cast_a_spell(bool check_range, spell_type spell)
{
if (!you.spell_no)
{
@@ -686,52 +686,55 @@ bool cast_a_spell(bool check_range)
const int minRange = _get_dist_to_nearest_monster();
- int keyin = 0;
-
- while (true)
+ if (spell == SPELL_NO_SPELL)
{
- if (keyin == 0)
+ int keyin = 0;
+
+ while (true)
{
- mpr("Cast which spell? (? or * to list) ", MSGCH_PROMPT);
+ if (keyin == 0)
+ {
+ mpr("Cast which spell? (? or * to list) ", MSGCH_PROMPT);
- keyin = get_ch();
- }
+ keyin = get_ch();
+ }
- if (keyin == '?' || keyin == '*')
- {
- keyin = list_spells(true, false, minRange);
- if (!keyin)
- keyin = ESCAPE;
+ if (keyin == '?' || keyin == '*')
+ {
+ keyin = list_spells(true, false, minRange);
+ if (!keyin)
+ keyin = ESCAPE;
- if (!crawl_state.doing_prev_cmd_again)
- redraw_screen();
+ if (!crawl_state.doing_prev_cmd_again)
+ redraw_screen();
- if (isalpha(keyin) || keyin == ESCAPE)
- break;
+ if (isalpha(keyin) || keyin == ESCAPE)
+ break;
+ else
+ mesclr();
+
+ keyin = 0;
+ }
else
- mesclr();
+ break;
+ }
- keyin = 0;
+ if (keyin == ESCAPE)
+ {
+ canned_msg( MSG_OK );
+ return (false);
}
- else
- break;
- }
- if (keyin == ESCAPE)
- {
- canned_msg( MSG_OK );
- return (false);
- }
+ if (!isalpha(keyin))
+ {
+ mpr("You don't know that spell.");
+ crawl_state.zero_turns_taken();
+ return (false);
+ }
- if (!isalpha(keyin))
- {
- mpr("You don't know that spell.");
- crawl_state.zero_turns_taken();
- return (false);
+ spell = get_spell_by_letter( keyin );
}
- const spell_type spell = get_spell_by_letter( keyin );
-
if (spell == SPELL_NO_SPELL)
{
mpr("You don't know that spell.");