From 1d23ad9eae6203fcabc6b1f9a933174bc907f2a9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 10 Sep 2009 15:58:46 +0000 Subject: 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 --- crawl-ref/source/spl-cast.cc | 71 +++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 34 deletions(-) (limited to 'crawl-ref/source/spl-cast.cc') 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."); -- cgit v1.2.3-54-g00ecf